Appearance
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:
edge:EdgeHandle— The edge to query
- Returns:
number— The index (-1if unindexed)
getHalfEdge(edge)
Get the primary half-edge of an edge.
- Parameters:
edge:EdgeHandle— The edge to query
- Returns:
HalfEdgeHandle| null— The half-edge, ornullif uninitialized
listVertices(edge)
List the two endpoint vertices of an edge.
- Parameters:
edge:EdgeHandle— The edge to query
- Returns:
VertexHandle[]— The endpoints
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:
edge:EdgeHandle— The edge to query
- Returns:
CurveHandle| null— The curve, ornullif 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).
- Parameters:
edge:EdgeHandle— The edge to query
- Returns:
FaceHandle[]— The bordering faces
Errors
Failed calls reject with a typed PluginError — see Error Handling. Conditions specific to this namespace:
| Code | Thrown by | When | details |
|---|---|---|---|
HANDLE_INVALID | all methods | The 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.