Commit ecc41c3
committed
CAD->TGeo: Add first support for material mapping
The present commit adds support to complement
the geometry created from CAD STEP files with materials.
For now the script can process materials in a CSV
file, where each line maps the CAD part name to a material string.
An example is this
```
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
CAD,Mechanical/Part,ST1782525_01,AA.04,FIRST PART,1.51881,St. Steel EN 1.4306 (304L)
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
CAD,Mechanical/Part,ST2487461_01,AA.04,SECOND PART,2.344,Alu EN AW-5083 (H116)
,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
CAD,Mechanical/Part,ST2487721_01,AA.02,THIRD PART,0.313133,Carbon Fiber
```
where `ST2487721_01` are the part names referenced in the STEP file.
The conversion script will read the material names (e.g., Alu EN AW-5083 (H116))
and attempt a mapping to known materials in the Geant4 NIST database of materials
based on string matching as well as material density.
The user should check the emitted materials in the resulting geometry
file (geom.C) and possibly edit/correct the code. Another possibility
would be to fix the CSV file from the start and only reference Geant4 NIST
names.
The commit also contains a small utility to extract a JSON G4 NIST database
from the Geant4 engine. The resulting JSON file `G4_NIST_DB.json` is also
part of the commit and can be extended by the user with further definitions.
A complete conversion example, including materials would like this:
```bash
python3 O2_CADtoTGeo.py STEPFILE.stp --mesh [--mesh-prec 1.2] \
--out-path tgeo_geometry_output_folder -o geom.C \
--materials-csv MATERIALS.csv \
--g4-nist-json G4_NIST_DB.json
```
Code generated with help of a code assistent.1 parent 23fa9c3 commit ecc41c3
File tree
5 files changed
+8080
-24
lines changed- scripts/geometry
- g4_nist_database
5 files changed
+8080
-24
lines changed
0 commit comments