TrueForm Example Gallery

Examples are grouped by workflow. Click an image for a larger preview, or click a title to jump to the matching code snippet.

Example Code

Extrude (DSL)

docs/reference/dsl/examples/features.md -> Extrude

const examplePart = part("example-extrude", [
  extrude("base", profileRect(80, 50), 12, "body:main"),
]);
Back to gallery

Selection Ledger Extrude Review (DSL)

docs/reference/dsl/examples/features.md -> Extrude

const examplePart = part("example-extrude", [
  extrude("base", profileRect(80, 50), 12, "body:main"),
]);
Back to gallery

Surface (DSL)

docs/reference/dsl/examples/features.md -> Surface

const rect = sketchRectCorner("rect-1", [0, 0], 40, 20);
const sketch = sketch2d(
  "sketch-face",
  [{ name: "profile:rect", profile: profileSketchLoop(["rect-1"]) }],
  { entities: [rect] }
);

const examplePart = part("example-surface", [
  sketch,
  surface("face-1", profileRef("profile:rect"), "surface:main"),
]);
Back to gallery

Extrude (Surface) (DSL)

docs/reference/dsl/examples/features.md -> Extrude (Surface)

const spline = sketchSpline("spline-1", [
  [-30, -12],
  [-10, 18],
  [8, -6],
  [30, 16],
]);
const sketch = sketch2d(
  "sketch-extrude-surface",
  [{ name: "profile:open", profile: profileSketchLoop(["spline-1"], { open: true }) }],
  { entities: [spline] }
);

const examplePart = part("example-extrude-surface", [
  sketch,
  extrude("surface-extrude", profileRef("profile:open"), 18, "surface:wall", undefined, {
    mode: "surface",
  }),
]);
Back to gallery

Curve Intersect (Staging) (DSL)

docs/reference/dsl/examples/features.md -> Curve Intersect (Staging)

const line = sketchLine("line-1", [10, 0], [10, 16]);
const sketch = sketch2d(
  "sketch-curve-intersect",
  [{ name: "profile:wall", profile: profileSketchLoop(["line-1"], { open: true }) }],
  { plane: planeDatum("sketch-plane"), entities: [line] }
);

const examplePart = part("example-curve-intersect", [
  datumPlane("sketch-plane", "+Y"),
  sketch,
  revolve(
    "surface-revolve",
    profileRef("profile:wall"),
    "+Z",
    "full",
    "surface:cylinder",
    { mode: "surface" }
  ),
  datumPlane("cut-plane", axisVector([0, 1, 1]), [0, 0, 8]),
  plane("cut-face", 80, 80, "surface:cut", {
    plane: planeDatum("cut-plane"),
    deps: ["cut-plane"],
  }),
  curveIntersect(
    "curve-intersect-1",
    selectorNamed("surface:cylinder"),
    selectorNamed("surface:cut"),
    "curve:main"
  ),
]);
Back to gallery

Revolve (DSL)

docs/reference/dsl/examples/features.md -> Revolve

const examplePart = part("example-revolve", [
  revolve(
    "ring-revolve",
    profileRect(3, 6, [1.5, 3, 0]),
    "+X",
    "full",
    "body:main"
  ),
]);
Back to gallery

Selection Ledger Revolve Review (DSL)

docs/reference/dsl/examples/features.md -> Revolve

const examplePart = part("example-revolve", [
  revolve(
    "ring-revolve",
    profileRect(3, 6, [1.5, 3, 0]),
    "+X",
    "full",
    "body:main"
  ),
]);
Back to gallery

Loft (DSL)

docs/reference/dsl/examples/features.md -> Loft

const examplePart = part("example-loft", [
  loft(
    "loft-1",
    [
      profileCircle(10, [0, 0, 0]),
      profilePoly(6, 16, [0, 0, 24], Math.PI / 6),
    ],
    "body:main"
  ),
]);
Back to gallery

Sweep (Surface) (DSL)

docs/reference/dsl/examples/features.md -> Sweep

const line = sketchLine("line-1", [-8, 0], [8, 0]);
const sketch = sketch2d(
  "sketch-sweep",
  [
    {
      name: "profile:line",
      profile: profileSketchLoop(["line-1"], { open: true }),
    },
  ],
  { entities: [line] }
);
const path = pathPolyline([
  [0, 0, 0],
  [0, 0, 20],
  [15, 0, 30],
]);

