Export TGeo Geometry to step file

Hi guys,

I have a detector geometry in the Root TGeo format and was trying to export it to a step file (or any other 3D format which can be edited with 3D editors)

I found one thread which lead me to the class TGeoToStep which is meant for exactly this purpose. Unfortunatly it requires the external toolkit OCC and is not included by default.
Wince I was not able to find a different way, I tried to recompile Root with the geocad option enabled.

First I had to get OCC 7.3.0 working which took me quite some time. Once this was done I tried to recompile Root but this ended with some compile errors mentioning not existing classes and functions. My guess is that OCC 7.3.0 is too new for the Root OCC implementations, so I tried the latest OCC 6.9 version, but I was not able to get this working since my operating systems seems to be too new for this because the base libraries seem to lack some classes needed.

Furthermore I tried the OCE community toolkit which worked quite well, since I was able to compile Root woth the geocad option enabled. Unfortunatly during the actual export I get an error and Root crashes.

The configure part of the Root installation told me that the geocad option is deprecated and will be removed soon. Therefore I guess that it is actually a problem with uncompatible versions. I am wondering whether there is a replacement for the geocad functionalities implemented since it is supposed to be removed. Furthermore I was wondering whether there is a ddifferent way to export the geometry to any usable 3D format.

Any advice is asked for.
Thanks in advance.


ROOT Version: 6.16
Platform: Debian Buster
Compiler: Newest g++


I guess @agheata can help you.

Hi @Triple_S,

Indeed, we’ve got into the same terrible headache trying to support the TGeoToStep add-on while moving to newer OCC versions. This is the main reason why we had to discontinue support for this, even if we do not have yet any good replacement for the functionality. Future support may require writing a native TGeoToStep converter, but we’re lacking the person power for this, so no plans yet.

Meanwhile you might want to look into http://cad-gdml.in2p3.fr that apparently can handle CAD <-> GDML conversions, since TGeo can export to GDML.

Best, Andrei

Thanks for your reply,

I already thought that the situation would be like you described it.
I have also seen this CAD <-> GDML FreeCAD tool, but it’s functionalities are unfortunatly extremly limited since it only supports the shapes “BOX” and “CYLINDER” which is not sufficient for complex detector setups.

Sounds to me the only possibility is setting up a virtual machine with an old operating system where I can install an old OCC version which is compatible with Root. Can you recommend a combination of Operating System, OCC Version and Root Version which you know is working?

I cannot recommend a version, but last time I tested was using v16-00-rc1 (last version supporting geocad. I was using OpenCASCADE Community Edition CAE coming with Ubuntu 16.04

OK, I just tried it with Ubuntu 16.04 and the corresponding OCE version (sudo apt install liboce*) and Root 6.16, but it did not work. There is still an error reported when I try the export.

Hi, what is the error? It may be related to the implementation for a shape with OCC

Unfortunatly the error does not give much info.
It is terminate called after throwing an instance of 'StdFail_NotDone' when I compile the macro and Error in <TRint::HandleTermInput()>: Exception caught! when I run on the console.

The problem seems to be connected to our Detector Setup or at least a part of it. I tried it with a very simple shape and there it worked. I will try to investigate a little bit further by turning of different subdetectors and see where the error lies.

Edit: OK, basically every one of our subdetectors triggers this error.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.