meshing.export.save_step

meshing.export.save_step(mesh, path)

Write a minimal faceted STEP AP214 boundary representation.

Builds one planar ADVANCED_FACE per merged polygon (via :func:merge_planar_faces) and per leftover triangle, over shared VERTEX_POINT and EDGE_CURVE/LINE topology, gathered into a CLOSED_SHELL inside a MANIFOLD_SOLID_BREP with the minimal AP214 product and unit boilerplate. Every referenced entity id is defined and the output is deterministic for a given mesh.

Degenerate loop edges (endpoints closer than the file’s declared distance accuracy, which sharp feature placement can produce) are welded away first — OCCT rejects zero-length LINE geometry and would split the shell. Output is validated against the OCCT kernel in tests/meshing/test_step_kernel.py: files read back as a single valid closed MANIFOLD_SOLID_BREP with matching face counts and volume. Units are metres (one mesh unit = 1 m); readers defaulting to millimetres scale coordinates by 1000 on import.

Parameters

Name Type Description Default
mesh Mesh A dual-contour :class:~cadjoint.meshing.dual_contouring.Mesh; must contain at least one face. required
path str | Path Output file path. required

Raises

Name Type Description
ValueError If the mesh has no faces.