Usually the direction is from CAD files into Geant4. I want to go the other way, to allow using Geant4 geometries on GPUs.
Tessellated solids can also be used to import geometrical models from CAD systems (see Figure 4.1). In order to do this, it is required to convert first the CAD shapes into tessellated surfaces. A way to do this is to save the shapes in the geometrical model as STEP files and convert them to tessellated (faceted surfaces) solids, using a tool which allows such conversion. At the time of writing, at least two tools are available for such purpose: STViewer (part of the STEP-Tools development suite) or FASTRAD. This strategy allows to import any shape with some degree of approximation; the converted CAD models can then be imported through GDML (Geometry Description Markup Language) into Geant4 and be represented as G4TessellatedSolid shapes.
Other tools which can be used to generate meshes to be then imported in Geant4 as tessellated solids are:
[blyth@cms01 ascii]$ vi include/G4tgbGeometryDumper.hh
[blyth@cms01 ascii]$ pwd
/data/env/local/dyb/trunk/external/build/LCG/geant4.9.2.p01/source/persistency/ascii
[blyth@cms01 ascii]$
G4tgbVolumeMgr* volmgr = G4tgbVolumeMgr::GetInstance()
volmgr->AddTextFile(theFileName)
G4tgbGeometryDumper::GetInstance()->DumpGeometry(theFilename)
CAD interfaces for simulation and analysis tools in the space domain, Giovanni Santin Geant4 CAD interface development meeting Orsay, 23 March 2010
Importing predefined CAD models into GEANT4 is not always possible or requires intermediate file format conversion to Geometry Description Markup Language (GDML) using commercial or third party software. CADMesh is a direct CAD model import interface for GEANT4 optionally leveraging VCGLIB, and ASSIMP by default. Currently it supports the import of triangular facet surface meshes defined in formats such as STL and PLY. A G4TessellatedSolid is returned and can be included in a standard user detector constructor.
Additional functionality is included for the fast navigation of tessellated solids by automatically creating equivalent tetrahedral meshes thereby making smart voxelisation available for the solid.
Based on VCGLIB
Can import/export: VRML, X3D, COLLADA, STL, PLY Based on VCGLIB