How to Open Step File in VTK

Who can tell me how to open the STEP file and display it? Thank you!

You may read the STEP file with OpenCascade kernel and then visualize it in a VTK scene after faceting (generating visualization mesh from a CAD model). Here is the project where this workflow is readily available: https://gitlab.com/ssv/AnalysisSitus

thank you Quaoar!

There is now a vtkOCCTReader in VTK able to read step files.

I can’t find any document about vtkOCCTReader in python,
from vtkmodules.vtkIOLegacy import vtkOCCTReader
comes with

from vtkmodules.vtkIOLegacy import vtkOCCTReader
ImportError: cannot import name 'vtkOCCTReader' from 'vtkmodules.vtkIOLegacy'

Is there any python example?

Which version of VTK are you using ?
How did you install it ?

vtk = β€œ^9.4.1”
I installed it with poetry, and I can run the example 01_vtk\solution_flow.py successfully.
I just want to change some code to test STEP loading.

Then it means OCCT is not enabled in the python wheels. You need to build open cascade and VTK yourself to access it.

Thanks for reply. How can I check whether vtkXXXReader is support in python? Maybe it is in another package, not from vtkmodules.vtkIOLegacy. Is there any document for python wheel?

The configuration is here: https://gitlab.kitware.com/vtk/vtk/-/blob/master/.gitlab/ci/configure_wheel.cmake?ref_type=heads

1 Like