* updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * docs Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
79 lines
181 KiB
Markdown
79 lines
181 KiB
Markdown
---
|
|
title: "intersect"
|
|
excerpt: "Intersect returns the shared volume between multiple solids, preserving only overlapping regions."
|
|
layout: manual
|
|
---
|
|
|
|
**WARNING:** This function is deprecated.
|
|
|
|
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.
|
|
|
|
```js
|
|
intersect(solids: [Solid]): [Solid]
|
|
```
|
|
|
|
|
|
### Arguments
|
|
|
|
| Name | Type | Description | Required |
|
|
|----------|------|-------------|----------|
|
|
| `solids` | [`[Solid]`](/docs/kcl/types/Solid) | The solids to intersect. | Yes |
|
|
|
|
### Returns
|
|
|
|
[`[Solid]`](/docs/kcl/types/Solid)
|
|
|
|
|
|
### Examples
|
|
|
|
```js
|
|
// Intersect two cubes using the stdlib functions.
|
|
|
|
|
|
fn cube(center) {
|
|
return startSketchOn(XY)
|
|
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|
|
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
|
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
|
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
|
|> close()
|
|
|> extrude(length = 10)
|
|
}
|
|
|
|
part001 = cube([0, 0])
|
|
part002 = cube([8, 8])
|
|
|
|
intersectedPart = intersect([part001, part002])
|
|
```
|
|
|
|

|
|
|
|
```js
|
|
// 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) {
|
|
return startSketchOn(XY)
|
|
|> startProfileAt([center[0] - 10, center[1] - 10], %)
|
|
|> line(endAbsolute = [center[0] + 10, center[1] - 10])
|
|
|> line(endAbsolute = [center[0] + 10, center[1] + 10])
|
|
|> line(endAbsolute = [center[0] - 10, center[1] + 10])
|
|
|> close()
|
|
|> extrude(length = 10)
|
|
}
|
|
|
|
part001 = cube([0, 0])
|
|
part002 = cube([8, 8])
|
|
|
|
// This is the equivalent of: intersect([part001, part002])
|
|
intersectedPart = part001 & part002
|
|
```
|
|
|
|

|
|
|
|
|