const examplePart = part("example-sweep", [
  sketch,
  sweep("sweep-1", profileRef("profile:line"), path, "surface:main", undefined, {
    mode: "surface",
  }),
]);
Back to gallery

Pipe (DSL)

docs/reference/dsl/examples/features.md -> Pipe

const examplePart = part("example-pipe", [
  pipe("pipe-1", "+Z", 60, 24, 18, "body:main"),
]);
Back to gallery

Helix Path (DSL)

docs/reference/dsl/examples/features.md -> Helix Path

const examplePart = part("example-path-helix", [
  pipeSweep(
    "helix-pipe",
    pathHelix({
      origin: [0, 0, 0],
      axis: [0, 0, 1],
      radius: 12,
      pitch: 12,
      turns: 1.5,
      segmentsPerTurn: 24,
    }),
    4,
    undefined,
    "body:main"
  ),
]);
Back to gallery

Spiral Path (DSL)

docs/reference/dsl/examples/features.md -> Spiral Path

const examplePart = part("example-path-spiral", [
  pipeSweep(
    "spiral-pipe",
    pathSpiral({
      origin: [0, 0, 0],
      normal: [0, 0, 1],
      startRadius: 10,
      endRadius: 36,
      turns: 2,
      segmentsPerTurn: 60,
    }),
    4,
    undefined,
    "body:main"
  ),
]);
Back to gallery

Sweep (Arbitrary Sketch) (DSL)

docs/reference/dsl/examples/features.md -> Sweep (Arbitrary Sketch)

const l1 = sketchLine("line-1", [-5, -4], [5, -4]);
const l2 = sketchLine("line-2", [5, -4], [0, 6]);
const l3 = sketchLine("line-3", [0, 6], [-5, -4]);
const sketch = sketch2d(
  "sketch-sweep-profile",
  [{ name: "profile:loop", profile: profileSketchLoop(["line-1", "line-2", "line-3"]) }],
  { entities: [l1, l2, l3] }
);
const path = pathSpline(
  [
    [0, 0, 0],
    [0, 0, 20],
    [14, 8, 34],
    [30, 0, 48],
  ],
  { degree: 3 }
);

const examplePart = part("example-sweep-sketch", [
  sketch,
  sweep("sweep-sketch-1", profileRef("profile:loop"), path, "body:main", undefined, {
    orientation: "frenet",
  }),
]);
Back to gallery

Hole (DSL)

docs/reference/dsl/examples/features.md -> Hole

const examplePart = part("example-hole", [
  extrude("base", profileRect(90, 50), 12, "body:main"),
  hole(
    "hole-1",
    selectorFace([predPlanar()], [rankMaxZ()]),
    "-Z",
    14,
    "throughAll",
    { deps: ["base"] }
  ),
]);
Back to gallery

Hole (Counterbore + Countersink) (DSL)

docs/reference/dsl/examples/features.md -> Hole

const examplePart = part("example-hole", [
  extrude("base", profileRect(90, 50), 12, "body:main"),
  hole(
    "hole-1",
    selectorFace([predPlanar()], [rankMaxZ()]),
    "-Z",
    14,
    "throughAll",
    { deps: ["base"] }
  ),
]);
Back to gallery

Fillet (DSL)

docs/reference/dsl/examples/features.md -> Fillet

const examplePart = part("example-fillet", [
  extrude("cyl", profileCircle(14), 28, "body:main"),
  fillet(
    "edge-fillet",
    selectorEdge([predCreatedBy("cyl")], [rankMaxZ()]),
    3,
    ["cyl"]
  ),
]);
Back to gallery

Selection Ledger Fillet Edge Review (DSL)

docs/reference/dsl/examples/features.md -> Fillet

const examplePart = part("example-fillet", [
  extrude("cyl", profileCircle(14), 28, "body:main"),
  fillet(
    "edge-fillet",
    selectorEdge([predCreatedBy("cyl")], [rankMaxZ()]),
    3,
    ["cyl"]
  ),
]);
Back to gallery

Selection Ledger Fillet Seam Review (DSL)

docs/reference/dsl/examples/features.md -> Fillet

