Overview
/
KCL Standard Library
/
Functions
/
subtract

subtractFunction in std::solid

Subtract removes tool solids from base solids, leaving the remaining material.

Performs a bool subtraction operation, removing the volume of one or more tool solids from one or more base solids. The result is a new solid representing the material that remains after all tool solids have been cut away. This function is essential for machining simulations, cavity creation, and complex multi-body part modeling.

This operation consumes both the base solids and the tool solids. After it succeeds, neither set of original variables can be used in another modeling operation. Assign the returned solid or solids to a new variable and use that result for subsequent operations. For multiple cuts, pass each subtract result into the next call instead of reusing the original base solid.

Arguments

NameTypeDescriptionRequired
solids[Solid; 1+]The solids to use as the base to subtract from. These solids are consumed by this operation.Yes
tools[Solid]The solids to subtract. These tool solids are also consumed by this operation.Yes
tolerancenumber(Length)Defines the smallest distance below which two entities are considered coincident, intersecting, coplanar, or similar. For most use cases, it should not be changed from its default value of 10^-7 millimeters.No
legacyMethodboolDeprecated as of KCL 2.0. You probably shouldn't set this or care about this, it's for opting back into an older version of an engine algorithm. If true, revert to older engine SSI algorithm. Defaults to false.No

Returns

[Solid]

Examples