tscad GitHub

Element reference

Every lowercase JSX element tscad understands, generated from the type definitions: the same text your editor shows on hover. Lengths in mm, angles in degrees.

#Shared props

Placement (3D)

Where a solid goes. Applied in this order: mirror, scale, rotate (+ rotateX/Y/Z), then the translation (at + x/y/z). Available on every solid-producing element.

PropTypeDescription
xnumberMove along X, mm (added to at).
ynumberMove along Y, mm (added to at).
znumberMove along Z, mm (added to at).
atVec3Move by [x, y, z], mm.
rotateVec3Rotate [rx, ry, rz] degrees about the fixed X, then Y, then Z axes (OpenSCAD's rotate([rx, ry, rz])), about the origin, before translating.
rotateXnumberRotate about X, degrees (added to rotate[0]).
rotateYnumberRotate about Y, degrees (added to rotate[1]).
rotateZnumberRotate about Z, degrees (added to rotate[2]).
scalenumberUniform scale factor about the origin.
mirrorAxisMirror across the plane through the origin square to this axis ("x" negates X).
namestringA name other elements can refer to (".plate", ".bolt > .shank"): <subtract from tool>, <union of>, <intersect of>, <fillet target>, <chamfer target>, <shell target>, <draft target>. Refs resolve within the enclosing <part>. Component calls take name too.
ghostbooleanA tool for refs only: left out of the output unless a ref op uses it up (<subtract tool>, <union of>), with a warning when nothing does. Component calls take it too.

Placement (2D)

Where a 2D shape goes in its sketch: mirror, then rotate, then translate.

PropTypeDescription
xnumberMove along sketch X, mm.
ynumberMove along sketch Y, mm.
atVec2Move by [x, y], mm (added to x/y).
rotatenumberRotate CCW about the sketch origin, degrees (before translating).
mirror"x" | "y"Mirror: "x" negates sketch X, "y" negates sketch Y.
znumberInside <loft>: the height of this section, mm.

#Containers

Parts, assemblies and groups: the structure of a model.

<assembly>

A collection of parts (may nest); placement props move every part in it.

PropTypeDescription
allowFreebooleanDon't warn about parts their mates leave free to move.
strictbooleanMates must fix every part (free parts are errors) and redundant mates are reported.
fixedbooleanAs a sub-assembly: ground it in the parent assembly's mates.
namestringAssembly name (used as a prefix for loose solids' part name).

Also takes placement props, solid children.

<part>

One named, coloured solid: the unit of export. Several children are unioned.

PropTypeDescription
namestringPart name: unique within the model; used for meshes, STEP entities and export files.
colorstringDisplay colour, any CSS colour (default: from material).
materialMaterialName | (string & {})Material preset ("pla", "petg", "abs", "aluminum", "steel", "brass", "wood"...), giving a default colour and density. See materials.
densitynumberDensity in g/cm³ for mass estimates (default: from material).
visiblebooleanfalse leaves the part out of the document (and exports); default true.
fixedbooleanGround this part for <mate>s: it never moves (default: the first part is grounded).

Also takes placement props, solid children.

<group>

Groups solids (unioned) so they can be placed together.

Also takes placement props, solid children.

<drawing>

A flat 2D part (laser / CNC): exports to DXF/SVG; thickness also makes it a 3D part.

A flat 2D part for laser cutting / CNC: its 2D shapes compile straight to loops (no kernel) and export to DXF/SVG with tscad/drawing. Give it a thickness to also get a 3D part (the sheet, extruded up from z = 0) for the viewer and STEP/STL.
<drawing name="gasket" thickness={1.5}><rect w={50} h={30} /><circle r={8} /></drawing>
PropTypeDescription
namestringDrawing (and part) name; unique. Default "drawing".
thicknessnumberSheet thickness, mm: also emit the drawing as an extruded part.
layerstringOutput layer in DXF/SVG, e.g. "cut" or "engrave" (SVG colours engrave blue). Default: the drawing's name.
colorstringDisplay colour of the part.
materialMaterialName | (string & {})Material preset of the part (see <part material>).
densitynumberDensity override, g/cm³.

Also takes 2D placement props, 2D shape children.

#Assemblies

Anchors and mates place parts for you (see Assemblies & mates).

<anchor>

A named frame on a part, for mates.

A named frame (connector) on a part: an origin and an axis (its local z), plus an x direction. It moves with everything around it, so a component can expose mounting points. Anchors build no geometry.
<anchor id="shaft" at={[0, 0, 24]} axis="z" />
PropTypeDescription
id*stringName, unique within its part: the mate refers to "part.id".
atVec3Origin, mm (default the origin of where the anchor sits).
xnumberAdded to at[0].
ynumberAdded to at[1].
znumberAdded to at[2].
axisDirectionThe anchor's axis (its local z). Default "z".
xAxisDirectionThe anchor's x direction (projected square to axis). Default: X, or Y when axis is along X.

<mate>

A joint between two anchors (inside <assembly>).

Join anchor b (its part moves) to anchor a. Origins meet, axes align (opposed with flip) and, depending on type, x directions align: | type | free motion | driven by | |---|---|---| | fastened (default) | none | none | | revolute | rotation about the axis | angle | | slider | travel along the axis | offset | | cylindrical | rotation about + travel along the axis | angle, offset | | planar | travel in the plane, rotation about the normal | angle | | ball | any rotation about the origin | none |
PropTypeDescription
a*string | AnchorRefThe first anchor: "part.anchor" or a handle (A.motor.shaft).
b*string | AnchorRefThe second anchor.
typeMateTypeJoint type. Default "fastened".
offsetnumberOffset along a's axis, mm (a slider's travel; a gap for the others).
distancenumberAlias of offset.
anglenumberRotation of b about a's axis, degrees (a revolute joint's angle).
flipbooleanAxes opposed instead of aligned (face-to-face).
idstringName, for <gear>s relating this joint to another.
limits[number, number]Allowed range of the joint, [min, max]: degrees for revolute/cylindrical/planar (the angle), mm for a slider (the offset). Out-of-range positions warn.

