Bitbybit Docs
    Preparing search index...

    Class OCCTBooleans

    Combining OpenCascade shapes with each other: union fuses them into one, difference cuts one away from another, intersection keeps only what they share. These work on the exact geometry and give exact results. The mesh intersection methods instead triangulate the shapes and intersect the triangles, which is faster and more robust on awkward geometry but gives polylines rather than curves. Every method returns a new shape; unless keepEdges is set, faces that end up lying on one surface are merged and the seams between them removed.

    Index

    Constructors

    booleans

    • Fuses several shapes into one, the way two overlapping blobs of clay become one lump.

      The shapes are fused one after another in list order. With keepEdges false, the default, faces that end up on one surface are merged and the seams removed; true keeps every edge of the inputs.

      Parameters

      Returns Promise<TopoDSShapePointer>

      The fused shape

      const fused = await bitbybit.occt.booleans.union({ shapes: [box, cylinder], keepEdges: false });
      
    • Cuts shapes away from a main shape, the way a drill removes material: what remains is the main shape minus every shape in the list.

      The shapes are subtracted one after another. With keepEdges false, the default, faces left on one surface are merged; when exactly one solid remains it is returned on its own rather than inside a compound.

      Parameters

      Returns Promise<TopoDSShapePointer>

      What is left of the main shape

      const holed = await bitbybit.occt.booleans.difference({ shape: box, shapes: [cylinder], keepEdges: false });
      
    • Keeps only the volume the first shape shares with each of the others.

      The first shape is intersected with every other shape one at a time and the pieces come back in one compound: with three shapes you get the overlap of the first with the second and with the third, not of all three. Fewer than two shapes throw.

      Parameters

      Returns Promise<TopoDSShapePointer>

      A compound of the shared parts

      const common = await bitbybit.occt.booleans.intersection({ shapes: [box, sphere], keepEdges: false });
      

    mesh based

    • Finds where the surfaces of two shapes cross by triangulating both and intersecting the triangles, and returns the crossing lines as wires.

      Each shape has its own meshing precision: a smaller value follows curved surfaces more closely and takes longer. The wires are polylines, so they trace the crossing approximately; the exact curves come from intersection with faces.

      Parameters

      Returns Promise<TopoDSWirePointer[]>

      The crossing lines as polyline wires

      const seams = await bitbybit.occt.booleans.meshMeshIntersectionWires({ shape1: sphere, shape2: box, precision1: 0.01, precision2: 0.01 });
      
    • Finds where the surfaces of two shapes cross by triangulating both and intersecting the triangles, and returns the crossing lines as lists of points.

      Each shape has its own meshing precision: a smaller value follows curved surfaces more closely and takes longer. Each list of points is one crossing line, in order along it.

      Parameters

      Returns Promise<Point3[][]>

      One list of points per crossing line

      const lines = await bitbybit.occt.booleans.meshMeshIntersectionPoints({ shape1: sphere, shape2: box, precision1: 0.01, precision2: 0.01 });
      
    • Finds where the surface of one shape crosses the surfaces of several others by triangulating them all and intersecting the triangles, and returns the crossing lines as wires.

      precision meshes the main shape and precisionShapes gives one precision per other shape; smaller values follow curves more closely and take longer.

      Parameters

      Returns Promise<TopoDSWirePointer[]>

      The crossing lines as polyline wires, for all the shapes together

      const seams = await bitbybit.occt.booleans.meshMeshIntersectionOfShapesWires({ shape: sphere, shapes: [box, cylinder], precision: 0.01, precisionShapes: [0.01, 0.01] });
      
    • Finds where the surface of one shape crosses the surfaces of several others by triangulating them all and intersecting the triangles, and returns the crossing lines as lists of points.

      precision meshes the main shape and precisionShapes gives one precision per other shape; each list of points is one crossing line, in order along it.

      Parameters

      Returns Promise<Point3[][]>

      One list of points per crossing line, for all the shapes together

      const lines = await bitbybit.occt.booleans.meshMeshIntersectionOfShapesPoints({ shape: sphere, shapes: [box, cylinder], precision: 0.01, precisionShapes: [0.01, 0.01] });