Terminally confused in using GDML
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
- federico.carminati
- Posts: 66
- Joined: Thu May 18, 2017 1:01 pm
- Location: Geneva, Switzerland
Terminally confused in using GDML
Hello,
this is my environment
Mac OS X Big Sur 11.2.3 (20D91)
Model Name: MacBook Pro
Model Identifier: MacBookPro16,1
Processor Name: 8-Core Intel Core i9
Processor Speed: 2.4 GHz
Number of Processors: 1
Total Number of Cores: 8
L2 Cache (per Core): 256 KB
L3 Cache: 16 MB
Hyper-Threading Technology: Enabled
Memory: 64 GB
OS: macOS 10.16
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
I want to convert to GDML the object "target" in the attached file. I have successfully installed gmsh in FreeCAD (with some pain...), but I cannot produce a GDML file. If I export to GDML, FreeCAD goes into a "spinning ball frenzy" and does not respond any longer. In the GDML workbench, I can create a tessellation (which is very large and uneven from the look of it), but I am not sure what I am supposed to do with it. All other commands go into Spinball forever. Thanks for your help, and always thanks for the AMAZING work you are all doing. This is one of the best free codes I have ever seen, and I have seen a lot...
Best,
this is my environment
Mac OS X Big Sur 11.2.3 (20D91)
Model Name: MacBook Pro
Model Identifier: MacBookPro16,1
Processor Name: 8-Core Intel Core i9
Processor Speed: 2.4 GHz
Number of Processors: 1
Total Number of Cores: 8
L2 Cache (per Core): 256 KB
L3 Cache: 16 MB
Hyper-Threading Technology: Enabled
Memory: 64 GB
OS: macOS 10.16
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24276 (Git)
Build type: Release
Branch: (HEAD detached at 0.19.1)
Hash: a88db11e0a908f6e38f92bfc5187b13ebe470438
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
I want to convert to GDML the object "target" in the attached file. I have successfully installed gmsh in FreeCAD (with some pain...), but I cannot produce a GDML file. If I export to GDML, FreeCAD goes into a "spinning ball frenzy" and does not respond any longer. In the GDML workbench, I can create a tessellation (which is very large and uneven from the look of it), but I am not sure what I am supposed to do with it. All other commands go into Spinball forever. Thanks for your help, and always thanks for the AMAZING work you are all doing. This is one of the best free codes I have ever seen, and I have seen a lot...
Best,
- Attachments
-
- targetcad.FCStd
- (95.11 KiB) Downloaded 40 times
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Terminally confused in using GDML
Sorry for the confusion - Note to self need to make documentation clearer.
GDML uses a rich set of computer solids, the workbench is really aimed at inspection creating GDML object as per the GDML manual.
It is not straight forward to go from CAD ( BREP ) graphics to GDML graphics the main way is to create GDML Tessellated Objects.
The main way I envisaged users creating GDML Tessellated objects was by importing a STEP file, Tessellate parts, Allocate GDML materials to Tessellated Parts and then exporting.
Okay I hope i have made a GDML file with your target see https://www.dropbox.com/sh/gfg8yy37c663 ... aFJia?dl=0
The way I created it was as follows.
1) Opened your file in FreeCAD ( Had problems with FreeCAD 0.19.1 so using Realthunders experimental DAILY ).
2) Selected target
3) File | Export | Step
4) switch to GDML Workbench
5) File New
Should create some default materials and create a World Volume ( Part )
6) In the resources directory there is a file called Geant3Materials.xml
If you import this file it will add the Standard Geant4 materials.
(Really should make them the default)
7) Click on Part ( Yellow box icon) to create a Volume to contain the target
8) Drag created Part to WorldVolume Part
9) Select the new Part
10) File Import the exported STEP file.
11) Select and Tessellate and allocate GDML material
12) Delete the target that was imported.
You should end up with a structure that looks like this You can then select the World Volume and export to GDML.
GDML uses a rich set of computer solids, the workbench is really aimed at inspection creating GDML object as per the GDML manual.
It is not straight forward to go from CAD ( BREP ) graphics to GDML graphics the main way is to create GDML Tessellated Objects.
The main way I envisaged users creating GDML Tessellated objects was by importing a STEP file, Tessellate parts, Allocate GDML materials to Tessellated Parts and then exporting.
Okay I hope i have made a GDML file with your target see https://www.dropbox.com/sh/gfg8yy37c663 ... aFJia?dl=0
The way I created it was as follows.
1) Opened your file in FreeCAD ( Had problems with FreeCAD 0.19.1 so using Realthunders experimental DAILY ).
2) Selected target
3) File | Export | Step
4) switch to GDML Workbench
5) File New
Should create some default materials and create a World Volume ( Part )
6) In the resources directory there is a file called Geant3Materials.xml
If you import this file it will add the Standard Geant4 materials.
(Really should make them the default)
7) Click on Part ( Yellow box icon) to create a Volume to contain the target
8) Drag created Part to WorldVolume Part
9) Select the new Part
10) File Import the exported STEP file.
11) Select and Tessellate and allocate GDML material
12) Delete the target that was imported.
You should end up with a structure that looks like this You can then select the World Volume and export to GDML.
- federico.carminati
- Posts: 66
- Joined: Thu May 18, 2017 1:01 pm
- Location: Geneva, Switzerland
Re: Terminally confused in using GDML
Yay! I love this forum where people answer so quickly and so thoroughly! Thanks a lot! A couple of points here. I managed to know whether it is possible to control the tessellation parameters since it looks a bit uneven and produces *a lot* of volumes. I checked the file you sent me and mine, and they look identical. One more question, I am sorry, but I do not know how to reach the resource directory. Could you help me? Thanks again and best regards,
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Terminally confused in using GDML
The straight tessellation just uses the standard FreeCAD routine to tessellate i.e default. The Gmsh one currently has hard coded options. I used the Gmsh python libraries and since then certainly the FEM workbench is using Gmsh directly, might also be true of the Mesh Design Workbench, not sure but I think there are options on at least the Gmsh options using the Mesh Design Workbench. You should in theory be able to use the Mesh Design Workbench to perform the meshing and then switch back to the GDML workbench to convert the Mesh to GDML Tessellated object. If you want a GDML Tetrahedron you are currently stuck with hard coded. I have a report that needs to be in by the 7th May and Exam on the 8th, after that I could look at making the relevant icons from the Mesh Design available from the GDML workbench.federico.carminati wrote: ↑Sun Apr 18, 2021 6:41 pm Yay! I love this forum where people answer so quickly and so thoroughly! Thanks a lot! A couple of points here. I managed to know whether it is possible to control the tessellation parameters since it looks a bit uneven and produces *a lot* of volumes. I checked the file you sent me and mine, and they look identical. One more question, I am sorry, but I do not know how to reach the resource directory. Could you help me? Thanks again and best regards,
Other things to note: FreeCAD has options as to whether a STEP file is imported as single or separate objects. If you select a Material before you Tessellate that should set the material for the Tessellated Object rather than have to go in and change via properties ( If not raise as an issue on Github). Yes access to Sample files and resources is an issue if installed via Addon manager, on my machine I currently have a separate clone of the repro https://github.com/KeithSloan/GDML. But assuming it is Geant4materials you are after
- federico.carminati
- Posts: 66
- Joined: Thu May 18, 2017 1:01 pm
- Location: Geneva, Switzerland
Re: Terminally confused in using GDML
Thanks! I have found your file. I do not know how to load "by default" the Geant4 materials, but I can load them, find all the NIST stuff, and so on. Brilliant. Spurred by your explication, I have found the following:
- Meshed the object in the Mesh workbench.
- Exported as .stl
- Imported in Blender and decimated (could do it in Mesh workbench, but Blender is much better) and re-saved in STL
- Opened a new GDML file
- Opened a new file and imported the target STL
- Scaled the target STL to the right dimension (could not find a better way to do it)
- Copied pasted the mesh into the GDML file
- Mesh2Tess the mesh
- Deleted the Mesh
- Exported the gdml file.
The resulting file is only 2818 lines against the 25010 of the original gdml, and the tessellation is much better (see picture). All the files are attached. Did I do something wrong? Best and thanks again!
- Meshed the object in the Mesh workbench.
- Exported as .stl
- Imported in Blender and decimated (could do it in Mesh workbench, but Blender is much better) and re-saved in STL
- Opened a new GDML file
- Opened a new file and imported the target STL
- Scaled the target STL to the right dimension (could not find a better way to do it)
- Copied pasted the mesh into the GDML file
- Mesh2Tess the mesh
- Deleted the Mesh
- Exported the gdml file.
The resulting file is only 2818 lines against the 25010 of the original gdml, and the tessellation is much better (see picture). All the files are attached. Did I do something wrong? Best and thanks again!
- Attachments
-
- Target_small.stl
- (87.29 KiB) Downloaded 27 times
-
- Traget_small_GDML.FCStd
- (735.44 KiB) Downloaded 29 times
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Terminally confused in using GDML
Just seems a pity that you have to go through so many Mesh/STL steps.
I am not familiar with all the mesh options Perhaps @wmayer or @bernd or somebody else might like to comment as to how to easily get the same result without having to use an external application.
I am not familiar with all the mesh options Perhaps @wmayer or @bernd or somebody else might like to comment as to how to easily get the same result without having to use an external application.
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Terminally confused in using GDML
If you update the Default.gdml now contains the GEANT Materialsfederico.carminati wrote: ↑Mon Apr 19, 2021 2:15 pm I do not know how to load "by default" the Geant4 materials, but I can load them, find all the NIST stuff, and so on.
- federico.carminati
- Posts: 66
- Joined: Thu May 18, 2017 1:01 pm
- Location: Geneva, Switzerland
Re: Terminally confused in using GDML
Done, thanks a lot! I will check with the other meshers if I can control them and let you know. Thanks again for your help. Best,
Federico Carminati
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
Co-Founder and Scientific Director of Transmutex SA
Switzerland/Suisse
Re: Terminally confused in using GDML
Standard is the default meshing method provided by OpenCascade that we use to tessellate part objects.Perhaps @wmayer or @bernd or somebody else might like to comment as to how to easily get the same result without having to use an external application.
Mefisto and Netgen are supported meshing methods by Salome's SMESH module.
And gmsh uses the external application gmsh is back-end. This provides the most options to control the meshing.
I have no idea of what quality your target mesh should be. But if you want to use the mesh decimation function you better don't create a mesh with the Standard method because this usually produces a very heterogeneous mesh with long and skinny triangles and that makes it rather difficult for most decimation algorithms to remove triangles.
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: Terminally confused in using GDML
My understanding which could be completely wrong iswmayer wrote: ↑Thu Apr 22, 2021 11:06 amStandard is the default meshing method provided by OpenCascade that we use to tessellate part objects.Perhaps @wmayer or @bernd or somebody else might like to comment as to how to easily get the same result without having to use an external application.
Mefisto and Netgen are supported meshing methods by Salome's SMESH module.
And gmsh uses the external application gmsh is back-end. This provides the most options to control the meshing.
I have no idea of what quality your target mesh should be. But if you want to use the mesh decimation function you better don't create a mesh with the Standard method because this usually produces a very heterogeneous mesh with long and skinny triangles and that makes it rather difficult for most decimation algorithms to remove triangles.
- That a GDML Tessellation supports both triangular ( 3 sided ) and quadrangular ( 4 sided ) Facets.
- Going via STL means one would end up with triangular ( 3 sided ) Facets
- FreeCAD's meshs are just triangular ( 3 sided)
- If one wanted to produce a mixture of triangular and quad facets you would have to use Gmsh
- Currently Workbench call to Gmsh pretty much uses default so just 3 sided
- Not sure what impact of 3 or 4 sided facets has on GEANT4 accuracy and performance