const examplePart = part("example-fillet", [
  extrude("cyl", profileCircle(14), 28, "body:main"),
  fillet(
    "edge-fillet",
    selectorEdge([predCreatedBy("cyl")], [rankMaxZ()]),
    3,
    ["cyl"]
  ),
]);
Back to gallery

Variable Fillet (DSL)

docs/reference/dsl/examples/features.md -> Variable Fillet

const examplePart = part("example-variable-fillet", [
  extrude("base", profileCircle(12), 16, "body:main"),
  variableFillet(
    "fillet-var",
    selectorNamed("body:main"),
    [
      { edge: selectorEdge([predCreatedBy("base")], [rankMaxZ()]), radius: 1.8 },
      { edge: selectorEdge([predCreatedBy("base")], [rankMinZ()]), radius: 0.9 },
    ],
    "body:filleted",
    ["base"]
  ),
]);
Back to gallery

Chamfer (DSL)

docs/reference/dsl/examples/features.md -> Chamfer

const examplePart = part("example-chamfer", [
  extrude("block", profileRect(40, 26), 12, "body:main"),
  chamfer(
    "edge-chamfer",
    selectorEdge([predCreatedBy("block")]),
    2,
    ["block"]
  ),
]);
Back to gallery

Selection Ledger Chamfer Edge Review (DSL)

docs/reference/dsl/examples/features.md -> Chamfer

const examplePart = part("example-chamfer", [
  extrude("block", profileRect(40, 26), 12, "body:main"),
  chamfer(
    "edge-chamfer",
    selectorEdge([predCreatedBy("block")]),
    2,
    ["block"]
  ),
]);
Back to gallery

Selection Ledger Chamfer Join Review (DSL)

docs/reference/dsl/examples/features.md -> Chamfer

const examplePart = part("example-chamfer", [
  extrude("block", profileRect(40, 26), 12, "body:main"),
  chamfer(
    "edge-chamfer",
    selectorEdge([predCreatedBy("block")]),
    2,
    ["block"]
  ),
]);
Back to gallery

Selection Ledger Multi-Feature Audit (DSL)

docs/reference/dsl/examples/features.md -> Fillet

const examplePart = part("example-fillet", [
  extrude("cyl", profileCircle(14), 28, "body:main"),
  fillet(
    "edge-fillet",
    selectorEdge([predCreatedBy("cyl")], [rankMaxZ()]),
    3,
    ["cyl"]
  ),
]);
Back to gallery

Variable Chamfer (DSL)

docs/reference/dsl/examples/features.md -> Variable Chamfer

const examplePart = part("example-variable-chamfer", [
  extrude("base", profileCircle(12), 16, "body:main"),
  variableChamfer(
    "chamfer-var",
    selectorNamed("body:main"),
    [
      { edge: selectorEdge([predCreatedBy("base")], [rankMaxZ()]), distance: 1.2 },
      { edge: selectorEdge([predCreatedBy("base")], [rankMinZ()]), distance: 0.6 },
    ],
    "body:chamfered",
    ["base"]
  ),
]);
Back to gallery

Boolean Union (DSL)

docs/reference/dsl/examples/features.md -> Boolean Union

const examplePart = part("example-boolean", [
  extrude("base", profileCircle(18), 12, "body:base"),
  extrude("tool", profileRect(20, 12, [16, 0, 0]), 12, "body:tool"),
  booleanOp(
    "union-1",
    "union",
    selectorNamed("body:base"),
    selectorNamed("body:tool"),
    "body:main",
    ["base", "tool"]
  ),
]);
Back to gallery

Boolean Subtract (DSL)

docs/reference/dsl/examples/features.md -> Boolean Subtract

const examplePart = part("example-boolean-cut", [
  extrude("base", profileRect(70, 36), 14, "body:base"),
  extrude("tool", profileCircle(10, [10, 0, 0]), 14, "body:tool"),
  cut("subtract-1", selectorNamed("body:base"), selectorNamed("body:tool"), "body:main"),
]);
Back to gallery

Boolean Intersect (DSL)

docs/reference/dsl/examples/features.md -> Boolean Intersect

const examplePart = part("example-boolean-intersect", [
  extrude("a", profileCircle(16), 26, "body:a"),
  extrude("b", profileCircle(16, [12, 0, 0]), 26, "body:b"),
  intersect("intersect-1", selectorNamed("body:a"), selectorNamed("body:b"), "body:main"),
]);
Back to gallery

