GDML icon indicating copy to clipboard operation
GDML copied to clipboard

problem loading physvol from file

Open nicolaseavalos opened this issue 2 months ago • 5 comments

I am trying to open a somewhat complex geometry, which loads a "physvol" from a file. I was able to mock the bug with a minimal example, which I send attached (I changed the extension to "xml" so I can upload them here). I can load "part.gdml" correctly. However, I when I load "assembly.gdml" it finds the path to "part.gdml", but when it tries to parse the volumes it does not find the appropriate solids.

assembly.xml part.xml

(EDIT) I am using FreeCAD 0.21.2 and the GDML Workbench v2.0.1 Beta, installed from the Addon Manager.

nicolaseavalos avatar Oct 20 '25 15:10 nicolaseavalos

Thanks for reporting.

May I ask did you create the assembly.xml file by hand? Or Are you trying to use one of the Assembly workbenches in conjunction with the GDML workbench?

KeithSloan avatar Oct 20 '25 19:10 KeithSloan

I have created it by hand. It loads correctly in geant4. I have also added "importFlag" as the first positional argument of function "processPhysVolFile" (line 3195 of importGDML.py) and to the call to "processVol" in line 3226.

nicolaseavalos avatar Oct 21 '25 08:10 nicolaseavalos

This is what is printed in the console:

Full Path : /home/nico/freecad-examples/minimal-bug/part.gdml Parse : /home/nico/freecad-examples/minimal-bug/part.gdml running with lxml.etree Process Materials DocSet define xml <Element define at 0x7190ece38f80> materialsl <Element materials at 0x7190ecf7f500> Process Materials : Materials Process - Opticals: matrix_spreadsheet define xml <Element define at 0x7190ece38f80> Find all Matrix Now process Volume Process Positions Process Rotations <Element solids at 0x7190ece82e40> Process Volume : LV_part importFlag 1 solidref : Part ERROR - Solid : Part Not defined Process Surfaces skinsurface bordersurface Parse physvol : None importFlag 1 name: LV_assembly parentpart = <Part object> paramvol = None ProcessVol returning Part::PartFeature GDMLBox_assemblyWorld Process Surfaces skinsurface bordersurface End processing GDML file time : 1.1152 seconds

nicolaseavalos avatar Oct 21 '25 08:10 nicolaseavalos

Please could you try branch 164fix.

Sorry it has taken a long time but it has taken me a long while to resolve an issue on my machine.

If you can let me know if it is now resolved I will merge into Main

Thanks

KeithSloan avatar Oct 27 '25 08:10 KeithSloan

Hello Keith,

Thanks for addressing the issue. However, after checking out to this branch, I still run into the same issue. This is the full console output: console_output.txt

However, I have found a workaround: define all the solids in a "solids.xml" file, then add the corresponding ENTITY to the header of the gdml file, then add the reference in the section. With this, which is in my opinion a clean way, I don't have issues.

nicolaseavalos avatar Oct 27 '25 11:10 nicolaseavalos