CAD->TGeo: Add first support for material mapping#15127
Open
sawenzel wants to merge 1 commit intoAliceO2Group:devfrom
Open
CAD->TGeo: Add first support for material mapping#15127sawenzel wants to merge 1 commit intoAliceO2Group:devfrom
sawenzel wants to merge 1 commit intoAliceO2Group:devfrom
Conversation
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.
Contributor
|
REQUEST FOR PRODUCTION RELEASES: This will add The following labels are available |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The present commit adds support to complement
the geometry created from CAD STEP files with materials.
For now the script can process materials mentioned in a CSV
file, where each line maps the CAD part name to a material string.
An example is this
where
ST2487721_01are 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.jsonis also part of the commit and can be extended by the user with further definitions.A complete conversion example, including materials would like this:
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.jsonCode generated with help of a code assistant.