Bitbybit Docs
    Preparing search index...

    Class OCCTBrepGraph

    Structural queries over an OpenCascade shape seen as a graph: which faces touch, which faces an edge belongs to, which edges meet at a vertex, what surface or curve backs each face or edge, how shells and solids contain each other, and the product and occurrence tree of an assembly. Every query returns plain data with ok and an error message rather than throwing, so a batch of queries can report per-item failures; reconstruct turns a node of that data back into a real sub-shape.

    Index

    Constructors

    assembly

    • Reads the assembly structure of a shape as products and occurrences: a product is a part or sub-assembly defined once, an occurrence is one placement of it with a matrix and a parent.

      This is what STEP assembly import produces and what a tree view walks; a plain shape reports no products.

      Parameters

      Returns Promise<BRepGraphAssemblyResult>

      The root products, all products and all occurrences

      const tree = await bitbybit.occt.brepGraph.assembly({ shape: imported });
      console.log(tree.products.length, tree.occurrences.length);

    geometry

    • Describes the geometry of every face: the kind of surface it lies on, its UV bounds, whether it carries a triangulation, and a unique id.

      Faces are numbered from 0 in the order shapes.face.getFaces uses.

      Parameters

      Returns Promise<BRepGraphFaceInfoResult>

      One geometry entry per face

      const faces = await bitbybit.occt.brepGraph.faceInfo({ shape: cylinder });
      console.log(faces.faces.map(f => f.surfaceType));
    • Describes the geometry of every edge: the kind of curve it follows, its parameter range, its continuity and a unique id.

      Edges are numbered from 0 in the order shapes.edge.getEdges lists them.

      Parameters

      Returns Promise<BRepGraphEdgeInfoResult>

      One geometry entry per edge

      const edges = await bitbybit.occt.brepGraph.edgeInfo({ shape: cylinder });
      

    navigate

    • Turns a node of the graph, given by its kind and index, back into the real sub-shape it stands for, so a face or edge found by a query can be used in an operation.

      The indexes are the ones the query results use, counted from 0 per kind.

      Parameters

      Returns Promise<TopoDSShapePointer>

      The sub-shape

      const face = await bitbybit.occt.brepGraph.reconstruct({ shape: box, kind: Bit.Inputs.OCCT.brepGraphNodeKindEnum.face, index: 2 });
      
    • Finds the graph node that stands for a given sub-shape of a shape: its kind, its index and its unique id.

      The reverse of reconstruct; a sub-shape that does not belong to the shape gives a result marked invalid.

      Parameters

      Returns Promise<BRepGraphNodeLookup>

      The node's kind, index and id, or an invalid result

      const faces = await bitbybit.occt.shapes.face.getFaces({ shape: box });
      const node = await bitbybit.occt.brepGraph.nodeOfShape({ shape: box, subShape: faces[0] });
      console.log(node.kind, node.index);

    topology

    • Counts what a shape is made of: solids, shells, faces, wires, edges, coedges and vertices, the distinct surfaces and curves behind them, and any assembly products and occurrences.

      The quickest way to see what an imported file holds, and to tell one solid from a compound that only looks like one.

      Parameters

      Returns Promise<BRepGraphAnalysis>

      The counts and graph metadata

      const census = await bitbybit.occt.brepGraph.analyze({ shape: imported });
      console.log(census.solids, census.faces);
    • Lists, for every face, the faces that share an edge with it, along with its edges, wire count and outer wire.

      Faces are numbered from 0 in the order the kernel walks the shape, the same order shapes.face.getFaces uses. This is the building block for growing a selection outward from a seed face or finding the faces of a pocket.

      Parameters

      Returns Promise<BRepGraphFaceAdjacencyResult>

      One adjacency entry per face

      const adjacency = await bitbybit.occt.brepGraph.faceAdjacency({ shape: box });
      console.log(adjacency.faces[0].adjacent);
    • Lists, for every edge, the faces it belongs to, its end vertices and its topology flags, such as whether it is a seam or a border edge.

      Edges are numbered from 0 in the order shapes.edge.getEdges lists them.

      Parameters

      Returns Promise<BRepGraphEdgeFaceMapResult>

      One entry per edge

      const edges = await bitbybit.occt.brepGraph.edgeFaceMap({ shape: box });
      
    • Maps the shape's parts upward: which shells each face belongs to, which solids each shell belongs to, and which solids each face ends up in.

      Each list holds the parent indexes of one child, so a face shared by two solids lists both.

      Parameters

      Returns Promise<BRepGraphContainmentResult>

      The parent indexes per face and per shell

      const containment = await bitbybit.occt.brepGraph.containment({ shape: compound });
      
    • Describes every wire: whether it is closed, whether it is the outer boundary of its face, how many coedges and distinct edges it has and which face owns it.

      Parameters

      Returns Promise<BRepGraphWireInfoResult>

      One entry per wire

      const wires = await bitbybit.occt.brepGraph.wireInfo({ shape: plateWithHoles });
      
    • Dumps the whole structure of a shape: every solid, shell, face, edge and vertex with its unique id and the parts directly below it.

      The heaviest query here, for reasoning about the whole topology at once rather than answering one question.

      Parameters

      Returns Promise<BRepGraphDumpResult>

      The solids, shells, faces, edges and vertices with their references

      const structure = await bitbybit.occt.brepGraph.dump({ shape: box });
      console.log(structure.faces.length, structure.edges.length);

    validation

    • Checks the structure of a shape's graph for problems such as dangling references or inconsistent links, and lists every issue found with its severity.

      This checks the bookkeeping, not the geometry; shapes.shape.isValid and shapeFix.basicShapeRepair deal with geometric validity.

      Parameters

      Returns Promise<BRepGraphValidationResult>

      Whether the graph is sound and the issues found

      const report = await bitbybit.occt.brepGraph.validate({ shape: imported });
      console.log(report.valid, report.issues);