gmlewis/step/components/common does not have a README file

    Approximation

    pub(all) struct Approximation {
    feature : String
    kind : ApproximationKind
    deviation_mm : Double
    control : String
    }

    Approximation records one approximated feature with its stated deviation and the control that produced it, so a downstream consumer can decide whether the model is good enough for its purpose.

    Approximation::documentation

    fn Approximation::documentation(self : Approximation) -> String

    Approximation::documentation returns a one-line human-readable record.

    Approximation::new

    fn Approximation::new(feature~ : String, kind~ : ApproximationKind, deviation_mm~ : Double, control~ : String) -> Approximation

    Approximation::new builds an approximation record.

    ApproximationKind

    pub(all) enum ApproximationKind {
    PolylineArc
    PolygonRevolve
    SweptSpline
    EngineeringDefault
    }

    ApproximationKind classifies how a modelled feature departs from the ideal mathematical surface.

    The list is deliberately short and explicit: a feature is either modelled exactly (and listed in FeatureRecord::modeled), approximated by one of these documented schemes, or omitted with a reason. Labelling a sharp edge as a chamfer is not an option.

    ApproximationKind::to_string

    fn ApproximationKind::to_string(self : ApproximationKind) -> String

    ApproximationKind::to_string returns a stable machine-readable token.

    Component

    pub struct Component {
    // private fields
    }

    Component is a named, metadata-bearing collection of placed solid layers in a local millimetre frame.

    Components are immutable values: translate, rotate_x, and friends return a new component. nodes() materialises the layers as @cad.SceneNode values for a Design, preserving order and names.

    Component::add_layer

    fn Component::add_layer(self : Component, shape :
    Shape
    , name? : String, color? :
    Rgb
    , placement? : Placement) -> Component

    Component::add_layer appends one solid body. Layers are evaluated in the order they were added.

    Component::add_layers

    fn Component::add_layers(self : Component, layers : Array[ComponentLayer]) -> Component

    Component::add_layers appends every layer in layers.

    Component::bounding_box

    fn Component::bounding_box(self : Component) -> (Double, Double, Double, Double, Double, Double)

    Component::bounding_box returns the world-axis-aligned bounds of the materialised component in its local frame, as (x_min, x_max, y_min, y_max, z_min, z_max).

    Component::connector

    fn Component::connector(self : Component, name : String) -> Result[MateConnector, MateError]

    Component::connector looks up a connector by name.

    Component::connector_placed

    fn Component::connector_placed(self : Component, name : String, parent : Placement) -> Result[MateConnector, MateError]

    Component::connector_placed returns a connector transformed by parent, for snapping against a component that is already placed in an assembly.

    Component::connectors

    fn Component::connectors(self : Component) -> Array[MateConnector]

    Component::connectors returns a copy of the component's mate connectors.

    Component::description

    fn Component::description(self : Component) -> String

    Component::description returns the free-form component description.

    Component::documentation

    fn Component::documentation(self : Component) -> String

    Component::documentation returns the metadata plus any family description and the machine-readable feature record, suitable for a STEP header.

    Component::features

    fn Component::features(self : Component) -> FeatureRecord

    Component::features returns the machine-readable feature record.

    Component::layers

    fn Component::layers(self : Component) -> Array[ComponentLayer]

    Component::layers returns a copy of the component layers in local coordinates.

    Component::metadata

    fn Component::metadata(self : Component) -> Metadata

    Component::metadata returns the component metadata.

    Component::name

    fn Component::name(self : Component) -> String

    Component::name returns the component's canonical name.

    Component::new

    fn Component::new(name~ : String, metadata~ : Metadata, description? : String, features? : FeatureRecord) -> Component

    Component::new builds an empty component with a name and metadata.

    features is the machine-readable feature record. When omitted it is empty and documentation() states no modelled features.

    Component::nodes

    Component::nodes materialises the component in its own local frame.

    Component::nodes_under

    Component::nodes_under materialises the component with parent applied to every layer. This is the hook the assembly layer uses.

    Component::rebase_to_connector

    fn Component::rebase_to_connector(self : Component, name : String) -> Result[Component, MateError]

    Component::rebase_to_connector applies the inverse of a named connector's placement to every layer and every connector, making that connector frame the component origin.

    Only frames move. Layer geometry, volume, layer count, and shape identity are unchanged, as are the relative positions of all connectors.

    Component::rotate_x

    fn Component::rotate_x(self : Component, angle : Double) -> Component

    Component::rotate_x rotates the component about its local +X axis by angle degrees.

    Component::rotate_y

    fn Component::rotate_y(self : Component, angle : Double) -> Component

    Component::rotate_y rotates the component about its local +Y axis by angle degrees.

    Component::rotate_z

    fn Component::rotate_z(self : Component, angle : Double) -> Component

    Component::rotate_z rotates the component about its local +Z axis by angle degrees.

    Component::size

    fn Component::size(self : Component) -> (Double, Double, Double)

    Component::size returns the bounding-box extent (dx, dy, dz).

    Component::to_design

    fn Component::to_design(self : Component, name? : String, documentation? : String) ->
    Design

    Component::to_design materialises the component as a @cad.Design.

    Component::to_step

    fn Component::to_step(self : Component, checked? : Bool) -> String

    Component::to_step renders the component as flat STEP text.

    Component::transform_with

    fn Component::transform_with(self : Component, outer : Placement) -> Component

    Component::transform_with prepends outer to every layer placement.

    Component::translate

    fn Component::translate(self : Component, x? : Double, y? : Double, z? : Double) -> Component

    Component::translate moves the whole component by (x, y, z) millimetres in its parent frame.

    Component::with_connector

    fn Component::with_connector(self : Component, connector : MateConnector) -> Result[Component, MateError]

    Component::with_connector registers a named mate connector.

    The component is immutable; a successful call returns a copy with one more connector. Invalid connectors and duplicate names are rejected with a typed error. Registering a connector never changes layers, geometry, or metadata.

    Component::with_connector_unchecked

    fn Component::with_connector_unchecked(self : Component, connector : MateConnector) -> Component

    Component::with_connector_unchecked registers a connector that the caller has already constructed correctly.

    Component builders use this for their own documented metadata, where a failure means the builder itself is broken rather than the caller's parameters. Caller-supplied connectors should use with_connector.

    Component::with_connectors

    fn Component::with_connectors(self : Component, connectors : Array[MateConnector]) -> Result[Component, MateError]

    Component::with_connectors registers several connectors, rejecting the first invalid or duplicate name. Nothing is changed when any connector fails.

    Component::with_description

    fn Component::with_description(self : Component, description : String) -> Component

    Component::with_description returns a copy with a new description.

    Component::with_features

    fn Component::with_features(self : Component, features : FeatureRecord) -> Component

    Component::with_features returns a copy with a new feature record.

    Component::with_metadata

    fn Component::with_metadata(self : Component, metadata : Metadata) -> Component

    Component::with_metadata returns a copy with new metadata.

    Component::with_name

    fn Component::with_name(self : Component, name : String) -> Component

    Component::with_name returns a copy with a new name.

    Existing layer names are not rewritten; callers that need a fully consistent name should build the component under the final name.

    Component::write_step

    async fn Component::write_step(self : Component, out_path : String?, checked? : Bool) -> Unit

    Component::write_step writes the component as a STEP file. Pass checked=true to refuse designs with error diagnostics.

    ComponentLayer

    pub(all) struct ComponentLayer {
    shape :
    Shape

    name : String
    color :
    Rgb

    placement : Placement
    }

    ComponentLayer is one solid body of a component, expressed in the component's local frame.

    Many mechanically correct parts are naturally built from stacked bodies (for example a screw head with a blind socket is a socket ring over a floor disc). Keeping the layers explicit makes that construction visible instead of pretending a nominal boolean trimmed it.

    DetailLevel

    pub(all) enum DetailLevel {
    Simplified
    Detailed
    FullyModeled
    }

    DetailLevel selects how much mechanically relevant detail a component carries.

    The level is a request, not a promise: a family documents exactly which features exist at each level. In particular, Simplified must never be described as having real threads.

    DetailPolicy

    pub(all) struct DetailPolicy {
    level : DetailLevel
    threads : ThreadRepresentation
    segments_per_turn : Int
    circle_segments : Int
    include_small_features : Bool
    }

    DetailPolicy is the resolved interpretation of a DetailLevel for one component family.

    DetailPolicy::for_level

    fn DetailPolicy::for_level(level : DetailLevel) -> DetailPolicy

    DetailPolicy::for_level returns the default policy for a detail level.

    DetailPolicy::with_threads

    fn DetailPolicy::with_threads(self : DetailPolicy, threads : ThreadRepresentation) -> DetailPolicy

    DetailPolicy::with_threads overrides the thread representation while keeping the rest of the detail policy.

    FeatureRecord

    pub(all) struct FeatureRecord {
    modeled : Array[String]
    approximated : Array[Approximation]
    omitted : Array[Omission]
    tolerance_mm : Double
    }

    FeatureRecord is the machine-readable statement of which features a component models, approximates, or omits.

    It is carried on every Component, copied into the STEP header documentation, and asserted by tests. tolerance_mm is the component's stated geometric tolerance for the modelled representation as a whole.

    FeatureRecord::add_approximated

    fn FeatureRecord::add_approximated(self : FeatureRecord, approximation : Approximation) -> FeatureRecord

    FeatureRecord::add_approximated returns a copy with one more approximation.

    FeatureRecord::add_modeled

    fn FeatureRecord::add_modeled(self : FeatureRecord, feature : String) -> FeatureRecord

    FeatureRecord::add_modeled returns a copy with one more modelled feature.

    FeatureRecord::add_omitted

    fn FeatureRecord::add_omitted(self : FeatureRecord, omission : Omission) -> FeatureRecord

    FeatureRecord::add_omitted returns a copy with one more omission.

    FeatureRecord::documentation

    fn FeatureRecord::documentation(self : FeatureRecord) -> String

    FeatureRecord::documentation returns the multi-line STEP header block.

    FeatureRecord::empty

    FeatureRecord::empty returns a record that claims no modelled features and no approximations. Used as the default before a builder fills it in.

    FeatureRecord::has_approximated

    fn FeatureRecord::has_approximated(self : FeatureRecord, feature : String) -> Bool

    FeatureRecord::has_approximated reports whether feature is approximated.

    FeatureRecord::has_modeled

    fn FeatureRecord::has_modeled(self : FeatureRecord, feature : String) -> Bool

    FeatureRecord::has_modeled reports whether feature is in the modelled list.

    FeatureRecord::has_omitted

    fn FeatureRecord::has_omitted(self : FeatureRecord, feature : String) -> Bool

    FeatureRecord::has_omitted reports whether feature is in the omitted list.

    FeatureRecord::new

    fn FeatureRecord::new(modeled? : Array[String], approximated? : Array[Approximation], omitted? : Array[Omission], tolerance_mm? : Double) -> FeatureRecord

    FeatureRecord::new builds a feature record.

    FeatureRecord::omission_reason

    fn FeatureRecord::omission_reason(self : FeatureRecord, feature : String) -> String?

    FeatureRecord::omission_reason returns the documented reason a feature is omitted, or None when it is not omitted.

    FeatureRecord::with_approximated

    fn FeatureRecord::with_approximated(self : FeatureRecord, approximated : Array[Approximation]) -> FeatureRecord

    FeatureRecord::with_approximated returns a copy with the approximations.

    FeatureRecord::with_modeled

    fn FeatureRecord::with_modeled(self : FeatureRecord, modeled : Array[String]) -> FeatureRecord

    FeatureRecord::with_modeled returns a copy with the modelled feature list.

    FeatureRecord::with_omitted

    fn FeatureRecord::with_omitted(self : FeatureRecord, omitted : Array[Omission]) -> FeatureRecord

    FeatureRecord::with_omitted returns a copy with the omissions.

    FeatureRecord::with_tolerance

    fn FeatureRecord::with_tolerance(self : FeatureRecord, tolerance_mm : Double) -> FeatureRecord

    FeatureRecord::with_tolerance returns a copy with a new overall tolerance.

    MateAlignment

    pub(all) struct MateAlignment {
    placement : Placement
    axis : (Double, Double, Double)
    parent_connector : MateConnector
    child_connector : MateConnector
    fit :
    Fit

    insertion_anti_parallel : Bool
    axis_flipped : Bool
    } derive(Eq,
    Debug
    )

    MateAlignment is the resolved relationship of a mate pair.

    placement maps the child component's local frame into the parent's frame at the mated pose. axis is the joint/approach axis expressed in the child frame. axis_flipped records that resolve applied the interface's anti-parallel convention on top of the caller's flip_axis request, so the extra half-turn is never silent.

    MateAlignment::declared_clearance_mm

    fn MateAlignment::declared_clearance_mm(self : MateAlignment) -> Double

    MateAlignment::declared_clearance_mm returns the per-face clearance implied by the pair's declared fit. It is intent metadata, not a modelled offset.

    MateAlignment::equal

    MateAlignment::nominal_diameter_gap_mm

    fn MateAlignment::nominal_diameter_gap_mm(self : MateAlignment) -> Double

    MateAlignment::nominal_diameter_gap_mm returns the absolute difference of the two declared nominal diameters, or zero when either is unspecified.

    MateAlignment::not_equal

    fn MateAlignment::not_equal(x : MateAlignment, y : MateAlignment) -> Bool

    MateConnector

    pub(all) struct MateConnector {
    name : String
    placement : Placement
    axis : (Double, Double, Double)
    kind : MateKind
    gender : MateGender
    diameter_mm : Double?
    depth_mm : Double?
    fit :
    Fit

    description : String
    } derive(Eq,
    Debug
    )

    MateConnector is a named attachment frame (port) on one component.

    placement is a full rigid frame in the component-local frame, in millimetres and degrees. axis is an independent unit direction in the component-local frame: the approach, insertion, or joint axis. It defaults to +Z but is not required to be the placement's +Z; this matches the URDF MateConnector, whose origin (rpy) and axis are independent.

    Connector names are stable, unique within a component, and lower-case kebab-case by convention (shaft, bore, mount-front, bolt-hole-1).

    Connectors are metadata. Adding one never changes the component's exported STEP geometry, bounding box, layer count, or volume.

    MateConnector::documentation

    fn MateConnector::documentation(self : MateConnector) -> String

    MateConnector::documentation returns a one-line human-readable record.

    MateConnector::equal

    MateConnector::from_m_rad

    fn MateConnector::from_m_rad(name : String, xyz_m : (Double, Double, Double), rpy_rad : (Double, Double, Double), axis? : (Double, Double, Double), kind? : MateKind, gender? : MateGender, diameter_mm? : Double, depth_mm? : Double, fit? :
    Fit
    , description? : String) -> MateConnector

    MateConnector::from_m_rad builds a connector from URDF units: metres and radians. The connector stores millimetres and degrees internally.

    MateConnector::from_mm_deg

    fn MateConnector::from_mm_deg(name : String, x? : Double, y? : Double, z? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double, axis? : (Double, Double, Double), kind? : MateKind, gender? : MateGender, diameter_mm? : Double, depth_mm? : Double, fit? :
    Fit
    , description? : String) -> MateConnector

    MateConnector::from_mm_deg builds a connector from millimetre translations and degree rotations plus an optional component-local axis.

    MateConnector::new

    fn MateConnector::new(name : String, placement? : Placement, axis? : (Double, Double, Double), kind? : MateKind, gender? : MateGender, diameter_mm? : Double, depth_mm? : Double, fit? :
    Fit
    , description? : String) -> MateConnector

    MateConnector::new builds a connector, normalizing a usable axis.

    Structural problems (empty name, non-finite placement, zero axis, negative diameter) are reported by validate and by Component::with_connector; the constructor itself is total so it can be used to build test values.

    MateConnector::not_equal

    fn MateConnector::not_equal(x : MateConnector, y : MateConnector) -> Bool

    MateConnector::to_m_rad

    fn MateConnector::to_m_rad(self : MateConnector) -> ((Double, Double, Double), (Double, Double, Double))

    MateConnector::to_m_rad returns (xyz_m, rpy_rad) at the URDF boundary.

    MateConnector::transformed

    fn MateConnector::transformed(self : MateConnector, parent : Placement) -> MateConnector

    MateConnector::transformed composes parent into the connector frame and rotates its axis as a direction.

    Use this before snapping connectors that belong to components already placed in a common assembly frame.

    MateConnector::validate

    fn MateConnector::validate(self : MateConnector) -> Result[Unit, MateError]

    MateConnector::validate checks the structural invariants of one connector.

    It rejects empty or whitespace-bearing names, non-finite frames, zero or non-unit axes, negative diameter/depth, and a kind/gender combination that contradicts the interface (for example a CylindricalBore declared male).

    MateError

    pub(all) enum MateError {
    UnknownConnector(String)
    DuplicateConnector(String)
    InvalidConnector(String)
    } derive(Eq,
    Debug
    )

    MateError is the typed failure for connector lookup and validation.

    MateError::equal

    fn MateError::equal(MateError, MateError) -> Bool

    MateError::message

    fn MateError::message(self : MateError) -> String

    MateError::message returns a human-readable message.

    MateError::not_equal

    fn MateError::not_equal(x : MateError, y : MateError) -> Bool

    MateError::to_string

    fn MateError::to_string(self : MateError) -> String

    MateError::to_string is an alias for message.

    MateGender

    pub(all) enum MateGender {
    Neutral
    Male
    Female
    } derive(Eq,
    Debug
    )

    MateGender describes geometric engagement, not strength or load capacity.

    A male shaft engages a female bore. Neutral is correct for datum frames, plane faces, and slots that do not carry an insertion gender.

    MateGender::equal

    fn MateGender::equal(MateGender, MateGender) -> Bool

    MateGender::not_equal

    fn MateGender::not_equal(x : MateGender, y : MateGender) -> Bool

    MateGender::to_string

    fn MateGender::to_string(self : MateGender) -> String

    MateGender::to_string returns a stable lowercase token.

    MateKind

    pub(all) enum MateKind {
    PlaneFace
    CylindricalBore
    CylindricalShaft
    Threaded
    ProfileSlot
    Datum
    } derive(Eq,
    Debug
    )

    MateKind classifies the mechanical interface a MateConnector describes.

    The kind is CAD metadata. It never changes exported geometry: a connector is a named frame, not a solid feature.

    MateKind::equal

    fn MateKind::equal(MateKind, MateKind) -> Bool

    MateKind::not_equal

    fn MateKind::not_equal(x : MateKind, y : MateKind) -> Bool

    MateKind::requires_gender

    fn MateKind::requires_gender(self : MateKind) -> Bool

    MateKind::requires_gender reports whether the kind describes geometric engagement that should be declared male or female rather than neutral.

    MateKind::to_repr

    MateKind::to_string

    fn MateKind::to_string(self : MateKind) -> String

    MateKind::to_string returns a stable lowercase token.

    MatePair

    pub(all) struct MatePair {
    parent : String
    child : String
    offset_mm : Double
    twist_deg : Double
    flip_axis : Bool
    fit :
    Fit

    description : String
    } derive(Eq,
    Debug
    )

    MatePair is the relationship between two named connectors.

    It owns the parent connector name, the child connector name, the offset along the parent axis (millimetres), the twist about the parent axis (degrees), the axis-flip flag, and the declared fit. It does not duplicate either connector's frame: the frames live on the connectors.

    A pair is geometric. Kinematic kind, limits, dynamics, mimic, and transmission data stay in the URDF/CAD joint types.

    MatePair::equal

    fn MatePair::equal(MatePair, MatePair) -> Bool

    MatePair::new

    fn MatePair::new(parent~ : String, child~ : String, offset_mm? : Double, twist_deg? : Double, flip_axis? : Bool, fit? :
    Fit
    , description? : String) -> MatePair

    MatePair::new builds a relationship record. Defaults describe a nominal, unshifted, untwisted pair whose axes are not flipped.

    MatePair::not_equal

    fn MatePair::not_equal(x : MatePair, y : MatePair) -> Bool

    MatePair::resolve

    fn MatePair::resolve(self : MatePair, parent : MateConnector, child : MateConnector) -> Result[MateAlignment, MatePairError]

    MatePair::resolve validates the pair and snaps the child connector onto the parent connector.

    Unlike snap_connectors, this is interface-aware: it checks kind, gender, diameter, and fit, converts the pair's degree twist to radians, and enforces the anti-parallel insertion convention for shaft/bore and plane/plane interfaces. When that enforcement changes the returned axis it is recorded in MateAlignment::axis_flipped.

    MatePair::to_repr

    MatePair::validate

    fn MatePair::validate(self : MatePair, parent : MateConnector, child : MateConnector) -> Result[Unit, MatePairError]

    MatePair::validate checks that the supplied connector values match the pair and that their kinds, genders, diameters, and declared fits are compatible.

    MatePairError

    pub(all) enum MatePairError {
    MissingConnector(String)
    MissingInstance(String)
    ConnectorNameMismatch(String, String)
    IncompatibleKind(String, String)
    IncompatibleGender(String, String)
    DiameterMismatch(Double, Double)
    FitMismatch(String)
    InvalidConnector(String)
    InvalidPair(String)
    } derive(Eq,
    Debug
    )

    MatePairError is the typed failure for validating or resolving a mate pair.

    MatePairError::equal

    MatePairError::message

    fn MatePairError::message(self : MatePairError) -> String

    MatePairError::message returns a human-readable message.

    MatePairError::not_equal

    fn MatePairError::not_equal(x : MatePairError, y : MatePairError) -> Bool

    MatePairError::to_string

    fn MatePairError::to_string(self : MatePairError) -> String

    MatePairError::to_string is an alias for message.

    Metadata

    pub(all) struct Metadata {
    designation : String
    standard : String
    family : String
    size : String
    length_mm : Double?
    material : String?
    source : String
    }

    Metadata identifies a component instance and records where its dimensions came from.

    source is free-form but should name the standard, revision, and table (or manufacturer catalogue) used. It is copied into the generated STEP header documentation so a file never loses its provenance.

    Metadata::documentation

    fn Metadata::documentation(self : Metadata) -> String

    Metadata::documentation returns a multi-line provenance block for a STEP file header.

    Metadata::new

    fn Metadata::new(designation~ : String, standard? : String, family? : String, size? : String, length_mm? : Double, material? : String, source? : String) -> Metadata

    Metadata::new builds a metadata record. Empty fields are allowed; callers should fill everything they can verify.

    Metadata::summary

    fn Metadata::summary(self : Metadata) -> String

    Metadata::summary returns a one-line description used in component names and documentation.

    Metadata::with_material

    fn Metadata::with_material(self : Metadata, material : String) -> Metadata

    Metadata::with_material returns a copy with a material label.

    Omission

    pub(all) struct Omission {
    feature : String
    reason : String
    }

    Omission records a feature that is intentionally absent, with a reason.

    A simplified part is not a liar only when it says what it left out.

    Omission::documentation

    fn Omission::documentation(self : Omission) -> String

    Omission::documentation returns a one-line human-readable record.

    Omission::new

    fn Omission::new(feature~ : String, reason~ : String) -> Omission

    Omission::new builds an omission record.

    Placement

    pub(all) struct Placement {
    rot :
    Matrix3x3

    trans : (Double, Double, Double)
    } derive(Eq,
    Debug
    )

    Placement is a rigid transform (rotation about the origin, then translation) used to position a component layer or an assembly instance.

    The rotation convention matches the existing @cad DSL: angles are in degrees and the matrix is Rz * Ry * Rx, so a placement built here lands the same way as SceneNode::rotate_x/rotate_y/rotate_z.

    Placement::compose(outer, inner) applies inner first, then outer:

    compose(outer, inner).apply_point(p) == outer.apply_point(inner.apply_point(p))

    Placement::apply_dir

    fn Placement::apply_dir(self : Placement, v : (Double, Double, Double)) -> (Double, Double, Double)

    Placement::apply_dir maps a direction through the rotation only.

    Placement::apply_point

    fn Placement::apply_point(self : Placement, p : (Double, Double, Double)) -> (Double, Double, Double)

    Placement::apply_point maps a point through the rotation and translation.

    Placement::at

    fn Placement::at(x : Double, y : Double, z : Double, rx? : Double, ry? : Double, rz? : Double) -> Placement

    Placement::at builds a placement with a rotation followed by a translation.

    Placement::compose

    fn Placement::compose(outer : Placement, inner : Placement) -> Placement

    Placement::compose returns outer applied after inner.

    Placement::equal

    fn Placement::equal(Placement, Placement) -> Bool

    Placement::identity

    fn Placement::identity() -> Placement

    Placement::identity is the no-op placement.

    Placement::inverse

    fn Placement::inverse(self : Placement) -> Placement

    Placement::inverse returns the reverse rigid transform.

    Placement::not_equal

    fn Placement::not_equal(x : Placement, y : Placement) -> Bool

    Placement::rotation_axis_angle

    fn Placement::rotation_axis_angle(axis : (Double, Double, Double), angle_rad : Double) -> Placement

    Placement::rotation_axis_angle rotates about axis by angle_rad using Rodrigues' formula. A zero-length axis yields the identity rotation.

    This is the rotation used by the mate-snapping helper: MatePair twist is expressed about the parent connector axis, which is not generally one of the Euler axes. The matrix convention remains the Rz * Ry * Rx layout of Placement, so the result composes exactly like every other placement.

    Placement::rotation_deg

    fn Placement::rotation_deg(rx : Double, ry : Double, rz : Double) -> Placement

    Placement::rotation_deg rotates about X, then Y, then Z, in degrees.

    Placement::rotation_x

    fn Placement::rotation_x(angle_deg : Double) -> Placement

    Placement::rotation_x rotates about +X by angle_deg.

    Placement::rotation_y

    fn Placement::rotation_y(angle_deg : Double) -> Placement

    Placement::rotation_y rotates about +Y by angle_deg.

    Placement::rotation_z

    fn Placement::rotation_z(angle_deg : Double) -> Placement

    Placement::rotation_z rotates about +Z by angle_deg.

    Placement::to_euler

    fn Placement::to_euler(self : Placement) -> (Double, Double, Double)

    Placement::to_euler returns the rotation as (rx, ry, rz) degrees in the same convention as @cad scene nodes.

    Placement::translation

    fn Placement::translation(x : Double, y : Double, z : Double) -> Placement

    Placement::translation moves by (x, y, z) millimetres.

    SpecError

    pub(all) enum SpecError {
    InvalidSize(String)
    UnsupportedLength(String)
    InvalidDimension(String)
    InvalidParameter(String)
    }

    SpecError is the common validation failure type for component specifications.

    Constructors carry a human-readable message so callers can report the exact parameter that was rejected instead of guessing which check failed.

    SpecError::message

    fn SpecError::message(self : SpecError) -> String

    SpecError::to_string

    fn SpecError::to_string(self : SpecError) -> String

    ThreadRepresentation

    pub(all) enum ThreadRepresentation {
    None
    Cosmetic
    Helical
    }

    ThreadRepresentation states exactly how a component's threads are modeled.

    Keeping this explicit prevents a cosmetic cylinder from being mistaken for a real helical thread in a downstream BOM or drawing.

    chord_deviation

    fn chord_deviation(radius : Double, segments : Int) -> Double

    chord_deviation returns the maximum sag (chord) error of a circle of radius sampled into segments chords.

    It is r * (1 - cos(pi / segments)), the exact deviation used to justify a polyline approximation.

    dir_dot

    fn dir_dot(a : (Double, Double, Double), b : (Double, Double, Double)) -> Double

    dir_dot returns the dot product of two directions.

    expect_ok

    fn[T] expect_ok(r : Result[T, SpecError]) -> T

    expect_ok unwraps a validated specification, aborting with the validation message when it is invalid. Use this at the top of an executable where a bad command-line value should stop the program.

    fit_token

    fn fit_token(fit :
    Fit
    ) -> String

    fit_token returns the stable token for a declared fit.

    fits_compatible

    fn fits_compatible(parent_fit :
    Fit
    , child_fit :
    Fit
    , pair_fit :
    Fit
    ) -> Bool

    fits_compatible reports whether the pair's declared fit agrees with the connectors' declarations.

    When both connectors leave the fit at Nominal, the pair owns the intent and any value is allowed. Otherwise the pair's fit must match at least one explicitly declared connector fit.

    genders_compatible

    fn genders_compatible(parent : MateKind, parent_gender : MateGender, child : MateKind, child_gender : MateGender) -> Bool

    genders_compatible reports whether two genders can engage. Neutral mates with anything; plane faces and datums carry no gender requirement.

    interface_anti_parallel

    fn interface_anti_parallel(a : MateKind, b : MateKind) -> Bool

    interface_anti_parallel reports whether the assembled interface has anti-parallel axes: a shaft entering a bore, or two plane faces in contact with outward normals facing each other.

    is_finite

    fn is_finite(v : Double) -> Bool

    is_finite rejects NaN and infinities so a component cannot be built from a value that would corrupt the STEP geometry.

    is_mate_name_valid

    fn is_mate_name_valid(name : String) -> Bool

    is_mate_name_valid checks the documented connector naming convention without requiring a full parser: non-empty and free of whitespace.

    kinds_compatible

    fn kinds_compatible(parent : MateKind, child : MateKind) -> Bool

    kinds_compatible reports whether two interface kinds can mate. A Datum mates with anything because it makes no contact claim.

    length_mm

    fn length_mm(name : String, v :
    Length
    ) -> Result[Double, SpecError]

    expect_mm converts a Length to millimetres, rejecting non-finite values.

    near

    fn near(a : Double, b : Double, tol? : Double) -> Bool

    near compares two lengths with an absolute tolerance in millimetres.

    normalize_dir

    fn normalize_dir(v : (Double, Double, Double)) -> (Double, Double, Double)

    normalize_dir returns a unit direction, or the zero vector when v has no usable length.

    require_in_range

    fn require_in_range(name : String, v : Double, min : Double, max : Double) -> Result[Unit, SpecError]

    require_in_range validates a finite value inside an inclusive range.

    require_non_negative

    fn require_non_negative(name : String, v : Double) -> Result[Unit, SpecError]

    require_non_negative validates a finite dimension that may be zero.

    require_positive

    fn require_positive(name : String, v : Double) -> Result[Unit, SpecError]

    require_positive validates a strictly positive, finite dimension.

    rotation_matrix_deg

    fn rotation_matrix_deg(rx : Double, ry : Double, rz : Double) ->
    Matrix3x3

    rotation_matrix_deg builds the Rz * Ry * Rx rotation matrix used by the CAD scene graph.

    snap_connectors

    fn snap_connectors(parent : MateConnector, child : MateConnector, offset_mm? : Double, twist_rad? : Double, flip_axis? : Bool) -> (Placement, (Double, Double, Double))

    snap_connectors snaps a child connector frame onto a parent connector frame.

    It reproduces the sibling URDF snap_mates semantics: translate along the parent axis by offset_mm, rotate about the parent axis by twist_rad, then apply the inverse child frame. It returns the child-component placement at q = 0 and the joint axis expressed in the child frame.

    Both connectors must be expressed in the same parent frame. Call MateConnector::transformed(parent_placement) first for placed components.