Building VTK with OpenCascade support

Hello, I am interested in using VTK’s vtkOCCTReader to read Step files in my python project. From reading Difficulty Accessing the vtkOCCTReader through the python modules it seems that the pip installation of VTK does not offer OpenCascade support so I need to build VTK on my own. I was able to build VTK using Cmake-gui which worked with other parts of my project but I still get the error " module ‘vtk’ has no attribute ‘vtkOCCTReader’". My question then is, how exactly do I enable OpenCascade support in my VTK build? I was not able to find “enable OpenCascade module” or something similar in cmake-gui as can be seen in the following image:

Look for VTK_MODULE_ENABLE_VTK_IOOCCT, you will need to install open cascade though.

Thank you for the fast answer Mathieu. I have managed to find VTK_MODULE_ENABLE_VTK_IOOCCT, seems I forgot to click on the “Advanced” checkbox on cmake-gui and that was hiding it. I will attempt to install OpenCascade and then rebuild VTK correctly.

1 Like

I have managed to install OpenCascade but while building VTK without the IOOCCT module works, every attempt at building with the module enabled gives me the error “ImportError: DLL load failed while importing vtkIOOCCT: The specified module could not be found” when running my project and I can’t really understand why that is.

Did you copy the OCCT dlls into your application folder?

I have added the path to the VTK folder to my PYTHONPATH environment variable and that seemed to work for builds without OpenCascade, even now when I look at the folder I can find the vtkIOOCCT dll and pyd files there so I don’t know why I am getting this error.