CADMesh is still the easiest way to load triangular mesh files and CAD files into Geant4 geometries. The original version depended on some external libraries to read the various supported file formats. Now CADMesh 2 has built-in readers for PLY, OBJ, and STL files. Check it out here!.
Easy Installation
The built-in readers are one thing, but the main selling point for CADMesh to is its trivial installation process.
CADMesh 2 is now header only.
Just copy CADMesh.hh
to your project include
directory, and you are ready to load triangular mesh files as geometry in your Geant4 simulation.
This is ideal if you are running your simulations using HPC infrastructure as well, no messing around compiling the library and dealing with internet access and so on that may or may not be available.
Importantly, CADMesh now travels with your source code, so you are not dependent on repositories remaining online, or keeping up with the latest version. Install it, use it. That is it.
Built-in Readers
Built-in readers mean there are no external dependencies when you want to load OBJ, PLY or STL files into your geometry. Loading a mesh is just this easy:
auto mesh = CADMesh::TessellatedMesh::FromPLY("mesh.ply");
Reading Assemblies
CADMesh 2 also supports accessing multiple meshes found in a single file. This is common with OBJ files. Check out the examples for more details.
auto solid = mesh->GetSolid("cube"); // Get the mesh named "cube" as a solid.