Skip to content

kSTEP 0.3.0

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 24 Oct 10:43
· 58 commits to master since this release
9ea472a

kSTEP 0.3.0 — 2026-10-24 (pre-release)

Fourth pre-release. It makes the geometry layer parametric and adds presentation data: sketches gain radius,
tangency and angle constraints and re-solve inside a feature history, edges generated by extrude, revolve, fillet,
chamfer, boolean and hole operations get persistent names, a feature history gets undo/redo, kstep render / preview /
GLB honour assembly placements, the OCCT bridge gains mirror, uniform scale, face and vertex selection and shell, and
colours and layers are written by kstep export and read back by kstep import, which now also reports the length
unit and runs in a supervised worker process. As before, the GitHub release carries a platform-independent JVM-only
kstep-cli-0.3.0.zip (about 87 MB because it bundles the Kotlin compiler for *.kstep.kts scripts) and a SHA-256
checksum, and nothing is published to Maven Central or Homebrew.

Geometry, sketches and kstep import need the native bridges. The zip is built without them, so those
features report a clear "unavailable" error there; build from source with a system OpenCascade (Linux
x86-64, or macOS arm64 via Homebrew) to use them. Interoperability is verified with OpenCascade-based readers
(OpenCascade's own readers and FreeCAD), not yet with other CAD/PLM systems.

Added

  • Sketch extensions (ADR-0032, Welle M). Circle and arc radii can be solver unknowns (fixedRadius = false);
    new sketch constraints radius, diameter, equalRadius, tangent(line, circle), tangent(circle, circle, internal) and angle(l1, l2, degrees); SolvedSketch.radius(ref). New PlaneGCS constraint kinds 7-12 and
    scalar unknowns (SketchScalar, RadiusConstraint, EqualScalarConstraint, PointOnCircleConstraint,
    TangentLineCircleConstraint, TangentCircleCircleConstraint, AngleConstraint) behind the new native entry
    point nativeSolveSystem (at most 128 scalars).
  • SketchFeature / sketchFeature(...): a parametric sketch as a step of a feature history that re-solves on
    FeatureRebuilder.rebuild, through the new open interface ExternalRootFeature (and ExternalFeatureException).
  • Several separate outer contours in one sketch become several bodies in one shape: SolvedSketch.toRegions(),
    OcctKernel.extrudeRegions/revolveRegions, ExtrudeRegionsFeature/RevolveRegionsFeature, native
    nativeMakeCompound (at most 32 bodies); STEP export writes them as one representation with several
    MANIFOLD_SOLID_BREP; kstep import reports them per body (ImportedPart.bodies, JSON field bodies).
  • OcctKernel.solidSummaries, groupLoopsIntoRegions, requireValidDisjoint.
  • Example scripts and scripts/interop/verify-sketch-extensions.sh.
  • Persistent naming of generated edges (ADR-0033, Welle N). GeneratedEdges(featureIndex, sources, role, expected, within) addresses the edges an extrude or revolve generated from profile sources (ProfileVertex, ProfileEdge,
    RegionVertex, RegionEdge, PointAt, SegmentAt, and for sketches SketchCorner / SketchEdgeOf by point
    name), so a parameter change keeps hitting the same logical edges. Kernel API: OcctKernel.extrudeProfileNamed,
    revolveProfileNamed, extrudeRegionNamed, revolveRegionNamed, generatedEdges, and fillet/chamfer overloads
    on a NamedShape; SolvedSketch.extrudeNamed/revolveNamed; EdgeNamingException (KSTEP-S-011 in scripts);
    SketchBuilder.rectangle(..., names = ...). Four new native entry points, no new OCCT toolkit.
  • Undo/redo: FeatureHistory with AddFeature, RemoveFeature, ReplaceFeature, MoveFeature over a
    FeatureSequence (immutable snapshots, index remapping, no shapes held), FeatureHistoryException.
  • Example scripts for both and scripts/interop/verify-persistent-naming.sh.
  • Naming of edges generated by derived features (ADR-0034, Welle N2). GeneratedEdges now also accepts a fillet,
    chamfer, boolean or hole as generator, with the new sources BlendedEdges, OperandEdges(operand, selector),
    OperandFaces(operand, faceSelector), BooleanSection and HoleWall and the new roles BOUNDARY, SECTION,
    RIM_ENTRY, RIM_EXIT. Kernel API: OcctKernel.filletNamed, chamferNamed, booleanNamed, holeNamed,
    generatedEdges(DerivedNamedShape, ...), DerivedNamedShape, MAX_DERIVED_QUERIES. Strict like ADR-0033: a blind
    hole has no RIM_EXIT, a source without an image or a wrong count is an EdgeNamingException (KSTEP-S-011). Three
    new native entry points (nativeFilletEdgesNamed, nativeChamferEdgesNamed, nativeBooleanOpNamed), no new OCCT
    toolkit, OCCT 7.9 APIs only. The source/role/generator combinations are validated before any native call.
  • Example scripts for the hole rim, a union section and an unresolved name, and
    scripts/interop/verify-derived-naming.sh (with --spike for the standalone OCCT history spike).
  • Placement-aware render, preview and GLB (ADR-0035, Welle O). kstep render, kstep asciidoc and the preview
    pipeline now draw every instance of a placed assembly at its composed place (SVG, PNG and GLB; the GLB is one
    merged mesh). New public AssemblyInstanceExpander and RigidPlacement.toGeometryPlacement() in kstep-shape
    (limits: 4096 instances, 16384 visited nodes, depth 64); each distinct part is triangulated once. The JSON output
    gains geometry.instanceCount and geometry.distinctShapeCount, the text summary says assembly: N instance(s) of M part(s), and an invalid placement degrades into a placement_invalid notice card. A model with several
    shapes but no assembly usage still previews shape 1 only, with a reworded warning.
  • Mirror and scale as shape operations (ADR-0036, Welle P). OcctKernel.mirror(shape, plane) and scale(shape, factor, about) return a mirrored or uniformly scaled COPY (also mirrorWithHistory / scaleWithHistory), new
    MirrorPlane, script-level mirror(...) / scale(...), MirrorFeature / ScaleFeature in the feature history
    (persistent edge names set before the step are followed through it). Scale factor within [1e-6, 1e6]; solid or
    compound of solids as input, every result solid checked. Four new native entry points (nativeMirrorShape,
    nativeScaleShape and their Tracked variants), no new OCCT toolkit. OcctKernel.compound(shapes) combines
    separate bodies into one shape for one product definition (at most 32). Six example scripts plus
    hello-scale-invalid, and scripts/interop/verify-mirror-scale.sh (with --spike).
  • Face and vertex selection, nearest(point) and shell (ADR-0037, Welle Q). Edges.nearest(point, within),
    Faces.nearest and Vertices.nearest pick the sub-shape(s) with the smallest GEOMETRIC distance to a point
    (BRepExtrema_DistShapeShape, ties are all returned); new Faces.all(), face and/or/minus, the
    VertexSelector family (Vertices.all/atMax/atMin/nearest/ofEdge), Edges.atVertex, OcctKernel.selectFaces /
    selectVertices, OcctShape.vertices (VertexInfo), TopologySelectionException as common base of the three
    selection failures (KSTEP-S-011 in scripts; the constant keeps its name). One selector-tree validator now bounds
    depth 32 / 256 nodes over all cross-nested hierarchies, iteratively and before any hashing. OcctKernel.shell (face
    indices or a face selector, a positive thickness and ShellDirection.INWARD/OUTWARD), shellWithHistory, the
    script function shell(...) and ShellFeature with SelectFaces / FaceIndices in the feature history: an edge
    named before an INWARD shell is followed through it, an OUTWARD shell cannot be tracked through (refused with the
    reason). The wall must be thinner than half the smallest extent, the input at most 200 faces. Five new native entry
    points (nativeShapeVertexInfo, nativeShapeVertexEdges, nativeShapeDistances, nativeShellShape,
    nativeShellShapeTracked) and ONE new OCCT toolkit, TKOffset (the CI jobs check for it; on Ubuntu it is expected in
    libocct-modeling-algorithms-dev, proven only by the CI Linux job). Eight example scripts and
    scripts/interop/verify-face-ops.sh (with --spike). Not included: a pocket or hole from a face, draft and thickening
    (planned as Welle Q2), naming of the inner wall of a shell, TrackedFaces; see ADR-0037.
  • Import of colours, layers and units (ADR-0038, Welle R). kstep import now reports the colour (sRGB, as written in the
    file) and layers of each part, each body of a multi-solid part and each styled face (colour, layers, faceStyles),
    the file's declared length unit (sourceLengthUnit: declared, missing or mixed, with the factor to mm) and a
    presentation summary; face numbers are OCCT's 0-based face order. New error KSTEP-I-013 (unit_unresolved) for a
    length unit that cannot be resolved (for example a conversion factor of 0, for which OCCT otherwise returns a bounding
    box of 1e100). A new pre-transfer check bounds the product-structure depth (32) and detects cycles on the typed
    entities. OcctKernel.surfaceTypeCounts and the part key surfaceTypes count faces per surface kind (a B-spline face
    stays FaceKind.OTHER). New JNI entry points nativeImportColors, nativeImportLayerRefs, nativeImportLayerNames,
    nativeImportStyleStats, nativeImportUnitInfo, nativeImportUnitNames, nativeShapeSurfaceTypeCounts. Fixtures for
    styled, multi-body, inch, centimetre, metre, unit-less, unresolved-unit, structure-only and a FreeCAD B-spline loft,
    scripts/interop/make_import_extras_fixtures.py and scripts/interop/verify-import-extras.sh. Not included: instance
    colours and layers, edge colours, imported colours in --render, colour export.
  • Export: colours and layers (ADR-0039, Welle S). shape(pd, shape, name, colour, layer), style(pd, colour, layer) and
    styleFaces(pd, selector, colour, layer, expected) give a part or single faces an sRGB colour (StepColour.rgb,
    StepColour.hex, StepColours) and a layer name. A styled part is written through STEPCAFControl_Writer (new JNI
    entry point nativeWriteStepStyled), and the style entities (STYLED_ITEM, PRESENTATION_LAYER_ASSIGNMENT, colours)
    are merged into the Part 21 file with a fail-closed allow-list. Parts without a style are written by the unchanged
    path and stay byte-identical (golden files generated before the change pin this down). kstep import reads the colours and
    layers back; kstep render shows the part colour (SVG, PNG, GLB COLOR_0). New codes KSTEP-S-012 (invalid colour),
    KSTEP-S-013 (invalid layer name), KSTEP-S-014 (second colour or layer for one target), KSTEP-S-015 (unknown target).
    Layer names are printable ASCII (1 to 128 characters, no backslash); transparency is not supported.
  • scripts/interop/verify-export-colours-layers.sh and freecad_read_styles.py; spike_export_styles.cpp holds the
    measurements behind ADR-0039.

Changed

  • kstep import reads with OCCT's colour and layer modes on (measured: no import-time difference on the placed-assembly
    fixture). The warning "ignored (not imported)" now names only pmi; ignored.colours and ignored.layers keep counting
    occurrences in the file. DIMENSIONAL_EXPONENTS (a unit entity) is no longer counted as PMI. A representation without
    any B-Rep is no_content (KSTEP-I-011) instead of a part with volume 0.
  • The messages of Placement.fromRowMajor3x4, Rotation.fromAxes, the native nativeTransformShape and the
    exporter/preview refusal of two shapes on one product definition now name the way out (mirror(...), scale(...),
    OcctKernel.compound(...)); the old wording is kept as a prefix. A placement stays rigid.
  • BREAKING (source): GeneratedRole gained the values SECTION, BOUNDARY, RIM_ENTRY and RIM_EXIT; an exhaustive
    when over GeneratedRole or GenerationSource in third-party code no longer compiles and needs the new
    branches. GenerationMap can carry images of derived sources (images() answers them by role).
  • SolveResult gained a scalars field (default empty): source compatible, not binary compatible.
  • Arcs now bind their end points with a point-on-circle constraint on the radius unknown instead of two distance
    constraints; labels and degrees of freedom are unchanged for fixed radii.
  • BREAKING (source): SolvedSketch.extrudeFeature/revolveFeature now return Feature instead of
    ExtrudeRegionFeature/RevolveRegionFeature, callers using the concrete type must adapt; toRegion() fails with INVALID_PROFILE when the
    sketch has several separate outer contours (use toRegions()).
  • fillet/chamfer (index, selector and history variants) refuse a shape with more than one solid with a clear
    message instead of failing inside OCCT.
  • FeatureRebuilder closes all built shapes when an external feature fails with any runtime exception.
  • ExternalRootFeature gained supportsGeneratedNaming and buildNamedShape with default bodies (source
    compatible, not binary compatible without -Xjvm-default=all); FeatureRebuilder.validateStructure is public.
  • kstep import no longer fails for a part with more than 1024 solids: the per-body summary is omitted with a
    warning. Computing it for up to 1024 solids adds noticeable import time.
  • Documentation: the README was split into focused documents under docs/ (status, modules, building, releasing,
    usage, roadmap); the README itself is now a short entry point.

