RunMat
  • Pricing
RunMat
GitHub
GitHub
Sign inTry in browser
DesktopRuntimePhysicsCADAdministrationAgent

Get RunMat updates

New releases, guides and examples.

Product+
  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download
Math+
  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting
Physics+
  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA
Industries+
  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance
Learn+
  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students
Compare+
  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons
Company+
  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms

Product

  • Runtime
  • GPU
  • Parallel
  • Compile
  • Interop and MEX
  • Simulation
  • MCAD
  • ECAD
  • Enterprise
  • AI integrations
  • Pricing
  • Download

Math

  • Signal processing
  • Linear algebra
  • Statistics
  • Curve fitting
  • Differential equations
  • Control systems
  • Optimization
  • Finance
  • Data and tables
  • Plotting

Physics

  • Simulation overview
  • Structural
  • Thermal
  • Electromagnetic
  • Joule heating
  • Thermal stress
  • Acoustics
  • Fluid flow
  • Conjugate heat transfer
  • Fluid–structure
  • What is FEA

Industries

  • Aerospace
  • Automotive and transportation
  • Defense
  • Electronics and semiconductors
  • Energy
  • Industrial machinery
  • Life sciences
  • Quantitative finance

Learn

  • Guides
  • Docs
  • Function reference
  • Language reference
  • Migration guide
  • Changelog
  • MATLAB Online
  • MATLAB AI agent
  • For students

Compare

  • RunMat vs MATLAB
  • RunMat vs Ansys
  • RunMat vs SOLIDWORKS
  • RunMat vs Altium
  • RunMat vs Cadence
  • RunMat vs COMSOL
  • RunMat vs Python
  • RunMat vs Julia
  • RunMat vs Physics AI
  • RunMat vs Octave
  • Benchmarks
  • MATLAB alternatives
  • All comparisons

Company

  • About
  • Blog
  • Contact
  • Source code↗
  • License
  • Privacy
  • Terms
GitHubXLinkedIn

© Dystr, Inc. · RunMat v0.7.1, Nov 17, 2026

RunMat® is a registered trademark of Dystr, Inc. MATLAB® is a registered trademark of The MathWorks, Inc. RunMat is not affiliated with, endorsed by, or sponsored by The MathWorks, Inc.

/
    • Model a part
    • Build an assembly
    • Make a drawing
    • Sheet metal
    • Product families and configurations
Docs>CAD>MCAD guides

Build an assembly

This guide builds a small rotary stage: a base plate, a turntable that turns on a revolute mate, and four standoffs repeated by a pattern. It shows how an assembly finds its parts, places them, joins the moving ones and checks the result.

1. The parts

An assembly places parts by their names. Parts in the same folder need no import, and a +<package>/ folder above the assembly holds parts many assemblies share. This page's three parts sit beside the assembly:

runmat 0.7
std 1

part base {
    sketch s on origin.xy {
        l1 = line(start = [0 mm, 0 mm], end = [100 mm, 0 mm])
        l2 = line(start = [100 mm, 0 mm], end = [100 mm, 100 mm])
        l3 = line(start = [100 mm, 100 mm], end = [0 mm, 100 mm])
        l4 = line(start = [0 mm, 100 mm], end = [0 mm, 0 mm])
    }
    feature body = extrude(profile = sketch.s, distance = 8 mm)
    output base = { body = feature.body.body, part_number = "RS-BASE", material = "material.aluminum_6061" }
}
runmat 0.7
std 1

part turntable {
    input radius : length = 35 mm
    sketch s on origin.xy {
        c = circle(center = [0 mm, 0 mm], radius = input.radius)
    }
    feature body = extrude(profile = sketch.s, distance = 6 mm)
    output turntable = { body = feature.body.body, part_number = "RS-TT", material = "material.aluminum_6061" }
}
runmat 0.7
std 1

