Exporting CAD Views from Simulation
16 September 2024
Export to Step
./eic-shell
source /opt/detector/epic-25.01.0/bin/thisepic.sh
export DETECTOR_CONFIG=epic_craterlake_tracking_only
bash exportCAD.sh
### exportCAD.sh ###
#!/bin/bash
IFS=$' \n\t'
# First get all detectors (except world)
declare -A detectors
while read d ; do
detectors[${d}]='-l 3'
done <<< $(npdet_to_step list $DETECTOR_PATH/${DETECTOR_CONFIG}.xml | sed '/world/d;s/.*(vol: \(.*\)).*/\1/g')
# Then tweak the levels (default is 1)
detectors[HcalBarrel]='-l 1'
detectors[LFHCAL]='-l 2'
detectors[OuterBarrelMPGDSubAssembly]='-l 4'
# Export to one STEP file
npdet_to_step $(for d in ${!detectors[@]} ; do echo part ${detectors[$d]} $d ; done) -o ${DETECTOR_CONFIG} $DETECTOR_PATH/${DETECTOR_CONFIG}.xml 2>&1 | sed '/TGeoMatrix::dtor/d'
Import Into Onshape
Using Python API
Create API key if you own the project
Save id and secrets in a file “keys.py”
access = <access id>
secret = <secret key>
Google Colab
Notebook with example code snippets to manipulate CAD models with REST API