A tool to convert CAD models for importation into Geant4
Carl Vuosalo, Duncan Carlsmith, Sridhara Dasu, Kimberly Palladino (for, the LUX-ZEPLIN Collaboration)

TL;DR
SW2GDML is a tool that converts SOLIDWORKS CAD models into compact GDML files for efficient import into Geant4, streamlining detector simulation workflows.
Contribution
The paper introduces SW2GDML, a novel tool that produces human-readable, shape-based GDML from SOLIDWORKS models, improving upon existing tessellation-based conversion methods.
Findings
Produces compact, human-readable GDML files
Uses standard geometric shapes for better performance
Facilitates rapid detector design and simulation cycles
Abstract
The engineering design of a particle detector is usually performed in a Computer Aided Design (CAD) program, and simulation of the detector's performance can be done with a Geant4-based program. However, transferring the detector design from the CAD program to Geant4 can be laborious and error-prone. SW2GDML is a tool that reads a design in the popular SOLIDWORKS CAD program and outputs Geometry Description Markup Language (GDML), used by Geant4 for importing and exporting detector geometries. Other methods for outputting CAD designs are available, such as the STEP format, and tools exist to convert these formats into GDML. However, these conversion methods produce very large and unwieldy designs composed of tessellated solids that can reduce Geant4 performance. In contrast, SW2GDML produces compact, human-readable GDML that employs standard geometric shapes rather than tessellated…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
A tool to convert CAD models for importation into Geant4
Carl Vuosalo
Duncan Carlsmith
Sridhara Dasu
and Kimberly Palladino
on behalf of the LUX-ZEPLIN collaboration
University of Wisconsin-Madison [email protected]
Abstract
The engineering design of a particle detector is usually performed in a Computer Aided Design (CAD) program, and simulation of the detector’s performance can be done with a Geant4-based program. However, transferring the detector design from the CAD program to Geant4 can be laborious and error-prone.
SW2GDML is a tool that reads a design in the popular SOLIDWORKS CAD program and outputs Geometry Description Markup Language (GDML), used by Geant4 for importing and exporting detector geometries. Other methods for outputting CAD designs are available, such as the STEP format, and tools exist to convert these formats into GDML. However, these conversion methods produce very large and unwieldy designs composed of tessellated solids that can reduce Geant4 performance. In contrast, SW2GDML produces compact, human-readable GDML that employs standard geometric shapes rather than tessellated solids.
This paper will describe the development and current capabilities of SW2GDML and plans for its enhancement. The aim of this tool is to automate importation of detector engineering models into Geant4-based simulation programs to support rapid, iterative cycles of detector design, simulation, and optimization.
1 Introduction
The development of a device such as a sophisticated particle detector requires both engineering design and simulation of performance under exposure to particle flux. Design is performed in a Computer Aided Design (CAD) program like SOLIDWORKS solidworks , which is a long-standing market leader in the CAD industry. Simulation is typically performed with Geant4 Agostinelli2003250 ; Allison2016186 ; 1610988 , which is extensively used in particle physics. The model of the device must be represented in both the CAD program and in the simulation. Any discrepancies between these two models could lead to incorrect results and, ultimately, a faulty design of the device.
Transfer of the design from the CAD program to Geant4 is often done manually, which is a slow, laborious, and error-prone process. As an alternative, many CAD programs can output a design in a standard format, like STEP (STandard for the Exchange of Product model data) ISO10303 . From STEP, it is necessary to convert into the Geometry Description Markup Language (GDML) format used by Geant4 for importing and exporting models. Tools like FASTRAD trad can convert STEP into GDML. However, this method drops material properties and produces very large and unwieldy designs composed of tessellated solids that can reduce Geant4 performance.
SW2GDML is a tool that reads a design in SOLIDWORKS and outputs GDML in a compact, human-readable format that uses standard geometric solids rather than tessellated shapes. It also includes the material composition of parts as specified in SOLIDWORKS in the converted GDML. The converted design can be used in Geant4 without the performance penalties of tessellated forms that have large numbers of vertices.
With SW2GDML, a rapid, iterative design cycle becomes feasible. A model can be created in SOLIDWORKS, converted and imported into Geant4, and then simulations can be run. The results of the simulations may show deficiencies in the design, which can be rectified in the SOLIDWORKS model. Then the cycle can be repeated, as often as necessary, with the rapid, automated conversion from SOLIDWORKS to Geant4 the key to speeding up the process (Fig. 1).
2 Initial Development of SW2GDML
SW2GDML was initially developed for use in the design of the LUX-ZEPLIN (LZ) Dark Matter Experiment Akerib:2015cja . The LZ collaboration is building a detector that will hold 7 tonnes of liquid xenon and which will be installed at the Sanford Underground Research Facility in the former Homestake gold mine in Lead, South Dakota. When the LZ detector is installed and begins collecting data, it will be the most sensitive liquid xenon dark matter detector to date. Major components of the detector are being designed with SOLIDWORKS. Figure 2 shows an overview of the detector, Fig. 3 highlights the outer detector photomultiplier tubes, and Fig. 4 shows the outer detector liquid scintillator tanks. The task of converting key parts of the detector, like the liquid scintillator tanks, guided the early development of SW2GDML.
Divergence of the development time lines for SW2GDML and the LZ detector design, along with sparse resources for SW2GDML development, limited the contribution of SW2GDML to the LZ design effort, but now the tool is available for use with other projects that employ SOLIDWORKS and Geant4.
3 Capabilities of SW2GDML
Development of SW2GDML is ongoing. It can convert simple SOLIDWORKS designs and supports the following shapes and features: board, cone, cylinder (full and partial), disk (full and partial), half-ellipsoid with a circular face, torus, cylindrical holes in parts, multiple coordinate systems in simple configurations, and repeated parts in linear patterns. Figures 5, 6, and 7 show examples of simple models automatically converted from SOLIDWORKS to Geant4 by SW2GDML. An example of GDML generated by SW2GDML can be found in the Appendix.
SW2GDML consists of about 3000 lines of C++ code developed with Microsoft Visual Studio and employs the SOLIDWORKS Application Program Interface (API). This API gives the converter direct access to the details of the model stored in SOLIDWORKS. Conceptually, the code is divided into three modules: one to read out of SOLIDWORKS the information about parts and their surfaces, one to associate surfaces together to form solids and calculate necessary coordinate transformations for them, and one to write out the solids in GDML format. The reading module is the most complicated one, because the SOLIDWORKS API requires many complex operations to extract and calculate the features of the parts.
SW2GDML is tied directly to SOLIDWORKS, and this tie is both an advantage and a disadvantage. It is able to very efficiently access all information in the SOLIDWORKS model, but it cannot work at all with any other CAD program. To adapt the SW2GDML code to another CAD program would be a very large development effort. Though the non-SOLIDWORKS-specific parts of the code could be probably be used with few changes, a new CAD API would probably be entirely different from the SOLIDWORKS API and thus require a complete re-development of the most complex part of SW2GDML.
4 Future Development of SW2GDML
SW2GDML cannot yet handle complex SOLIDWORKS models. Features not supported by SW2GDML may be omitted or may cause misplacement of converted parts. SOLIDWORKS has a long history of continuous development and enhancement, and it has become quite complex, with several different, parallel methods to perform each design task. Implementing in SW2GDML support for a feature in SOLIDWORKS has to be done not only once but several times because of the multiple approaches SOLIDWORKS uses to handle the same feature or capability. This complexity presents a large challenge to the goal of fully supporting conversion of all possible SOLIDWORKS models. At present, the SW2GDML development plan is incremental, with the aim of adding support for the most important or commonly used SOLIDWORKS features in a step-by-step fashion.
The current priorities for development are support for additional shapes, more complex combinations of coordinate systems, and special patterns where a single part is specified to repeat around a circle. Figure 8 shows an x-ray collimator design dinca with a spiral-cut cylinder shape whose conversion is currently under development.
5 Conclusion
SW2GDML is a tool to automatically convert designs in the SOLIDWORKS CAD program into GDML for importing into Geant4 for simulation. It aims to facilitate rapid, iterative cycles of design, simulation, and validation. It currently supports conversion of simple SOLIDWORKS models and is on a path of further development to support more SOLIDWORKS features.
\ack
We gratefully acknowledge the support for this work provided by grant PHY-1104447 from the National Science Foundation.
Appendix
An abbreviated example of GDML generated by SW2GDML follows:
<materials> <material name="AISI_316_Stainless_Steel_Sheet_.SS."> <D value="8.0" unit="g/cm3"/> <fraction n="0.685" ref="Iron"/> <fraction n="0.17" ref="Chromium"/> <fraction n="0.12" ref="Nickel"/> <fraction n="0.025" ref="Molybdenum"/> </material> </materials> <solids> <box name="WorldBox" x="10000.0" y="10000.0" z="10000.0"/> <cone name="cone1" z="0.687022" rmin1="0" rmin2="0" rmax1="0.126993" rmax2="0.0746125" deltaphi="TWOPI"/> <torus name="torus1" rtor="0.119" rmin="0" rmax="0.054" deltaphi="1.5708"/> <ellipsoid name="s-revolve1" ax="0.91395" by="0.91395" cz="0.460433" zcut1="0"/> <tube name="disk1" rmin="0" rmax="3.81476" deltaphi="6.28319" z="0.01"/> <tube name="cylinder1" z="5.96274" rmin="3.81" rmax="3.81476" deltaphi="6.28319"/> <tube name="cylinder12" z="0.342" rmin="0" rmax="0.054" deltaphi="6.28319"/> <subtraction name="subt1"> <first ref="torus1"/> <second ref="cylinder12"/> <position name="pos1" x="-0.171" y="0.119" z="0"/> <rotation name="rot1" x="0" y="1.5708" z="0"/> </subtraction> </solids> <structure> <volume name="vol8"> <materialref ref="AISI_316_Stainless_Steel_Sheet_.SS."/> <solidref ref="disk1"/> </volume> <volume name="World"> <materialref ref="Air"/> <solidref ref="WorldBox"/> <physvol> <volumeref ref="vol8"/> <position name="pos11" x="0" y="0" z="5.93734"/> <rotation name="rot11" z="0" y="1.5708" x="0"/> </physvol> </volume> </structure>The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Dassault Systèmes SOLIDWORKS Corporation, Waltham, Massachusetts
- 2[2] Agostinelli S et al. 2003 Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 506 250 – 303 ISSN 0168-9002 URL http://www.sciencedirect.com/science/article/pii/S 0168900203013688
- 3[3] Allison J et al. 2016 Nuclear Instruments and Methods in Physics Research Section A: Accelerators, Spectrometers, Detectors and Associated Equipment 835 186 – 225 ISSN 0168-9002 URL http://www.sciencedirect.com/science/article/pii/S 0168900216306957
- 4[4] Allison J et al. 2006 IEEE Transactions on Nuclear Science 53 270–278 ISSN 0018-9499
- 5[5] ISO TC 184/SC 4 1994 ISO 10303-1:1994 Industrial automation systems and integration Product data representation and exchange - Overview and Fundamental Principles, Standard International Organization for Standardization Geneva, Switzerland
- 6[6] TRAD Tests & Radiations, Labège, France
- 7[7] Akerib D S et al. (LZ) 2015 ( Preprint http://arxiv.org/abs/1509.02910 )
- 8[8] Dinca D C, American Science and Engineering, Inc, Billerica, Massachusetts 2016
