1 of 5

Exporting CAD Views from Simulation

16 September 2024

2 of 5

Export to Step

  1. Start eic-shell:

./eic-shell

  • Set detector version:

source /opt/detector/epic-25.01.0/bin/thisepic.sh

  • Set detector config:

export DETECTOR_CONFIG=epic_craterlake_tracking_only

  • Export to STEP

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'

3 of 5

Import Into Onshape

4 of 5

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>

5 of 5

Google Colab

Notebook with example code snippets to manipulate CAD models with REST API