Skip to content

Query: Edge

Edge queries — read a single BREP edge's topology and geometry (all-handle model). An EdgeHandle is minted by walking from a brep/face/vertex handle; it is session-ephemeral and goes stale on undo/redo/re-topologize. Accessed via snaptrude.core.geom.query.edge.

Functions

Every method in this namespace takes the same single positional parameter.

getIndex(edge)

Get the index of an edge within its brep.

  • Parameters:
  • Returns: number — The index (-1 if unindexed)

getHalfEdge(edge)

Get the primary half-edge of an edge.

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

listVertices(edge)

List the two endpoint vertices of an edge.

ts
// Walk from a component's brep to an edge and read its endpoints
const brep = await snaptrude.design.query.geometry.getBrep(component);
const edges = await snaptrude.core.geom.query.brep.listEdges(brep);
const [start, end] = await snaptrude.core.geom.query.edge.listVertices(edges[0]);

getCurve(edge)

Get the underlying curve geometry of an edge (a line or arc).

  • Parameters:
  • Returns: CurveHandle | null — The curve, or null if it is a circle or unset
ts
const curve = await snaptrude.core.geom.query.edge.getCurve(edges[0]);
if (curve !== null) {
  const length = await snaptrude.core.geom.query.curve.getLength(curve);
}

listFaces(edge)

List the faces bordering an edge (one or two).

Errors

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

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe edge handle is invalid, foreign, or stale (undo/redo/re-topologize invalidates it)

Beyond handle resolution these reads are total — misses come back as null/[] (e.g. getCurve), not errors.