docs / Place & transform

Place & transform

Move a body into position, mirror it, or repeat it.

One boss, patterned around the hub axis. The count stays editable afterwards because the kernel records the pattern as a feature. cylinder() takes height first, then radius; the boss ring has to clear the hub radius or the copies end up inside it.

const hub = cylinder(12, 16);
const boss = cylinder(12, 5).translate(20, 0, 0);

return hub
  .union(boss.patternCircular({ count: 6, axis: [0, 0, 1] }))
  .color('frame');
JavaScript is off — the listing above is the whole example.

Calls

CallWhat it does
Shape.translate(x: Editable<number>, y: Editable<number>, z: Editable<number>) => ShapeTranslate by (x, y, z).
Shape.rotate(axis: [Editable<number>, Editable<number>, Editable<number>], degrees: Editable<number>, pivot?: [Editable<number>, Editable<number>, Editable<number>]) => ShapeRotate degrees around axis (vector); pivot defaults to origin.
Shape.rotateX(degrees: Editable<number>, pivot?: [Editable<number>, Editable<number>, Editable<number>]) => ShapeRotate degrees around the world X axis.
Shape.rotateY(degrees: Editable<number>, pivot?: [Editable<number>, Editable<number>, Editable<number>]) => ShapeRotate degrees around the world Y axis.
Shape.rotateZ(degrees: Editable<number>, pivot?: [Editable<number>, Editable<number>, Editable<number>]) => ShapeRotate degrees around the world Z axis.
Shape.transform(t: Transform) => ShapeApply an SE(3) Transform.
Shape.alongAxis(axis: [number, number, number]) => ShapeOrient this shape so its current +Z axis aligns with the given direction.
Shape.scale(factor: number | [number, number, number]) => ShapeScale this shape uniformly (single positive finite number) or per-axis (Vec3 — sx/sy/sz).
Shape.reflect(plane: 'xy' | 'xz' | 'yz' | { plane: 'xy' | 'xz' | 'yz'; offset: number }) => ShapeReflect (pure rigid-body transformation) across a cardinal plane or an offset parallel plane.
Sketch.reflect(axis: 'x' | 'y' | { axis: 'x' | 'y'; offset: number }) => SketchReflect this sketch's path across an axis, returning a new Sketch.
Shape.mirror(plane: 'xy' | 'xz' | 'yz' | { plane: 'xy' | 'xz' | 'yz'; offset: number }) => ShapeBoolean union of the source and its reflection across a cardinal plane.
Shape.patternLinear({ count, direction, spacing }) => ShapeRepeat this shape in a linear array.
Shape.patternGrid({ x: { count, direction, spacing }, y: { count, direction, spacing } }) => ShapeRepeat this shape in a two-axis grid.
Shape.patternCircular({ count, axis, angleDeg? }) => ShapeRepeat this shape around an axis.
Shape.recenter(opts?: { x?: boolean; y?: boolean; z?: boolean }) => Promise<Shape>Translate this Shape so its bounding-box center lands on the world origin, then return it for chaining.
Shape.seatOnFloor(opts?: { center?: boolean }) => Promise<Shape>Translate this Shape so it rests on the z = 0 floor (bbox min.z → 0), centered in x/y over the origin; returns it for chaining.