Cadmesh - A CAD file interface for GEANT4

  •        0

UPDATEFebruary 18, 2010: Added support for COLLADA files (exportable from Google Sketchup) - requires QtXml and OpenGl. Enabled with ./configure --enable-collada User-code GNUMakefiles only require "include cadmesh.gmk" for compilation with settings made during configure persevered. Building with cmake is coming... October 17, 2011: Version v0.6.1 available in the downloads section (replacing v0.6) fixing compile errors if all includes not in the same direction when compiling shared library (old bug reintroduced with previous update). October 10, 2011: Version v0.6 available in the downloads section now includes the new autoconf configure scripts with new installation instructions below. August 13, 2011: Development branch update: now contains an autoconf configure script to aid building, new constructors with various optional arguments have been included, and cadmesh now compiles to a shared object library for linking against. Browse the repo here May 31, 2011: The requirement for all GEANT4 headers to be installed in one directory has been removed with a modification to the Makefile (thanks Andrea Ferrero). May 25, 2011: Added the offset argument to CADMesh::LoadMesh allowing for arbitrary (x, y, z) offsets to be applied to all coordinates. Useful if the CAD model has absolute coordinates. Added reverse argument to CADMesh::LoadMesh allowing for the vertex read direction to be reverses; this can solve inside/outside navigation errors. IntroductionImporting 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 leveraging VCGLIB. 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. Citing CADMeshCADMesh is described in a pre-print publication, available here. If you would like the cite the article, you may wish use the following bibtex entry: @article{poole2011acad, author = {Poole, C. M. and Cornelius, I. and Trapp, J. V. and Langton, C. M.}, title = {{A CAD Interface for GEANT4}}, journal={Arxiv preprint arXiv:1105.0963},, year = 2011, month = April,}Example UsageThe following shows basic usage for cadmesh in a UserDetectorConstruction, a complete example can be found here // User Detector Constructor#include "CADMesh.hh"...G4ThreeVector offset;G4VSolid * cad_solid;G4LogicalVolume * cad_logical;G4VPhysicalVolume * cad_physical;...offset = G4ThreeVector(-30*cm, 0, 0);CADMesh * mesh = new CADMesh("../../models/cone.ply", "PLY", mm, offset, false);cad_solid = mesh->TessellatedMesh();cad_logical = new G4LogicalVolume(cad_solid, water, "cad_logical", 0, 0, 0);cad_physical = new G4PVPlacement(0, G4ThreeVector(), cad_logical, "cad_physical", world_logical, false, 0);...# GNUMakefilename := exampleG4TARGET := $(name)G4EXLIB := trueinclude cadmesh.gmk.PHONY: all all: lib bin include $(G4INSTALL)/config/binmake.gmkDependenciesA working installation of the folowing libraries or packages is required: GEANT4 VCGLIB TETGEN QT & OpenGL (for COLLADA support) Installation (v0.6 and above)For installation of v0.5 and below see the wikipage OldInstallation. Everyone else, download the latest release of CADMesh from the Downloads section, and extract the archive, or checkout the development branch from the repository. Additionally, download VCGLIB (you can find more information about acquiring VCGLIB here) and download tetgen from here (on ubuntu you can sudo apt-get install libtet1.4.2-dev). # Checkout VCGLIBsvn co vcglib# CADMesh latest dev branchhg clone # OR with source from downloads sectiontar xvjf cadmesh-VERSION.tar.bz2cd cadmesh/# General autoconf options for ./configure --help help topics --prefix=dir change install location from /usr/local/bin --enable-debug enable extra output # For CAD only ./configure --disable-tetgen --with-vcglib=dir# FOR TET only./configure --disable-vcglib# OR if tetgen not installed./configure --disable-vcglib --with-tetgen=dir# FOR CAD and TET./configure --with-vcglib=dir# OR if tetgen not installed./configure --with-vcglib=dir --with-tetgen=dir# FOR COLLADA SUPPORT./configure --enable-vcglib --enable-collada --with-qt=dirmakesudo make install# Run example (Linux with g++)cd examples/basicmake$G4WORKDIR/bin/Linux-g++/cadmesh_exampleIdle> exitIf you encounter any problems send me an email or open an Issue on the tracker. Status/Road-mapCurrently there is public support for importing triangular facet meshes defined in PLY, STL or OFF file formats. Work is continuing



Related Projects

FlightGear - Flight Simulator

FlightGear is a flight-simulator created by an international group of volunteers. The goal of the FlightGear project is to create a sophisticated and open flight simulator framework for use in research or academic environments, pilot training, as an industry engineering tool.


NaroCAD is a fully fledged and extensible 3D parametric modeling CAD application. It is based on OpenCascade.


lignumCAD is a solid modeling tool oriented towards the design of furniture.

Minix - Operating System by Andrew S. Tanenbaum

MINIX 3 is a free, open-source, operating system designed to be highly reliable, flexible, and secure. It is based on a tiny microkernel running in kernel mode with the rest of the operating system running as a collection of isolated, protected, processes in user mode.

Archimedes: The open CAD

Archimedes is a free and open source CAD (Computer Aided Design) software. It is a robust system built over Eclipse's Rich Client Platform fully based on plug ins. This means it is easily extensible but also has a pretty thin core that allows you to select the features you need and drop the other ones easily.

Archimedes: An architecture open CAD

Archimedes will be a Computer Aided Design (CAD) program developed side by side with architecture offices in order to fulfill all their needs. This way, we hope to develop software better suited for architects than the currently widely used AutoCAD.

XTrkCAD Model RR Track Planner

XTrackCAD is a CAD program for designing model railroad layouts. You can easily create layout of any scale or size. Libraries for many brands of track and turnouts are included. Adding new components is easy with the built-in editor.

XTrkCAD Model RR Track Planner

XTrackCAD is a CAD program for designing model railroad layouts. You can easily create layout of any scale or size. Libraries for many brands of track and turnouts are included. Adding new components is easy with the built-in editor.


TinyCAD is a program for drawing circuit diagrams commonly known as schematic drawings. It supports standard and custom symbol libraries. It supports PCB layout programs with several netlist formats and can also produce SPICE simulation netlists.


RapidSmith is a research-based FPGA CAD tool framework written in Java for modern Xilinx FPGAs. Based on XDL, its objective is to serve as a rapid prototyping platform for research ideas and algorithms relating to low level FPGA CAD tools.