Skip to content

EntityBuilderEdgeRef

A lightweight placeholder for an Edge created inside an EntitiesBuilder callback.

The EntitiesBuilder is the high-performance path for creating geometry. When you need to draw hundreds or thousands of edges and faces — like generating a mesh or importing model data — the builder batches everything into a single round-trip to SketchUp, making it dramatically faster than calling operation.createEdge repeatedly.

When you call edgeCreate on a builder, it returns an EntityBuilderEdgeRef immediately. This ref is only valid inside the builder callback — to use it after the build completes, convert it with EntityBuilderRefConverter.asRef in an EntityBuilderCall.onPostBuild callback.

let model = await SketchUpApi.getActiveModel();
await model.performOperation(async op => {
const tagRef = op.createTag('Burst');
// The builder callback creates geometry in bulk.
// Return refs you'll need in the post step.
await op.createBuilder(builder => {
const ebEdgeRefs = [];
// 12 lines radiating from center
for (let i = 0; i < 12; i++) {
const angle = (i / 12) * Math.PI * 2;
const end = [
Math.cos(angle) * 50,
Math.sin(angle) * 50,
0,
];
ebEdgeRefs.push(
builder.edgeCreate([0, 0, 0], end)
);
}
return ebEdgeRefs;
})
// onPostBuild runs after geometry is created.
// Use converter.asRef() to convert builder refs
// into operation refs.
.onPostBuild((converter, ebEdgeRefs) => {
ebEdgeRefs.forEach(ebEdgeRef => {
const edgeRef = converter.asRef(ebEdgeRef);
op.drawingElementSetTag(edgeRef, tagRef);
});
})
.build(model);
}, 'Build a radial burst');

readonly mappingId: number


readonly type: Edge = EntityType.Edge

get typeName(): string

Returns a named variant of the type field.

SDK 2.35.0

string