KeithSloan / GDML

FreeCAD GDML Workbench - AddonManager Installable
Other
49 stars 16 forks source link

Solved: Boolean operations involving Torus #72

Closed aminetec closed 5 months ago

aminetec commented 2 years ago

Greetings,

I'm trying to make a GDML geometry of an HPGe detector. My parts include a torus and when I try a union operation the resulting union part have two union solids instead of one.

Any help is appreciated. Thank for your time.

hpge_sperated.FCStd.txt hpge_union.FCStd.txt

KeithSloan commented 2 years ago

Please can you check the attached file, Is it nearer to what you are trying to achieve?

If yes, then to achieve a Union you need to select the logical Volumes (Parts in FC) and then use the GDML union (icon in toolbar)

With GDML Unions the second part is placed relative to the first. The Placement information is in the Logical Volumes, hence why you need to select them rather than the GDML objects and use the GDML Booleans rather than FreeCAD booleans.

Not sure how things could be made better, open to suggestions on how documentation on this could be improved.

hpge_My_Union FCStd.txt

KeithSloan commented 2 years ago

I exported hpge_MyUnion and found some problems with materials. Checking your flle the materials section seems to have been messed up some how. It had multiple sets for Geant4 and some Geant4 materials in the non Geant4 sections.

Tidied up the materials section hpge_MyUnion_CleanFCStd.txt and loaded into Geant4

Exported GDML file hpge_MyUnion_Clean-world0x55d123cff820.gdml.txt

Screen shot of loaded into Geant4

Image 21-12-2021 at 16 02

aminetec commented 2 years ago

Thank you for the speedy response.

I'm trying to achieve the following Screenshot_2021-12-21_19-24-18 I did this with an earlier version of the toolkit but following the same step with selecting the logical volumes with placement it seem to not produce the same results this is the freecad file i did a while back hpge_union.FCStd.txt

KeithSloan commented 2 years ago

Okay there is a problem with a Boolean operation on another Boolean operation. Need a clear head so will be tomorrow at least.

aminetec commented 2 years ago

Thank you immensely

KeithSloan commented 2 years ago

Try the latest version 1) Hopefully has fixed the problem with a boolean operation which involves a boolean 2) Adds torus command/icon ( currently an X) SVG icon to follow.

Please let me know how you get on - Thanks

aminetec commented 2 years ago

The double union geometry worked great in FreeCAD but the exported gdml file is not right, only containing one union operation.

HPGe_union.FCStd.txt HPGe_union.gdml.txt

KeithSloan commented 2 years ago

Are you able to try a branch?

I have pushed a new branch called newExport which has restructured the code

I don't want to merge as I still need to sort out multifuse and a number of things before tidying up and removing redundant code, which will have to wait till after the holidays.

Your File has the materials still messed up a bit as you have multiple Geant4 groups in Materials. Do you know how this is happening? Are you importing an XML file with Materials? In which case I need to fix, but it would be helpful to know how your materials get into the state HPGe_union4_Clean.FCStd.txt HPGe_union4_Clean-worldVOLgdml.txt Image 22-12-2021 at 20 30

aminetec commented 2 years ago

Sorry I lack the technical knowledge to answer your questions, for the export I just select the world volume and name the file with the .gdml extension. when it comes to the materials I just edit them materials in the resulting file.

But I'll try the new branch hopefully it'll fix the problem.

Again, thank you for your effort.

KeithSloan commented 2 years ago

Has now been merged.

aminetec commented 2 years ago

Hi,

Any news on the fix of the double boolean operation issue.

KeithSloan commented 2 years ago

Hi,

Any news on the fix of the double boolean operation issue.

Thought it was fixed and the new branch merged.

Are you still seeings a problem?

KeithSloan commented 2 years ago

Sorry about this Weird somewhere along the line I changed the code to insert booleans at the start of solids for some reason. Using you test file seems this is wrong and just need to be inserted in the order as found.

Try latest code.

aminetec commented 2 years ago

I tried the latest merge the problem is fixed thank you