Create new geometry with gdml files

Hello everyone!
I’m new in the field of Geant4. Recently I downloaded the version that you see below following online tutorials. I’m interested in creating new geometries with CAD and let Geant4 read the .gdml file produced by FreeCAD.
However, I don’t know how to aknowledge Geant4 of the presence of my .gdml file. I’m using the app Gears to facilitate my approach to Geant4, but the command /geometry/source file.gdml seems not to work.
Does someone have an idea of how I can do?

Thank you in advance!

_Geant4 Version:_4-11.2
_Operating System:_Windows 10
_Compiler/Version:_Visual Studio 17_2022
_CMake Version:_3.29.1

On Gears itself, maybe @Jing_Liu can help on that side.

For GDML in general, the extended example G01/02/03:

demonstrate the underlying interfaces used if you want to do this in your own application. does not change the default behavior of Geant4 GDML. It simply uses it. If a GDML file created by FreeCAD cannot be loaded by, most probably, the problem is originated from converting FreeCAD format to GDML format. If that is the case, you should start with very simple geometry, like a single box, in FreeCAD and convert it to GDML, open the GDML file and examine it by eye based on the GDML manual.

GDML is an optional part of Geant4. By default, it is not compiled into Geant4. You can use geant4-config --features to check if your Geant4 installation has it or not. If your Geant4 doesn’t have it, cannot magically load it. Again, uses GDML provided by Geant4 without any modification.

Please watch to learn how to enable GDML in Geant4 if you have not done so.

1 Like

For testing the FreeCAD GDML workbench we use load_color_gdml which is a modified version of load.gdml in the Geant4 - G01 directory. The modifications are just to display the colours according to the extra auxtype info that the workbench adds for colour. .

If you create a GDML file with the workbench and the file does not load with load.gdml, please report as a bug by raising an issue at GitHub - KeithSloan/GDML: FreeCAD GDML Workbench - AddonManager Installable Thanks

For information on creating Geant4 GDML file with the FreeCAD workbench please see

There are some example FreeCAD files in the wiki, you have to remove the extra txt from the file extension as Github does not support the FCStd file extension.

If you are trying to use Gears with a FreeCAD created GDML Geometry, I would first check that the GDML file loads correctly into Geant4 with load.gdml in the G01 directory.

Simple files i.e just a box, need to remove extra txt from file extension.

SimpleBox.FCStd.txt (148.5 KB)
SimpleBox-worldVOL.gdml.txt (2.5 KB)