kcl

intersect

Intersect returns the shared volume between multiple solids, preserving only overlapping regions.

Intersect computes the geometric intersection of multiple solid bodies, returning a new solid representing the volume that is common to all input solids. This operation is useful for determining shared material regions, verifying fit, and analyzing overlapping geometries in assemblies.

intersect(
  solids: [Solid],
  tolerance?: number,
): [Solid]

Arguments

NameTypeDescriptionRequired
solids[Solid]The solids to intersect.Yes
tolerancenumberThe tolerance to use for the intersection operation.No

Returns

[Solid]

Examples

// Intersect two cubes using the stdlib functions.


fn cube(center, size) {
  return startSketchOn(XY)
    |> startProfileAt([center[0] - size, center[1] - size], %)
    |> line(endAbsolute = [center[0] + size, center[1] - size])
    |> line(endAbsolute = [center[0] + size, center[1] + size])
    |> line(endAbsolute = [center[0] - size, center[1] + size])
    |> close()
    |> extrude(length = 10)
}

part001 = cube([0, 0], 10)
part002 = cube([7, 3], 5)
  |> translate(z = 1)

intersectedPart = intersect([part001, part002])

Rendered example of intersect 0

// Intersect two cubes using operators.
// NOTE: This will not work when using codemods through the UI.
// Codemods will generate the stdlib function call instead.


fn cube(center, size) {
  return startSketchOn(XY)
    |> startProfileAt([center[0] - size, center[1] - size], %)
    |> line(endAbsolute = [center[0] + size, center[1] - size])
    |> line(endAbsolute = [center[0] + size, center[1] + size])
    |> line(endAbsolute = [center[0] - size, center[1] + size])
    |> close()
    |> extrude(length = 10)
}

part001 = cube([0, 0], 10)
part002 = cube([7, 3], 5)
  |> translate(z = 1)

// This is the equivalent of: intersect([part001, part002])
intersectedPart = part001 & part002

Rendered example of intersect 1