Skip to content

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.

PropertyTypeDescription
xnumberX component
ynumberY component
znumberZ component

BBoxComponents

Plain-value axis-aligned bounding box record.

PropertyTypeDescription
minVec3ComponentsMinimum corner
maxVec3ComponentsMaximum 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 query
    • vertexIndexA: number — First vertex index
    • vertexIndexB: number — Second vertex index
  • Returns: EdgeHandle | null — The edge, or null if 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 query
    • vertexIndexA: number — First vertex index
    • vertexIndexB: number — Second vertex index
  • Returns: booleantrue if such an edge exists, otherwise false

listEdgesBetween(brep, vertexIndexA, vertexIndexB)

List every edge connecting two vertices (by their brep vertex indices).

  • Parameters:
    • brep: BrepHandle — The brep to query
    • vertexIndexA: number — First vertex index
    • vertexIndexB: 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 query
    • vertex: 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 units

listVertexPositions(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 brep
    • brepB: BrepHandle — Second brep
  • Returns: booleantrue if the breps are equal, otherwise false

Errors

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

CodeThrown byWhendetails
HANDLE_INVALIDall methodsThe 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.