<gear>

Couples two joints' angles (inside <assembly>).

Couples two revolute (or cylindrical) joints: b's angle = ratio × a's angle + phase. Negative ratios turn the other way (meshing spur gears).
<gear a="motor" b="wheel" ratio={-0.5} />
PropTypeDescription
a*stringid of the driving mate.
b*stringid of the driven mate.
ratio*numberb's angle per degree of a's.
phasenumberAngle offset, degrees.

#Primitives

Basic solids. Box, cylinder and cone sit centred in X/Y with their base on z = 0.

<box>

A box; centred in XY, base on z = 0.

A rectangular box. Default placement: centred in X and Y, base on z = 0 (ready to print). Size by size, or width/depth/height (aliases w/d/h).
PropTypeDescription
sizenumber | Vec3[x, y, z] mm, or one number for a cube.
widthnumberSize along X, mm.
depthnumberSize along Y, mm.
heightnumberSize along Z, mm.
wnumberAlias of width.
dnumberAlias of depth.
hnumberAlias of height.
centerCenterSpecCentring per axis. Default [true, true, false] (centred XY, base on z = 0).

Also takes placement props.

<cylinder>

A cylinder about +Z; base on z = 0.

A cylinder about +Z. Default placement: axis on Z, base on z = 0. Radius by r/radius or d/diameter; height by h/height.
PropTypeDescription
rnumberRadius, mm.
radiusnumberRadius, mm (alias of r).
dnumberDiameter, mm.
diameternumberDiameter, mm (alias of d).
hnumberHeight along +Z, mm.
heightnumberHeight along +Z, mm (alias of h).
centerCenterSpecCentring per axis. Default [true, true, false]; true also centres in Z.

Also takes placement props.

<cone>

A cone / frustum about +Z; base on z = 0.

A cone or frustum about +Z, from radius r1 at the base to r2 at the top (either may be 0). Default placement: axis on Z, base on z = 0.
PropTypeDescription
r1numberBottom radius, mm.
r2numberTop radius, mm (0 for a point).
d1numberBottom diameter, mm.
d2numberTop diameter, mm.
hnumberHeight along +Z, mm.
heightnumberHeight along +Z, mm (alias of h).
centerCenterSpecCentring per axis. Default [true, true, false].

Also takes placement props.

<sphere>

A sphere centred on the origin.

A sphere, centred on the origin by default.
PropTypeDescription
rnumberRadius, mm.
radiusnumberRadius, mm (alias of r).
dnumberDiameter, mm.
diameternumberDiameter, mm (alias of d).
centerCenterSpecCentring per axis. Default true; false puts the bounding box's corner on the origin.

Also takes placement props.

<torus>

A torus about +Z centred on the origin.

A torus about +Z, centred on the origin.
PropTypeDescription
RnumberMajor radius (centre to tube centre), mm.
rnumberMinor radius (tube radius), mm.
majornumberMajor radius, mm (alias of R).
minornumberMinor radius, mm (alias of r).

Also takes placement props.

<step>

An imported STEP solid: <step data={text} />.

An imported STEP solid (exact B-rep), placed like any other solid. Get the text with an import attribute: import bracket from "./bracket.step" with { type: "text" }. Analytic models round-trip; some blended (filleted) files can't be read yet.
PropTypeDescription
data*stringThe STEP file's text (ISO-10303-21).
solidnumberWhich solid of the file, 0-based (default: all solids, unioned).

Also takes placement props.

#Booleans

Combine solids.

<union>

Union of the children.

Everything in any child.
PropTypeDescription
ofstringBy ref instead of children: unite the named solids (".a, .b"). The first keeps its place and name; the others are moved into it and removed from where they were.

Also takes placement props, solid children.

<difference>

First child minus the rest.

The first child minus every other child.
PropTypeDescription
fromstringBy ref instead of children: the named solid to cut (".plate"). The result keeps its name and place in the tree. Needs tool.
<subtract from=".plate" tool=".bolt > .shank" />
toolstringBy ref: the solid(s) to cut away (".hole", ".a, .b"). They are used up: removed from the output.

Also takes placement props, solid children.

<subtract>

First child minus the rest (alias of <difference>).

The first child minus every other child.
PropTypeDescription
fromstringBy ref instead of children: the named solid to cut (".plate"). The result keeps its name and place in the tree. Needs tool.
<subtract from=".plate" tool=".bolt > .shank" />
toolstringBy ref: the solid(s) to cut away (".hole", ".a, .b"). They are used up: removed from the output.

Also takes placement props, solid children.

<intersection>

Common volume of the children.

Only what every child shares.
PropTypeDescription
ofstringBy ref instead of children: keep what the named solids share (".a, .b"); the first keeps its place and name.

Also takes placement props, solid children.

<intersect>

Common volume of the children (alias of <intersection>).

Only what every child shares.
PropTypeDescription
ofstringBy ref instead of children: keep what the named solids share (".a, .b"); the first keeps its place and name.

Also takes placement props, solid children.

#Transforms

Move, turn, scale and mirror children (every solid also has placement props).

<translate>

Translate children.

PropTypeDescription
xnumberOffset along X, mm.
ynumberOffset along Y, mm.
znumberOffset along Z, mm.
byVec3Offset [x, y, z], mm (added to x/y/z).

Also takes solid children.

<rotate>

Rotate children (degrees, X then Y then Z; or axis + angle).

PropTypeDescription
xnumberAngle about X, degrees (applied first).
ynumberAngle about Y, degrees (applied second).
znumberAngle about Z, degrees (applied third).
byVec3[rx, ry, rz] degrees, X then Y then Z (added to x/y/z).
axisVec3 | AxisRotate by angle about this axis instead (right-hand rule).
anglenumberAngle about axis, degrees.
originVec3Rotate about this point instead of the origin.

