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.
| Prop | Type | Description |
|---|---|---|
| x | number | Move along X, mm (added to at). |
| y | number | Move along Y, mm (added to at). |
| z | number | Move along Z, mm (added to at). |
| at | Vec3 | Move by [x, y, z], mm. |
| rotate | Vec3 | Rotate [rx, ry, rz] degrees about the fixed X, then Y, then Z axes (OpenSCAD's rotate([rx, ry, rz])), about the origin, before translating. |
| rotateX | number | Rotate about X, degrees (added to rotate[0]). |
| rotateY | number | Rotate about Y, degrees (added to rotate[1]). |
| rotateZ | number | Rotate about Z, degrees (added to rotate[2]). |
| scale | number | Uniform scale factor about the origin. |
| mirror | Axis | Mirror across the plane through the origin square to this axis ("x" negates X). |
| name | string | A 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. |
| ghost | boolean | A 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.
| Prop | Type | Description |
|---|---|---|
| x | number | Move along sketch X, mm. |
| y | number | Move along sketch Y, mm. |
| at | Vec2 | Move by [x, y], mm (added to x/y). |
| rotate | number | Rotate CCW about the sketch origin, degrees (before translating). |
| mirror | "x" | "y" | Mirror: "x" negates sketch X, "y" negates sketch Y. |
| z | number | Inside <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.
| Prop | Type | Description |
|---|---|---|
| allowFree | boolean | Don't warn about parts their mates leave free to move. |
| strict | boolean | Mates must fix every part (free parts are errors) and redundant mates are reported. |
| fixed | boolean | As a sub-assembly: ground it in the parent assembly's mates. |
| name | string | Assembly 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.
| Prop | Type | Description |
|---|---|---|
| name | string | Part name: unique within the model; used for meshes, STEP entities and export files. |
| color | string | Display colour, any CSS colour (default: from material). |
| material | MaterialName | (string & {}) | Material preset ("pla", "petg", "abs", "aluminum", "steel", "brass", "wood"...), giving a default colour and density. See materials. |
| density | number | Density in g/cm³ for mass estimates (default: from material). |
| visible | boolean | false leaves the part out of the document (and exports); default true. |
| fixed | boolean | Ground 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.
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>| Prop | Type | Description |
|---|---|---|
| name | string | Drawing (and part) name; unique. Default "drawing". |
| thickness | number | Sheet thickness, mm: also emit the drawing as an extruded part. |
| layer | string | Output layer in DXF/SVG, e.g. "cut" or "engrave" (SVG colours engrave blue). Default: the drawing's name. |
| color | string | Display colour of the part. |
| material | MaterialName | (string & {}) | Material preset of the part (see <part material>). |
| density | number | Density 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.
<anchor id="shaft" at={[0, 0, 24]} axis="z" />| Prop | Type | Description |
|---|---|---|
| id* | string | Name, unique within its part: the mate refers to "part.id". |
| at | Vec3 | Origin, mm (default the origin of where the anchor sits). |
| x | number | Added to at[0]. |
| y | number | Added to at[1]. |
| z | number | Added to at[2]. |
| axis | Direction | The anchor's axis (its local z). Default "z". |
| xAxis | Direction | The 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>).
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 || Prop | Type | Description |
|---|---|---|
| a* | string | AnchorRef | The first anchor: "part.anchor" or a handle (A.motor.shaft). |
| b* | string | AnchorRef | The second anchor. |
| type | MateType | Joint type. Default "fastened". |
| offset | number | Offset along a's axis, mm (a slider's travel; a gap for the others). |
| distance | number | Alias of offset. |
| angle | number | Rotation of b about a's axis, degrees (a revolute joint's angle). |
| flip | boolean | Axes opposed instead of aligned (face-to-face). |
| id | string | Name, 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>).
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} />| Prop | Type | Description |
|---|---|---|
| a* | string | id of the driving mate. |
| b* | string | id of the driven mate. |
| ratio* | number | b's angle per degree of a's. |
| phase | number | Angle 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.
size, or width/depth/height (aliases w/d/h).| Prop | Type | Description |
|---|---|---|
| size | number | Vec3 | [x, y, z] mm, or one number for a cube. |
| width | number | Size along X, mm. |
| depth | number | Size along Y, mm. |
| height | number | Size along Z, mm. |
| w | number | Alias of width. |
| d | number | Alias of depth. |
| h | number | Alias of height. |
| center | CenterSpec | Centring 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.
r/radius or d/diameter; height by h/height.| Prop | Type | Description |
|---|---|---|
| r | number | Radius, mm. |
| radius | number | Radius, mm (alias of r). |
| d | number | Diameter, mm. |
| diameter | number | Diameter, mm (alias of d). |
| h | number | Height along +Z, mm. |
| height | number | Height along +Z, mm (alias of h). |
| center | CenterSpec | Centring 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.
r1 at the base to r2 at the top (either may be 0). Default placement: axis on Z, base on z = 0.| Prop | Type | Description |
|---|---|---|
| r1 | number | Bottom radius, mm. |
| r2 | number | Top radius, mm (0 for a point). |
| d1 | number | Bottom diameter, mm. |
| d2 | number | Top diameter, mm. |
| h | number | Height along +Z, mm. |
| height | number | Height along +Z, mm (alias of h). |
| center | CenterSpec | Centring per axis. Default [true, true, false]. |
Also takes placement props.
<sphere>
A sphere centred on the origin.
| Prop | Type | Description |
|---|---|---|
| r | number | Radius, mm. |
| radius | number | Radius, mm (alias of r). |
| d | number | Diameter, mm. |
| diameter | number | Diameter, mm (alias of d). |
| center | CenterSpec | Centring 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.
| Prop | Type | Description |
|---|---|---|
| R | number | Major radius (centre to tube centre), mm. |
| r | number | Minor radius (tube radius), mm. |
| major | number | Major radius, mm (alias of R). |
| minor | number | Minor radius, mm (alias of r). |
Also takes placement props.
<step>
An imported STEP solid: <step data={text} />.
import bracket from "./bracket.step" with { type: "text" }. Analytic models round-trip; some blended (filleted) files can't be read yet.| Prop | Type | Description |
|---|---|---|
| data* | string | The STEP file's text (ISO-10303-21). |
| solid | number | Which solid of the file, 0-based (default: all solids, unioned). |
Also takes placement props.
#Booleans
Combine solids.
<union>
Union of the children.
| Prop | Type | Description |
|---|---|---|
| of | string | By 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.
| Prop | Type | Description |
|---|---|---|
| from | string | By ref instead of children: the named solid to cut (".plate"). The result keeps its name and place in the tree. Needs tool. |
| tool | string | By 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>).
| Prop | Type | Description |
|---|---|---|
| from | string | By ref instead of children: the named solid to cut (".plate"). The result keeps its name and place in the tree. Needs tool. |
| tool | string | By 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.
| Prop | Type | Description |
|---|---|---|
| of | string | By 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>).
| Prop | Type | Description |
|---|---|---|
| of | string | By 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.
| Prop | Type | Description |
|---|---|---|
| x | number | Offset along X, mm. |
| y | number | Offset along Y, mm. |
| z | number | Offset along Z, mm. |
| by | Vec3 | Offset [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).
| Prop | Type | Description |
|---|---|---|
| x | number | Angle about X, degrees (applied first). |
| y | number | Angle about Y, degrees (applied second). |
| z | number | Angle about Z, degrees (applied third). |
| by | Vec3 | [rx, ry, rz] degrees, X then Y then Z (added to x/y/z). |
| axis | Vec3 | Axis | Rotate by angle about this axis instead (right-hand rule). |
| angle | number | Angle about axis, degrees. |
| origin | Vec3 | Rotate about this point instead of the origin. |
Also takes solid children.
<scale>
Scale children (uniform or per axis).
| Prop | Type | Description |
|---|---|---|
| by* | number | Vec3 | Scale factor: a number (uniform) or [sx, sy, sz]. Non-uniform scale turns analytic surfaces (cylinders, spheres) into NURBS. |
| origin | Vec3 | Scale about this point instead of the origin. |
Also takes solid children.
<mirror>
Mirror children across a plane (with keep, a symmetric pair).
| Prop | Type | Description |
|---|---|---|
| axis* | Axis | Vec3 | The plane to mirror across, by its normal: an axis ("x" negates X) or a vector. |
| keep | boolean | Keep the original as well as the mirrored copy (a symmetric pair). Default false. |
| origin | Vec3 | A point on the mirror plane (default origin). |
Also takes solid children.
<transform>
Apply an arbitrary affine matrix (row-major, column-vector).
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.| Prop | Type | Description |
|---|---|---|
| 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).
| Prop | Type | Description |
|---|---|---|
| w | number | Width (sketch X), mm. |
| h | number | Height (sketch Y), mm. |
| width | number | Alias of w. |
| height | number | Alias of h. |
| size | number | Vec2 | [w, h], or one number for a square. |
| center | boolean | false puts the lower-left corner on the position instead. Default true. |
Also takes 2D placement props.
<roundedRect>
2D: rectangle with rounded corners (centred).
| Prop | Type | Description |
|---|---|---|
| w | number | Width (sketch X), mm. |
| h | number | Height (sketch Y), mm. |
| width | number | Alias of w. |
| height | number | Alias of h. |
| size | number | Vec2 | [w, h], or one number for a square. |
| center | boolean | false puts the lower-left corner on the position instead. Default true. |
| r | number | Corner radius, mm (clamped to half the shorter side). |
| radius | number | Alias of r. |
Also takes 2D placement props.
<circle>
2D: circle.
center, tangent, equal...).| Prop | Type | Description |
|---|---|---|
| center | PointLike | Centre point id (created if new) or [x, y] guess. |
| fixed | boolean | Pin the centre where drawn. |
| tangent | Refs<LineHandle | Round> | Tangent to these lines/arcs/circles. |
| equal | Refs<Round> | Same radius as these arcs/circles. |
| concentric | Ref<Round> | Same centre as this arc/circle. |
| r | number | Radius, mm. |
| radius | number | Radius, mm (alias of r). |
| d | number | Diameter, mm. |
| diameter | number | Diameter, mm (alias of d). |
Also takes 2D placement props.
<ellipse>
2D: ellipse.
| Prop | Type | Description |
|---|---|---|
| rx* | number | Semi-axis along sketch X, mm. |
| ry* | number | Semi-axis along sketch Y, mm. |
Also takes 2D placement props.
<polygon>
2D: polygon through points.
points (closed automatically).| Prop | Type | Description |
|---|---|---|
| points* | readonly Vec2[] | Vertices [x, y] in order (either winding). |
Also takes 2D placement props.
<regularPolygon>
2D: regular polygon.
| Prop | Type | Description |
|---|---|---|
| sides* | number | Number of sides (≥ 3). |
| r | number | Circumradius (centre to vertex), mm. |
| radius | number | Circumradius, mm (alias of r). |
| apothem | number | Inradius (centre to flat), mm: e.g. half a hex nut's across-flats size. |
| flats | number | Across-flats width, mm (= 2 × apothem). |
Also takes 2D placement props.
<slot>
2D: stadium slot along X.
| Prop | Type | Description |
|---|---|---|
| length* | number | Overall length end to end, mm. |
| width* | number | Width (= end diameter), mm. |
Also takes 2D placement props.
<path>
2D: SVG path data.
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).| Prop | Type | Description |
|---|---|---|
| d* | string | Path data, e.g. "M0 0 H20 V10 A5 5 0 0 1 10 10 Z". |
Also takes 2D placement props.
<star>
2D: star.
points tips, first tip on +Y, centred.| Prop | Type | Description |
|---|---|---|
| points* | number | Number of tips (≥ 2). |
| r1* | number | Tip radius, mm. |
| r2* | number | Valley radius, mm. |
Also takes 2D placement props.
<text>
2D: text outlines (emboss / engrave).
<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>| Prop | Type | Description |
|---|---|---|
| size | number | Font size (em), mm. Default 10. In the default font capitals are about 0.73 × size tall and lowercase x about 0.55 × size. |
| font | ArrayBuffer | Uint8Array | object | A 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). |
| spacing | number | Letter advance multiplier (1 = the font's own spacing; 1.2 = 20 % looser). |
| lineHeight | number | Line pitch as a multiple of size. Default 1.2. |
| kerning | boolean | Apply the font's kerning. Default true. |
| ligatures | boolean | Apply standard ligatures (fi, fl...). Default true. |
Also takes 2D placement props.
<dxf>
2D: an imported DXF drawing.
$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>| Prop | Type | Description |
|---|---|---|
| data* | string | The DXF file's text. |
| layer | string | readonly string[] | Only these layers. |
| units | "mm" | "cm" | "m" | "in" | "ft" | Override the file's units. |
| scale | number | Extra scale factor. |
| center | boolean | Move the drawing's bounding-box centre to the origin. |
| tolerance | number | End-point snapping tolerance when chaining, mm. |
Also takes 2D placement props.
<svg>
2D: an imported SVG drawing.
import logo from "./logo.svg" with { type: "text" } <extrude height={1}><svg data={logo} center /></extrude>| Prop | Type | Description |
|---|---|---|
| data* | string | The SVG file's text. |
| select | string | Only the element with this id ("logo", "#logo") or class (".cut"), with its children. |
| scale | number | Extra scale factor. |
| flipY | boolean | Flip y so the drawing reads the right way up. Default true. |
| center | boolean | Move the drawing's bounding-box centre to the origin. |
Also takes 2D placement props.
<sketch>
2D: groups shapes to place them together.
| Prop | Type | Description |
|---|---|---|
| prefer | "ccw" | "cw" | Hint: which way round the closed loops are drawn (in declaration order). |
| strict | boolean | Make an under-constrained sketch an error instead of a warning. |
| allowFree | boolean | Don't warn about remaining degrees of freedom. |
Also takes 2D placement props, 2D shape children.
<offset>
2D: offsets its shapes outward (+) or inward (−).
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>| Prop | Type | Description |
|---|---|---|
| distance | number | Offset distance, mm: positive outward, negative inward. |
| d | number | Alias of distance. |
| round | boolean | Round 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).
<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).
<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 profileAlso takes 2D placement props, 2D shape children.
<sketchDifference>
2D: the first child shape minus the others (exact).
<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 profileAlso takes 2D placement props, 2D shape children.
<sketchIntersection>
2D: what every child shape shares (exact).
<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 profileAlso takes 2D placement props, 2D shape children.
<union2d>
2D: alias of <sketchUnion>.
<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 profileAlso takes 2D placement props, 2D shape children.
<difference2d>
2D: alias of <sketchDifference>.
<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 profileAlso takes 2D placement props, 2D shape children.
<intersection2d>
2D: alias of <sketchIntersection>.
<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 profileAlso takes 2D placement props, 2D shape children.
<section>
2D: one loft section at height z.
z.| Prop | Type | Description |
|---|---|---|
| z* | number | Height 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 height={5}><rect w={40} h={30}/><circle r={5}/></extrude> is a plate with a hole.| Prop | Type | Description |
|---|---|---|
| height | number | Distance along the sketch normal, mm (negative extrudes the other way). |
| h | number | Alias of height. |
| distance | number | Alias of height. |
| draft | number | Taper 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. |
| offset | number | Offset of the sketch plane along its normal, mm. |
| center | boolean | Extrude 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.
| Prop | Type | Description |
|---|---|---|
| angle | number | Sweep angle, degrees (0 < angle ≤ 360). Default 360. |
Also takes placement props, 2D shape children.
<loft>
Loft through 2D sections along Z.
z, or wrap each in <section z={...}>. One loop per section, bottom to top.| Prop | Type | Description |
|---|---|---|
| ruled | boolean | Straight (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.
| Prop | Type | Description |
|---|---|---|
| path | Path3 | 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>).
<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>| Prop | Type | Description |
|---|---|---|
| plane | "XY" | "XZ" | "YZ" | The plane the path is drawn on (as <extrude plane>). Default "XY". |
| offset | number | Shift 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.| Prop | Type | Description |
|---|---|---|
| count* | number | Number of copies (including the original). |
| step | Vec3 | Offset between copies [dx, dy, dz], mm. |
| dx | number | X offset between copies, mm. |
| dy | number | Y offset between copies, mm. |
| dz | number | Z offset between copies, mm. |
| center | boolean | Centre the pattern on the original position. Default false. |
| of | string | 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.
nx × ny grid of copies in XY.| Prop | Type | Description |
|---|---|---|
| nx* | number | Columns (along X). |
| ny* | number | Rows (along Y). |
| dx* | number | Column spacing, mm. |
| dy* | number | Row spacing, mm. |
| center | boolean | Centre 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.| Prop | Type | Description |
|---|---|---|
| count* | number | Number of copies (including the original). |
| angle | number | Total angle, degrees. 360 (default) spaces copies evenly around the circle; anything less puts the first copy at 0 and the last at angle. |
| axis | Axis | Rotation axis. Default "z". |
| radius | number | Move the children out along +X by this radius first, mm (bolt circles). |
| startAngle | number | Angle 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.
radius 0 skips the fillet (handy for params).| Prop | Type | Description |
|---|---|---|
| target | string | By ref instead of children: the named solid to apply it to (".plate"); the result keeps its name. |
| radius | number | Fillet radius, mm. |
| r | number | Alias of radius. |
| edges | SelectorLike | Selector | Which 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.
distance 0 skips it.| Prop | Type | Description |
|---|---|---|
| target | string | By ref instead of children: the named solid to apply it to (".plate"); the result keeps its name. |
| distance | number | Setback along each face, mm. |
| d | number | Alias of distance. |
| edges | SelectorLike | Selector | Which edges (see fillet). Default: all edges. |
Also takes placement props, solid children.
<shell>
Hollow out.
thickness, leaving the open faces open.| Prop | Type | Description |
|---|---|---|
| target | string | By ref instead of children: the named solid to apply it to (".plate"); the result keeps its name. |
| thickness* | number | Wall thickness, mm. Walls grow inward unless outward (the sign is ignored: −2 is also 2 mm inward). |
| open | SelectorLike | Selector | Faces to remove: faces.top(), ">Z", ... Default: none (a closed hollow). |
| outward | boolean | Grow the walls outward (keep the inside size). Default false. |
Also takes placement props, solid children.
<draft>
Mould draft on faces.
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>| Prop | Type | Description |
|---|---|---|
| target | string | By ref instead of children: the named solid to apply it to (".plate"); the result keeps its name. |
| angle* | number | Draft angle, degrees (0 skips it). |
| faces | SelectorLike | Selector | Faces to draft. Default: the walls square to pull ("#Z" for the default pull). |
| neutral | number | PlaneSpec | Neutral plane: a height along pull (mm), or a plane. Default 0. |
| pull | Axis | `-${Axis}` | Vec3 | Mould 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).
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| Prop | Type | Description |
|---|---|---|
| distance | number | How far to move the faces, mm (negative: into the solid). Give this or d. |
| d | number | Alias of distance. |
| faces* | SelectorLike | Selector | Faces to move: faces.top(), ">Z", ... |
Also takes placement props, solid children.
<offsetFaces>
Move faces along their normals (alias of <pushPull>; the IR name).
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| Prop | Type | Description |
|---|---|---|
| distance | number | How far to move the faces, mm (negative: into the solid). Give this or d. |
| d | number | Alias of distance. |
| faces* | SelectorLike | Selector | Faces to move: faces.top(), ">Z", ... |
Also takes placement props, solid children.
<split>
Cut with a plane, keep one side.
<split plane="XY" offset={5}><sphere r={10} /></split> // the cap above z = 5| Prop | Type | Description |
|---|---|---|
| plane | PlaneSpec | The cutting plane (in the children's own coordinates). Default "XY". |
| offset | number | Move 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).
<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>| Prop | Type | Description |
|---|---|---|
| thickness* | number | Sheet thickness, mm. |
| bendRadius | number | Inside bend radius, mm. Default: the thickness. |
| kFactor | number | Neutral-axis position as a fraction of the thickness from the inside. Default 0.44. |
| name | string | Name of the flat-pattern drawings (<name>-flat...). Default "sheet". |
| flat | boolean | Show the flat pattern (extruded) instead of the folded part. |
| engraveNotes | boolean | Also 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.
Also takes 2D placement props.
<edgeFlange>
Sheet metal: 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.| Prop | Type | Description |
|---|---|---|
| length | number | Flat length beyond the bend, mm. Optional with profile (the outline's height). |
| angle | number | Bend angle, degrees (0, 180]. Default 90. |
| bendRadius | number | Inside bend radius, mm. Default: the sheet's. |
| profile | boolean | The 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). |
| cornerGap | number | Gap 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. |
| cornerReliefSize | number | Corner relief size (square side / radius), mm. Default bend radius + thickness. |
<hem>
Sheet metal: a 180° hem.
| Prop | Type | Description |
|---|---|---|
| length* | number | Flat length of the folded-back part, mm. |
| gap | number | Gap between the sheet and the hem, mm (bend radius = gap / 2). Default: the thickness. |
<jog>
Sheet metal: a jog (Z-bend).
angle, a web, back down, so the flange continues offset higher.| Prop | Type | Description |
|---|---|---|
| offset* | number | Rise of the jogged flange's bottom face above the parent's, mm. |
| length* | number | Flat length of the jogged flange, mm. |
| angle | number | Bend angle of both bends, degrees. Default 90. |
| bendRadius | number | Inside 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.
| Prop | Type | Description |
|---|---|---|
| face* | SelectorLike | Selector | Which face: a selector matching planar faces. |
| index | number | Which of the matching faces. Default 0. |
| draft | number | Taper, degrees. |
| depth* | number | How deep into the face, mm. |
| d | number | Alias of depth. |
Also takes 2D placement props.
<boss>
Raise a 2D profile height out of a face of the base.
| Prop | Type | Description |
|---|---|---|
| face* | SelectorLike | Selector | Which face: a selector matching planar faces. |
| index | number | Which of the matching faces. Default 0. |
| draft | number | Taper, degrees. |
| height* | number | How far out of the face, mm. |
| h | number | Alias of height. |
Also takes 2D placement props.
<cutThrough>
Cut a 2D profile through the base, from a face.
| Prop | Type | Description |
|---|---|---|
| face* | SelectorLike | Selector | Which face: a selector matching planar faces. |
| index | number | Which of the matching faces. Default 0. |
| draft | number | Taper, degrees. |
| depth | number | How 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).
op.<onFace face=">Z" op="cut"> <box size={[40, 30, 10]} /> <cylinder r={3} h={4} z={-4} /> </onFace>| Prop | Type | Description |
|---|---|---|
| face* | SelectorLike | Selector | Which face: a selector (">Z", faces.max("x")...) matching planar faces. |
| index | number | Which 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.
x/y are a rough guess unless fixed.| Prop | Type | Description |
|---|---|---|
| id | string | |
| ref | PointHandle | A handle naming this point (ref={s.o}). |
| x | number | Rough (or, with fixed, exact) X, mm. |
| y | number | Rough (or, with fixed, exact) Y, mm. |
| at | Vec2 | [x, y] (alias of x/y). |
| fixed | boolean | Pin the point at x, y (default 0, 0). |
| on | Ref<LineHandle | Round> | Keep the point on this curve (line, arc or circle). |
<line>
Constraint sketch: a line between two points.
<line>.| Prop | Type | Description |
|---|---|---|
| from* | PointLike | Start point: an id (created if new) or [x, y]. |
| to* | PointLike | End point: an id (created if new) or [x, y]. |
| horizontal | boolean | Keep the line horizontal. |
| vertical | boolean | Keep the line vertical. |
| length | number | Length, mm. |
| angle | number | Direction from from to to, degrees CCW from +X (lines are undirected: mod 180). |
| parallel | Refs<LineHandle> | Parallel to these lines. |
| perpendicular | Refs<LineHandle> | Perpendicular to these lines. |
| equal | Refs<LineHandle> | Same length as these lines. |
| tangent | Refs<Round> | boolean | Tangent to these arcs/circles (true: the arc meeting this line's from). |
<arc>
Constraint sketch: a circular arc.
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").| Prop | Type | Description |
|---|---|---|
| from* | PointLike | Start point. |
| to* | PointLike | End point. |
| center | PointLike | Centre point (created if new). |
| radius | number | Radius, mm. |
| r | number | Alias of radius. |
| diameter | number | Diameter, mm. |
| d | number | Alias of diameter. |
| cw | boolean | Clockwise from from to to. Default: counter-clockwise (or as drawn, for tangent arcs). |
| ccw | boolean | Explicitly counter-clockwise. |
| angle | number | Sweep angle, degrees (constrained). |
| tangent | Refs<LineHandle | Round> | boolean | Tangent to these lines/arcs/circles; true: to the curve meeting this arc's from. |
| equal | Refs<Round> | Same radius as these arcs/circles. |
| concentric | Ref<Round> | Same centre as this arc/circle. |
| major | boolean | Hint: the long way round (sweep over 180°). Picks the branch when nothing is drawn. |
| minor | boolean | Hint: the short way round (sweep under 180°). |
<spline>
Constraint sketch: a B-spline through control points.
| Prop | Type | Description |
|---|---|---|
| points* | readonly PointLike[] | Control points: ids (created if new) or [x, y], at least 2. |
| degree | number | Degree (default 3, lowered for few points). |
<dimension>
Constraint sketch: a driving dimension.
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.| Prop | Type | Description |
|---|---|---|
| distance | number | Distance, mm. |
| value | number | Alias 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. |
| dx | number | Signed horizontal distance b.x − a.x, mm. |
| dy | number | Signed vertical distance b.y − a.y, mm. |
| angle | number | Angle from line a to line b, degrees CCW (mod 180). |
| of | Ref<AnyCurve> | The entity for radius / diameter / length. |
| radius | number | |
| diameter | number | |
| length | number |
<distance>
Constraint sketch: a distance.
<dimension>).| Prop | Type | Description |
|---|---|---|
| value | number | Distance, mm. |
| side | "left" | "right" | For a distance from a line: "left" / "right" of it (from → to). Default: as drawn. |
| distance | number | Alias of value. |
| dx | number | |
| dy | number |
<angle>
Constraint sketch: an angle between lines.
a to line b, degrees CCW (lines undirected: mod 180).| Prop | Type | Description |
|---|---|---|
| value | number | |
| angle | number |
<coincident>
Constraint sketch: coincident points / point on curve.
<equal>
Constraint sketch: equal lengths / radii.
of for several.| Prop | Type | Description |
|---|---|---|
| of | readonly Ref<LineHandle | Round>[] |
<parallel>
Constraint sketch: parallel lines.
of for several).| Prop | Type | Description |
|---|---|---|
| of | readonly Ref<LineHandle>[] |
<perpendicular>
Constraint sketch: perpendicular lines.
<tangent>
Constraint sketch: tangency.
| Prop | Type | Description |
|---|---|---|
| side | "left" | "right" | Line–arc/circle: the side of the line (looking from → to) the centre lies on. |
<collinear>
Constraint sketch: collinear lines.
<concentric>
Constraint sketch: concentric arcs/circles.
<horizontal>
Constraint sketch: horizontal.
a) or two points (a, b) horizontal.<vertical>
Constraint sketch: vertical.
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).| Prop | Type | Description |
|---|---|---|
| about | Ref<PointHandle | LineHandle> | |
| axis | "x" | "y" |
<midpoint>
Constraint sketch: midpoint.
point at the middle of line of.| Prop | Type | Description |
|---|---|---|
| point* | PointId | |
| of* | Ref<LineHandle> |
<onCurve>
Constraint sketch: point on curve.
point on curve curve (line: the infinite line; arc: its circle).| Prop | Type | Description |
|---|---|---|
| point* | PointId | |
| curve* | Ref<LineHandle | Round> |
<fix>
Constraint sketch: fix a point.
x/y, or where it is drawn).| Prop | Type | Description |
|---|---|---|
| point | PointId | |
| a | PointId | |
| x | number | |
| y | number |
<mirrorEntities>
Constraint sketch: mirrored, constrained copies of entities.
' ("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"]} />| Prop | Type | Description |
|---|---|---|
| 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.
"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"]} />| Prop | Type | Description |
|---|---|---|
| center* | PointId | The point to turn about. |
| count* | number | Number of instances, the original included. |
| angle | number | Total angle, degrees: 360 (default) spaces them evenly; less puts the last at angle. |
| of* | Refs<LineHandle | ArcHandle | CircleHandle | SplineHandle> | Entities to copy. |