Fixed

  • kstep import: a product-structure chain of thousands of levels (a few hundred kilobytes) could exhaust OCCT's
    recursive transfer and crash the JVM; depth and cycles are now checked on the typed entities before the transfer and end
    in limit_exceeded (KSTEP-I-010). A length unit with conversion factor 0 no longer yields geometry of size 1e100.
  • Documentation: ADR-0031, ADR-0032 and ADR-0030 no longer claim OCCT 7.8 compatibility or a Linux CI on 7.8; the
    Linux CI uses 7.9.2 and 7.8 is not tested.
  • Export: a part colour together with a face colour no longer aborts with "unexpected entity OVER_RIDING_STYLED_ITEM ...
    refusing to merge it". The overriding item is merged fail-closed: simple instance with four arguments, attached to a
    face, overriding a styled item of the style closure through an acyclic chain of at most 16 that ends at a styled solid
    containing that face; unknown entities are still refused (ADR-0039 S2). Two single-style golden files guard the
    unchanged output.
  • Import: the new colour and layer mode made the OCCT transfer quadratic in the number of layer assignments and distinct
    colours (80k layers took 41 s under the global OCCT lock). A pre-transfer typed count now rejects more than 4096 layer
    assignments or 10000 colour definitions with limit_exceeded (KSTEP-I-010). The count also covers
    SURFACE_STYLE_TRANSPARENT and SURFACE_STYLE_RENDERING_WITH_PROPERTIES (10000 each), because OCCT's colour table is keyed
    by RGBA and distinct colour x transparency pairs were still quadratic (80k styled items took 67 s). These caps bound
    only the size of the colour table, not the work, because every STYLED_ITEM scans that table once (a full table plus
    300k styled items took 116 s). The count therefore also covers STYLED_ITEM / OVER_RIDING_STYLED_ITEM (at most
    200000) and bounds styled items x (colour definitions + rendering records) to 100000000. The style lists of
    PRESENTATION_STYLE_ASSIGNMENT, SURFACE_SIDE_STYLE and STYLED_ITEM are walked once per styled item too and could
    repeat one reference cheaply (10k styled items x 200k entries took 53 s); lists longer than 64 entries are rejected.
  • Import: capped style lists still multiplied, because the colour reader walks styled item -> presentation style
    assignment -> surface side style -> fill area style as nested loops (four lists of 64 = 16.7M steps per styled item;
    100 such items in a 71 kB file took 15 s). The pre-transfer check now sums the weighted expansion cost of all styled
    items (memoised per entity, linear in the file) and rejects more than 10000000 with limit_exceeded (KSTEP-I-010);
    real files cost 1-3 per styled item. The fill styles of FILL_AREA_STYLE and the properties of
    SURFACE_STYLE_RENDERING_WITH_PROPERTIES are capped at 64 as well. New constant
    StepImportLimits.MAX_STYLE_EXPANSION_WORK.
  • Import: an assembly "diamond" (each level using the same sub-assembly twice) has a small depth but 2^levels
    occurrences, and OCCT expanded it during the transfer before the Kotlin occurrence limit fired (28 levels, 56 kB: 69 s).
    The pre-transfer structure check now also counts the part occurrences after expansion on the usage graph and rejects
    more than 10000 (StepImportLimits.MAX_EXPANDED_OCCURRENCES, now also checked natively) with limit_exceeded
    (KSTEP-I-010) in well under a second.
  • kstep import runs the import in a worker subprocess (ADR-0038). Four audit rounds kept finding new loops inside OCCT
    (a self-overriding OVER_RIDING_STYLED_ITEM, deep override chains and MAPPED_ITEM chains or cycles ended the process
    with exit 132 and no output at all; override chains, MAPPED_ITEM diamonds and shells repeating one face ran into or
    past the 60 s bound). The command now starts a second JVM (same runtime and class path, -Xmx2g, no JVM crash banner)
    and only supervises it: a regular end (exit 0 or 1 with one complete report) is passed through unchanged; a timeout
    (60 s, can only be lowered via -Dkstep.import.timeoutMillis / KSTEP_IMPORT_TIMEOUT_MILLIS; the worker and its
    children are killed), an OutOfMemoryError or an output overflow become limit_exceeded (KSTEP-I-010), a crash or an
    incomplete report becomes read_failed (KSTEP-I-009), as text or --output json. With --output json stdout is
    always exactly one JSON document. The previous in-process watchdog (Runtime.halt) printed a JVM fatal-error banner on
    stdout when it ended a native call; it now only bounds an orphaned worker, silently. Cost: one extra JVM start per
    import (about 0.08 s, see ADR-0038). A 100000-deep override chain still crashes OCCT's reader before any pre-scan
    runs; it now ends as one read_failed document instead of a silent exit 132. Library callers of StepImporter / OcctKernel.readStep still run in-process without a time
    or memory bound, and kstep-mcp has no import tool.
  • Import: three more pre-transfer checks give the known worst cases a structured error in under a second (the worker is
    the guarantee, these are the fast path): OVER_RIDING_STYLED_ITEM chains deeper than 16 or cyclic, MAPPED_ITEM
    nesting deeper than 32 or cyclic and more than 10000 mapped-item expansions, and more than 250000 face references
    summed over all shells are rejected with limit_exceeded (KSTEP-I-010). New constants
    StepImportLimits.MAX_OVERRIDE_DEPTH and MAX_MAPPED_ITEM_EXPANSIONS.
  • Tests: a native handle-hygiene test compared the global shape counter exactly and failed once in a full build
    (the cleaner frees shapes of earlier tests asynchronously); it now allows a small growth. A test name was aligned
    with the CI skip guard's marker. The wall-clock bounds of the import limit tests were relaxed to 30 s for slower
    CI runners; the structured limit error is still asserted.

Notes

  • Not included: PMI (kstep import counts it and reports it as ignored, kstep export writes none); a pocket or hole
    from a face, draft and thickening (planned as Welle Q2); names for the inner wall of a shell and for edges of
    multi-body sketches; a persisted feature history (undo/redo lives in memory); booleans with several bodies; tangency
    at arc ends; contours touching each other; non-uniform scale; transparency, colours and layers on assembly
    instances, edge colours, face colours in the preview and imported colours in kstep import --render.
  • Platforms: the native bridges are built and tested on Linux x86-64 and macOS arm64 only. Windows and Intel Macs are
    not supported and not tested (the bridges report Unavailable there); the JVM-only zip has not been tried on Windows.
  • Interoperability: exports and imports are checked with OpenCascade-based readers only (OCCT's typed and XCAF readers,
    FreeCAD 1.1.4 on OCCT). FreeCAD's headless reader was used for geometry; colours were checked with kSTEP and OCCT.
    The multi-body STEP layout is verified on OCCT 7.9.3 and by the CLI round-trip test on the Linux CI. Other CAD/PLM
    systems and a lossless write-back round trip are unverified.
  • Import bounds: only the kstep import command runs the reader in a supervised worker process with a time and memory
    bound. Library callers of StepImporter / OcctKernel.readStep still run in-process without such a bound, and
    kstep-mcp has no import tool.
  • Gate (2026-10-24, macOS arm64, OCCT 7.9.3): clean check -Pkstep.occt.require=true -Pkstep.planegcs.require=true --no-build-cache, 2121 tests, 0 failures, 0 errors, 14 skipped (12 "native bridge unavailable" negative tests, two
    gltf-validator tests); release-style build without natives: verify-dist.sh green, import, sketch solving and
    geometry export report the bridge as unavailable, kstep mcp reports version 0.3.0.

Verify the download with the attached .sha256 file (sha256sum -c).