CADMesh 2 Released - A CAD file interface for GEANT4

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.

1 Like

Great news, thank you, I’ve been following your project on Github.

Is there any advantage performance- or memory-wise in using the external libraries ASSIMP or TETGEN for STL, PLY or OBJ files with CADMesh v2?

kind regards,
Christoph

Sorry for the late response.

I haven’t measured or compared the relative performance of the built-in readers versus external libraries.

The motivation is mostly to allow for a trivial installation process to get up and running for typical file formats as quickly as possible.

A performance evaluation is something I can look at including in the tests suite.

Thanks, Chris.