docs / Start a shape

Start a shape

The first call in any model: a solid primitive, or a 2D profile to extrude.

A primitive gives you a solid straight away; a closed path gives you a profile to extrude. color() takes a role token or a hex string.

const plate = box(60, 40, 8);

const rib = path()
  .moveTo(0, 0)
  .lineTo(60, 0)
  .lineTo(60, 14)
  .lineTo(0, 4)
  .close()
  .extrude(6)
  .translate(0, 12, 8);

return plate.union(rib).color('frame');
JavaScript is off — the listing above is the whole example.

Calls

CallWhat it does
box(x, y, z, centered?, opts?) => ShapeAxis-aligned box.
cylinder(h, r, segments?, opts?) => ShapeZ-axis cylinder centred on the Z axis in X/Y; bottom on the XY plane (spans z = 0..h), radius r.
sphere(r) => ShapeSphere centered at the origin, radius r.
torus(majorR: number, minorR: number, segments?: number) => ShapeSolid torus centered on world origin, axis along world +Z.
spring({ length, coilRadius, wireRadius, turns, axis?, pointsPerTurn?, endStyle?, segments? }) => ShapeBuild a helical spring as a circular wire profile swept along a smooth B-spline helix spine, producing one continuous watertight solid.
threadedRod({ spec: string, length: number, chamfer?: boolean | number, cosmetic?: boolean, clearance?: number }) => ShapeA real ISO metric EXTERNAL thread (60° basic profile, right-hand) along +Z from z = 0 to length; the ridge centre crosses +X at every z = k·pitch, so a modelled threadedHole whose entry face is on a whole pitch mates in phase.
isoThread(spec: string) => { spec, diameter, pitch, coarse, standard, pitchDiameter, minorDiameter, rootDiameter, tapDrill, threadDepth }Resolve an ISO metric thread designation.
spurGear({ module, teeth, faceWidth, pressureAngle?, bore?, backlash? }) => ShapeBuild an involute spur gear as ONE manifold solid.
internalSpurGear({ module, teeth, faceWidth, pressureAngle?, backlash?, rimThickness?, profileShift? }) => ShapeBuild an involute INTERNAL / ring gear as ONE manifold solid: outer rim minus a bore whose flanks are the external spur profile mirrored through the pitch circle.
ringGear({ module, teeth, faceWidth, pressureAngle?, backlash?, rimThickness?, profileShift? }) => ShapeAlias of internalSpurGear — involute internal / ring gear.
internalGear({ module, teeth, faceWidth, pressureAngle?, backlash?, rimThickness?, profileShift? }) => ShapeAlias of internalSpurGear — involute internal gear.
planetaryToothCompatibility({ sunTeeth, planetTeeth, ringTeeth }) => voidValidate coaxial planetary tooth counts: throws feature.invalid-args unless ringTeeth === sunTeeth + 2·planetTeeth (same module and pressure angle assumed).
extrudeRect(w, h, height, opts?) => ShapeExtrude a w-by-h rectangle (XY, centred on the origin) by height along Z (spans z = 0..height).
extrudeCircle(r, height, opts?) => ShapeExtrude a radius-r circle (XY, centred on the origin) by height along Z (spans z = 0..height).
extrudePolygon(points, depth, opts?) => ShapeExtrude a 2D polygon (array of [x, y] points; coordinates and depth accept ParamRefs) by depth along Z.
extrudeRoundedRect(width, height, radius, depth, opts?) => ShapeExtrude a rounded rectangle (corner radius) by depth.
filletPolygon(points: [number, number][], radius, opts?: { segments?: number }) => [number, number][]Round every corner of a closed 2D polygon with tangent arcs and return points for extrudePolygon / the prism helpers.
prismSide(points: [number, number][], halfY?: number) => ShapeSide-view mask prism: points are (station s, height z), extruded through Y from -halfY to +halfY (default 1200).
prismSideY(points: [number, number][], y0: number, y1: number) => ShapeSide-view mask prism on one side only: points are (s, z), extruded through Y from y0 to y1 (y1 > y0).
prismFront(points: [number, number][], x0: number, x1: number) => ShapeFront-view mask prism: points are (Y, Z), extruded along X from x0 to x1.
prismPlan(points: [number, number][], z0: number, z1: number) => ShapePlan-view mask prism: points are (X, Y), extruded along Z from z0 to z1.
sheetMetal(profile: Sketch, { thickness, kFactor, faceLabels? }) => ShapeBuild a sheet-metal body from a closed planar Sketch.
sdf : { sphere(r), box(size), cylinder(r, h), torus(R, r), smoothBlend(a, b, k), materialize(field, opts?), bind(name, field) }SDF authoring namespace (W2.3 slice-1).
path() => PathBuilderStart a 2D path: chain moveTo / lineTo / arcs / .close() to get a Sketch.
PathBuilder.moveTo(x: Editable<number>, y: Editable<number>) => PathBuilderStart the path at (x, y).
PathBuilder.lineTo(x: Editable<number>, y: Editable<number>) => PathBuilderAdd a straight line segment to (x, y).
PathBuilder.close() => SketchClose the path; returns a Sketch that can be extruded/revolved/swept.
PathBuilder.label(name: string) => PathBuilderTag the previous segment so it can be referenced later in fillet/chamfer/shell as {face: name}.
PathBuilder.circle(cx: Editable<number>, cy: Editable<number>, r: Editable<number>, segments?: number) => SketchClosed circle profile centered at (cx, cy) with radius r.
PathBuilder.tangentArc(x: Editable<number>, y: Editable<number>) => PathBuilderArc continuing tangent from the previous segment to (x, y).
PathBuilder.threePointsArc(x: Editable<number>, y: Editable<number>, midX: Editable<number>, midY: Editable<number>) => PathBuilderArc through start, midpoint, and end.
PathBuilder.sagittaArc(x: Editable<number>, y: Editable<number>, sagitta: Editable<number>) => PathBuilderArc by chord + perpendicular bulge height.
PathBuilder.bulgeArc(x: Editable<number>, y: Editable<number>, bulge: Editable<number>) => PathBuilderArc by chord + DXF bulge factor (tan(angle/4)).
PathBuilder.radiusArc(x: Editable<number>, y: Editable<number>, radius: Editable<number>) => PathBuilderArc by chord + explicit radius.
PathBuilder.tangentCircle(entities: TangentEntity2D[], opts?: { radius?: Editable<number>; near?: [Editable<number>, Editable<number>] }) => SketchClosed circle tangent to other 2D geometry.
PathBuilder.tangentLine(a: TangentEntity2D, b: TangentEntity2D, opts?: { near?: [Editable<number>, Editable<number>] }) => PathBuilderStraight segment along the line TANGENT to two circles — the belt/pulley move.
PathBuilder.smoothSpline(x: Editable<number>, y: Editable<number>) => PathBuilderC1-smooth spline segment from current position to (x, y); inherits start tangent from prior segment.
PathBuilder.spline(points: Array<[Editable<number>, Editable<number>]>, opts?: { tension?: Editable<number> }) => PathBuilderNURBS Slice D — N-waypoint B-spline interpolation.
PathBuilder.nurbsSegment(controlPoints: Array<[Editable<number>, Editable<number>]>, opts?: { degree?: number; weights?: number[]; knots?: number[] }) => PathBuilderNURBS Slice D — explicit B-spline segment defined by a control polygon.
PathBuilder.bezierTo(c1: [Editable<number>, Editable<number>], c2: [Editable<number>, Editable<number>], end: [Editable<number>, Editable<number>]) => PathBuilderCubic Bézier from the current pen via control points c1, c2 to end (SVG C).
PathBuilder.quadraticTo(c: [Editable<number>, Editable<number>], end: [Editable<number>, Editable<number>]) => PathBuilderQuadratic Bézier from the current pen via control point c to end (SVG Q).
hermiteG2(a: { point: Vec3; tangent: Vec3; curvature?: Vec3 }, b: { point: Vec3; tangent: Vec3; curvature?: Vec3 }) => Curve3DQuintic Hermite Curve3D that interpolates the two endpoints with matching positions, first derivatives (tangents), and second derivatives (curvatures).
PathBuilder.hermiteG2(a: HermiteEndpoint2D, b: HermiteEndpoint2D) => PathBuilderNURBS Slice D — 2D quintic-Hermite transition between two endpoints, each with prescribed point + first derivative (tangent) + optional second derivative (curvature).
Shape.sectionSketch(plane: 'xy' | 'xz' | 'yz' | { plane, offset? } | { origin, normal }, opts?: { curveTolerance? }) => Promise<Sketch>AWAIT THIS — returns Promise<Sketch>; chaining a Sketch method (e.g.
Shape.faceSketch(face: FaceSelector | string, opts?: { curveTolerance? }) => Promise<Sketch>AWAIT THIS — returns Promise<Sketch>; chaining a Sketch method (e.g.
Shape.silhouette(direction?: [number, number, number], opts?: { curveTolerance? }) => Promise<Sketch>AWAIT THIS — returns Promise<Sketch>; chaining a Sketch method (e.g.