Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

11.4 KB
Raw Blame

Typed interfaces and reusable subassemblies

For common-axis placement and whole-component rotation, see Concept-directed coaxial mating.

For layout-first placement against authored Concept planes, see Concept-directed Fixed seating.

For reusing unchanged exact parts across builds, see incremental compilation sessions.

For readable placement, named FrameTransform composition, definition-owned ports, keyed occurrence patterns and Fixed Gap/Clocking seating, see the assembly authoring foundation.

Firmament assemblies have two independent structures: the product tree owns definition/occurrence identity, while the Interface graph owns mechanical relationships. Tree nesting never implies a Mate.

Executable assemblies can also export to OpenUSD, preserving nested hierarchy, shared display geometry, occurrence placement, and the accepted frame-based Fixed/Revolute/Prismatic contracts. STEP remains the engineering/manufacturing interchange output.

Concept<T> describes truths that make one semantic object valid. Interface<T> describes truths that make several objects valid together. Subassembly is a reusable, locally solved Assembly definition. Expose names the small public semantic contract visible to a parent.

Compiler-owned interface families

The Assembly profile admits this bounded matrix:

Interface Expansion Admitted motion Status
Interface<Fixed> FrameCoincident none qualified
Interface<Axial> AxisCoincident translation along and rotation about the axis qualified
Interface<Revolute> two semantic datum frames rotation about frame Z qualified for state-driven poses; legacy axis/seat form remains accepted
Interface<Prismatic> two semantic datum frames translation along frame Z qualified for state-driven poses
Interface<Custom> authored atomic Mate lines and bounded numeric Require checks explicitly authored qualified escape hatch
Interface<Gear> the existing Gear evaluator plus occurrence-space axis and center-distance evidence ideal ratio/sign metadata qualified for direct and exposed hierarchical Gear endpoints

These are compiler-owned families, not user-defined generics. Atomic assembly relations remain the existing AxisCoincident, AxisAligned, PlaneCoincident, PointCoincident, OffsetAlongAxis, and FrameCoincident kinds. A typed family expands into those relations before the ordinary Assembly compiler runs.

Prefer a reusable typed contract plus a named Mate application. For example, Interface<Fixed> Install { } declares the relationship requirements, and Mate BracketMount: Install { A: Machine.Frame.Mount; B: Machine.Bracket.Mount; } applies them inside an Assembly. The compiler supplies the family's roles and lowering; authors do not need to restate Role A requires ... or Lower .... Named Mate assignments use the declared role spelling, conventionally A and B. Compact inline applications also retain the historical a/b slot aliases; this does not case-fold user-defined role identities. Built-in options such as gap, clocking and orientation use camelCase; their historical PascalCase aliases remain admitted. Unknown fields and statements, duplicate assignments, invalid option units and unresolved roles reject with diagnostics.

Inline typed Interface applications shown below remain supported. Historical custom Role/Lower/Fit/Allow clauses now share structural AST admission and lower to the existing relationship IR. They are compatibility and specialist contract forms, not the introductory authoring style. Interface<Custom> remains the explicit atomic escape hatch; it does not replace the placement solver.

For Fixed, Revolute, and Prismatic, the preferred port is one Semantic value with a DatumFrame. A names the parent occurrence and B names the child. The two frame origins coincide at state zero; Z is the rotation or translation axis, and X fixes the angular reference. The compiler derives the zero transform directly. Revolute accepts angle state in degrees, Prismatic accepts position state in millimetres, and omitted state means zero. The compiled AssemblyIr.Joints and pure AssemblyKinematics.Evaluate(ir, state) expose the relationship, DOF, frames, and posed occurrence transforms. Changing state keeps part definitions and BReps shared. A cycle or multiple movable interfaces driving the same child is rejected.

Assembly Arm {
  <Assembly Arm>
    <Part Base = BasePart> Semantic Hinge { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; } </Part>
    <Part Link = LinkPart> Semantic Socket { DatumFrame Frame = [0,0,0] x [1,0,0] y [0,1,0] z [0,0,1]; } </Part>
  </Assembly>
  Anchor: Arm.Base.Hinge;
  Interface<Revolute> Shoulder { A: Arm.Base.Hinge; B: Arm.Link.Socket; }
}

The older Revolute axis/seat port continues to compile through the atomic relation path. It does not produce a state-driven joint because the axis/seat pair does not define a unique angular zero. For a deterministic movable interface, provide datum frames. Imported STEP part occurrences can declare these ports in Firmament; the STEP geometry need not contain mating metadata.

Interface<Revolute> ShaftBearing {
    A: Module.Shaft.Joint;
    B: Module.Bearing.Joint;
}

