CAD into GEANT4 using CADMesh.hh

Hi all,

I am trying to load CAD files into GEANT4 through the CADMESH from GitHub - christopherpoole/CADMesh: A CAD file interface for GEANT4.

I converted my .step file to a .ply format. The code is running without any error in the beginning and then when I tried to open the geometry with the Qt visualization program an error appeared and I cannot see the geometry.

userDetector->Construct() start.

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : LexerError
issued by : CADMesh in Lexer

The CAD file appears to contain incorrect syntax:
Error around line 1: PLY files start with ‘ply’.

*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

*** G4Exception: Aborting execution ***

I tried to convert my .step file to .obj format since I thought that probably something went wrong with the .ply transformation but again a different error appeared when I tried to see the geometry in the qt program.

userDetector->Construct() start.

-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : MeshNotFound
issued by : CADMesh in Reader::GetMesh

The mesh with index ‘0’ could not be found.
*** Fatal Exception *** core dump ***
**** Track information is not available at this moment
**** Step information is not available at this moment

-------- EEEE -------- G4Exception-END --------- EEEE -------

*** G4Exception: Aborting execution ***

Could someone help me with the above errors?

Thank you very much for your help.

I frequently get this error when the ply-file is not at the correct location, or the filename is incorrect.
check if you (or cmake for you ;-)) have placed the file into the location where you are looking for it, typically the same folder as the executable. note it is not affected by setting the directory where you place macros…

if that does not help, second option would be: try ascii encoded ply files, instead of binary

Thank you veryyy much for your quick reply! The problem was the file location as you said! I put it in the right folder and now I am able to open it! :grinning: