Skip to main content

Overview

OpenGeometry exposes kernel-backed boolean operations that work on B-Rep payloads. The helpers accept multiple operand formats (wrapper objects, raw B-Rep objects, or serialized JSON) and return a renderable THREE.Mesh result with access to the output B-Rep and a structured report. To learn how booleans work and what to expect from them, read Booleans.

Initialization

Initialize the WASM module once before calling any boolean helpers:

API

booleanUnion

booleanIntersection

booleanSubtraction

BooleanOperand

Each boolean helper accepts a BooleanOperand in any of these forms:
  • A serialized B-Rep JSON string
  • A parsed B-Rep object (the helper will JSON.stringify(...) it)
  • A wrapper object that exposes one of these methods:
    • getBrepSerialized(): string
    • getBrepData(): unknown
    • getBrep(): unknown
This means you can pass OpenGeometry shape wrappers (like Cuboid and Opening) directly.

BooleanExecutionOptions

Boolean options let you tune both kernel behavior and rendering. Kernel options
number
Numeric tolerance used by the kernel for boolean decisions.
boolean
When enabled, the kernel attempts to merge coplanar faces in the output.
Render options
number
Output mesh color (hex).
boolean
Enable outline rendering for the result. The helpers default to true when omitted.
boolean
Use wide outlines backed by Three.js LineSegments2 (instead of thin LineSegments).
number
Outline width for fat outlines. Values are sanitized and must be finite and greater than zero.

Return type: BooleanResult

All boolean helpers return a BooleanResult, which extends THREE.Mesh.

Common fields and methods

BooleanReport | null
Parsed report emitted by the kernel (operation name, input/output counts, empty flag, and more).
() => object | null
Returns the parsed output B-Rep object.
() => string
Returns the output B-Rep JSON string (useful for export and persistence).
boolean
Enables or disables outline rendering for the result mesh.
boolean
Toggles wide outline rendering.
number
Sets the outline width used for fat outlines.
() => void
Disposes the result mesh geometry and materials (call this when you remove the mesh from your scene).

Examples

Cut a cuboid with an opening

Use Opening.subtractFrom(...) when you want the opening to be the cutting operand:

Union and intersection

  • Booleans for behavior, limitations, and tips
  • Exports for exporting boolean results to STL/STEP/IFC

Live Demo

Boolean Operations Demo

Try Boolean operations in the browser
Last modified on March 14, 2026