Interface<Custom> CarryLink {
    A: Register.Digit1.Input;
    B: Register.Digit0.Output;
    Mate AxisCoincident A.Axis B.Axis;
    Mate PlaneCoincident A.Seat B.Seat;
    Require PositiveClearance => 1mm > 0mm;
    Allow rotation:about-axis;
}

asm inspect reports the typed Interface, its endpoint paths, expanded atomic Mates, requirement status, shared definition counts, the hierarchical occurrence tree, and the source dependency hashes. JSON inspection retains the same data structurally.

Multi-file subassemblies

For organized, qualified dependencies, prefer Inventory Records. include remains compile-time semantic composition for concise shared declarations. Paths resolve relative to the including file and must remain under the repository source root (or, outside a checkout, the root document directory). Missing files and include cycles are typed errors. Duplicate Interface or Subassembly definitions in one include-composed module reject. Inventory members bind checked aliases to named exports without pooling imported definitions into that namespace.

Include "digit-module.firmament";

Subassembly Register {
    <Assembly Register>
        <Assembly Digit0 = DigitModule></Assembly>
        <Assembly Digit1 = DigitModule></Assembly>
    </Assembly>
    Anchor: Register.Digit0.Output;
    Expose {
        Semantic Input = Digit0.Input;
        Semantic Output = Digit1.Output;
    }
}

Every occurrence has a stable hierarchical path, while repeated occurrences share one solved semantic definition. Internal child occurrences and semantic values are private across a Subassembly boundary. Expose aliases an internal semantic value; it does not copy geometry or mutate the shared definition.

Semantic type survives hierarchy: Expose changes visibility, not type. A Gear endpoint therefore remains backed by the original Gear AIR—including family, teeth, module, pressure angle, pitch geometry, axis, and phase—while each occurrence contributes only its own placement and identity.

Subassembly DigitModule {
    <Assembly DigitModule><Part OutputGear = Wheel></Part></Assembly>
    Anchor: DigitModule.OutputGear;
    Expose { Gear Output = OutputGear; }
}

Interface<Gear> Transfer {
    A: Machine.RegisterA.Output;
    B: Machine.RegisterB.Input;
}

The parent cannot name OutputGear unless the child exposes it. The exposed alias does not restate gear parameters, and Interface<Gear> invokes the same compatibility evaluator used by a direct gear pair. Inspection reports both the public port path and the occurrence-qualified source path.

The executable example is fixtures/Canonical/AssemblyInterfaces/machine.firmament. It includes a Register definition, which includes a DigitModule definition; instantiates two Registers and four Digits; and connects the Registers only through Input and Output.

The hierarchical Gear flagship is fixtures/Canonical/AssemblyInterfaces/exposed-gear-port.firmament; the two-level form is nested-register-gear.firmament.

Subassembly composition never exports a child STEP and imports it into its parent. Included definitions form one semantic source graph, the existing Assembly compiler solves the whole tree, and the existing AP242 exporter lowers the resulting hierarchy once when every leaf has executable geometry.

A capped, closed SectionChain or bounded Loft<Hollow> can serve as a ruled assembly part from a separate authored .firmament file. Write <Part Shade = LoftFile<"lamp-shade-loft.firmament">> (or SectionChainFile for a directly authored chain); the path is relative to the assembly source. Both use the SectionChain materializer, and assembly imports its AP242 body into the ordinary product tree. Open shells are rejected as part definitions. The Cartesian lamp fixture exercises this path with a tilted ruled shade.

Legacy JSON .firmasm remains a compatibility/import lane. Canonical reusable semantic authoring uses .firmament; the compatibility format does not gain runtime inclusion or become the design authority.

Articulated definitions and finite clips

Reusable definitions preserve their solved zero frames and local joint graph. Each occurrence receives its own realized Mate identity and qualified name; geometry remains shared. Pose evaluation resolves both rigid ancestry and kinematic dependencies before a dependent joint reads a published port. Exposed ports retain the actual child occurrence rather than a frozen rest-frame copy. Fixed local relationships remain Fixed and do not make a route-bound assembly moving.

See shared datums and motion syntax and the executable articulated assembly and clip. AssemblyMotion.Evaluate(ir, name, seconds, preserveEndpoint) samples an admitted clip; AssemblyKinematics.Evaluate remains the direct realized-Mate-state API. A clip does not make arbitrary closed mechanical loops admissible.

Ordinary Placement keeps its exact frame dependency when its target moves. It uses the same occurrence evaluator as the mechanical joints, but does not create a physical Fixed joint in USD. An installation source mount on a reusable Subassembly must remain rigid within that unit; using an internally moving port as that mount rejects explicitly.

A reusable definition publishes a movable coordinate with expose { Mate Bend = Elbow; }. Its parent can target Unit.Bend.angle or Unit.Travel.translation, according to the actual Mate family. Wrappers can re-export nested public channels. Private local Mate names remain developer state-query names and do not bypass this Motion authoring boundary.