dymokomi/luce-step
Luce Base STEP Part 21 import with analytic B-rep surfaces, shared trims, colors and assembly groups.
A library written in luce-base. Latest release 0.11.2.
Install#
luc add dymokomi/luce-stepDocumentation#
luce-step
Original Luce Base STEP Part 21 geometry reader. Public export: step.Step.load_model(path) and Step.decode_model(text) return an analytic cad.CadModel; call its tessellate(segments) for a luce-geocore Mesh. File entity/reference decoding lives here; model validation, surface ownership, trim semantics and surface sampling belong to luce-cad.
Both APIs accept an optional tolerance argument. 0 (default) uses the file's declared length uncertainty, with the existing 1e-6 fallback. A positive value from 1e-9 through 1 explicitly replaces it, in **source coordinate units**. The chosen value is retained by the CAD model for edge agreement and trim projection during preview and tessellation. This is not a tessellation edge-length or polygon-density control, automatic healing, or unit conversion. For example, Step.load_model(path, tolerance=0.0001) imports with that specific boundary tolerance; an explicit tighter value also overrides a looser file value.
Current supported subset:
- Faceted
FACE/POLY_LOOPgeometry. ADVANCED_FACEB-reps with sharedVERTEX_POINT/EDGE_CURVEtopology, oriented edge uses, outer boundaries and holes. Lines, circles and trimmed B-spline/rational B-spline and elliptical edges are retained analytically.- Plane, cylinder, cone, sphere, torus and B-spline support surfaces. CAD meshing currently supports planar trims, circular bands, ruled patches and bounded nonperiodic NURBS UV trim projection.
STYLED_ITEMsurface-fillCOLOUR_RGBstyles are retained on CAD faces. Shell/solid colors are inherited, with explicit face styles taking priority. Tessellation emits primitiveCd; no material/texture or transparency shader is inferred. RGB values are retained without color-space conversion.- Declared length uncertainty is used for boundary agreement in source units.
- Unique-occurrence rigid assemblies using representation relationships and item-defined transformations retain composed face placements.
- Surface-only untrimmed
B_SPLINE_SURFACE_WITH_KNOTSdatasets, including complex rational B-spline entities and explicit weights.
This is not full STEP support. General p-curves/surface curves, general periodic/singular NURBS trims, mapped/repeated instances, oriented shells/void solids and automatic unit conversion remain unsupported. Unsupported face/placement topology fails instead of importing support surfaces as if they were trimmed parts. Source units/coordinates are retained; the editor uses a separate Transform node for scale. Shared STEP edges tessellate once.
The Part 21 scanner handles strings, references, simple and complex entities; it is not a general EXPRESS schema validator. References use a bounded hash table. Limits: 256 MiB input, 2,097,152 entities, 32,768 shared vertices/edges. Faceted faces may have any number of corners, B-rep faces any number of trim loops and edge uses, and spline edges any number of controls; a face luce-cad's tessellator cannot follow is left out of the mesh and named there (CadGeometry.skipped_faces). NURBS surfaces are bounded to 1,024 per direction and 262,144 controls total. Entity allocation follows a counted preflight; topology references use hashed lookup. Spline trim endpoints must still agree within the chosen import tolerance; automatic tolerance healing is not enabled. Uniform surface sampling is not a tolerance-controlled CAD tessellator.
luc test runs the Luce regressions in tests/step/ (faceted and rational surfaces, B-rep cylinder, assembly placements, colors, reflected transforms, import tolerance and faces of any size, on fixtures it generates). The external-file probe luced-3d/tools/cad_probe.py tests a real STEP against a reference OBJ without using that OBJ to generate geometry. See luced-3d/docs/CAD_TESSELLATION.md.
Dependencies#
| Package | Version |
|---|---|
| dymokomi/luce-cad | newest |
| dymokomi/luce-geocore | newest |
| dymokomi/luce-std | newest |
Versions#
0.11.2
Browse source · pack · commit 4b8c440fc246
SHA-256 f746eca8bfd0b7fb26059a98a5bbc68315c4b72790dea43e72b3f1bd2c556a27
luce-step 0.11.2: batch release
0.11.1
Browse source · pack · commit 5a968fe538a0
SHA-256 241a54f7131226135cd24d07c677bd98328c8e2afada8fca31d7c4a814466c65
luce-step 0.11.1: batch release
0.11.0
Browse source · pack · commit 688e57216736
SHA-256 28418fe55a9fc73a53675ff9111da574749a1f32042afb976409e6cadd9c2395
growable text is luce-std's collections.Buffer; dependencies name no version