Skip to content

Vertex

A point in 3D space where edges meet.

Vertices are the endpoints of edges — every edge has a start vertex and an end vertex. You don’t query vertices directly; instead, you access them through the edges that connect to them.

Each vertex has an (x, y, z) position in the model’s coordinate system.

let model = await SketchUpApi.getActiveModel();
// Draw some edges so we have vertices to work with.
await model.performOperation(op => {
op.createEdge(model, [[0, 0, 0], [100, 50, 0]]);
op.createEdge(model, [[100, 50, 0], [200, 0, 25]]);
}, 'Draw connected edges');
// Query the edges back, then access their vertices.
let edges = await model.entities.get({
filterBy: { types: ['Edge'] }
});
let firstEdge = edges[0];
console.log(firstEdge.start.x, firstEdge.start.y);
// => 0 0
let secondEdge = edges[1];
console.log(secondEdge.end.x);
// => 200

Edge

readonly attributes: Attributes

Custom attributes stored on this vertex. Empty if no attributes have been set via the API or Ruby scripts.


readonly id: number

The persistent ID that uniquely identifies this vertex.


readonly type: Vertex = EntityType.Vertex


readonly x: number

The X coordinate of this vertex in the model’s coordinate system.


readonly y: number

The Y coordinate of this vertex in the model’s coordinate system.


readonly z: number

The Z coordinate of this vertex in the model’s coordinate system.

get point(): Point3d

Returns this vertex’s position as a Point3d object. Useful when working with other geometry utilities that expect Point3d, like BoundingBox.add().

let model = await SketchUpApi.getActiveModel();
let edges = await model.entities.get({
filterBy: { types: ['Edge'] }
});
let point = edges[0].start.point;
console.log(point.x, point.y, point.z);
// => 0, 0, 0 (or wherever your first edge starts)

Point3d


get sketchupId(): SketchupId

JS API identifier for this vertex. Pass it to API methods that accept a sketchupId.

SketchupId


get typeName(): string

Returns a named variant of the type field.

SDK 2.35.0

string

refresh(): Promise<Vertex>

Re-fetches this vertex from SketchUp to get its current state. Because Vertex is a snapshot, it can become stale if the model changes. Call refresh() to get an up-to-date copy.

Promise<Vertex>

A new Vertex reflecting the current model state. Throws if the vertex has been deleted.

let model = await SketchUpApi.getActiveModel();
let edges = await model.entities.get({
filterBy: { types: ['Edge'] },
});
// Later, after the user makes changes...
let fresh = await edges[0].start.refresh();
console.log(fresh.x, fresh.y, fresh.z);

SDK 2.14.0 Protocol 1.11.0


toString(): string

string