Skip to content

Query: Vertex

Vertex queries — read a single BREP vertex's topology and position. A VertexHandle is minted by walking from a brep/face/edge handle; it is session-ephemeral and goes stale on undo/redo/re-topologize. Position lives on the parent brep (indexed by the vertex), so getPosition takes both handles. No query mutates its inputs. Accessed via snaptrude.core.geom.query.vertex.

Types

Vec3Components

Primitive read-out of a 3D position, in Snaptrude units (see snaptrude.core.units.convert(value, from, to)).

PropertyTypeDescription
xnumberX component
ynumberY component
znumberZ component

Functions

getIndex(vertex)

Get the index of a vertex within its brep.

  • Parameters:
  • Returns: number — The index (-1 if unindexed)
  • Throws: HandleInvalidError (code HANDLE_INVALID) if the vertex handle is invalid or stale

getHalfEdge(vertex)

Get a seed half-edge emanating from a vertex.

  • Parameters:
    • vertex: VertexHandle — The vertex to read
  • Returns: HalfEdgeHandle | null — The half-edge, or null if uninitialized

getPosition(brep, vertex)

Get the position of a vertex (needs the parent brep for coordinates).

  • Parameters:
    • brep: BrepHandle — The parent brep (source of coordinates)
    • vertex: VertexHandle — The vertex whose position to read
  • Returns: Vec3Components — The position as { x, y, z }, in Snaptrude units
ts
// Read the position of the first vertex of a component's brep
const brep = await snaptrude.design.query.geometry.getBrep(component);
const vertices = await snaptrude.core.geom.query.brep.listVertices(brep);
const position = await snaptrude.core.geom.query.vertex.getPosition(brep, vertices[0]);
console.log(position.x, position.y, position.z);

listHalfEdges(vertex)

List the half-edges around a vertex.

  • Parameters:
    • vertex: VertexHandle — The vertex to read
  • Returns: HalfEdgeHandle[] — The half-edges around the vertex (possibly empty)

listEdges(vertex)

List the edges around a vertex.

  • Parameters:
    • vertex: VertexHandle — The vertex to read
  • Returns: EdgeHandle[] — The edges around the vertex (possibly empty)

listFaces(vertex)

List the faces around a vertex.

  • Parameters:
    • vertex: VertexHandle — The vertex to read
  • Returns: FaceHandle[] — The faces around the vertex (possibly empty)

listNeighbors(vertex)

List the neighbouring vertices of a vertex.

  • Parameters:
    • vertex: VertexHandle — The vertex to read
  • Returns: VertexHandle[] — The neighbouring vertices (possibly empty)

Errors

Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe vertex (or parent brep) handle is invalid, foreign, or stale (undo/redo/re-topologize)

Beyond handle resolution these reads are total — enumerations may simply be empty ([]).