Also takes solid children.

<scale>

Scale children (uniform or per axis).

PropTypeDescription
by*number | Vec3Scale factor: a number (uniform) or [sx, sy, sz]. Non-uniform scale turns analytic surfaces (cylinders, spheres) into NURBS.
originVec3Scale about this point instead of the origin.

Also takes solid children.

<mirror>

Mirror children across a plane (with keep, a symmetric pair).

PropTypeDescription
axis*Axis | Vec3The plane to mirror across, by its normal: an axis ("x" negates X) or a vector.
keepbooleanKeep the original as well as the mirrored copy (a symmetric pair). Default false.
originVec3A point on the mirror plane (default origin).

Also takes solid children.

<transform>

Apply an arbitrary affine matrix (row-major, column-vector).

Apply an arbitrary affine matrix (OpenSCAD's multmatrix): row-major, column-vector (p' = M p, translation in the last column), exactly the IR's layout. Shear or non-uniform scale turns analytic faces into NURBS.
PropTypeDescription
matrix*readonly number[] | readonly (readonly number[])[]16 numbers (4×4), 12 (3×4, last row [0, 0, 0, 1] implied), or the rows as nested arrays.

Also takes solid children.

#Sketch shapes

2D shapes, used inside extrude, revolve, loft, sweep and drawing. Overlapping shapes union; nested loops become holes.

<rect>

2D: rectangle (centred).

A rectangle, centred on its position by default.
PropTypeDescription
wnumberWidth (sketch X), mm.
hnumberHeight (sketch Y), mm.
widthnumberAlias of w.
heightnumberAlias of h.
sizenumber | Vec2[w, h], or one number for a square.
centerbooleanfalse puts the lower-left corner on the position instead. Default true.

Also takes 2D placement props.

<roundedRect>

2D: rectangle with rounded corners (centred).

A rectangle with rounded corners (exact quarter arcs), centred.
PropTypeDescription
wnumberWidth (sketch X), mm.
hnumberHeight (sketch Y), mm.
widthnumberAlias of w.
heightnumberAlias of h.
sizenumber | Vec2[w, h], or one number for a square.
centerbooleanfalse puts the lower-left corner on the position instead. Default true.
rnumberCorner radius, mm (clamped to half the shorter side).
radiusnumberAlias of r.

Also takes 2D placement props.

<circle>

2D: circle.

A circle (one exact arc), centred on its position. Inside a constraint sketch it is a solved circle (center, tangent, equal...).
PropTypeDescription
centerPointLikeCentre point id (created if new) or [x, y] guess.
fixedbooleanPin the centre where drawn.
tangentRefs<LineHandle | Round>Tangent to these lines/arcs/circles.
equalRefs<Round>Same radius as these arcs/circles.
concentricRef<Round>Same centre as this arc/circle.
rnumberRadius, mm.
radiusnumberRadius, mm (alias of r).
dnumberDiameter, mm.
diameternumberDiameter, mm (alias of d).

Also takes 2D placement props.

<ellipse>

2D: ellipse.

An ellipse (one exact rational NURBS), centred.
PropTypeDescription
rx*numberSemi-axis along sketch X, mm.
ry*numberSemi-axis along sketch Y, mm.

Also takes 2D placement props.

<polygon>

2D: polygon through points.

A polygon through points (closed automatically).
PropTypeDescription
points*readonly Vec2[]Vertices [x, y] in order (either winding).

Also takes 2D placement props.

<regularPolygon>

2D: regular polygon.

A regular polygon (hexagon, ...), centred, first vertex on +X.
PropTypeDescription
sides*numberNumber of sides (≥ 3).
rnumberCircumradius (centre to vertex), mm.
radiusnumberCircumradius, mm (alias of r).
apothemnumberInradius (centre to flat), mm: e.g. half a hex nut's across-flats size.
flatsnumberAcross-flats width, mm (= 2 × apothem).

Also takes 2D placement props.

<slot>

2D: stadium slot along X.

A stadium / slot (two half circles joined by straight sides) along sketch X, centred.
PropTypeDescription
length*numberOverall length end to end, mm.
width*numberWidth (= end diameter), mm.

Also takes 2D placement props.

<path>

2D: SVG path data.

An SVG-style path. Supports M L H V C S Q T A Z (absolute and relative). Each subpath must be closed (Z, or end where it began); subpaths nested in others become holes. Note: y points up (no SVG flip).
PropTypeDescription
d*stringPath data, e.g. "M0 0 H20 V10 A5 5 0 0 1 10 10 Z".

Also takes 2D placement props.

<star>

2D: star.

A star with points tips, first tip on +Y, centred.
PropTypeDescription
points*numberNumber of tips (≥ 2).
r1*numberTip radius, mm.
r2*numberValley radius, mm.

Also takes 2D placement props.

<text>

2D: text outlines (emboss / engrave).

Text outlines, for embossing (<extrude>) or engraving (<difference>). Glyph holes (o, a, e...) are handled like any nested loop. By default the first baseline starts at the position (align="left", valign="baseline"); \n starts a new line.
<extrude height={1}><text size={8} align="center" valign="middle">tscad</text></extrude>
PropTypeDescription
sizenumberFont size (em), mm. Default 10. In the default font capitals are about 0.73 × size tall and lowercase x about 0.55 × size.
fontArrayBuffer | Uint8Array | objectA TTF/OTF/WOFF font's bytes (e.g. import f from "./Font.ttf" with { type: "file" } then read it, or await Bun.file(...).arrayBuffer()), or an opentype.js Font. Default: the built-in DejaVu Sans (Latin, Greek and common symbols such as ° ± × µ ⌀ Ø).
align"left" | "center" | "right"Horizontal alignment of each line about the position. Default "left".
valign"baseline" | "top" | "middle" | "bottom"Vertical alignment of the block: "baseline" (default: first baseline at the position), "top" (ascender), "middle" (centre of the capitals), "bottom" (last descender).
spacingnumberLetter advance multiplier (1 = the font's own spacing; 1.2 = 20 % looser).
lineHeightnumberLine pitch as a multiple of size. Default 1.2.
kerningbooleanApply the font's kerning. Default true.
ligaturesbooleanApply standard ligatures (fi, fl...). Default true.

Also takes 2D placement props.

<dxf>

2D: an imported DXF drawing.

An imported DXF drawing as 2D shapes: LINE, ARC, CIRCLE, LWPOLYLINE/POLYLINE (bulges become exact arcs), SPLINE, ELLIPSE, INSERTed BLOCKs. $INSUNITS → mm. Loose entities are chained into closed loops; nested loops are holes.
import plate from "./plate.dxf" with { type: "text" } <extrude height={3}><dxf data={plate} layer="CUT" /></extrude>
PropTypeDescription
data*stringThe DXF file's text.
layerstring | readonly string[]Only these layers.
units"mm" | "cm" | "m" | "in" | "ft"Override the file's units.
scalenumberExtra scale factor.
centerbooleanMove the drawing's bounding-box centre to the origin.
tolerancenumberEnd-point snapping tolerance when chaining, mm.

Also takes 2D placement props.

<svg>

2D: an imported SVG drawing.

An imported SVG as 2D shapes: paths (arcs stay exact), rect, circle, ellipse, polygon, closed polylines, nested groups with transforms. Units come from the viewBox and the width/height (else 1 px = 0.2646 mm); y is flipped to point up. Each element's fill-rule decides its holes; overlapping elements are unioned.
import logo from "./logo.svg" with { type: "text" } <extrude height={1}><svg data={logo} center /></extrude>
PropTypeDescription
data*stringThe SVG file's text.
selectstringOnly the element with this id ("logo", "#logo") or class (".cut"), with its children.
scalenumberExtra scale factor.
flipYbooleanFlip y so the drawing reads the right way up. Default true.
centerbooleanMove the drawing's bounding-box centre to the origin.

Also takes 2D placement props.

<sketch>

2D: groups shapes to place them together.

PropTypeDescription
prefer"ccw" | "cw"Hint: which way round the closed loops are drawn (in declaration order).
strictbooleanMake an under-constrained sketch an error instead of a warning.
allowFreebooleanDon't warn about remaining degrees of freedom.

Also takes 2D placement props, 2D shape children.

<offset>

2D: offsets its shapes outward (+) or inward (−).

Offsets its 2D children: positive distance grows the shapes (clearance outlines, gaskets), negative shrinks them (insets, pockets). Holes move the other way, so the material grows/shrinks consistently. Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened to lines first. Holes that close up and islands that shrink away are removed.
<extrude height={2}><offset distance={1.5}><path d={outline} /></offset></extrude>
PropTypeDescription
distancenumberOffset distance, mm: positive outward, negative inward.
dnumberAlias of distance.
roundbooleanRound convex corners with exact arcs (default true); false mitres them.

Also takes 2D placement props, 2D shape children.

<hull>

2D: the convex hull of the children (exact arcs and tangents).

The exact convex hull of the child shapes: polygons stay polygons, circles and arcs give tangent lines and arcs (two circles → a slot, three → a rounded triangle), NURBS and text are flattened.
<hull><circle r={10} /><circle r={4} x={25} /></hull>

Also takes 2D placement props, 2D shape children.

<sketchUnion>

2D: union of the child shapes (exact; arcs stay arcs).

An exact 2D boolean of its child shapes: each child is one operand (a <sketch> groups several shapes into one; nested loops in an operand are holes). Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened first. The result is a 2D shape like any other: use it in <extrude>, <revolve>, <drawing>, <offset>... - <sketchUnion> (<union2d>): everything in any child. - <sketchDifference> (<difference2d>): the first child minus the others. - <sketchIntersection> (<intersection2d>): only what every child shares.
<extrude height={8}><difference2d><circle d={6} /><rect w={6} h={3} y={3} /></difference2d></extrude> // a D-shaft profile

Also takes 2D placement props, 2D shape children.

<sketchDifference>

2D: the first child shape minus the others (exact).

An exact 2D boolean of its child shapes: each child is one operand (a <sketch> groups several shapes into one; nested loops in an operand are holes). Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened first. The result is a 2D shape like any other: use it in <extrude>, <revolve>, <drawing>, <offset>... - <sketchUnion> (<union2d>): everything in any child. - <sketchDifference> (<difference2d>): the first child minus the others. - <sketchIntersection> (<intersection2d>): only what every child shares.
<extrude height={8}><difference2d><circle d={6} /><rect w={6} h={3} y={3} /></difference2d></extrude> // a D-shaft profile

Also takes 2D placement props, 2D shape children.

<sketchIntersection>

2D: what every child shape shares (exact).

An exact 2D boolean of its child shapes: each child is one operand (a <sketch> groups several shapes into one; nested loops in an operand are holes). Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened first. The result is a 2D shape like any other: use it in <extrude>, <revolve>, <drawing>, <offset>... - <sketchUnion> (<union2d>): everything in any child. - <sketchDifference> (<difference2d>): the first child minus the others. - <sketchIntersection> (<intersection2d>): only what every child shares.
<extrude height={8}><difference2d><circle d={6} /><rect w={6} h={3} y={3} /></difference2d></extrude> // a D-shaft profile

Also takes 2D placement props, 2D shape children.

<union2d>

2D: alias of <sketchUnion>.

An exact 2D boolean of its child shapes: each child is one operand (a <sketch> groups several shapes into one; nested loops in an operand are holes). Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened first. The result is a 2D shape like any other: use it in <extrude>, <revolve>, <drawing>, <offset>... - <sketchUnion> (<union2d>): everything in any child. - <sketchDifference> (<difference2d>): the first child minus the others. - <sketchIntersection> (<intersection2d>): only what every child shares.
<extrude height={8}><difference2d><circle d={6} /><rect w={6} h={3} y={3} /></difference2d></extrude> // a D-shaft profile

Also takes 2D placement props, 2D shape children.

<difference2d>

2D: alias of <sketchDifference>.

An exact 2D boolean of its child shapes: each child is one operand (a <sketch> groups several shapes into one; nested loops in an operand are holes). Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened first. The result is a 2D shape like any other: use it in <extrude>, <revolve>, <drawing>, <offset>... - <sketchUnion> (<union2d>): everything in any child. - <sketchDifference> (<difference2d>): the first child minus the others. - <sketchIntersection> (<intersection2d>): only what every child shares.
<extrude height={8}><difference2d><circle d={6} /><rect w={6} h={3} y={3} /></difference2d></extrude> // a D-shaft profile

Also takes 2D placement props, 2D shape children.

<intersection2d>

2D: alias of <sketchIntersection>.

An exact 2D boolean of its child shapes: each child is one operand (a <sketch> groups several shapes into one; nested loops in an operand are holes). Lines and arcs stay exact; NURBS (ellipses, text, Béziers) are flattened first. The result is a 2D shape like any other: use it in <extrude>, <revolve>, <drawing>, <offset>... - <sketchUnion> (<union2d>): everything in any child. - <sketchDifference> (<difference2d>): the first child minus the others. - <sketchIntersection> (<intersection2d>): only what every child shares.
<extrude height={8}><difference2d><circle d={6} /><rect w={6} h={3} y={3} /></difference2d></extrude> // a D-shaft profile

Also takes 2D placement props, 2D shape children.

<section>

2D: one loft section at height z.

A loft section: one 2D shape at height z.
PropTypeDescription
z*numberHeight of the section, mm.

Also takes 2D shape children.

#Sketch → solid

Turn 2D shapes into solids.

<extrude>

Extrude 2D shapes (nested loops become holes).

Extrude 2D shapes into a solid. Every closed loop is extruded; loops nested inside an odd number of others are holes, and disjoint outlines are unioned: <extrude height={5}><rect w={40} h={30}/><circle r={5}/></extrude> is a plate with a hole.
PropTypeDescription
heightnumberDistance along the sketch normal, mm (negative extrudes the other way).
hnumberAlias of height.
distancenumberAlias of height.
draftnumberTaper angle, degrees: positive narrows the outline as it rises (mould draft).
plane"XY" | "XZ" | "YZ"Sketch plane. "XY" (default): normal +Z. "XZ": sketch x → X, y → Z, normal −Y. "YZ": sketch x → Y, y → Z, normal +X.
offsetnumberOffset of the sketch plane along its normal, mm.
centerbooleanExtrude symmetrically about the sketch plane. Default false.

Also takes placement props, 2D shape children.

<revolve>

Revolve a 2D profile (x = radius, y = height) about Z.

Revolve 2D shapes about the Z axis: sketch x is the radius, sketch y is the height (the profile is placed in the XZ plane). Keep the profile at x ≥ 0.
PropTypeDescription
anglenumberSweep angle, degrees (0 < angle ≤ 360). Default 360.

Also takes placement props, 2D shape children.

<loft>

Loft through 2D sections along Z.

Skin through 2D sections stacked along Z. Give each shape a z, or wrap each in <section z={...}>. One loop per section, bottom to top.
PropTypeDescription
ruledbooleanStraight (ruled) walls between sections instead of a smooth skin. Default false.

Also takes placement props, 2D shape children.

<sweep>

Sweep a 2D profile along a 3D path.

PropTypeDescription
pathPath3 | readonly Vec3[]The path: helix({...}), polyline3([...]), arc3({...}), or IR curves. Or draw it in 2D with a <sweepPath> child instead.
frame"follow" | "translate""follow" (default) turns the profile with the path; "translate" keeps its orientation (no twist; for threads along a helix, follow is usually right).

Also takes placement props, 2D shape children.

<sweepPath>

A sweep's path drawn in 2D (inside <sweep>).

A <sweep>'s path drawn in 2D on a plane: a constraint <sketch> (lines, arcs, splines; open, or closed for a ring) or <path d="M ..."> data. Keep it tangent-continuous (join lines with tangent arcs): the sweep is exact along lines and arcs, and sharp corners warn.
<sweep> <sweepPath plane="XZ"><path d="M0 0 V40 A15 15 0 0 0 30 40" /></sweepPath> <circle r={3} /> </sweep>
PropTypeDescription
plane"XY" | "XZ" | "YZ"The plane the path is drawn on (as <extrude plane>). Default "XY".
offsetnumberShift the plane along its normal, mm.

Also takes 2D placement props.

#Patterns

Repeat children.

<linearPattern>

Copies along a line.

count copies, each moved by step from the last.
PropTypeDescription
count*numberNumber of copies (including the original).
stepVec3Offset between copies [dx, dy, dz], mm.
dxnumberX offset between copies, mm.
dynumberY offset between copies, mm.
dznumberZ offset between copies, mm.
centerbooleanCentre the pattern on the original position. Default false.
ofstring | readonly unknown[]Inside a constraint <sketch>: the entities to copy (ids or handles); the copies stay tied by translation constraints. Without of it is the usual solid pattern.

Also takes placement props, solid children.

<gridPattern>

Copies on an XY grid.

An nx × ny grid of copies in XY.
PropTypeDescription
nx*numberColumns (along X).
ny*numberRows (along Y).
dx*numberColumn spacing, mm.
dy*numberRow spacing, mm.
centerbooleanCentre the grid on the original position. Default true.

Also takes placement props, solid children.

<polarPattern>

Copies around an axis.

count copies rotated about an axis through the origin.
PropTypeDescription
count*numberNumber of copies (including the original).
anglenumberTotal angle, degrees. 360 (default) spaces copies evenly around the circle; anything less puts the first copy at 0 and the last at angle.
axisAxisRotation axis. Default "z".
radiusnumberMove the children out along +X by this radius first, mm (bolt circles).
startAnglenumberAngle of the first copy, degrees. Default 0.

Also takes placement props, solid children.

#Features

Round, bevel, hollow, draft, push/pull and split. Edges and faces are picked with selectors.

<fillet>

Round edges.

Round edges of the children (unioned). radius 0 skips the fillet (handy for params).
PropTypeDescription
targetstringBy ref instead of children: the named solid to apply it to (".plate"); the result keeps its name.
radiusnumberFillet radius, mm.
rnumberAlias of radius.
edgesSelectorLike | SelectorWhich edges: edges.top(), ">Z or |Z", or an IR selector. Default: all edges. The kernel fails if nothing matches.

Also takes placement props, solid children.

<chamfer>

Bevel edges.

Bevel edges of the children (unioned). distance 0 skips it.
PropTypeDescription
targetstringBy ref instead of children: the named solid to apply it to (".plate"); the result keeps its name.
distancenumberSetback along each face, mm.
dnumberAlias of distance.
edgesSelectorLike | SelectorWhich edges (see fillet). Default: all edges.

Also takes placement props, solid children.

<shell>

Hollow out.

Hollow the children (unioned) to a wall thickness, leaving the open faces open.
PropTypeDescription
targetstringBy ref instead of children: the named solid to apply it to (".plate"); the result keeps its name.
thickness*numberWall thickness, mm. Walls grow inward unless outward (the sign is ignored: −2 is also 2 mm inward).
openSelectorLike | SelectorFaces to remove: faces.top(), ">Z", ... Default: none (a closed hollow).
outwardbooleanGrow the walls outward (keep the inside size). Default false.

Also takes placement props, solid children.

<draft>

Mould draft on faces.

Mould draft: tilt the selected faces of the children (unioned) by angle so the part releases from a mould pulled along pull. Faces pivot about the neutral plane (default z = 0, square to pull); a positive angle leans them in as they rise along pull.
<draft angle={3}><box size={[40, 30, 20]} /></draft>
PropTypeDescription
targetstringBy ref instead of children: the named solid to apply it to (".plate"); the result keeps its name.
angle*numberDraft angle, degrees (0 skips it).
facesSelectorLike | SelectorFaces to draft. Default: the walls square to pull ("#Z" for the default pull).
neutralnumber | PlaneSpecNeutral plane: a height along pull (mm), or a plane. Default 0.
pullAxis | `-${Axis}` | Vec3Mould pull direction: an axis ("z", "-z") or a vector. Default "z".

Also takes placement props, solid children.

<pushPull>

Move faces along their normals (push/pull).

Push or pull faces: move the selected faces of the children (unioned) along their normals by distance (negative: inward); neighbouring faces stretch or shrink to meet them. distance={0} skips it.
<pushPull distance={2} faces=">Z"><box size={10} /></pushPull> // 10 × 10 × 12
PropTypeDescription
distancenumberHow far to move the faces, mm (negative: into the solid). Give this or d.
dnumberAlias of distance.
faces*SelectorLike | SelectorFaces to move: faces.top(), ">Z", ...

Also takes placement props, solid children.

<offsetFaces>

Move faces along their normals (alias of <pushPull>; the IR name).

Push or pull faces: move the selected faces of the children (unioned) along their normals by distance (negative: inward); neighbouring faces stretch or shrink to meet them. distance={0} skips it.
<pushPull distance={2} faces=">Z"><box size={10} /></pushPull> // 10 × 10 × 12
PropTypeDescription
distancenumberHow far to move the faces, mm (negative: into the solid). Give this or d.
dnumberAlias of distance.
faces*SelectorLike | SelectorFaces to move: faces.top(), ">Z", ...

Also takes placement props, solid children.

<split>

Cut with a plane, keep one side.

Cut the children (unioned) with a plane and keep one side: section views, halves for printing, flat bottoms.
<split plane="XY" offset={5}><sphere r={10} /></split> // the cap above z = 5
PropTypeDescription
planePlaneSpecThe cutting plane (in the children's own coordinates). Default "XY".
offsetnumberMove the plane along its normal, mm.
keep"above" | "below"Keep the side the normal points to ("above", default) or the other ("below").

Also takes placement props, solid children.

#Sheet metal

Bent sheet parts from a base outline: flanges, edge flanges, hems and jogs, with the flat pattern as cut/bend drawings. See the sheet-metal guide.

<sheetMetal>

A sheet-metal part (folded + flat pattern).

A sheet-metal part: a base <flange> (a closed 2D outline) with <edgeFlange>, <hem> and <jog> children hanging from its edges, nested to any depth. Bends are exact cylindrical sections. Besides the folded part, the flat pattern comes out as drawings named <name>-flat (layer cut) and <name>-bends (layer bend: the bend centre lines as open paths, with an "UP 90° R2" text note beside each), so tscad build -o part.dxf gives a cut-and-bend-ready flat; engraveNotes adds the labels as text outlines (<name>-notes, layer engrave). Bend allowance: BA = θ·(R + K·T).
<sheetMetal name="bracket" thickness={2} bendRadius={2}> <flange> <rect w={60} h={40} /> <edgeFlange edge="+y" length={30} /> </flange> </sheetMetal>
PropTypeDescription
thickness*numberSheet thickness, mm.
bendRadiusnumberInside bend radius, mm. Default: the thickness.
kFactornumberNeutral-axis position as a fraction of the thickness from the inside. Default 0.44.
namestringName of the flat-pattern drawings (<name>-flat...). Default "sheet".
flatbooleanShow the flat pattern (extruded) instead of the folded part.
engraveNotesbooleanAlso emit the bend labels as text outlines (<name>-notes, layer engrave) for laser marking. Default false.

Also takes placement props.

<flange>

Sheet metal: the base flange.

The base flange: a closed 2D outline (holes allowed) on z = 0, plus edge flanges as children.

Also takes 2D placement props.

<edgeFlange>

Sheet metal: a flange folded from an edge.

A flange folded from an edge: length of flat beyond the bend. Where two 90° edge flanges meet at a corner of their parent, corner closes the gap between them and cornerRelief cuts a relief where their bends meet.
PropTypeDescription
lengthnumberFlat length beyond the bend, mm. Optional with profile (the outline's height).
anglenumberBend angle, degrees (0, 180]. Default 90.
bendRadiusnumberInside bend radius, mm. Default: the sheet's.
profilebooleanThe flange's 2D children are its outline (tapered tabs, holes inside it) instead of holes in a width × length rectangle. Drawn in flange coordinates (x along the edge from 0 to its width, y away from the bend); it must stand on the bend line: a straight edge along y = 0 from x = 0 to the width.
corner"open" | "closed" | "overlap"How it meets a neighbouring 90° edge flange at a corner: "open" (default, a gap of the bend's size), "closed" (both run on and meet on the corner's diagonal, mitred; the flat pattern cuts square at the inside of the mitre), "overlap" (this one runs past the corner flush with the neighbour's outside; the neighbour stops cornerGap short of it).
cornerGapnumberGap left at a closed / overlapped corner, mm. Default min(0.2, thickness / 4).
cornerRelief"round" | "rect" | "tear"Relief where the bends meet at a corner: "rect" / "round" cut cornerReliefSize into the parent and cut the bends back; "tear" none.
cornerReliefSizenumberCorner relief size (square side / radius), mm. Default bend radius + thickness.

<hem>

Sheet metal: a 180° hem.

A hem: folded right back (180°) over the sheet.
PropTypeDescription
length*numberFlat length of the folded-back part, mm.
gapnumberGap between the sheet and the hem, mm (bend radius = gap / 2). Default: the thickness.

<jog>

Sheet metal: a jog (Z-bend).

A jog (Z-bend): up by angle, a web, back down, so the flange continues offset higher.
PropTypeDescription
offset*numberRise of the jogged flange's bottom face above the parent's, mm.
length*numberFlat length of the jogged flange, mm.
anglenumberBend angle of both bends, degrees. Default 90.
bendRadiusnumberInside bend radius, mm. Default: the sheet's.

#Features on faces

Sketch on a face of a solid, then pocket into it, raise a boss from it or cut through. The face is picked with a selector; x, y and rotate place the sketch in the face.

<pocket>

Cut a 2D profile depth into a face of the base.

PropTypeDescription
face*SelectorLike | SelectorWhich face: a selector matching planar faces.
indexnumberWhich of the matching faces. Default 0.
draftnumberTaper, degrees.
depth*numberHow deep into the face, mm.
dnumberAlias of depth.

Also takes 2D placement props.

<boss>

Raise a 2D profile height out of a face of the base.

PropTypeDescription
face*SelectorLike | SelectorWhich face: a selector matching planar faces.
indexnumberWhich of the matching faces. Default 0.
draftnumberTaper, degrees.
height*numberHow far out of the face, mm.
hnumberAlias of height.

Also takes 2D placement props.

<cutThrough>

Cut a 2D profile through the base, from a face.

PropTypeDescription
face*SelectorLike | SelectorWhich face: a selector matching planar faces.
indexnumberWhich of the matching faces. Default 0.
draftnumberTaper, degrees.
depthnumberHow far to cut, mm. Default 2000 (through anything reasonable).

Also takes 2D placement props.

<onFace>

Model on a face of the first child (sketch on face).

Model on a face of another solid ("sketch on face"). The first child is the base; the other children are tools modelled in the face's frame (origin at the centre of the face's bounding box, +Z pointing out of the material, +X along model X projected onto the face (Y when the face is square to X), then combined with the base by op.
<onFace face=">Z" op="cut"> <box size={[40, 30, 10]} /> <cylinder r={3} h={4} z={-4} /> </onFace>
PropTypeDescription
face*SelectorLike | SelectorWhich face: a selector (">Z", faces.max("x")...) matching planar faces.
indexnumberWhich of the matching faces (0-based, kernel order). Default 0.
op"union" | "add" | "cut" | "difference" | "intersect" | "intersection" | "none"How the tools combine with the base. Default "union".

Also takes solid children.

#Constraint sketch

Elements of constraint-solved sketches (see Constraint sketches).

<point>

Constraint sketch: a point.

A sketch point. x/y are a rough guess unless fixed.
PropTypeDescription
idstring
refPointHandleA handle naming this point (ref={s.o}).
xnumberRough (or, with fixed, exact) X, mm.
ynumberRough (or, with fixed, exact) Y, mm.
atVec2[x, y] (alias of x/y).
fixedbooleanPin the point at x, y (default 0, 0).
onRef<LineHandle | Round>Keep the point on this curve (line, arc or circle).

<line>

Constraint sketch: a line between two points.

Line-ish constraint props shared by <line>.
PropTypeDescription
from*PointLikeStart point: an id (created if new) or [x, y].
to*PointLikeEnd point: an id (created if new) or [x, y].
horizontalbooleanKeep the line horizontal.
verticalbooleanKeep the line vertical.
lengthnumberLength, mm.
anglenumberDirection from from to to, degrees CCW from +X (lines are undirected: mod 180).
parallelRefs<LineHandle>Parallel to these lines.
perpendicularRefs<LineHandle>Perpendicular to these lines.
equalRefs<LineHandle>Same length as these lines.
tangentRefs<Round> | booleanTangent to these arcs/circles (true: the arc meeting this line's from).

<arc>

Constraint sketch: a circular arc.

A circular arc from from to to, counter-clockwise about center unless cw. Give center (an id) or leave it out and set radius / tangent: the centre is then an implicit point ("<id>.center").
PropTypeDescription
from*PointLikeStart point.
to*PointLikeEnd point.
centerPointLikeCentre point (created if new).
radiusnumberRadius, mm.
rnumberAlias of radius.
diameternumberDiameter, mm.
dnumberAlias of diameter.
cwbooleanClockwise from from to to. Default: counter-clockwise (or as drawn, for tangent arcs).
ccwbooleanExplicitly counter-clockwise.
anglenumberSweep angle, degrees (constrained).
tangentRefs<LineHandle | Round> | booleanTangent to these lines/arcs/circles; true: to the curve meeting this arc's from.
equalRefs<Round>Same radius as these arcs/circles.
concentricRef<Round>Same centre as this arc/circle.
majorbooleanHint: the long way round (sweep over 180°). Picks the branch when nothing is drawn.
minorbooleanHint: the short way round (sweep under 180°).

<spline>

Constraint sketch: a B-spline through control points.

A clamped B-spline through control points (ends on the first and last).
PropTypeDescription
points*readonly PointLike[]Control points: ids (created if new) or [x, y], at least 2.
degreenumberDegree (default 3, lowered for few points).

<dimension>

Constraint sketch: a driving dimension.

A driving dimension. Between two points: distance (or dx / dy, signed b − a); point–line: perpendicular distance; line–line: distance between (and so parallel) lines; an arc/circle stands for its centre. of + radius/diameter for circles, of + length for lines, a/b + angle for two lines.
PropTypeDescription
distancenumberDistance, mm.
valuenumberAlias of distance.
side"left" | "right"For a distance from a line: which side of it (looking from its from to its to) the other point/line lies. Default: the side it is drawn on.
dxnumberSigned horizontal distance b.x − a.x, mm.
dynumberSigned vertical distance b.y − a.y, mm.
anglenumberAngle from line a to line b, degrees CCW (mod 180).
ofRef<AnyCurve>The entity for radius / diameter / length.
radiusnumber
diameternumber
lengthnumber

<distance>

Constraint sketch: a distance.

Distance between two things (see <dimension>).
PropTypeDescription
valuenumberDistance, mm.
side"left" | "right"For a distance from a line: "left" / "right" of it (from → to). Default: as drawn.
distancenumberAlias of value.
dxnumber
dynumber

<angle>

Constraint sketch: an angle between lines.

Angle from line a to line b, degrees CCW (lines undirected: mod 180).
PropTypeDescription
valuenumber
anglenumber

<coincident>

Constraint sketch: coincident points / point on curve.

Two points made one, or a point put on a curve.

<equal>

Constraint sketch: equal lengths / radii.

Equal length (lines) or radius (arcs/circles); of for several.
PropTypeDescription
ofreadonly Ref<LineHandle | Round>[]

<parallel>

Constraint sketch: parallel lines.

Two lines parallel (of for several).
PropTypeDescription
ofreadonly Ref<LineHandle>[]

<perpendicular>

Constraint sketch: perpendicular lines.

Two lines perpendicular.

<tangent>

Constraint sketch: tangency.

Tangent: line–arc/circle or arc/circle–arc/circle.
PropTypeDescription
side"left" | "right"Line–arc/circle: the side of the line (looking from → to) the centre lies on.

<collinear>

Constraint sketch: collinear lines.

Lines on one infinite line.

<concentric>

Constraint sketch: concentric arcs/circles.

Same centre.

<horizontal>

Constraint sketch: horizontal.

A line (a) or two points (a, b) horizontal.

<vertical>

Constraint sketch: vertical.

A line (a) or two points (a, b) vertical.

<symmetric>

Constraint sketch: symmetry.

a and b mirror images: across line about; about point about (point symmetry); or, with axis, across the vertical ("x": x mirrored) or horizontal ("y") line through point about (default the origin).
PropTypeDescription
aboutRef<PointHandle | LineHandle>
axis"x" | "y"

<midpoint>

Constraint sketch: midpoint.

point at the middle of line of.
PropTypeDescription
point*PointId
of*Ref<LineHandle>

<onCurve>

Constraint sketch: point on curve.

point on curve curve (line: the infinite line; arc: its circle).
PropTypeDescription
point*PointId
curve*Ref<LineHandle | Round>

<fix>

Constraint sketch: fix a point.

Pin a point (at x/y, or where it is drawn).
PropTypeDescription
pointPointId
aPointId
xnumber
ynumber

<mirrorEntities>

Constraint sketch: mirrored, constrained copies of entities.

Mirrored copies of entities across a line, kept symmetric by constraints: edit one side and the other follows. A mirrored point is named with a ' ("p" → "p'"), and a copy's id gets a ' too ("lug" → "lug'"). Points on the mirror line meet their own image, so a mirrored half profile closes.
<mirrorEntities about="axis" of={["lugTop", "lugEnd", "lugBottom"]} />
PropTypeDescription
about*Ref<LineHandle>The mirror line (usually construction).
of*Refs<LineHandle | ArcHandle | CircleHandle | SplineHandle>Entities to mirror.

<circularPattern>

Constraint sketch: copies turned about a centre, constrained.

Copies of entities turned about a centre, tied by rotation constraints (not baked coordinates). Copy k of a point "p" is "p~k" (wrapping round for a full turn, so a chain can end on the next copy's start: to="a~1"), and copy k of "lobe" is "lobe~k".
<circularPattern center="o" count={6} of={["hole"]} />
PropTypeDescription
center*PointIdThe point to turn about.
count*numberNumber of instances, the original included.
anglenumberTotal angle, degrees: 360 (default) spaces them evenly; less puts the last at angle.
of*Refs<LineHandle | ArcHandle | CircleHandle | SplineHandle>Entities to copy.