Face
A planar face bounded by one outer loop and any number of hole loops.
Extends
Section titled “Extends”Properties
Section titled “Properties”
readonlyarea:number
Area in the face’s own context, in square meters.
bounds
Section titled “bounds”
readonlybounds: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.
Inherited from
Section titled “Inherited from”entityId
Section titled “entityId”
readonlyentityId:number
Identifier that stays the same for the entity’s lifetime, including across undo and redo.
Inherited from
Section titled “Inherited from”hidden
Section titled “hidden”hidden:
boolean
The element’s own hidden flag; assign inside Model.operation. Hidden ancestors are not taken into account; use Model.isDrawingElementVisible for that.
Inherited from
Section titled “Inherited from”isDeleted
Section titled “isDeleted”
readonlyisDeleted:boolean
Whether the entity was deleted, for example by an edit or by undo.
Inherited from
Section titled “Inherited from”isValid
Section titled “isValid”
readonlyisValid:boolean
Whether the entity still exists in the model.
Inherited from
Section titled “Inherited from”
readonlyloops: readonlyLoop[]
All boundary loops: the outer loop and every hole.
material
Section titled “material”material:
Material|null
The material both sides show, or null for the default. Assign a material of this
model, or null, inside Model.operation.
normal
Section titled “normal”
readonlynormal:Vector3d|null
Unit front normal in the face’s own context, or null for a degenerate face.
outerLoop
Section titled “outerLoop”
readonlyouterLoop:Loop
The outer boundary loop.
triangles
Section titled “triangles”
readonlytriangles: 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.
readonlytype:"Face"
The concrete class name, for narrowing unions such as AnyElement.
Overrides
Section titled “Overrides”visible
Section titled “visible”visible:
boolean
The inverse of hidden; assign inside Model.operation.
Inherited from
Section titled “Inherited from”Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”Layer | null
Set Signature
Section titled “Set Signature”set layer(
value):void
Parameters
Section titled “Parameters”Layer | null
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”uvTransform
Section titled “uvTransform”Get Signature
Section titled “Get Signature”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.
Returns
Section titled “Returns”readonly number[] | null
Set Signature
Section titled “Set Signature”set uvTransform(
value):void
Parameters
Section titled “Parameters”readonly number[] | null
Returns
Section titled “Returns”void
Methods
Section titled “Methods”extrude()
Section titled “extrude()”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.
Parameters
Section titled “Parameters”distance
Section titled “distance”number
Returns
Section titled “Returns”Face | null
positionTexture()
Section titled “positionTexture()”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] }]));Parameters
Section titled “Parameters”Iterable<{ point: Point3dLike; uv: readonly [number, number]; }>
Returns
Section titled “Returns”void
reverse()
Section titled “reverse()”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.
Returns
Section titled “Returns”void
sweep()
Section titled “sweep()”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.
Parameters
Section titled “Parameters”Iterable<Point3dLike>
Returns
Section titled “Returns”void
toJSON()
Section titled “toJSON()”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" }.
Returns
Section titled “Returns”object
entityId
Section titled “entityId”entityId:
number
optionalname?:string
type:
"Material"|"Vertex"|"Edge"|"Face"|"Loop"|"EdgeUse"|"Curve"|"ArcCurve"|"ComponentDefinition"|"ComponentInstance"|"Group"|"Layer"|"Guide"|"Text"|"LinearDimension"|"SectionPlane"
Inherited from
Section titled “Inherited from”transformedArea()
Section titled “transformedArea()”transformedArea(
transformation):number
The face’s area after a transformation, such as a scaled instance’s, in square meters.
Parameters
Section titled “Parameters”transformation
Section titled “transformation”Returns
Section titled “Returns”number
uvAt()
Section titled “uvAt()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”readonly [number, number]