G’day,
Almost 10 years ago I released CADMesh, a small library for loading triangular mesh CAD files as tessellated solids into Geant4. Today I released an update, version 2, which is header only and has built-in readers for STL, PLY, and OBJ files. Other file types are still supported using external dependencies as required.
So, if you want to load one of these types of files as geometry into your detector construction, all you have to do is this, after you have copied CADMesh.hh
to your include
directory:
#include "CADMesh.hh"
....
auto mesh = CADMesh::TessellatedMesh::FromPLY("mesh.ply");
G4VSolid* solid = mesh->GetSolid();
The code (https://github.com/christopherpoole/CADMesh) is MIT licensed, and you can find the latest release here.
If there are any CADMesh users out there, I would like it if you would send me STL, PLY, or OBJ files that it doesn’t work with, and possibly any fancy looking screenshots you might have which I could include in a future website.
Thanks, Chris.