Pattern (Feature/Body) (DSL)

docs/reference/dsl/examples/features.md -> Pattern (Feature/Body)

const examplePart = part("example-pattern", [
  extrude("seed", profileRect(10, 10), 8, "body:seed"),
  patternLinear(
    "pattern-1",
    selectorFace([predCreatedBy("seed"), predPlanar(), predNormal("+Z")], [rankMaxZ()]),
    [18, 0],
    [4, 1],
    {
      source: selectorNamed("body:seed"),
      result: "body:main",
      deps: ["seed"],
    }
  ),
]);
Back to gallery

Pattern (Circular) (DSL)

docs/reference/dsl/examples/features.md -> Pattern (Circular)

const examplePart = part("example-pattern-circular", [
  extrude("center", profileCircle(8), 8, "body:center"),
  extrude("seed", profileRect(18, 6, [13, 0, 0]), 8, "body:seed"),
  patternCircular(
    "pattern-circular-1",
    selectorFace([predCreatedBy("center"), predPlanar(), predNormal("+Z")], [rankMaxZ()]),
    "+Z",
    6,
    {
      source: selectorNamed("body:seed"),
      result: "body:pattern",
      deps: ["center", "seed"],
    }
  ),
  booleanOp(
    "pattern-circular-union",
    "union",
    selectorNamed("body:center"),
    selectorNamed("body:pattern"),
    "body:main"
  ),
]);
Back to gallery

Feature Array (DSL)

docs/reference/dsl/examples/generators.md -> Feature Array

const baseThickness = 6;
const bossHeight = 8;
const bossSize = 16;

const base = extrude(
  "base",
  profileRect(120, 80, [0, 0, 0]),
  baseThickness,
  "body:base"
);

const cubes = featureArray(
  { count: [3, 2], spacing: [36, 36], origin: [-36, -18, baseThickness] },
  ({ index, offset }) =>
    extrude(
      `cube-${index}`,
      profileRect(bossSize, bossSize, offset),
      bossHeight,
      `body:cube-${index}`
    )
);

const unions = [];
let current = "body:base";
for (let i = 0; i < cubes.length; i++) {
  const result = i === cubes.length - 1 ? "body:main" : `body:union-${i}`;
  unions.push(
    booleanOp(
      `union-${i}`,
      "union",
      selectorNamed(current),
      selectorNamed(`body:cube-${i}`),
      result
    )
  );
  current = result;
}

const examplePart = part("example-feature-array", [base, ...cubes, ...unions]);
Back to gallery

Tolerancing (PMI) (DSL)

docs/reference/dsl/examples/tolerancing.md -> Tolerancing PMI Sidecar

import { dsl, buildPart } from "trueform";
import { exportStepAp242WithPmi } from "trueform/export";

const topFace = dsl.selectorFace(
  [dsl.predPlanar(), dsl.predNormal("+Z")],
  [dsl.rankMaxZ()]
);
const bottomFace = dsl.selectorFace(
  [dsl.predPlanar(), dsl.predNormal("-Z")],
  [dsl.rankMinZ()]
);

const sideFace = dsl.selectorFace([dsl.predPlanar(), dsl.predNormal("+X")]);

const base = dsl.extrude(
  "base",
  dsl.profileRect(120, 70),
  12,
  "body:main"
);
const hole = dsl.hole("hole-1", topFace, "-Z", 10, "throughAll", {
  deps: ["base"],
});
const holeFace = dsl.selectorFace(
  [dsl.predCreatedBy("hole-1")],
  [dsl.rankMaxArea()]
);

