Appearance
Query: Brep
BREP queries — read the topology and geometry of a boundary-representation mesh as plain values / child handles. A BrepHandle is a session-ephemeral resource handle obtained from design.query.geometry.getBrep; it goes stale on undo/redo/re-topologize. Enumerations mint fresh child topology handles (FaceHandle, EdgeHandle, VertexHandle, HalfEdgeHandle); the registry dedupes by identity, so re-enumeration returns the same handles. Position reads return Vec3Components. No query mutates its inputs. Accessed via snaptrude.core.geom.query.brep.
Types
Vec3Components
Plain-value vector record returned by position reads.
| Property | Type | Description |
|---|---|---|
x | number | X component |
y | number | Y component |
z | number | Z component |
BBoxComponents
Plain-value axis-aligned bounding box record.
| Property | Type | Description |
|---|---|---|
min | Vec3Components | Minimum corner |
max | Vec3Components | Maximum corner |
Functions
listFaces(brep)
List the faces of a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
FaceHandle[]— The faces
ts
const brep = await snaptrude.design.query.geometry.getBrep(component);
const faces = await snaptrude.core.geom.query.brep.listFaces(brep);listEdges(brep)
List the edges of a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
EdgeHandle[]— The edges
listVertices(brep)
List the vertices of a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
VertexHandle[]— The vertices
listHalfEdges(brep)
List the half-edges of a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
HalfEdgeHandle[]— The half-edges
getEdge(brep, vertexIndexA, vertexIndexB)
Get the edge connecting two vertices (by their brep vertex indices).
- Parameters:
brep:BrepHandle— The brep to queryvertexIndexA:number— First vertex indexvertexIndexB:number— Second vertex index
- Returns:
EdgeHandle | null— The edge, ornullif no such edge exists
hasEdge(brep, vertexIndexA, vertexIndexB)
Test whether an edge connects two vertices (by their brep vertex indices).
- Parameters:
brep:BrepHandle— The brep to queryvertexIndexA:number— First vertex indexvertexIndexB:number— Second vertex index
- Returns:
boolean—trueif such an edge exists, otherwisefalse
listEdgesBetween(brep, vertexIndexA, vertexIndexB)
List every edge connecting two vertices (by their brep vertex indices).
- Parameters:
brep:BrepHandle— The brep to queryvertexIndexA:number— First vertex indexvertexIndexB:number— Second vertex index
- Returns:
EdgeHandle[]— The edges
getVertexPosition(brep, vertex)
Get the position of a vertex within a brep.
- Parameters:
brep:BrepHandle— The brep to queryvertex:VertexHandle— The vertex whose position to read
- Returns:
Vec3Components— The position, as{ x, y, z }
ts
const { brep: brepQuery } = snaptrude.core.geom.query;
const brep = await snaptrude.design.query.geometry.getBrep(component);
const vertices = await brepQuery.listVertices(brep);
const position = await brepQuery.getVertexPosition(brep, vertices[0]);
// position = { x, y, z } in Snaptrude unitslistVertexPositions(brep)
List the positions of all vertices in a brep (ordered as listVertices).
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
Vec3Components[]— The positions
getCentroid(brep)
Get the centroid (mean of all vertex positions) of a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
Vec3Components— The centroid
getFaceCount(brep)
Get the number of faces in a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
number— The face count
getEdgeCount(brep)
Get the number of edges in a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
number— The edge count
getVertexCount(brep)
Get the number of vertices in a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
number— The vertex count
getHalfEdgeCount(brep)
Get the number of half-edges in a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
number— The half-edge count
getBoundingBox(brep)
Get the axis-aligned bounding box of a brep.
- Parameters:
brep:BrepHandle— The brep to query
- Returns:
BBoxComponents— The bounding box, as{ min, max }
isEqual(brepA, brepB)
Test whether two breps are geometrically equal.
- Parameters:
brepA:BrepHandle— First brepbrepB:BrepHandle— Second brep
- Returns:
boolean—trueif the breps are equal, otherwisefalse
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 brep (or child topology) handle is invalid, foreign, or stale — brep handles go stale on undo/redo/re-topologize | — |
Beyond handle resolution these reads are total — degenerate topology comes back as []/null results, not errors.