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.

/
    • Sketches and constraints
    • Features
    • Outputs, regions and published values
    • Configurations
    • Occurrences and mates
    • Patterns, mirrors and fasteners
    • Drawing views and annotations
    • Evaluate
    • Import and export
    • Scripting and sweeps
Docs>CAD>MCAD reference

Sketches and constraints

A sketch is 2D geometry on a plane or a planar face, solved from its constraints. Features use a sketch's closed loops as profiles (profile = sketch.outline), its open chains as paths, and its points as positions.

runmat 0.7
std 1

part link {
    input length : length = 60 mm
    input radius : length = 8 mm

    sketch s on origin.xy {
        bottom = line(start = [0 mm, -8 mm], end = [60 mm, -8 mm])
        right = arc(center = [60 mm, 0 mm], start = bottom.end, end = [60 mm, 8 mm])
        top = line(start = right.end, end = [0 mm, 8 mm])
        left = arc(center = [0 mm, 0 mm], start = top.end, end = bottom.start)
        hole = circle(center = left.center, radius = 3 mm)
        axis = line(start = left.center, end = right.center, construction)
        constrain fix(axis.start)
        constrain horizontal(axis)
        constrain length(axis) = input.length
        constrain tangent(bottom, right)
        constrain tangent(top, left)
        constrain parallel(bottom, top)
        constrain equal(right, left)
        constrain radius(right) = input.radius
        constrain diameter(hole) = 6 mm
    }
    feature body = extrude(profile = sketch.s, distance = 5 mm)
    output link = { body = feature.body.body }
}

Planes

sketch <name> on <plane> { … } places the sketch:

PlaneExample
An origin planeon origin.xy, on origin.yz, on origin.zx
A datum planeon plane.top_plane
A planar faceon feature.body.face.end

A sketch on a face moves with the face when an earlier feature changes.

Entities

EntityForm
Linel1 = line(start = [0 mm, 0 mm], end = [80 mm, 0 mm])
Arca1 = arc(center = [0 mm, 0 mm], start = [10 mm, 0 mm], end = [0 mm, 10 mm])
Circlec1 = circle(center = [40 mm, 25 mm], radius = 5 mm)
Splinelobe = spline(points = [[10 mm, 0 mm], [0 mm, 10 mm], [-10 mm, 0 mm]], closed)
Pointp1 = point(at = [3 mm, 4 mm])
  • A point is [x, y] with a unit on each coordinate, or [x, y] mm with one unit after the list.
  • Shared points. Writing another entity's point (start = bottom.end) makes the two the same point, so the loop stays closed as the solver moves it. Entity points are start, end and center; a point entity's position is p1.at.
  • Construction geometry. construction after an entity's arguments makes it a reference for constraints only; it never becomes part of a profile.
  • Sketch points are read elsewhere as sketch.<sketch>.<entity>.<point>, such as a hole at sketch.marks.p1.at.

Constraints

constrain <relation> states a relation the solver keeps. A dimensional constraint takes its value after =, and the value may be any expression (= input.length, = 2 * input.radius).

ConstraintForm
Fixconstrain fix(p1), constrain fix(l1.start)
Coincidentconstrain coincident(l1.end, l2.start)
Horizontal, verticalconstrain horizontal(l1), constrain vertical(l2)
Parallel, perpendicularconstrain parallel(l1, l3), constrain perpendicular(l1, l2)
Tangentconstrain tangent(l1, a1)
Equalconstrain equal(a1, a2)
Midpointconstrain midpoint(p1.at, l1): the point sits halfway along the line
Concentric, coradialconstrain concentric(c1, c2) (one center), constrain coradial(c1, a1) (one center and one radius)
Collinearconstrain collinear(l1, l5): both lines lie on one infinite line
Symmetricconstrain symmetric(l1.start, l2.end, axis): two points mirror each other in a line
Distanceconstrain distance(l1.start, l2.end) = 60 mm
Lengthconstrain length(l1) = 80 mm
Radius, diameterconstrain radius(c1) = 5 mm, constrain diameter(c1) = 10 mm
Angleconstrain angle(l1, l2) = 90 deg
Limitconstrain limit(length(l3, value = 80 mm), min = 60 mm, max = 90 mm): a dimension that may move between bounds

id = <name> names a constraint (constrain length(l1, id = span) = 80 mm), so a configuration or the editor can address it.

Solving

The check reports a sketch that is over-constrained (with the conflicting constraints), under-constrained (with the free directions), or has redundant constraints, and a profile that does not close (cad.sketch.open_profile). The editor writes the solver's last result in a solved { … } block inside the sketch, in SI units, so a file reopens without re-solving:

sketch s1 on origin.xy {
    l1 = line(start = [0 mm, 0 mm], end = [80 mm, 0 mm])
    c1 = circle(center = [40 mm, 25 mm], radius = 5 mm)
    constrain horizontal(l1)
    solved {
        l1.start = [0, 0]
        c1.radius = 0.005
    }
}

The solved block is a cache: editing the constraints re-solves the sketch and rewrites it.

On this page
  • Planes
  • Entities
  • Constraints
  • Solving