const part = dsl.part("example-tolerancing", [base, hole], {
  datums: [
    dsl.datumFeature("datum-A", "A", dsl.refSurface(bottomFace)),
    dsl.datumFeature("datum-B", "B", dsl.refSurface(sideFace)),
  ],
  constraints: [
    dsl.flatnessConstraint("flat-top", dsl.refSurface(topFace), 0.05, {
      requirement: "req-flat-top",
    }),
    dsl.parallelismConstraint(
      "parallel-top",
      dsl.refSurface(topFace),
      0.08,
      [dsl.datumRef("datum-A")]
    ),
    dsl.perpendicularityConstraint(
      "perp-side",
      dsl.refSurface(sideFace),
      0.1,
      [dsl.datumRef("datum-A")]
    ),
    dsl.positionConstraint(
      "pos-hole",
      dsl.refAxis(holeFace),
      0.2,
      [dsl.datumRef("datum-A"), dsl.datumRef("datum-B")],
      { zone: "diameter", modifiers: ["MMC"] }
    ),
    dsl.sizeConstraint("size-hole", dsl.refAxis(holeFace), {
      nominal: 10,
      tolerance: 0.1,
      modifiers: ["MMC"],
    }),
    dsl.surfaceProfileConstraint("profile-top", dsl.refSurface(topFace), 0.03, {
      referenceFrame: dsl.refFrame(topFace),
      requirement: "req-profile-top",
      capabilities: ["mill-3axis"],
    }),
  ],
});

// After building with a backend:
// const { step, pmi } = exportStepAp242WithPmi(backend, body, part, { schema: "AP242" });
Back to gallery

Spline Array (DSL)

docs/reference/dsl/examples/generators.md -> Spline Array

const baseThickness = 6;
const bossHeight = 8;
const bossSize = 12;

const base = extrude(
  "base",
  profileRect(160, 90, [0, 0, 0]),
  baseThickness,
  "body:base"
);

const bosses = featureArrayAlongSpline(
  {
    points: [
      [-60, -20, baseThickness],
      [-30, 25, baseThickness],
      [20, -10, baseThickness],
      [60, 30, baseThickness],
    ],
    count: 7,
    mode: "spline",
  },
  ({ index, offset }) =>
    extrude(
      `boss-${index}`,
      profileRect(bossSize, bossSize, offset),
      bossHeight,
      `body:boss-${index}`
    )
);

const unions = [];
let current = "body:base";
for (let i = 0; i < bosses.length; i++) {
  const result = i === bosses.length - 1 ? "body:main" : `body:union-${i}`;
  unions.push(
    booleanOp(
      `union-${i}`,
      "union",
      selectorNamed(current),
      selectorNamed(`body:boss-${i}`),
      result
    )
  );
  current = result;
}

const examplePart = part("example-spline-array", [base, ...bosses, ...unions]);
Back to gallery

Circular Array (DSL)

docs/reference/dsl/examples/generators.md -> Circular Array

const baseThickness = 6;
const bossHeight = 8;
const bossRadius = 6;

const base = extrude(
  "base",
  profileRect(140, 100, [0, 0, 0]),
  baseThickness,
  "body:base"
);

const bosses = featureCircularArray(
  { count: 8, radius: 36, center: [0, 0, baseThickness], units: "deg" },
  ({ index, offset }) =>
    extrude(
      `boss-${index}`,
      profileCircle(bossRadius, offset),
      bossHeight,
      `body:boss-${index}`
    )
);

const unions = [];
let current = "body:base";
for (let i = 0; i < bosses.length; i++) {
  const result = i === bosses.length - 1 ? "body:main" : `body:union-${i}`;
  unions.push(
    booleanOp(
      `union-${i}`,
      "union",
      selectorNamed(current),
      selectorNamed(`body:boss-${i}`),
      result
    )
  );
  current = result;
}

const examplePart = part("example-circular-array", [base, ...bosses, ...unions]);
Back to gallery

Radial Array (DSL)

docs/reference/dsl/examples/generators.md -> Radial Array

const baseThickness = 6;
const bossHeight = 8;
const bossSize = 10;

const base = extrude(
  "base",
  profileRect(160, 110, [0, 0, 0]),
  baseThickness,
  "body:base"
);

const bosses = featureRadialArray(
  {
    count: [6, 3],
    radiusStep: 18,
    radiusStart: 18,
    center: [0, 0, baseThickness],
    angleStep: 60,
    units: "deg",
  },
  ({ index, offset }) =>
    extrude(
      `boss-${index}`,
      profileRect(bossSize, bossSize, offset),
      bossHeight,
      `body:boss-${index}`
    )
);

const unions = [];
let current = "body:base";
for (let i = 0; i < bosses.length; i++) {
  const result = i === bosses.length - 1 ? "body:main" : `body:union-${i}`;
  unions.push(
    booleanOp(
      `union-${i}`,
      "union",
      selectorNamed(current),
      selectorNamed(`body:boss-${i}`),
      result
    )
  );
  current = result;
}

