Edge
A straight line segment between two vertices in the model.
Edges are the most fundamental geometry in SketchUp — every face is bounded by edges, and standalone edges can be used for drawing 3D lines.
When edges are joined smoothly (like the segments of a circle), they share a Curve or ArcCurve.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Draw an edge and a circle, so we have some to play with.await model.performOperation(op => {
// First a simple edge. op.createEdge( model, [[0, 0, 0], [100, 0, 0]] );
// Then a circle. const center = [200, 0, 0]; const normal = [0, 0, 1]; const radius = 50; const segments = 12; op.createCircle( model, center, normal, radius, segments );}, 'Draw edge and circle');
// Use entities.get() to return all of the edges.let edges = await model.entities.get({ filterBy: { types: ['Edge'] }});let simpleEdge = edges[0];let firstCircleEdge = edges[1];
console.log(simpleEdge.start.x, simpleEdge.end.x);// => 0 100console.log(await simpleEdge.getCurve());// => undefinedconsole.log(await firstCircleEdge.getCurve());// => ArcCurve { edges: [...], ... }SketchupOperation
Extends
Section titled “Extends”BaseDrawingElement
Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes:Attributes
The attribute dictionaries attached to this element. Attributes store custom key-value metadata that extensions can read and write.
Inherited from
Section titled “Inherited from”BaseDrawingElement.attributes
castsShadows
Section titled “castsShadows”
readonlycastsShadows:boolean
Whether this element casts shadows onto other geometry.
Inherited from
Section titled “Inherited from”BaseDrawingElement.castsShadows
readonlycurve:ArcCurveRef|CurveRef|undefined
A reference to the curve this edge belongs to, if any. Edges that form arcs or smooth curves share a single Curve or ArcCurve parent. Call getCurve to fetch the full curve object.
readonlyend:Vertex
The vertex at the end of this edge.
hidden
Section titled “hidden”
readonlyhidden:boolean
Whether this element is hidden. Hidden elements don’t appear in the viewport unless the user enables “View > Hidden Geometry.”
Inherited from
Section titled “Inherited from”BaseDrawingElement.hidden
readonlyid:number
The persistent ID that uniquely identifies this edge.
materialRef
Section titled “materialRef”
readonlymaterialRef:MaterialRef|undefined
A reference to the material applied to this element, if any. Call
getMaterial() to fetch the full Material object with color and texture data.
Inherited from
Section titled “Inherited from”BaseDrawingElement.materialRef
receivesShadows
Section titled “receivesShadows”
readonlyreceivesShadows:boolean
Whether this element receives shadows cast by other geometry.
Inherited from
Section titled “Inherited from”BaseDrawingElement.receivesShadows
smooth
Section titled “smooth”
readonlysmooth:boolean
Whether this edge is smoothed, causing adjacent faces to render with blended normals instead of a hard crease.
readonlysoft:boolean
Whether this edge is soft — hidden from view but still logically connecting two faces. Soft edges also smooth their adjacent faces.
readonlystart:Vertex
The vertex at the start of this edge.
tagRef
Section titled “tagRef”
readonlytagRef:TagRef|undefined
A reference to the tag (formerly “layer”) assigned to this element. Call
getTag() to fetch the full Tag object.
Inherited from
Section titled “Inherited from”BaseDrawingElement.tagRef
readonlytype:Edge=EntityType.Edge
Accessors
Section titled “Accessors”sketchupId
Section titled “sketchupId”Get Signature
Section titled “Get Signature”get sketchupId():
SketchupId
JS API identifier for this edge. Pass it to API methods that accept a sketchupId.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”BaseDrawingElement.sketchupId
typeName
Section titled “typeName”Get Signature
Section titled “Get Signature”get typeName():
string
Returns a named variant of the type field.
SDK 2.35.0
Returns
Section titled “Returns”string
Methods
Section titled “Methods”getBounds()
Section titled “getBounds()”getBounds():
Promise<BoundingBox>
Fetches the axis-aligned bounding box for this element from SketchUp.
Returns
Section titled “Returns”Promise<BoundingBox>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let all = await model.entities.get();let element = all[0];let box = await element.getBounds();console.log(box.min.x, box.min.y, box.min.z);console.log(box.max.x, box.max.y, box.max.z);SDK 2.30.0
Inherited from
Section titled “Inherited from”BaseDrawingElement.getBounds
getCurve()
Section titled “getCurve()”Fetches the full Curve or ArcCurve that this edge belongs to. Many edges in
SketchUp are segments of a larger curve (like the edges forming a circle).
This method resolves the lightweight curve reference into the complete
object. Returns undefined if this edge isn’t part of a curve.
Returns
Section titled “Returns”Promise<ArcCurve | Curve | undefined>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let curves = await model.entities.getCurves();let edge = curves[0].edges[0];let curve = await edge.getCurve();console.log(curve.type);// => 24 (ArcCurve)SDK 2.23.0 Protocol 1.20.0
getMaterial()
Section titled “getMaterial()”getMaterial():
Promise<Material|undefined>
Fetches the material applied to this element. Returns undefined if the
element uses the default material.
Returns
Section titled “Returns”Promise<Material | undefined>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let all = await model.entities.get();let element = all[0];let mat = await element.getMaterial();if (mat) { console.log(mat.name, mat.color.toHex());}SDK 2.30.0
Inherited from
Section titled “Inherited from”BaseDrawingElement.getMaterial
getTag()
Section titled “getTag()”getTag():
Promise<Tag|undefined>
Fetches the tag assigned to this element. Most elements have a tag — even
those on the default “Untagged” tag. Returns undefined only if the tag
reference is missing.
Returns
Section titled “Returns”Promise<Tag | undefined>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let all = await model.entities.get();let element = all[0];let tag = await element.getTag();if (tag) { console.log(tag.name);}SDK 2.30.0
Inherited from
Section titled “Inherited from”BaseDrawingElement.getTag
refresh()
Section titled “refresh()”refresh():
Promise<Edge>
Re-fetches this edge from SketchUp to get its current state. Because Edge
is a snapshot, it can become stale if the model changes. Call refresh() to
get an up-to-date copy.
Returns
Section titled “Returns”Promise<Edge>
A new Edge reflecting the current model state. Throws if the edge has been deleted.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let edges = await model.entities.get({ filterBy: { types: ['Edge'] },});let fresh = await edges[0].refresh();console.log(fresh.start.x, fresh.start.y);toString()
Section titled “toString()”toString():
string
Returns a string representation of an object.
Returns
Section titled “Returns”string
Deprecated
Section titled “Deprecated”materialId
Section titled “materialId”
readonlymaterialId:number|undefined
Inherited from
Section titled “Inherited from”BaseDrawingElement.materialId
readonlytagId:number|undefined
Inherited from
Section titled “Inherited from”BaseDrawingElement.tagId
bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”get bounds():
Promise<BoundingBox>
Returns
Section titled “Returns”Promise<BoundingBox>
Inherited from
Section titled “Inherited from”BaseDrawingElement.bounds
Get Signature
Section titled “Get Signature”get tag():
Promise<Readonly<Tag> |undefined>
Returns
Section titled “Returns”Promise<Readonly<Tag> | undefined>
Inherited from
Section titled “Inherited from”BaseDrawingElement.tag