Skip to content
AI-Ready Docs
/llms.txt/llms-mcp.txt

Difference ​

Subtracts an ordered list of solid tools from one solid target. Difference is logical composition and can lower to multiple existing native difference nodes.

Import Difference from @barocss/cad-react. This private workspace API is not a published installable package.

Props and output ​

PropInput/defaultMeaning
childrenExactly one Target and one Tools groupNo other direct realized slots are accepted.
refOptional SolidRefThe final cut solid handle has kind difference.

Example ​

tsx
import { Difference, Target, Tools, Extrude, Rectangle, Circle } from '@barocss/cad-react';

export function HoledPlate() {
  return <Difference>
    <Target><Extrude distance={6}><Rectangle min={[0,0]} max={[80,60]} /></Extrude></Target>
    <Tools><Extrude from={-1} distance={8}><Circle center={[10,10]} radius={3} /></Extrude></Tools>
  </Difference>;
}

Insert the returned composition as the single output of a Part with a connected lifecycle. Any Definitions in the example remain logical siblings of that output; Target/Tools are used only inside Difference.

Composition and validation ​

One Target establishes the initial solid. Each tool is subtracted from the running result in declared order. An overcut tool outside the target does not count as removed target material.

Missing/duplicate slots, empty Tools or incompatible operands refuse. Difference does not accept a target or tools prop in place of its logical child groups. It adds no new Boolean algorithm, tolerance policy or mesh fallback.

References and identity ​

The outer Difference may expose one SolidRef. Target and Tools are operand slots, not native body handles or independent Part outputs. IDs/parent links are generated by the compiler.

Measured boundary ​

The original and transformed Bracket measure four floor cuts and the wall window. The standalone example above is a complete typechecked usage pattern, not an additional independent physical qualification.

The complete code block uses current public exports; its extracted type-check result is recorded separately. Type/compiler checks do not by themselves evaluate this standalone example as a new native case. Read the component catalog, refs and compiler, engine integration and current support limits.