const examplePart = part("example-radial-array", [base, ...bosses, ...unions]);
Back to gallery

Mirror (DSL)

docs/reference/dsl/examples/features.md -> Mirror

const examplePart = part("example-mirror", [
  datumPlane("mirror-plane", "+X"),
  plane("mirror-plane-surface", 80, 52, "surface:mirror-plane", {
    plane: planeDatum("mirror-plane"),
  }),
  extrude("rib", profileRect(44, 12, [20, 0, 0]), 8, "body:rib"),
  extrude("boss", profileCircle(10, [34, 12, 0]), 16, "body:boss"),
  booleanOp(
    "half-union",
    "union",
    selectorNamed("body:rib"),
    selectorNamed("body:boss"),
    "body:half"
  ),
  mirror(
    "mirror-1",
    selectorNamed("body:half"),
    planeDatum("mirror-plane"),
    "body:mirror"
  ),
  booleanOp(
    "union-2",
    "union",
    selectorNamed("body:half"),
    selectorNamed("body:mirror"),
    "body:main"
  ),
]);
Back to gallery

Move Body (DSL)

docs/reference/dsl/examples/features.md -> Move Body

const examplePart = part("example-move-body", [
  extrude("base", profileRect(44, 20), 10, "body:base"),
  moveBody(
    "move-1",
    selectorNamed("body:base"),
    "body:moved",
    ["base"],
    {
      translation: [26, 0, 0],
      rotationAxis: "+Z",
      rotationAngle: Math.PI / 18,
      scale: 0.95,
      origin: [0, 0, 0],
    }
  ),
  booleanOp(
    "union-1",
    "union",
    selectorNamed("body:base"),
    selectorNamed("body:moved"),
    "body:main"
  ),
]);
Back to gallery

Delete Face (DSL)

docs/reference/dsl/examples/features.md -> Delete Face

const examplePart = part("example-delete-face", [
  extrude("base", profileRect(56, 32), 18, "body:base"),
  deleteFace(
    "delete-top",
    selectorNamed("body:base"),
    selectorFace([predCreatedBy("base"), predPlanar()], [rankMaxZ()]),
    "surface:main",
    ["base"],
    { heal: false }
  ),
]);
Back to gallery

Replace Face (DSL)

docs/reference/dsl/examples/features.md -> Replace Face

const examplePart = part("example-replace-face", [
  extrude("base", profileRect(56, 32), 18, "body:base"),
  plane("replace-tool", 56, 32, "surface:tool", {
    origin: [0, 0, 18],
    deps: ["base"],
  }),
  replaceFace(
    "replace-top",
    selectorNamed("body:base"),
    selectorFace([predCreatedBy("base"), predPlanar()], [rankMaxZ()]),
    selectorNamed("surface:tool"),
    "body:main",
    ["base", "replace-tool"],
    { heal: true }
  ),
]);
Back to gallery

Move Face (DSL)

docs/reference/dsl/examples/features.md -> Move Face

const examplePart = part("example-move-face", [
  extrude("base", profileRect(56, 32), 18, "body:base"),
  moveFace(
    "move-top",
    selectorNamed("body:base"),
    selectorFace([predCreatedBy("base"), predPlanar()], [rankMaxZ()]),
    "surface:main",
    ["base"],
    {
      translation: [0, 0, 2],
      heal: false,
    }
  ),
]);
Back to gallery

Draft (DSL)

docs/reference/dsl/examples/features.md -> Draft

const examplePart = part("example-draft", [
  extrude("base", profileRect(60, 40), 20, "body:base"),
  datumPlane("draft-neutral", "+Z"),
  draft(
    "draft-1",
    selectorNamed("body:base"),
    selectorFace([
      predCreatedBy("base"),
      predPlanar(),
      predNormal("+X"),
    ]),
    planeDatum("draft-neutral"),
    "+Z",
    Math.PI / 60,
    "body:main"
  ),
]);
Back to gallery

Thicken (DSL)

docs/reference/dsl/examples/features.md -> Thicken

