EdgeRef
A lightweight placeholder for an Edge that hasn’t been fully loaded yet.
When you create edges inside a SketchupOperation, the
API returns EdgeRef objects immediately, before SketchUp has
finished processing the geometry. You can often pass these refs to
other operation methods (like smoothing or softening),
but if you need the full Edge instance, you can request
it with entityForRef().
Think of a ref as a “claim ticket” — it guarantees an edge
will exist after the operation commits, but it doesn’t carry
the edge’s properties (vertices, smooth, etc.) yet. A ref is
only valid inside the performOperation callback that created
it — do not return it or use it after the operation commits.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Turn on hidden geometry so we can see// hidden edges as dashed lines.await model.updateRenderingOptions({ DrawHidden: true});
await model.performOperation(async op => { // Returns instantly, before SketchUp processes // the geometry. const edgeRefs = op.createEdge( model, [[0, 0, 0], [100, 0, 0]] ); const edgeRef = edgeRefs[0];
// You can use the ref right away — here we // hide the edge (it'll render as a dashed // line since DrawHidden is on). op.edgeSetProperties( edgeRef, { hidden: true, soft: true } );
// But properties like the bounding box require // SketchUp to create the geometry first. // Use entityForRef() to get the full Edge. const edge = await op.entityForRef(edgeRef); const bounds = await edge.getBounds(); console.log(bounds.min.x, bounds.max.x); // => 0 100}, 'Create a hidden, softened edge');Properties
Section titled “Properties”sketchupId
Section titled “sketchupId”
readonlysketchupId:SketchupId
readonlytype:Edge=EntityType.Edge
Accessors
Section titled “Accessors”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”toString()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string