Bitbybit Docs
    Preparing search index...

    Class JSCADBooleans

    Combining JSCAD geometry: union fuses, subtract cuts and intersect keeps the overlap, in a two-input form and a many-input form. All inputs of one call must be of the same kind, either solids or flat 2D shapes, or the kernel throws an error; a path cannot be combined. Every method gives new geometry and leaves the inputs as they are.

    Index

    Constructors

    boolean

    • Keeps only the volume or area that all the inputs share, dropping everything else.

      The inputs must all be solids or all be 2D shapes; an empty result is possible when they do not overlap.

      Parameters

      Returns Promise<JSCADEntity>

      The shared part as one solid or 2D shape

      const common = await bitbybit.jscad.booleans.intersect({ meshes: [cube, sphere] });
      
    • Cuts every later input out of the first one, leaving what remains of the first.

      The inputs must all be solids or all be 2D shapes; the order matters, the first is the one being cut.

      Parameters

      • inputs: BooleanObjectsDto

        The geometry to cut from, first, followed by the geometry to cut with

      Returns Promise<JSCADEntity>

      The first input minus the others

      const holed = await bitbybit.jscad.booleans.subtract({ meshes: [cube, cylinder1, cylinder2] });
      
    • Fuses all the inputs into one solid or one 2D shape, merging where they overlap and keeping separate parts as one entity.

      The inputs must all be solids or all be 2D shapes.

      Parameters

      Returns Promise<JSCADEntity>

      The fused solid or 2D shape

      const fused = await bitbybit.jscad.booleans.union({ meshes: [cube, sphere] });
      
    • Keeps only the volume or area that first and second share, the two-input form of intersect.

      Parameters

      Returns Promise<JSCADEntity>

      The shared part

      const common = await bitbybit.jscad.booleans.intersectTwo({ first: cube, second: sphere });
      
    • Cuts second out of first, the two-input form of subtract.

      Parameters

      Returns Promise<JSCADEntity>

      The first input minus the second

      const holed = await bitbybit.jscad.booleans.subtractTwo({ first: cube, second: sphere });
      
    • Fuses first and second into one, the two-input form of union.

      Parameters

      Returns Promise<JSCADEntity>

      The fused solid or 2D shape

      const fused = await bitbybit.jscad.booleans.unionTwo({ first: cube, second: sphere });
      
    • Cuts every entry of meshes out of from, leaving what remains of from; the same as subtract with the base geometry named separately.

      Parameters

      Returns Promise<JSCADEntity>

      The base geometry minus the others

      const holed = await bitbybit.jscad.booleans.subtractFrom({ from: cube, meshes: [cylinder1, cylinder2] });
      

    minkowski

    • Sweeps each later solid over the whole surface of the running result and fuses everything it passes through, so the first solid grows by the shape of the others - the Minkowski sum, which is how a solid is rounded or padded by a sphere.

      Solids only; a 2D shape or a path throws an error.

      Parameters

      Returns Promise<JSCADEntity>

      The grown solid

      const padded = await bitbybit.jscad.booleans.minkowskiSum({ meshes: [cube, sphere] });