const line = sketchLine("line-1", [10, 0], [10, 16]);
const sketch = sketch2d(
  "sketch-thicken",
  [{ name: "profile:open", profile: profileSketchLoop(["line-1"], { open: true }) }],
  { plane: planeDatum("sketch-plane"), entities: [line] }
);

const examplePart = part("example-thicken", [
  datumPlane("sketch-plane", "+Y"),
  sketch,
  revolve(
    "surface-revolve",
    profileRef("profile:open"),
    "+Z",
    "full",
    "surface:main",
    { mode: "surface" }
  ),
  thicken("thicken-1", selectorNamed("surface:main"), 4, "body:main"),
]);
Back to gallery

Unwrap (Box Net) (DSL)

docs/reference/dsl/examples/features.md -> Unwrap (Box Net)

const examplePart = part("example-unwrap-box", [
  extrude("base", profileRect(48, 32), 20, "body:main"),
  unwrap("unwrap-1", selectorNamed("body:main"), "surface:flat"),
]);
Back to gallery

Shell (DSL)

docs/reference/dsl/examples/features.md -> Shell

const topFace = selectorFace(
  [predCreatedBy("base"), predPlanar(), predNormal("+Z")],
  [rankMaxArea()]
);

const examplePart = part("example-shell", [
  extrude("base", profileRect(60, 40), 20, "body:base"),
  shell("shell-1", selectorNamed("body:base"), 2, "body:main", undefined, {
    direction: "inside",
    openFaces: [topFace],
  }),
]);
Back to gallery

Cosmetic Thread (DSL)

docs/reference/dsl/examples/tolerancing.md -> Cosmetic Thread

const target = refSurface(selectorFace([predCreatedBy("base")], [rankMaxArea()]));

const examplePart = part("example-thread-cosmetic", [
  extrude("base", profileCircle(10), 24, "body:main"),
], {
  cosmeticThreads: [
    cosmeticThread("thread-1", target, {
      designation: "M8x1.25-6H",
      internal: true,
      length: 12,
    }),
  ],
});
Back to gallery

Line (Sketch)

docs/reference/dsl/examples/sketches.md -> Line

sketchLine("line-1", [-40, -20], [40, 20]);
Back to gallery

Arc (Sketch)

docs/reference/dsl/examples/sketches.md -> Arc

sketchArc("arc-1", [30, 0], [0, 30], [0, 0], "ccw");
Back to gallery

Circle (Sketch)

docs/reference/dsl/examples/sketches.md -> Circle

sketchCircle("circle-1", [0, 0], 22);
Back to gallery

Ellipse (Sketch)

docs/reference/dsl/examples/sketches.md -> Ellipse

sketchEllipse("ellipse-1", [0, 0], 26, 12, { rotation: exprLiteral(20, "deg") });
Back to gallery

Rectangle (Center) (Sketch)

docs/reference/dsl/examples/sketches.md -> Rectangle (Center)

sketchRectCenter("rect-center", [0, 0], 60, 32, { rotation: exprLiteral(10, "deg") });
Back to gallery

Rectangle (Corner) (Sketch)

docs/reference/dsl/examples/sketches.md -> Rectangle (Corner)

sketchRectCorner("rect-corner", [-25, -12], 60, 30, { rotation: exprLiteral(-8, "deg") });
Back to gallery

Slot (Sketch)

docs/reference/dsl/examples/sketches.md -> Slot

sketchSlot("slot-1", [0, 0], 70, 16, { rotation: exprLiteral(12, "deg") });
Back to gallery

Polygon (Sketch)

docs/reference/dsl/examples/sketches.md -> Polygon

sketchPolygon("poly-1", [0, 0], 24, 6);
Back to gallery

Spline (Sketch)

docs/reference/dsl/examples/sketches.md -> Spline

sketchSpline("spline-1", [
  [-30, -10],
  [-10, 20],
  [10, 10],
  [30, -15],
]);
Back to gallery

Point (Sketch)

docs/reference/dsl/examples/sketches.md -> Point

sketchPoint("point-1", [0, 0]);
Back to gallery

Rectangle Array (Sketch)

docs/reference/dsl/examples/sketches.md -> Rectangle Array

sketchArray(
  { count: [3, 2], spacing: [28, 18], origin: [-28, -9] },
  ({ index, offset }) => sketchRectCenter(`rect-${index}`, offset, 18, 10)
);
Back to gallery