Skip to main content

Booleans and Fusion

FluidCAD automatically merges (fuses) solids that touch. This guide explains how auto-fusion works and how to use explicit boolean operations when you need more control.

Auto-fusion

By default, when you extrude a sketch and the result touches an existing solid, they merge into one:

import { sketch, extrude } from 'fluidcad/core';
import { rect, circle } from 'fluidcad/core';

sketch("xy", () => {
rect(60, 60).center()
})

extrude(30)

sketch("xy", () => {
circle([0, 0], 40)
})

extrude(50)

Auto-fusion result

The result is a single solid — the box with a cylinder sticking out of the top.

Creating separate solids

Use .new() to prevent auto-fusion:

import { sketch, extrude } from 'fluidcad/core';
import { rect, circle } from 'fluidcad/core';

sketch("xy", () => {
rect(60, 60).center()
})

const box = extrude(30)

sketch("xy", () => {
circle([80, 0], 40)
})

const cyl = extrude(30).new()

Separate solids with .new()

Explicit boolean operations

Fuse (union)

Merge two or more solids into one:

import { fuse } from 'fluidcad/core';

fuse(solid1, solid2)

Subtract (difference)

Remove one solid from another:

import { subtract } from 'fluidcad/core';

subtract(solidToKeep, solidToRemove)

Subtract result

Common (intersection)

Keep only the volume where two solids overlap:

import { common } from 'fluidcad/core';

common(solid1, solid2)

When to use what

ScenarioApproach
Adding a boss to an existing solidJust extrude — auto-fusion handles it
Creating a holesketch on a face + cut()
Merging two separate objectsfuse(a, b)
Subtracting a shape from anothersubtract(keep, remove)
Keeping only the overlapcommon(a, b)
Building multiple independent partsUse .new() or part()