Skip to content

Vibe coding a plugin? Teach your agent Modlumi first. Works with Claude Code, Codex, Cursor and more.

Face

A planar face bounded by one outer loop and any number of hole loops.

readonly area: number

Area in the face’s own context, in square meters.


readonly bounds: BoundingBox | null

The element’s bounds in its context’s coordinates, or null when it has no geometry. A group’s or instance’s bounds enclose its transformed contents and may be a little larger than they are.

DrawingElement.bounds


readonly entityId: number

Identifier that stays the same for the entity’s lifetime, including across undo and redo.

DrawingElement.entityId


hidden: boolean

The element’s own hidden flag; assign inside Model.operation. Hidden ancestors are not taken into account; use Model.isDrawingElementVisible for that.

DrawingElement.hidden


readonly isDeleted: boolean

Whether the entity was deleted, for example by an edit or by undo.

DrawingElement.isDeleted


readonly isValid: boolean

Whether the entity still exists in the model.

DrawingElement.isValid


readonly loops: readonly Loop[]

All boundary loops: the outer loop and every hole.


material: Material | null

The material both sides show, or null for the default. Assign a material of this model, or null, inside Model.operation.


readonly normal: Vector3d | null

Unit front normal in the face’s own context, or null for a degenerate face.


readonly outerLoop: Loop

The outer boundary loop.


readonly triangles: readonly readonly [Point3d, Point3d, Point3d][]

Triangles that cover the face, holes left open, in the face’s own context, as Modlumi draws it. Each runs counterclockwise seen from the front.


readonly type: "Face"

The concrete class name, for narrowing unions such as AnyElement.

DrawingElement.type


visible: boolean

The inverse of hidden; assign inside Model.operation.

DrawingElement.visible

get layer(): Layer | null

The layer the element is on, or null for the default layer; assign inside Model.operation. A hidden layer hides the element whatever hidden says. Needs the "layers" feature.

Layer | null

set layer(value): void

Layer | null

void

DrawingElement.layer


get uvTransform(): readonly number[] | null

How a texture is placed on the face, as SketchUp files store it: a row-major 3×3 projective matrix in inches, or null when the texture follows the face’s default projection. The row vector [u, v, 1] of a texture position in inches times the matrix gives [x, y, w], and [x / w, y / w] is the point along the face’s default texture axes. Assign nine numbers, or null to reset the placement, inside Model.operation. Assigning needs the "texturePositioning" feature.

readonly number[] | null

set uvTransform(value): void

readonly number[] | null

void

extrude(distance): Face | null

Extrudes the face by a signed distance in meters, like the Extrude tool. Positive distances follow normal. Call it inside Model.operation.

Returns the cap face, the same face when distance is zero, or null when the extrusion cuts through an opposite face. Other faces may be replaced, so keep the returned cap for further edits. Throws ModelError when the distance goes beyond the first parallel opposite face or the geometry isn’t supported.

number

Face | null


positionTexture(pins): void

Places the face’s texture so that each pin’s point, in the face’s own context, shows the pin’s texture coordinates, in repeats of the material’s image (one meter without an image). One pin moves the texture, two also turn and scale it, three shear it and four distort it in perspective, like the pins of the Position Texture tool. Points are projected onto the face’s plane. Call it inside Model.operation. Throws ModelError for more than four pins, or pins on top of each other or in a line. Needs the "texturePositioning" feature.

// Run the wood grain along the face's first edge.
const [a, b] = face.outerLoop.edgeUses[0].edge.vertices.map((v) => v.position);
model.operation("Align grain", () =>
face.positionTexture([{ point: a, uv: [0, 0] }, { point: b, uv: [1, 0] }]));

Iterable<{ point: Point3dLike; uv: readonly [number, number]; }>

void


reverse(): void

Swaps the face’s front and back sides, which flips normal. The material, which both sides show, stays. Call it inside Model.operation.

void


sweep(path): void

Sweeps the face along a path of two or more points in the face’s own context, like the Sweep tool. Repeat the first point at the end to close the path; a closed path around an axis through the face’s vertices revolves the face. Call it inside Model.operation.

The swept surface replaces this face, which becomes deleted. Throws ModelError when the path or the resulting geometry isn’t supported.

Iterable<Point3dLike>

void


toJSON(): object

JSON.stringify writes the entity as its type and entityId, plus its name when it has one, such as { "type": "Group", "entityId": 12, "name": "Wheel" }.

object

entityId: number

optional name?: string

type: "Material" | "Vertex" | "Edge" | "Face" | "Loop" | "EdgeUse" | "Curve" | "ArcCurve" | "ComponentDefinition" | "ComponentInstance" | "Group" | "Layer" | "Guide" | "Text" | "LinearDimension" | "SectionPlane"

DrawingElement.toJSON


transformedArea(transformation): number

The face’s area after a transformation, such as a scaled instance’s, in square meters.

Transformation

number


uvAt(point): readonly [number, number]

The texture coordinates a point of the face’s plane, in its own context, shows: [u, v] in repeats of the material’s image (or meters without an image), with v growing toward the image’s top. Needs the "texturePositioning" feature.

Point3dLike

readonly [number, number]