Read a STEP part

Read a STEP part#

STEP is the dominant neutral interchange format in mechanical CAD. This example loads a real STEP part, the NIST AM Bench 2022 LPBF bridge specimen (public domain, https://doi.org/10.18434/mds2-2607), and inspects the resulting pyvista.MultiBlock. Every STEP part becomes one block with its OCCT label and color attached as cad.label / cad.color field data.

import pyvista as pv

import pyvista_cad
from pyvista_cad.examples import downloads

Read the real STEP part.

MultiBlock (0x7f6faf6789a0)
  N Blocks:   1
  X Bounds:   0.000e+00, 7.500e+01
  Y Bounds:   -2.446e-13, 5.000e+00
  Z Bounds:   0.000e+00, 1.225e+01


Render CAD-friendly: smooth faces coloured by Z with the model’s topological edges overlaid; the triangle-mesh edges are hidden.

for _, part in mb.cad.walk():
    part['elevation'] = part.points[:, 2]

pl = pv.Plotter()
pl.cad.add(mb, scalars='elevation', cmap='viridis')
pl.show()
read step

Total running time of the script: (0 minutes 0.308 seconds)