meshEdits.extrude

A copy of a polygon mesh with chosen faces pushed along their normals, each joined to its old edges by side walls.

GeometricSince 0.16.0

Usage

TypeScript
MeshEdits.extrude(geometry: Geometry | VerbValue, params?: MeshExtrudeParams): Result<VerbValue>

Parameters

  • geometryGeometry | VerbValue

    Polygon geometry; the input is not modified.

    Required

  • params.facesnumber[]

    The faces to push, by index; omit for every face. Default every face.

  • params.distancenumber

    How far to push; negative pushes against the normal, 0 makes zero-height walls. Default 1. In model.

  • params.scopestring

    The host’s node id, for minted ids. Default none: minted under 'extrude' with minter 0 (untrusted).

Returns

Ok with a VerbValue (the caller frees it): each chosen face moved to distance along its normal (the cap), one quad wall per edge from the old corners to the new, the other faces as they were; data has points and faces.

Errors

Guarantees

  • each chosen n-gon adds n points and n faces; the rest keep their points, corners and order
  • every new point lies at distance from its base point, along its face’s normal
  • carried ids are unchanged and new ids are unique; lineage records each top point as generated from its base point and each wall from its face
  • the same input and parameters give the same bytes (geometryContentHash), natively and in WASM
  • The same result on every machine.

Example

TypeScript
const r = MeshEdits.extrude(Mesh.box().value, { faces: [1], distance: 0.5 })
r.ok || r.diagnostics[0].code // → 12 points and 10 faces once loadGeometryKernel() has run

See also