Skip to content

hertzforge.io.step

step

Read STEP and IGES files (B-rep CAD), tessellated by OpenCASCADE.

Unlike STL and 3MF, these files hold surfaces rather than triangles, so reading them needs a CAD kernel: OCP (Apache-2.0 bindings) over OpenCASCADE (LGPL-2.1 with an exception, a replaceable library as Qt is; see NOTICE.md). The kernel is a dependency of the package and is included in every packaged build; if it fails to import, this module refuses with the reason and the command that reinstalls it.

The result is the same as the 3MF reader's: triangle face elements in meters, with the units defined, one named element group per top-level (free) shape in the file. Part models downloaded from vendors in STEP or IGES read directly.

Functions:

Name Description
sniff

True for a path ending in .step, .stp, .iges or .igs, in any

load

Read a STEP or IGES file as a geometry, with each top-level shape

Classes

Functions:

sniff

sniff(path: str | PathLike) -> bool

True for a path ending in .step, .stp, .iges or .igs, in any case.

Only the suffix is checked, so the CAD kernel is not loaded until a file is imported.

load

load(path: str | PathLike) -> Geometry

Read a STEP or IGES file as a geometry, with each top-level shape as a named element group.

Parameters:

Name Type Description Default
path str or path - like

The .step/.stp or .iges/.igs file.

required

Returns:

Type Description
Geometry

Triangle face elements in meters, tessellated by the kernel, with one element group per free shape the file holds, named as the file names it or for the file when it has no name.

Raises:

Type Description
ValueError

When the kernel is not installed, the kernel refuses the unit setting, the file does not read, nothing transfers, or no shape tessellates.