part standoff {
    input height : length = 12 mm
    sketch s on origin.xy {
        c = circle(center = [0 mm, 0 mm], radius = 3 mm)
    }
    feature body = extrude(profile = sketch.s, distance = input.height)
    output standoff = { body = feature.body.body, part_number = "SO-M3", material = "material.steel_304" }
}

2. Place the parts

use part <design> as <occurrence> places a design. The occurrence's block sets where it goes and how it is configured. An occurrence is fixed at its placement unless it says fixed = false, which makes the placement a starting pose that mates move.

runmat 0.7
std 1

assembly stage {
    input angle : angle = 0 deg

    use part base as base
    use part turntable as table {
        fixed = false
        configuration = { select = inputs, values = { radius = 40 mm } }
        placement = { placement = offset, offset = { translation = [50 mm, 50 mm, 8 mm] } }
    }
    use part standoff as post {
        placement = { placement = offset, offset = { translation = [10 mm, 10 mm, 8 mm] } }
    }

    connector axis = { occurrence = [{ name = base }], anchor = { anchor = explicit, offset = { translation = [50 mm, 50 mm, 8 mm] } } }
    connector hub = { occurrence = [{ name = table }], anchor = { anchor = origin } }
    mate spin = { kind = { mate = revolute, angle = { target = exact, value = input.angle } }, a = axis, b = hub }

    pattern posts = grid(seeds = [post], first = [1, 0, 0], first_spacing = 80 mm, first_count = 2, second = [0, 1, 0], second_spacing = 80 mm, second_count = 2)

    part_number = "RS-100"
}
  • configuration = { select = inputs, values = { radius = 40 mm } } sets this occurrence's radius. The same turntable.part can serve another stage at its default 35 mm.
  • placement = offset puts the occurrence at a translation and an optional rotation in the assembly's axes.

3. Join the moving parts

A connector is a frame on an occurrence; its Z axis is the joint axis. A mate joins two connectors and leaves some motion free. revolute leaves rotation about Z, so the turntable spins about the axis at the base's center.

The mate's angle drives that rotation from the assembly's angle input. Set the input in Properties, or in a run, and the turntable turns. A range in place of an exact value ({ target = range, min = 0 deg, max = 270 deg }) limits the motion, and the solve reports cad.asm.limit_active when the turntable rests on a limit.

In the Desktop, Mate takes two faces picked on the model and a mate type. The preview shows where the floating occurrence goes, and confirming moves it there. Here a concentric mate puts a hinge pin in its bore:

In an assembly, Mate set to Concentric takes the floating hinge pin's side and the hinge mount's pin bore; the preview ghosts the pin in the bore, and the pin moves there, flush with both lugs.

The solve reports an occurrence that still moves freely (cad.asm.under_defined) and mates that contradict each other (cad.asm.mate_conflict). See Occurrences and mates for every mate kind, including gear, rack-and-pinion, screw and pin-in-slot mates.

4. Repeat parts

pattern posts = grid(…) copies the standoff into a 2 × 2 grid 80 mm apart. Each copy has a key that later statements name it by, and skip leaves copies out. A follow_pattern places one copy per hole of a hole pattern a part publishes, so fasteners stay on their holes as the part changes. See Patterns, mirrors and fasteners.

5. Check the assembly

Evaluate measures the assembly in its current pose:

  • Interference lists pairs of occurrences whose solids overlap, with the overlap volume.
  • Clearance lists pairs closer than a gap you set, such as 0.5 mm between the turntable and the standoffs.
  • Mass properties adds every part at its placement: total mass, center of gravity and inertia.

The bill of materials lists each part number with its quantity: one base, one turntable and four standoffs. A drawing places the same list as a BOM table with balloons. See Evaluate.

Next

  • Make a drawing of the assembly with its BOM.
  • Scripting and sweeps runs the stage at many angles from a .m script.
On this page
  • 1. The parts
  • 2. Place the parts
  • 3. Join the moving parts
  • 4. Repeat parts
  • 5. Check the assembly
  • Next