cad

    Pluggable parametric CAD and URDF robotics component library in MoonBit

    cad
    step
    urdf
    robotics
    3d-modeling
    Download zip
    Author
    Version
    0.2.4
    License
    Apache-2.0
    Last updated
    16 hours ago
    Downloads
    4

    #gmlewis/cad (MoonBit)

    A pluggable parametric CAD and robotics component library for MoonBit.

    gmlewis/cad unites the exact B-Rep CAD kernel from gmlewis/step with the URDF kinematics and inertia model from gmlewis/urdf. One parametric Component tree compiles to a STEP assembly, a glTF scene, a Blender script, a URDF robot, or a complete ROS 2 package bundle.

    #Build a part in one command

    ./build-part.sh 02

    This writes build/02/ and produces a styled, self-contained build/02/START-HERE.html. Open that page; it has exactly three sections:

    1. the STEP files to 3D-print (in printable/, with material and infill),
    2. the shopping list (quantities, prices, and supplier links),
    3. the numbered assembly steps.

    Use ./build-part.sh 05 or ./build-part.sh 06 for the other maintained examples. Nothing is opened on your screen while the package is generated.

    To render any Markdown file nicely in your browser:

    ./view-md.sh README.md

    It uses pandoc and an embedded stylesheet, so the resulting .html is self-contained and easy to share. Install pandoc once with brew install pandoc if needed.

    #Architecture

    A Component is a reusable, parameterized mechanical or robotic module: a bracket, a bearing, a stepper motor, a planetary gearbox, a leg link, a wheel, or an entire robot. It contains:

    FieldPurpose
    parameters : Map[String, String]Self-documenting design parameters ("module": "3.0").
    bodies : Array[BodyPart]Rigid solids with CAD geometry, density, exact inertia, and collision primitives.
    mates : Map[String, @urdf.MateConnector]Named attachment frames other components snap onto.
    attachments : Array[Attachment]Child components plus the joint that connects them.
    part : PartMeta?Purchasing/manufacturing data (part number, supplier and URL, material, process, cost).
    ports : Array[Port]Typed electrical/mechanical interfaces (power, signal, bus, sensor).
    fasteners : Array[Fastener]Fastener schedule: thread, length, engagement, quantity, torque, references.
    fits : Array[Fit]Named fits with a nominal size and allowed min/max range.
    actuator : ActuatorSpec?Voltage, current, torque, driver, control interface, and encoder for a motor.
    sensor : SensorSpec?Kind, interface, supply, current draw, range, and resolution for a sensor.
    pcb : PcbSpec?Board outline, thickness, mounting holes, height limit, and connectors.
    wiring : Array[WireRun]Point-to-point cable runs with gauge, length, and endpoints.
    control : Array[ControlBinding]Joint → actuator/channel/pins, direction, gear ratio, soft limits, homing/limit inputs.
    cables : Array[CableRoute]Routed cable bundles: polyline, jacket diameter, carried wire runs, material.

    A BodyPart stores both representations of one solid: a @step_cad.SceneNode in millimeters/degrees and a @urdf.Inertial in meters/radians, so CAD and simulation never drift apart.

    Mates snap together through JointSpec:

    • JointSpec::merge_rigid() folds the child's bodies, collisions, and inertia directly into the parent link. No extra URDF <joint> is emitted, which is how a bolted bracket, stator, or coupler becomes one rigid body.
    • JointSpec::fixed(), revolute(limit), continuous(limit?), and prismatic(limit) emit a kinematic <joint>, rebase the child link onto its chosen mate, and optionally register a <transmission> or <mimic>.

    Component::attach_to(name, ...) attaches to a named component anywhere in the tree, so a load can be snapped onto a motor's nested rotor link.

    #Units and origins

    • CAD (@step_cad) lengths are millimeters; rotations are degrees (R = Rz * Ry * Rx).
    • URDF (@urdf) lengths are meters; angles are radians; inertia is in kg·m².
    • URDF Box and Cylinder geometry is centered on its frame. The centered_cuboid_node, centered_cylinder_node, centered_tube_node, and centered_extruded_profile_node bridges make the CAD primitives centered too, so local origin, center of mass, and URDF inertia always agree.

    #Compilers

    MethodResult
    comp.compile_links()CompiledLinks, @urdf.Joints, and @urdf.Transmissions.
    comp.to_robot()Complete @urdf.Robot with combined inertials and diagnostics.
    comp.to_urdf_bundle()ROS 2 bundle: urdf/<robot>.urdf, package.xml, per-link .gltf meshes, and printable .step parts.
    comp.to_design(joint_positions~)Posed @step_cad.Design solved through forward_kinematics.
    comp.to_step_file(), to_assembly_step(), to_gltf(), to_blender_python()Posed exports in the requested format.

    #Three-tier architecture

    • Tier 1 — gmlewis/step/components/* — low-level, parametrized STEP hardware primitives: ISO fasteners, bearings, shafts, spacers, T-slot extrusions, gears, and frames. Every primitive accepts detail~ : DetailLevel (Simplified, Detailed, FullyModeled) and an optional threads? : ThreadRepresentation (None, Cosmetic, Helical).
    • Tier 2 — gmlewis/cad/components — reusable robotic and mechatronic sub-assemblies that wrap Tier-1 primitives with named mates, URDF kinematics, analytical inertia, collision geometry, PartMeta, fastener schedules, fits, ports, actuator/sensor/PCB specs, wiring, and control bindings. Every builder accepts detail~ (and threads? for threaded hardware) and forwards it to Tier 1.
    • Tier 3 — examples/ — specialized, parameterized, printable, and simulatable end-to-end models. Every example accepts --detail and --threads and can emit STEP, glTF, URDF, a ROS 2 bundle, a manufacturing package, and standalone printable STEP parts.

    #Hardware components

    • components/hardware — ISO 4762/4017/4032/7089/DIN 976 wrappers, hex standoffs, spacers, bushings, ball bearings, T-slot extrusions and frames, compression springs, shaft couplers, flange plates, L/U brackets, and heat-set inserts. Each carries PartMeta so it can flow into a bill of materials and the printable-part export.
    • components/actuators — NEMA steppers, quasi-direct-drive BLDC actuator pods, hub-motor wheels, and the integrated low-KV planetary_bldc_actuator / bldc_actuator_pod. At Detailed/FullyModeled the low-KV outrunner adds rear ventilation louvres, three modeled phase leads and a connector stub, a bell flux ring, a keyed output shaft, and an AS5047P-class rotor encoder board with a 1 mm magnet gap. Example 02 builds the actuator with heat-set inserts in the 6 mm housing wall and a set-screw clamp collar between the output bearings.
    • components/gears — a parameterized herringbone planetary gearbox built from true involute swept B-Rep gears with mimic-coupled planets and carrier (a local port of moonbit-17-step/examples/38-planetary-gearbox), plus spur_gear_part and planetary_gearset_stage. The stage wraps the Tier-1 planetary_gear_set assembly and is what example 02 uses; sun, planet, ring, and carrier are individually printable. Tier-1 does not yet expose a herringbone gearbox component, only the involute planetary assembly.
    • components/motorized-gearbox — a compact multi-stage motorized planetary gearbox: each stage's internal ring gear is printed as part of that stage's outer casing module, the motor bolts to the casing's end cap, every later stage's sun rides directly on the previous carrier's output shaft, and the final carrier drives a flanged output shaft plus a 40 mm bolt-circle hub. Planet bearings default to flanged, sealed FR8-2RS bearings pressed into the planets from the lower face; the flange seats flush and prevents the bearing sliding through the gear. Example 01 builds a motorized wheel from it.
    • components/mobility — reusable box-tube struts, printable robot leg segments with bored proximal hubs, dual spars, lightening ribs, cable clips, and a distal motor cup, treaded wheels with a printed rim and chevron/lug TPU tread, 4-DOF quadruped legs, and a steerable suspension fork. Every quadruped leg joint is a real planetary_bldc_actuator: the actuator's motor rotor is the commanded joint, its printed carrier is the moving output, and the next link bolts to the carrier's output shaft. A reusable joystick_pod (2-axis Hall stick, E-stop, power button, printed housing) serves assistive vehicles. Whole robots live in examples/05 and examples/06.
    • components/grippers — a 1-DOF parallel-jaw gripper and a motorized, threaded lead-screw gripper (NEMA stepper, exposed screw/nut/rails, matched jaws, printable brackets, two limit switches, and a controller PCB).
    • components/sensors — micro limit switches, magnetic encoders, six-axis IMUs, camera modules, force sensors, printable sensor-mount brackets, and PCB envelopes with mounting holes and optional standoffs.
    • components/harness — polyline cable bundles with jacket diameter, carried wire runs, a length-based purchased part number, and jacket geometry.
    • components/kicad — KiCad .pos CSV import: board envelope with mounting holes, connector placements, and ports.

    #Low-KV BLDC and planetary actuators

    The component package now builds realistic, inexpensive robotic actuators from the Tier-1 STEP primitives:

    • bldc_preset / bldc_preset_names — 5010_360kv, 5008_335kv, 5208_180kv, 5065_270kv, and 6354_190kv outrunners with KV, pole pairs, voltage/current, shaft, bearing, mass, and price data.
    • bldc_torque_constant / bldc_rated_torque — Kt = 8.27 / KV N·m/A and the rated motor torque.
    • low_kv_bldc_motor — stator with endbell, stack, mounting flange, sensor boss, bearings, ventilation louvres, phase leads, and a rotor encoder board; out-runner bell, flux ring, a keyed shaft, and sensor magnet on a continuous <name>_rotor_joint. Phase resistance, thermal resistance, pole count, KV, and rated/peak current are carried as design parameters.
    • step_brushless_motor — the measured Tier-1 @step_motors.brushless_motor outrunner envelope adapted to the same two-link stator/rotor contract: the bell and shaft rotate on <name>_rotor_joint, the stator hub carries the mount face, and every preset is mapped proportionally. Example 02 uses it in both layouts; low_kv_bldc_motor remains the default for examples 05/06 and the legacy actuator path.
    • planetary_bldc_actuator — a low-KV motor driving a Tier-1 herringbone or exact-arc planetary stage (or two compounded stages), with a printed housing, a clamped sun input, 688 planet bearings on steel carrier pins, a two-bearing 608 output cartridge, an on-axis AS5047P output encoder, and mimic-linked gears. The output carrier is a true mimic joint; the output sensor supplies absolute joint feedback rather than a second command binding.
    • motorized_gearbox — the compact, arbitrary-stage alternative used by example 01. Stage ring gears are the casing; the default planet bearing is the flanged FR8-2RS; the motor's fixed side bolts to the casing; and the final carrier carries a standard output hub. Every stage parameter is independent, and the command input is the motor rotor joint.
    • bldc_actuator_pod — the preferred factory name for the integrated actuator; qdd_actuator_pod remains for compatibility.
    • planetary_gearset_stage — the exposed stage used by example 02's --motor exposed variant. It prints a ring outer housing by default (the exposed variant passes housing=false) and carries the overall reduction on its carrier joint.
    • planetary_wheel_drive_unit — a heavy 6354_190kv two-stage wheel drive for the wheelchair, and caster_fork_assembly for its front casters. The drive extends the carrier's real 8 mm output shaft past the printed cover; the wheel hub bore, a 608 hub bearing, and a set-screw clamp collar all match that shaft, so the wheel is a closed load path from motor to tyre with no synthetic axle frame.
    • joystick_pod — a reusable two-axis Hall stick with an E-stop and power button, a printable housing, and signal/estop/power/ground ports.

    Examples 01, 02, 05, and 06 use these modules. Example 02 uses the measured Tier-1 step_brushless_motor in both layouts and also accepts --motorexposed for the exposed-stage variant; example 01 uses the compact multi-stage motorized_gearbox; example 05 accepts --foot for a rubber-foot quadruped; example 06 accepts --layout scooter for the lighter single-fork vehicle.

    #Showcase examples

    Each example is a MoonBit executable under examples/. Run one by number or name:

    ./run-example.sh 01 --numStages 2 --headless ./run-example.sh 05-galileo-quadruped --bundle /tmp/galileo_bundle ./run-example.sh 06 --out scooter.step --urdf scooter.urdf

    Every example supports the shared output flags:

    • --detail simplified|detailed|fully-modeled — geometry detail.
    • --threads none|cosmetic|helical — thread representation override.
    • --print-parts <dir> — standalone 3D-printable STEP parts and print-list.csv, each part in its own local datum frame with purchased motors, screws, bearings, and PCBs excluded.
    • --posed-parts <dir> — world-posed per-link STEP files for exact interference analysis.
    • --collisions — conservative OBB/AABB collision and interference audit.
    • -o, --assembly, --gltf, --blender, --urdf, --bundle, --package, --bom, --control, --pins, and --check.

    ExampleDescription
    01_motorized_wheelCompact multi-stage planetary gearbox whose ring gears are the outer casing, with a 1/2" flanged-bearing planet set, a printed three-hole tire_mount, and a 40 mm output bolt circle, driving a purchased budrash 72-107 7-inch wheel. Stage parameters are comma-separated lists (--numStages 3 --numElbows 0,1,2).
    02-planetary-actuatorMeasured Tier-1 BLDC outrunner (@step_motors.brushless_motor) driving a print-in-place, four-elbow, four-planet Tier-1 planetary gearbox — housed with a twin-bearing output cartridge and the moteus C1 on-axis AS5047P sensor, or exposed as a bench/viewing stage.
    05-galileo-quadrupedWheeled quadruped with a V-slot chassis and four 4-DOF legs; every leg joint is a real low-KV BLDC planetary actuator driving the next printed link from its carrier output shaft. STEP, glTF, URDF, or full ROS 2 bundle.
    06-assistive-scooterMotorized wheelchair with two-stage planetary rear drives whose wheels bolt to the actuator output shafts, a V-slot frame, seat, armrests, a reusable joystick pod, and front casters (or a steerable fork). Rear and caster tyre bottoms share the z = 0 ground plane.

    Example 02 vendors and imports the exact moteus C1 r1.2 controller board (components/vendor/20240305-moteus-c1-r1_2.step) as its on-axis output sensor, © mjbots and the moteus contributors, under the Apache-2.0 license. See examples/02-planetary-actuator/README.md for the upstream link, sensor mounting, and attribution.

    The Galileo bundle contains urdf/galileo_quadruped.urdf, package.xml, glTF meshes, and the printable STEP parts:

    ./run-example.sh 05 -- --bundle /tmp/galileo_bundle python3 scripts/validate_urdf.py --check-meshes \ /tmp/galileo_bundle/urdf/galileo_quadruped.urdf

    #Bill of materials and assembly plan

    Every example accepts --bom <file.csv>, which rolls the component tree up into aggregated part lines (part number, description, quantity, supplier, supplier URL, material, process, finish, unit and total cost, notes). Components with their own part are counted as one purchased/assembled item and their bodies are not double-counted; attachments marked bom_external=false (such as a motor's rotor) stay internal, while bolted-on children are collected. Any body or fastener without PartMeta is reported in an UNASSIGNED row rather than silently dropped.

    --plan <file.txt> writes the ordered assembly plan derived from the same tree: each child subassembly is built before it is attached, fasteners are installed at the step that joins the components they reference, and every step names its tool (e.g. 2.5 mm hex key) and torque. --check prints warnings for inconsistent hardware data (engagement longer than the screw, invalid fits, duplicate names, missing part metadata); example 05 reports zero warnings.

    ./run-example.sh 05 --bom 05-bom.csv --plan 05-plan.txt

    #Power and IO budget

    --report <file.txt> writes the electrical budget derived from the tree: actuator ratings (voltage, rated/stall current, torque, driver, control interface, encoder), per-voltage totals and power, sensor supply/draw/interface, the full port map, the declared wire runs (endpoints, gauge, length), and the routed cable bundles (jacket diameter, path length, carried wires). Component::wiring_checks() verifies that every wire and route endpoint resolves to a declared component and port, that no wire connects a component to itself, and that each carried wire matches its route's components.

    ./run-example.sh 05 --report 05-report.txt

    Example 05 declares sixteen low-KV BLDC planetary leg joints on CAN, plus the chassis bus, battery, IMU, and depth camera. Example 06 declares left and right wheelchair drives, two caster swivels and wheels (or a steering fork), a joystick, IMU, camera, and controller PCB. Component::power_budget() returns the same data programmatically.

    #Control export

    --control <file.yaml> writes a ros2_control configuration with a joint-state broadcaster, a joint trajectory controller, and a hardware section mapping every bound joint to its actuator, CAN node or STEP/DIR channel, MCU pins, direction, gear ratio, soft limits, and homing/limit inputs. The same file lists the declared sensors and their interfaces. --pins <file.csv> writes the matching firmware pin map, and the build package's firmware.h carries the same bindings and sensor tables as C structs for MCU firmware. Component::control_checks() verifies that every commandable joint is bound and that every referenced joint, actuator, and input resolves.

    ./run-example.sh 05 --control 05-control.yaml --pins 05-pins.csv

    #Build package

    --package <dir> writes everything needed to source, fabricate, assemble, and test one example:

    FileContents
    README.mdManifest: part counts, cost, assembly steps, warnings, file list, validation commands.
    bom.csvAggregated bill of materials.
    sourcing.csvSuppliers, supplier links, quantities, and cost roll-up.
    print-list.csvFabricated parts with orientation, layer height, infill, supports, and process notes.
    fasteners.csvFastener schedule and torque table.
    assembly.txtOrdered steps, torque table, electrical checkout, and test sequence.
    report.txtPower, IO, and wiring budget.
    control.yaml, pins.csvros2_control configuration and firmware pin map.
    pcb-connectors.csvImported PCB connector placements (reference, value, footprint, position, side).
    link-parts.csvLink-to-part map used by the drawing generator.
    firmware.hC header: joint bindings, gear ratios, limits, pins, and sensors.
    assembly.stepPosed assembly STEP.
    bundle/URDF, package.xml, glTF meshes, and per-link STEP parts.

    ./run-example.sh 05 --package build/05 --check python3 scripts/validate_step.py --no-mesh build/05/assembly.step python3 scripts/validate_urdf.py --check-meshes build/05/bundle/urdf/*.urdf

    #Drawings

    scripts/make_drawings.py turns a package into formal A3 drawing sheets. For every fabricated link it exports front, top, right, and isometric DXF views with SolidCraft (near-orthographic cameras), composes an SVG sheet with a title block and print settings, converts it to PDF when Inkscape is available, and writes drawings/index.md. The raw DXF views are kept in drawings/dxf/.

    python3 scripts/make_drawings.py build/05 # drawings/index.md, <link>.svg, <link>.pdf, # drawings/dxf/<link>-{front,top,right,iso}.dxf

    #KiCad PCB import

    parse_kicad_pos() reads a KiCad position-file CSV and pcb_from_kicad() builds a board envelope with mounting holes, connector placements, ports, and mounting hardware. The build package then includes pcb-connectors.csv with each connector's reference, value, footprint, position, rotation, and side. The import is a library API used by a component builder; the placement layer is imported, and full STEP B-Rep geometry import remains future work.

    #Development

    ./test-all.sh

    test-all.sh runs moon fmt, moon info, and moon test -j 12 across the workspace. The unit tests cover primitive bridges, component composition, URDF compilation (including rigid merges), posed STEP export, bill-of-materials roll-up, assembly plans and hardware checks, power/IO budgets, cable-route length and wire checks, control export and joint-completeness checks, forward-kinematics pose smoke tests, build-package generation (sourcing, print list, torque table, manifest), KiCad placement import, every component builder at all detail levels, printable-part extraction, the sensor and harness components, the mimic-coupled gearbox, the real planetary-actuator quadruped legs, the driven wheelchair wheel, and the joystick pod. Drawing sheets are generated by scripts/make_drawings.py from a built package.

    Validation and rendering helpers live in scripts/ (they run from a clone of this repository alone; only the external tools named below are required):

    ./run-example.sh 05 --headless --validate # STEP + URDF checks ./run-example.sh 05 --headless --bundle build/05 --validate --validate-meshes python3 scripts/validate_step.py --no-mesh model.step python3 scripts/validate_urdf.py --check-meshes model.urdf python3 scripts/check_interferences.py --parts-dir posed/ # exact OCCT link interference ./run-example.sh 05 --headless --detail detailed --posed-parts posed/05 python3 scripts/render_step.py model.step preview.png # OCCT + Inkscape python3 scripts/render_solidcraft.py model.step preview-shaded.png # SolidCraft + Inkscape python3 scripts/make_drawings.py build/05 # SolidCraft (+ Inkscape for PDF) python3 scripts/validate_control.py control.yaml robot.urdf --pins pins.csv # PyYAML

    Agents must always pass --headless (or call solidcraft-cli directly) and must never use --view, open -a SolidCraft, or raise the SolidCraft window while validating.

    render_step.py uses OCCT DRAWEXE (plus sips or ImageMagick for PPM conversion). render_solidcraft.py uses solidcraft-cli snapshot for shaded views. Both composite four views into one PNG with Inkscape; without Inkscape they write the isometric view alone.

    #License

    Apache-2.0

    ActuatorKind

    pub(all) enum ActuatorKind {
    Stepper
    Bldc
    Servo
    Hub
    }

    The kind of actuator a component represents.

    ActuatorLine

    pub(all) struct ActuatorLine {
    path : String
    spec : ActuatorSpec
    }

    One actuator line in the power budget.

    ActuatorSpec

    pub(all) struct ActuatorSpec {
    kind : ActuatorKind
    model : String
    voltage_v : Double
    current_rated_a : Double
    current_stall_a : Double
    torque_rated_nm : Double
    driver : String
    interface : String
    encoder : String
    }

    Electrical and mechanical ratings for one actuator.

    ActuatorSpec::new

    fn ActuatorSpec::new(kind : ActuatorKind, model? : String, voltage_v? : Double, current_rated_a? : Double, current_stall_a? : Double, torque_rated_nm? : Double, driver? : String, interface? : String, encoder? : String) -> ActuatorSpec

    AssemblyStep

    pub(all) struct AssemblyStep {
    sequence : Int
    title : String
    component : String
    joint : String?
    fasteners : Array[String]
    tools : Array[String]
    notes : String
    }

    One step in a derived assembly plan: a fastener installation or a child attachment, numbered in the order the tree should be built.

    AssemblyStep::new

    fn AssemblyStep::new(sequence : Int, title : String, component~ : String, joint? : String?, fasteners? : Array[String], tools? : Array[String], notes? : String) -> AssemblyStep

    AssemblyStep::to_line

    fn AssemblyStep::to_line(self : AssemblyStep) -> String

    Renders one step as a single human-readable line.

    Attachment

    pub(all) struct Attachment {
    joint_name : String
    child : Component
    spec : JointSpec
    bom_external : Bool
    }

    A child component snapped onto one of its parent's mates.

    BodyPart

    pub(all) struct BodyPart {
    name : String
    node :
    SceneNode

    density :
    Density

    inertial :
    Inertial

    collisions : Array[
    Collision
    ]
    part : PartMeta?
    }

    A physical solid inside a component.

    A BodyPart carries the exact CAD solid (node, millimeters/degrees) and the matching URDF mass properties (inertial, meters/radians) so the same geometry feeds both the STEP exporter and the robot simulator. Collisions are cheap analytical primitives in the same local frame.

    BodyPart::box_mm

    fn BodyPart::box_mm(name : String, sx_mm : Double, sy_mm : Double, sz_mm : Double, density? :
    Density
    , color? :
    Rgb
    , x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> BodyPart

    Builds a rectangular box body from millimeter dimensions and a millimeter/degree pose.

    BodyPart::custom

    Builds a body from a pre-existing scene node and inertia.

    BodyPart::cylinder_mm

    fn BodyPart::cylinder_mm(name : String, diameter_mm : Double, length_mm : Double, density? :
    Density
    , color? :
    Rgb
    , x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> BodyPart

    Builds a solid cylinder body, axis along Z, centered on its own frame.

    BodyPart::extruded_profile_mm

    fn BodyPart::extruded_profile_mm(name : String, outer : Array[(Double, Double)], height_mm : Double, holes? : Array[Array[(Double, Double)]], density? :
    Density
    , color? :
    Rgb
    , x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> BodyPart

    Builds an extruded-profile body. Its mass comes from the true net profile area; its inertia and collision use the profile's bounding box.

    BodyPart::from_step_component

    fn BodyPart::from_step_component(step_comp :
    Component
    , density? :
    Density
    , part? : PartMeta?, x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> Array[BodyPart]

    Converts one STEP primitive component into CAD bodies.

    Each layer of the STEP component becomes a BodyPart in the local frame placed by the millimeter/degree offset. The first body receives part so a multi-layer primitive (a screw shank, head, and socket, or a bearing's rings and balls) counts once in the bill of materials.

    BodyPart::imported_step

    fn BodyPart::imported_step(name : String, step_text : String, source? : String, density? :
    Density
    , color? :
    Rgb
    , part? : PartMeta?, x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> BodyPart

    Imports an exact vendor STEP file as a purchased body.

    The imported B-Rep is emitted verbatim (rigidly placed by the body's transform) in the flat STEP output. The URDF, collision checks, and glTF fallback use the imported solid's bounding box, so the body has a real mass, a conservative collision primitive, and a box visual without re-tessellating the vendor geometry.

    BodyPart::transform_by

    fn BodyPart::transform_by(self : BodyPart, urdf_xform :
    Transform
    ) -> BodyPart

    Rigidly transforms a body (CAD node, inertia, and collision frames).

    BodyPart::tube_mm

    fn BodyPart::tube_mm(name : String, outer_diam_mm : Double, inner_diam_mm : Double, length_mm : Double, density? :
    Density
    , color? :
    Rgb
    , x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> BodyPart

    Builds a hollow tube body, axis along Z, centered on its own frame.

    BodyPart::with_part

    fn BodyPart::with_part(self : BodyPart, part : PartMeta) -> BodyPart

    Attaches purchasing/manufacturing metadata to this body.

    Bom

    pub(all) struct Bom {
    lines : Array[BomLine]
    unassigned : Int
    }

    A bill of materials: aggregated part lines and a count of bodies without part metadata (explicit placeholders).

    Bom::add

    fn Bom::add(self : Bom, part : PartMeta, quantity : Int) -> Unit

    Adds quantity of part, aggregating by part number.

    Bom::add_unassigned

    fn Bom::add_unassigned(self : Bom, quantity : Int) -> Unit

    Counts a body or fastener that has no PartMeta.

    Bom::new

    fn Bom::new() -> Bom

    Bom::to_csv

    fn Bom::to_csv(self : Bom) -> String

    Renders the bill of materials as CSV with a header and a final newline.

    Bom::total_cost_usd

    fn Bom::total_cost_usd(self : Bom) -> Double

    BomLine

    pub(all) struct BomLine {
    part_number : String
    description : String
    quantity : Int
    supplier : String
    supplier_url : String
    material : String
    process : String
    finish : String
    unit_cost_usd : Double
    total_cost_usd : Double
    notes : String
    }

    One aggregated bill-of-materials line.

    BuildFile

    pub(all) struct BuildFile {
    path : String
    content : String
    }

    One file in a generated build package.

    BuildFile::new

    fn BuildFile::new(path : String, content : String) -> BuildFile

    CableRoute

    pub(all) struct CableRoute {
    name : String
    points : Array[(Double, Double, Double)]
    jacket_diameter_mm : Double
    wire_names : Array[String]
    material : String
    from_component : String
    from_port : String
    to_component : String
    to_port : String
    }

    One routed cable bundle. Points are in the owning component's local frame, in millimetres.

    CableRoute::length_mm

    fn CableRoute::length_mm(self : CableRoute) -> Double

    Total routed length, in millimetres.

    CableRoute::new

    fn CableRoute::new(name : String, points? : Array[(Double, Double, Double)], jacket_diameter_mm? : Double, wire_names? : Array[String], material? : String, from_component? : String, from_port? : String, to_component? : String, to_port? : String) -> CableRoute

    pub(all) struct CompiledLink {
    name : String
    bodies : Array[BodyPart]
    urdf_link :
    Link

    }

    A URDF link plus the CAD bodies that produced it.

    Component

    pub(all) struct Component {
    name : String
    description : String
    parameters : Map[String, String]
    bodies : Array[BodyPart]
    mates : Map[String,
    MateConnector
    ]
    attachments : Array[Attachment]
    robot_name : String?
    part : PartMeta?
    ports : Array[Port]
    fasteners : Array[Fastener]
    fits : Array[Fit]
    actuator : ActuatorSpec?
    sensor : SensorSpec?
    pcb : PcbSpec?
    wiring : Array[WireRun]
    control : Array[ControlBinding]
    cables : Array[CableRoute]
    }

    A reusable, parameterized CAD + robotics building block.

    Bodies provide B-Rep geometry and mass properties; mates are named frames other components snap onto; attachments hold the child Component tree.

    Component::add_bodies

    fn Component::add_bodies(self : Component, bodies : Array[BodyPart]) -> Component

    Appends several bodies to this component.

    Component::add_body

    fn Component::add_body(self : Component, body : BodyPart) -> Component

    Appends a body to this component.

    Component::add_cable_route

    fn Component::add_cable_route(self : Component, route : CableRoute) -> Component

    Adds a routed cable bundle to this component.

    Component::add_control_binding

    fn Component::add_control_binding(self : Component, binding : ControlBinding) -> Component

    Adds a joint-to-actuator binding.

    Component::add_fastener

    fn Component::add_fastener(self : Component, fastener : Fastener) -> Component

    Adds a fastener schedule entry.

    Component::add_fit

    fn Component::add_fit(self : Component, fit : Fit) -> Component

    Adds an explicit fit record.

    Component::add_mate

    Registers a mate connector on this component.

    Component::add_mate_mm_deg

    fn Component::add_mate_mm_deg(self : Component, name : String, x? : Double, y? : Double, z? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double, axis? : (Double, Double, Double)) -> Component

    Registers a mate from millimeter/degree inputs.

    Component::add_port

    fn Component::add_port(self : Component, port : Port) -> Component

    Adds a typed interface port.

    Component::add_wire_run

    fn Component::add_wire_run(self : Component, run : WireRun) -> Component

    Adds a point-to-point cable run to this component's harness.

    Component::assembly_checks

    fn Component::assembly_checks(self : Component) -> Array[String]

    Checks the hardware data for problems that would make the assembly unbuildable: bad fastener lengths/engagement/torque, missing parts, invalid fits, and duplicate names. Returns one message per problem; an empty array means the data is consistent.

    Component::assembly_plan

    fn Component::assembly_plan(self : Component) -> Array[AssemblyStep]

    Builds the assembly plan by walking the tree depth first.

    A component's own (internal) fasteners are installed first, then each child is built and attached, so children are complete before they are installed. A fastener that references another component in the tree is installed with the attach step that joins those two components.

    Component::assembly_plan_text

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

    The assembly plan as one numbered line per step.

    Component::attach

    fn Component::attach(self : Component, joint_name : String, parent_mate~ : String, child : Component, child_mate? : String, spec? : JointSpec, bom_external? : Bool) -> Component

    Attaches a child component onto a parent mate.

    Component::attach_to

    fn Component::attach_to(self : Component, target_name : String, joint_name : String, parent_mate~ : String, child : Component, child_mate? : String, spec? : JointSpec, bom_external? : Bool) -> Component

    Attaches a child to a named component anywhere in this component's tree.

    The tree's attachment arrays are shared, so this lets an assembly builder reach a nested link (for example a motor's rotor) without rebuilding the intermediate components.

    Component::bom

    fn Component::bom(self : Component) -> Bom

    Builds the bill of materials for this component tree.

    A component with part is treated as a purchased/assembled item: its own bodies are represented by that part, while attachments marked bom_external (the default) are still collected. Internal attachments such as a motor's rotor are marked non-external and are not counted separately.

    Component::build_manifest

    fn Component::build_manifest(self : Component, name? : String) -> String

    The package manifest: part counts, cost, step count, warnings, and files.

    Component::build_package_files

    fn Component::build_package_files(self : Component, name? : String) -> Array[BuildFile]

    Every text file in the build package, ready to write into a directory.

    Component::build_procedure_text

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

    Assembly, torque, electrical-checkout, and test procedure.

    Component::cable_routes

    fn Component::cable_routes(self : Component) -> Array[CableRoute]

    All cable routes declared anywhere in this component tree.

    Component::collision_checks

    One-line summaries of unintended positive-volume overlaps only.

    Component::collision_report_text

    fn Component::collision_report_text(self : Component, joint_positions? : Map[String, Double], tol? :
    TolerancePolicy
    , policy? :
    ContactPolicy
    ) -> String

    A text report of every contact, interference, and collision pair.

    Component::collision_reports

    Classifies every pair of distinct link instances in the posed tree.

    Compiles this component tree into links, joints, and transmissions.

    Component::control_bindings

    fn Component::control_bindings(self : Component) -> Array[ControlBinding]

    All control bindings declared anywhere in this component tree.

    Component::control_checks

    fn Component::control_checks(self : Component) -> Array[String]

    Checks the control map against the compiled robot: unknown joints or actuators, unbound commandable joints, bad directions/gear ratios/limits, and homing or limit inputs that are not declared ports.

    Returns no warnings when the tree declares no bindings, so examples without a control map are not forced to provide one.

    Component::display_name

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

    Returns the name used for the exported robot and design: the explicit robot name when set, otherwise the root component name.

    Component::fastener_table_csv

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

    The fastener schedule with torque, one row per component entry.

    Component::firmware_header

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

    A C header for firmware: joint-to-actuator bindings and sensor interfaces.

    The tables are derived from ControlBindings and SensorSpecs in the tree.

    Component::format_documentation

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

    Formats the component's name, description, and sorted parameters for STEP headers.

    Component::from_step_component

    fn Component::from_step_component(name : String, step_comp :
    Component
    , density? :
    Density
    , part? : PartMeta?, connector_prefix? : String, include_connectors? : Bool, x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> Component

    Converts a STEP primitive component into a CAD Component.

    The component inherits the primitive's description, its metadata as design parameters, and its modeled-feature list.

    Component::from_step_layer

    fn Component::from_step_layer(name : String, step_comp :
    Component
    , layer_name : String, density? :
    Density
    , part? : PartMeta?, connector_prefix? : String, include_connectors? : Bool, apply_placement? : Bool, x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) -> Component

    Converts one named layer of a multi-layer STEP component into a CAD Component.

    This splits a composite primitive (the sun, planet, and ring layers of a Tier-1 planetary gearbox, or the rolling elements of a bearing) into independent kinematic and printable links while preserving each layer's exact geometry. Semantic mate connectors whose names begin with the layer name are propagated; the implicit "origin" mate always exists.

    Component::get_mate

    Looks up a mate connector by name.

    Component::harness_checks

    fn Component::harness_checks(self : Component) -> Array[String]

    Checks cable routes: valid geometry, known wire names, and wire runs that are long enough for the route they follow.

    Returns no warnings when the tree declares no routes.
    fn Component::link_design(self : Component, link_name : String) ->
    Design
    ?

    Returns a CAD design containing one link's bodies in its local frame.
    fn Component::link_parts_csv(self : Component) -> String

    Maps each exportable link (component) to the BOM part numbers of its bodies.

    Component::name_key_text

    fn Component::name_key_text(self : Component, name? : String) -> String

    Maps the CAD names used in the assembly steps to the part a builder picks up. Long names with a shared prefix are capped so the file stays readable.

    Component::new

    fn Component::new(name : String, description? : String) -> Component

    Creates an empty component with a default "origin" mate.

    Component::pcb_placements_csv

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

    KiCad/PCB placement map: one row per imported connector placement.

    Component::placed_shapes

    fn Component::placed_shapes(self : Component, joint_positions? : Map[String, Double]) -> Array[
    PlacedShape
    ]

    Every body in the posed component tree as a placed oriented bounding box.

    Bodies inside one link are treated as one rigid instance; merged fasteners and bearings are therefore not reported against their host. The OBB uses the body's exact local bounding box, which is conservative for curved profiles.

    Component::power_budget

    fn Component::power_budget(self : Component) -> PowerBudget

    Walks the tree and collects actuator, sensor, port, and wire data.

    Component::print_list_csv

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

    Manufactured (non-purchased) parts with print/cut settings.

    Component::printable_parts

    fn Component::printable_parts(self : Component) -> Array[PrintablePart]

    Collects standalone printable/fabricated designs from this component tree.

    A whole component marked fabricated is exported with all its bodies. A body-level part number collects every body sharing that number. Pre-order traversal and part-number de-duplication make each printable part appear once.

    Component::report_text

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

    The full power/IO/wiring report for this component tree.

    Component::sourcing_csv

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

    Sourcing lines derived from the BOM, including supplier links and cost.

    Component::start_here_text

    fn Component::start_here_text(self : Component, name? : String) -> String

    The one-page beginner guide shipped at the root of every build package.

    It answers exactly three questions in order: what to print, what to buy, and how to assemble it. The engineering manifest, CSVs, and bundle remain available for advanced users.

    Component::to_assembly_step

    fn Component::to_assembly_step(self : Component, joint_positions? : Map[String, Double]) -> String

    Exports the posed design as a hierarchical assembly STEP file.

    Component::to_blender_python

    fn Component::to_blender_python(self : Component, joint_positions? : Map[String, Double], segments? : Int) -> String

    Exports the posed design as a Blender 5.0 Python script.

    Component::to_bom_csv

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

    Convenience: the bill of materials as CSV.

    Component::to_design

    fn Component::to_design(self : Component, joint_positions? : Map[String, Double]) ->
    Design

    Produces a posed design with every link's bodies in world coordinates (millimeters and degrees) for the given joint positions.

    Component::to_gltf

    fn Component::to_gltf(self : Component, joint_positions? : Map[String, Double]) -> String

    Exports the posed design as a Z-up glTF 2.0 JSON document.

    Component::to_pin_map_csv

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

    Renders the firmware pin map as CSV: one row per binding.

    Component::to_robot

    fn Component::to_robot(self : Component, package_name? : String?) ->
    Robot

    Builds a complete URDF robot from the component tree.

    Component::to_ros2_control_yaml

    fn Component::to_ros2_control_yaml(self : Component, controller_name? : String, update_rate_hz? : Double) -> String

    Renders a ros2_control configuration mapping every declared binding.

    The controller manager exposes a joint-state broadcaster and a joint trajectory controller over the bound joints. The hardware section carries the actuator, channel, pins, direction, gear ratio, soft limits, homing and limit inputs for each joint, plus the sensor interfaces.

    Component::to_step_file

    fn Component::to_step_file(self : Component, joint_positions? : Map[String, Double]) -> String

    Exports the posed design as a flat STEP file.

    Component::to_urdf_bundle

    fn Component::to_urdf_bundle(self : Component, package_name? : String, include_step_parts? : Bool) ->
    UrdfBundle

    Builds a ROS 2 URDF bundle with per-link glTF meshes and printable STEP parts.

    Component::total_mass_kg

    fn Component::total_mass_kg(self : Component) -> Double

    Recursively sums the mass of every body in the component tree.

    Component::wiring_checks

    fn Component::wiring_checks(self : Component) -> Array[String]

    Connector mating checks: every wire and cable-route endpoint must resolve to a component and (when given) a port, and every wire carried by a route must actually connect that route's two components.

    Component::with_actuator

    fn Component::with_actuator(self : Component, actuator : ActuatorSpec) -> Component

    Sets the actuator ratings for this component.

    Component::with_cable_route

    fn Component::with_cable_route(self : Component, route : CableRoute) -> Component

    Sets the routed cable bundles for this component.

    Component::with_description

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

    Replaces the component description.

    Component::with_param

    fn Component::with_param(self : Component, key : String, value : String) -> Component

    Records a design parameter for documentation and STEP headers.

    Component::with_part

    fn Component::with_part(self : Component, part : PartMeta) -> Component

    Sets purchasing/manufacturing metadata for the whole component.

    Component::with_pcb

    fn Component::with_pcb(self : Component, pcb : PcbSpec) -> Component

    Sets the PCB envelope metadata for this component.

    Component::with_robot_name

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

    Sets the exported robot/design name independently of the root link name.

    Component::with_sensor

    fn Component::with_sensor(self : Component, sensor : SensorSpec) -> Component

    Sets the sensor characteristics for this component.
    fn Component::with_supplier_links(self : Component, links : Array[SupplierLink]) -> Component

    Applies purchasing-link overrides throughout this component tree. Existing values are kept when a link leaves a field empty.

    ConnectionKind

    pub(all) enum ConnectionKind {
    MergeRigid
    Fixed
    Revolute(
    JointLimit
    )
    Continuous(
    JointLimit
    ?)
    Prismatic(
    JointLimit
    )
    } derive(
    Debug
    )

    How an attached child component connects to its parent.

    ControlBinding

    pub(all) struct ControlBinding {
    joint : String
    actuator : String
    channel : String
    mcu_pins : String
    direction : String
    gear_ratio : Double
    soft_lower : Double?
    soft_upper : Double?
    homing_input : String?
    limit_input : String?
    }

    Maps one commandable robot joint onto an actuator, bus channel, and physical pins, with direction, gear ratio, soft limits, and homing/limit inputs.

    ControlBinding::new

    fn ControlBinding::new(joint : String, actuator? : String, channel? : String, mcu_pins? : String, direction? : String, gear_ratio? : Double, soft_lower? : Double?, soft_upper? : Double?, homing_input? : String?, limit_input? : String?) -> ControlBinding

    Fastener

    pub(all) struct Fastener {
    name : String
    kind : FastenerKind
    thread : String
    length_mm : Double
    engagement_mm : Double
    quantity : Int
    torque_nm : Double
    references : Array[String]
    part : PartMeta?
    }

    A fastener schedule entry: thread, length, quantity, torque, and the parts or mates it joins.

    Fastener::new

    fn Fastener::new(name : String, kind : FastenerKind, thread? : String, length_mm? : Double, engagement_mm? : Double, quantity? : Int, torque_nm? : Double, references? : Array[String], part? : PartMeta?) -> Fastener

    Fastener::with_part

    fn Fastener::with_part(self : Fastener, part : PartMeta) -> Fastener

    FastenerKind

    pub(all) enum FastenerKind {
    Bolt
    Screw
    Nut
    Washer
    Insert
    }

    The kind of hardware a fastener record describes.

    Fit

    pub(all) struct Fit {
    name : String
    fit_class : FitClass
    nominal_mm : Double
    min_mm : Double
    max_mm : Double
    }

    Fit::new

    fn Fit::new(name : String, fit_class : FitClass, nominal_mm? : Double, min_mm? : Double, max_mm? : Double) -> Fit

    FitClass

    pub(all) enum FitClass {
    Nominal
    Clearance
    Transition
    Interference
    }

    A fit record: nominal size plus the allowed range.

    JointSpec

    The kinematic parameters of an attachment plus the shared geometric mate pair.

    The pair owns the parent connector name, child connector name, offset, twist, flip, and fit. JointSpec keeps only what is kinematic: the joint kind, limits, dynamics, mimic, and transmission reduction.

    JointSpec::continuous

    fn JointSpec::continuous(limit? :
    JointLimit
    ?, offset_mm? : Double, angle_deg? : Double, flip_axis? : Bool, dynamics? :
    JointDynamics
    ?, mimic? :
    JointMimic
    ?, transmission_reduction? : Double?) -> JointSpec

    Creates a continuous joint with an optional limit.

    JointSpec::fixed

    fn JointSpec::fixed(offset_mm? : Double, angle_deg? : Double, flip_axis? : Bool) -> JointSpec

    Creates a fixed kinematic joint.

    JointSpec::merge_rigid

    fn JointSpec::merge_rigid(offset_mm? : Double, angle_deg? : Double, flip_axis? : Bool) -> JointSpec

    Folds the child's bodies directly into the parent link: no joint is emitted.

    JointSpec::prismatic

    fn JointSpec::prismatic(limit :
    JointLimit
    , offset_mm? : Double, angle_deg? : Double, flip_axis? : Bool, dynamics? :
    JointDynamics
    ?, mimic? :
    JointMimic
    ?, transmission_reduction? : Double?) -> JointSpec

    Creates a prismatic joint with the given limit.

    JointSpec::revolute

    fn JointSpec::revolute(limit :
    JointLimit
    , offset_mm? : Double, angle_deg? : Double, flip_axis? : Bool, dynamics? :
    JointDynamics
    ?, mimic? :
    JointMimic
    ?, transmission_reduction? : Double?) -> JointSpec

    Creates a revolute joint with the given limit.

    PartMeta

    pub(all) struct PartMeta {
    part_number : String
    description : String
    supplier : String
    supplier_url : String
    material : String
    process : String
    finish : String
    unit_cost_usd : Double
    notes : String
    }

    Purchasing and manufacturing metadata for one part.

    PartMeta::new

    fn PartMeta::new(part_number : String, description? : String, supplier? : String, supplier_url? : String, material? : String, process? : String, finish? : String, unit_cost_usd? : Double, notes? : String) -> PartMeta

    PartMeta::with_notes

    fn PartMeta::with_notes(self : PartMeta, notes : String) -> PartMeta

    PartMeta::with_supplier_url

    fn PartMeta::with_supplier_url(self : PartMeta, supplier_url : String) -> PartMeta

    PcbPlacement

    pub(all) struct PcbPlacement {
    reference : String
    value : String
    footprint : String
    x_mm : Double
    y_mm : Double
    rotation_deg : Double
    side : String
    }

    One component placement from a KiCad position file or equivalent.

    PcbPlacement::new

    fn PcbPlacement::new(reference? : String, value? : String, footprint? : String, x_mm? : Double, y_mm? : Double, rotation_deg? : Double, side? : String) -> PcbPlacement

    PcbSpec

    pub(all) struct PcbSpec {
    model : String
    length_mm : Double
    width_mm : Double
    thickness_mm : Double
    mounting_holes : Int
    mounting_hole_diam_mm : Double
    max_component_height_mm : Double
    connectors : Array[String]
    placements : Array[PcbPlacement]
    }

    A PCB envelope: outline, thickness, mounting holes, height limit, and the connectors that must be reachable.

    PcbSpec::new

    fn PcbSpec::new(model? : String, length_mm? : Double, width_mm? : Double, thickness_mm? : Double, mounting_holes? : Int, mounting_hole_diam_mm? : Double, max_component_height_mm? : Double, connectors? : Array[String], placements? : Array[PcbPlacement]) -> PcbSpec

    Port

    pub(all) struct Port {
    name : String
    kind : PortKind
    spec : String
    }

    Port::new

    fn Port::new(name : String, kind : PortKind, spec? : String) -> Port

    PortKind

    pub(all) enum PortKind {
    Mechanical
    Power
    Signal
    Bus
    Fluid
    Sensor
    Ground
    }

    A typed interface exposed by a component.

    PortLine

    pub(all) struct PortLine {
    path : String
    name : String
    kind : String
    spec : String
    }

    One port line in the IO map.

    PowerBudget

    pub(all) struct PowerBudget {
    actuators : Array[ActuatorLine]
    sensors : Array[SensorLine]
    ports : Array[PortLine]
    wires : Array[WireLine]
    routes : Array[RouteLine]
    }

    The electrical budget for a component tree.

    PowerBudget::new

    PowerBudget::to_text

    fn PowerBudget::to_text(self : PowerBudget) -> String

    Renders the power, IO, and wiring report.

    PrintablePart

    pub(all) struct PrintablePart {
    part_number : String
    component_name : String
    meta : PartMeta
    design :
    Design

    }

    A standalone fabricated/3D-printable part: its own design in its local datum frame, without purchased motors, fasteners, bearings, or PCBs.

    RouteLine

    pub(all) struct RouteLine {
    path : String
    route : CableRoute
    }

    One routed cable bundle in the harness report.

    SensorKind

    pub(all) enum SensorKind {
    LimitSwitch
    Encoder
    Imu
    Camera
    Force
    }

    The kind of sensor a component represents.

    SensorLine

    pub(all) struct SensorLine {
    path : String
    spec : SensorSpec
    }

    One sensor line in the power budget.

    SensorSpec

    pub(all) struct SensorSpec {
    kind : SensorKind
    model : String
    interface : String
    voltage_v : Double
    current_ma : Double
    range : String
    resolution : String
    }

    Electrical and measuring characteristics for one sensor.

    SensorSpec::new

    fn SensorSpec::new(kind : SensorKind, model? : String, interface? : String, voltage_v? : Double, current_ma? : Double, range? : String, resolution? : String) -> SensorSpec

    pub(all) struct SupplierLink {
    part_number : String
    supplier : String
    supplier_url : String
    notes : String
    unit_cost_usd : Double?
    }

    A per-part purchasing override, typically loaded from an example's supplier-links.txt. Empty fields keep the component's existing value.

    SupplierLink::new

    fn SupplierLink::new(part_number~ : String, supplier? : String, supplier_url? : String, notes? : String, unit_cost_usd? : Double) -> SupplierLink

    VisualMode

    pub(all) enum VisualMode {
    Primitives
    MeshPackage(String)
    }

    How a compiled link's visuals are represented.

    WireLine

    pub(all) struct WireLine {
    path : String
    run : WireRun
    }

    One wire line in the harness report.

    WireRun

    pub(all) struct WireRun {
    name : String
    from_component : String
    from_port : String
    to_component : String
    to_port : String
    gauge_awg : Int
    length_mm : Double
    notes : String
    }

    One point-to-point cable run.

    WireRun::new

    fn WireRun::new(name : String, from_component~ : String, from_port~ : String, to_component~ : String, to_port~ : String, gauge_awg? : Int, length_mm? : Double, notes? : String) -> WireRun

    centered_cuboid_node

    fn centered_cuboid_node(sx_mm : Double, sy_mm : Double, sz_mm : Double, name? : String, color? :
    Rgb
    ) ->
    SceneNode

    Builds a cuboid whose geometric center is at the origin.

    centered_cylinder_node

    fn centered_cylinder_node(diameter_mm : Double, length_mm : Double, name? : String, color? :
    Rgb
    ) ->
    SceneNode

    Builds a cylinder whose geometric center is at the origin, axis along Z.

    centered_extruded_profile_node

    fn centered_extruded_profile_node(outer : Array[(Double, Double)], height_mm : Double, holes? : Array[Array[(Double, Double)]], name? : String, color? :
    Rgb
    ) ->
    SceneNode

    Builds an extruded profile whose geometric center is at the origin along Z.

    centered_tube_node

    fn centered_tube_node(outer_diam_mm : Double, inner_diam_mm : Double, length_mm : Double, name? : String, color? :
    Rgb
    ) ->
    SceneNode

    Builds a hollow tube whose geometric center is at the origin, axis along Z.

    The walls are exact cylindrical surfaces (four-quarter-arc loops), not a faceted polygon.

    detail_level_name

    fn detail_level_name(level :
    DetailLevel
    ) -> String

    The canonical CLI name of a detail level.

    detail_level_with_threads

    The detail level implied by a thread override, if any.

    A Helical thread request implies FullyModeled; the other modes keep the caller's detail level.

    gltf_safe_design

    Makes every node in a design safe for glTF tessellation.

    gltf_safe_node

    Makes a scene node safe for the glTF tessellator.

    Revolved profiles (bearing balls, button and countersunk heads, chamfered shafts) become bounding cylinders, swept profiles (herringbone gear flanks) and any remaining analytic shape the tessellator cannot handle become bounding boxes, and booleans are rebuilt from their converted children. Shapes that compile to planes, cylinders, and linear extrusions pass through unchanged, so the STEP output always keeps its exact analytic B-Rep.

    is_fabricated_part

    fn is_fabricated_part(meta : PartMeta) -> Bool

    Returns true when a part is fabricated in-house rather than purchased.

    parse_detail_level

    fn parse_detail_level(text : String) ->
    DetailLevel
    ?

    Parses a detail-level option.

    Accepts "simplified", "detailed", "fully-modeled", "fully_modeled", and "full"; returns None for anything else.

    parse_double_list

    fn parse_double_list(text : String, count : Int, label : String) -> Result[Array[Double], String]

    Parses a comma-separated double list and extends it to count entries by repeating the last value.

    Returns Err for an empty list or a malformed number. label is the CLI option name without the leading -- (for example "module").

    parse_int_list

    fn parse_int_list(text : String, count : Int, label : String) -> Result[Array[Int], String]

    Parses a comma-separated integer list and extends it to count entries by repeating the last value.

    parse_string_list

    fn parse_string_list(text : String, count : Int, label : String) -> Result[Array[String], String]

    Parses a comma-separated string list and extends it to count entries by repeating the last value.
    fn parse_supplier_links(text : String) -> Array[SupplierLink]

    Parses a pipe-separated supplier-link file.

    Format: part_number | supplier | supplier_url | notes | unit_cost_usd. Blank lines and lines starting with # are ignored, as are lines with fewer than three fields. An unparsable cost becomes None.

    parse_thread_rep

    Parses a thread-representation option.

    Accepts "none", "cosmetic", and "helical"; returns None for anything else.

    rgb_to_rgba

    fn rgb_to_rgba(c :
    Rgb
    , a? : Double) ->
    Rgba

    Converts a CAD RGB color to a URDF RGBA color with an optional alpha.

    rgba_to_rgb

    Converts a URDF RGBA color to a CAD RGB color, dropping alpha.

    sanitize_part_number

    fn sanitize_part_number(part_number : String) -> String

    Makes a part number safe for use as a file name.

    step_component_layer_names

    fn step_component_layer_names(step_comp :
    Component
    ) -> Array[String]

    The names of a multi-layer STEP component's layers, in model order.

    step_to_urdf_matrix

    Converts a CAD rotation matrix to a URDF rotation matrix.

    step_to_urdf_transform

    Converts a CAD transform (millimeters) to a URDF transform (meters).

    thread_rep_name

    The canonical CLI name of a thread representation.

    transform_scene_node

    Applies a CAD transform (millimeters, degrees) to a scene node by composing it with the node's own placement and re-deriving translation and extrinsic Euler angles.

    transform_scene_node_urdf

    Applies a URDF transform (meters) to a scene node.

    urdf_to_step_matrix

    Converts a URDF rotation matrix (radians) to a CAD rotation matrix (degrees are only applied when a transform is converted; the matrix itself is identical).

    urdf_to_step_transform

    Converts a URDF transform (meters) to a CAD transform (millimeters).

    urdf_transform_from_mm_deg

    fn urdf_transform_from_mm_deg(x_mm? : Double, y_mm? : Double, z_mm? : Double, rx_deg? : Double, ry_deg? : Double, rz_deg? : Double) ->
    Transform

    Builds a URDF transform from a millimeter/degree origin.