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.
Example
Section titled “Example”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);// => 200Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes:Attributes
Custom attributes stored on this vertex. Empty if no attributes have been set via the API or Ruby scripts.
readonlyid:number
The persistent ID that uniquely identifies this vertex.
readonlytype:Vertex=EntityType.Vertex
readonlyx:number
The X coordinate of this vertex in the model’s coordinate system.
readonlyy:number
The Y coordinate of this vertex in the model’s coordinate system.
readonlyz:number
The Z coordinate of this vertex in the model’s coordinate system.
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”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().
Example
Section titled “Example”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)Returns
Section titled “Returns”sketchupId
Section titled “sketchupId”Get Signature
Section titled “Get Signature”get sketchupId():
SketchupId
JS API identifier for this vertex. Pass it to API methods that accept a sketchupId.
Returns
Section titled “Returns”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”refresh()
Section titled “refresh()”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.
Returns
Section titled “Returns”Promise<Vertex>
A new Vertex reflecting the current model state. Throws if the vertex has been deleted.
Example
Section titled “Example”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()
Section titled “toString()”toString():
string
Returns
Section titled “Returns”string