Skip to content

Commit 2fbb006

Browse files
Update KCL docs (#556)
YOYO NEW KCL DOCS!! Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 1098221 commit 2fbb006

File tree

9 files changed

+49932
-88620
lines changed

9 files changed

+49932
-88620
lines changed

content/pages/docs/kcl-std/intersect.md renamed to content/pages/docs/kcl-std/functions/std-solid-intersect.md

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,56 @@
11
---
22
title: "intersect"
33
subtitle: "Function in std::solid"
4-
excerpt: "Intersect returns the shared volume between multiple solids, preserving only overlapping regions."
4+
excerpt: ""
55
layout: manual
66
---
77

8-
Intersect returns the shared volume between multiple solids, preserving only overlapping regions.
8+
99

1010
```kcl
1111
intersect(
12-
@solids: [Solid],
13-
tolerance?: number,
14-
): [Solid]
12+
@solids: [Solid; 2+],
13+
tolerance?: number(Length),
14+
): [Solid; 1+]
1515
```
1616

17-
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.
17+
Intersect returns the shared volume between multiple solids, preserving only
18+
overlapping regions.
19+
Intersect computes the geometric intersection of multiple solid bodies,
20+
returning a new solid representing the volume that is common to all input
21+
solids. This operation is useful for determining shared material regions,
22+
verifying fit, and analyzing overlapping geometries in assemblies.
1823

1924
### Arguments
2025

2126
| Name | Type | Description | Required |
2227
|----------|------|-------------|----------|
23-
| `solids` | [`[Solid]`](/docs/kcl-std/types/std-types-Solid) | The solids to intersect. | Yes |
24-
| `tolerance` | [`number`](/docs/kcl-std/types/std-types-number) | The tolerance to use for the intersection operation. | No |
28+
| `solids` | `[Solid; 2+]` | The solids to intersect. | Yes |
29+
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The tolerance to use for the intersection operation. | No |
2530

2631
### Returns
2732

28-
[`[Solid]`](/docs/kcl-std/types/std-types-Solid)
33+
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
2934

3035

3136
### Examples
3237

3338
```kcl
3439
// Intersect two cubes using the stdlib functions.
3540
36-
3741
fn cube(center, size) {
38-
return startSketchOn(XY)
39-
|> startProfile(at = [center[0] - size, center[1] - size])
40-
|> line(endAbsolute = [center[0] + size, center[1] - size])
41-
|> line(endAbsolute = [center[0] + size, center[1] + size])
42-
|> line(endAbsolute = [center[0] - size, center[1] + size])
43-
|> close()
44-
|> extrude(length = 10)
42+
return startSketchOn(XY)
43+
|> startProfile(at = [center[0] - size, center[1] - size])
44+
|> line(endAbsolute = [center[0] + size, center[1] - size])
45+
|> line(endAbsolute = [center[0] + size, center[1] + size])
46+
|> line(endAbsolute = [center[0] - size, center[1] + size])
47+
|> close()
48+
|> extrude(length = 10)
4549
}
4650
4751
part001 = cube(center = [0, 0], size = 10)
4852
part002 = cube(center = [7, 3], size = 5)
49-
|> translate(z = 1)
53+
|> translate(z = 1)
5054
5155
intersectedPart = intersect([part001, part002])
5256
```
@@ -58,20 +62,19 @@ intersectedPart = intersect([part001, part002])
5862
// NOTE: This will not work when using codemods through the UI.
5963
// Codemods will generate the stdlib function call instead.
6064
61-
6265
fn cube(center, size) {
63-
return startSketchOn(XY)
64-
|> startProfile(at = [center[0] - size, center[1] - size])
65-
|> line(endAbsolute = [center[0] + size, center[1] - size])
66-
|> line(endAbsolute = [center[0] + size, center[1] + size])
67-
|> line(endAbsolute = [center[0] - size, center[1] + size])
68-
|> close()
69-
|> extrude(length = 10)
66+
return startSketchOn(XY)
67+
|> startProfile(at = [center[0] - size, center[1] - size])
68+
|> line(endAbsolute = [center[0] + size, center[1] - size])
69+
|> line(endAbsolute = [center[0] + size, center[1] + size])
70+
|> line(endAbsolute = [center[0] - size, center[1] + size])
71+
|> close()
72+
|> extrude(length = 10)
7073
}
7174
7275
part001 = cube(center = [0, 0], size = 10)
7376
part002 = cube(center = [7, 3], size = 5)
74-
|> translate(z = 1)
77+
|> translate(z = 1)
7578
7679
// This is the equivalent of: intersect([part001, part002])
7780
intersectedPart = part001 & part002

content/pages/docs/kcl-std/patternCircular3d.md renamed to content/pages/docs/kcl-std/functions/std-solid-patternCircular3d.md

Lines changed: 21 additions & 21 deletions
Large diffs are not rendered by default.

content/pages/docs/kcl-std/patternLinear3d.md renamed to content/pages/docs/kcl-std/functions/std-solid-patternLinear3d.md

Lines changed: 56 additions & 51 deletions
Large diffs are not rendered by default.

content/pages/docs/kcl-std/functions/std-solid-patternTransform.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ patternTransform(
1212
@solids: [Solid; 1+],
1313
instances: number(_),
1414
transform: fn(number(_)): { },
15-
useOriginal?: boolean,
15+
useOriginal?: bool,
1616
): [Solid; 1+]
1717
```
1818

@@ -61,7 +61,7 @@ Its properties are:
6161
| `solids` | [`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid) | The solid(s) to duplicate. | Yes |
6262
| `instances` | [`number(_)`](/docs/kcl-std/types/std-types-number) | The number of total instances. Must be greater than or equal to 1. This includes the original entity. For example, if instances is 2, there will be two copies -- the original, and one new copy. If instances is 1, this has no effect. | Yes |
6363
| `transform` | [`fn(number(_)): { }`](/docs/kcl-std/types/std-types-fn) | How each replica should be transformed. The transform function takes a single parameter: an integer representing which number replication the transform is for. E.g. the first replica to be transformed will be passed the argument `1`. This simplifies your math: the transform function can rely on id `0` being the original instance passed into the `patternTransform`. See the examples. | Yes |
64-
| `useOriginal` | `boolean` | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. | No |
64+
| `useOriginal` | [`bool`](/docs/kcl-std/types/std-types-bool) | If the target was sketched on an extrusion, setting this will use the original sketch as the target, not the entire joined solid. | No |
6565

6666
### Returns
6767

content/pages/docs/kcl-std/subtract.md renamed to content/pages/docs/kcl-std/functions/std-solid-subtract.md

Lines changed: 28 additions & 26 deletions
Large diffs are not rendered by default.

content/pages/docs/kcl-std/union.md renamed to content/pages/docs/kcl-std/functions/std-solid-union.md

Lines changed: 32 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ Union two or more solids into a single solid.
99

1010
```kcl
1111
union(
12-
@solids: [Solid],
13-
tolerance?: number,
14-
): [Solid]
12+
@solids: [Solid; 2+],
13+
tolerance?: number(Length),
14+
): [Solid; 1+]
1515
```
1616

1717

@@ -20,33 +20,32 @@ union(
2020

2121
| Name | Type | Description | Required |
2222
|----------|------|-------------|----------|
23-
| `solids` | [`[Solid]`](/docs/kcl-std/types/std-types-Solid) | The solids to union. | Yes |
24-
| `tolerance` | [`number`](/docs/kcl-std/types/std-types-number) | The tolerance to use for the union operation. | No |
23+
| `solids` | `[Solid; 2+]` | The solids to union. | Yes |
24+
| `tolerance` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The tolerance to use for the union operation. | No |
2525

2626
### Returns
2727

28-
[`[Solid]`](/docs/kcl-std/types/std-types-Solid)
28+
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
2929

3030

3131
### Examples
3232

3333
```kcl
3434
// Union two cubes using the stdlib functions.
3535
36-
3736
fn cube(center, size) {
38-
return startSketchOn(XY)
39-
|> startProfile(at = [center[0] - size, center[1] - size])
40-
|> line(endAbsolute = [center[0] + size, center[1] - size])
41-
|> line(endAbsolute = [center[0] + size, center[1] + size])
42-
|> line(endAbsolute = [center[0] - size, center[1] + size])
43-
|> close()
44-
|> extrude(length = 10)
37+
return startSketchOn(XY)
38+
|> startProfile(at = [center[0] - size, center[1] - size])
39+
|> line(endAbsolute = [center[0] + size, center[1] - size])
40+
|> line(endAbsolute = [center[0] + size, center[1] + size])
41+
|> line(endAbsolute = [center[0] - size, center[1] + size])
42+
|> close()
43+
|> extrude(length = 10)
4544
}
4645
4746
part001 = cube(center = [0, 0], size = 10)
4847
part002 = cube(center = [7, 3], size = 5)
49-
|> translate(z = 1)
48+
|> translate(z = 1)
5049
5150
unionedPart = union([part001, part002])
5251
```
@@ -58,20 +57,19 @@ unionedPart = union([part001, part002])
5857
// NOTE: This will not work when using codemods through the UI.
5958
// Codemods will generate the stdlib function call instead.
6059
61-
6260
fn cube(center, size) {
63-
return startSketchOn(XY)
64-
|> startProfile(at = [center[0] - size, center[1] - size])
65-
|> line(endAbsolute = [center[0] + size, center[1] - size])
66-
|> line(endAbsolute = [center[0] + size, center[1] + size])
67-
|> line(endAbsolute = [center[0] - size, center[1] + size])
68-
|> close()
69-
|> extrude(length = 10)
61+
return startSketchOn(XY)
62+
|> startProfile(at = [center[0] - size, center[1] - size])
63+
|> line(endAbsolute = [center[0] + size, center[1] - size])
64+
|> line(endAbsolute = [center[0] + size, center[1] + size])
65+
|> line(endAbsolute = [center[0] - size, center[1] + size])
66+
|> close()
67+
|> extrude(length = 10)
7068
}
7169
7270
part001 = cube(center = [0, 0], size = 10)
7371
part002 = cube(center = [7, 3], size = 5)
74-
|> translate(z = 1)
72+
|> translate(z = 1)
7573
7674
// This is the equivalent of: union([part001, part002])
7775
unionedPart = part001 + part002
@@ -84,23 +82,22 @@ unionedPart = part001 + part002
8482
// NOTE: This will not work when using codemods through the UI.
8583
// Codemods will generate the stdlib function call instead.
8684
87-
8885
fn cube(center, size) {
89-
return startSketchOn(XY)
90-
|> startProfile(at = [center[0] - size, center[1] - size])
91-
|> line(endAbsolute = [center[0] + size, center[1] - size])
92-
|> line(endAbsolute = [center[0] + size, center[1] + size])
93-
|> line(endAbsolute = [center[0] - size, center[1] + size])
94-
|> close()
95-
|> extrude(length = 10)
86+
return startSketchOn(XY)
87+
|> startProfile(at = [center[0] - size, center[1] - size])
88+
|> line(endAbsolute = [center[0] + size, center[1] - size])
89+
|> line(endAbsolute = [center[0] + size, center[1] + size])
90+
|> line(endAbsolute = [center[0] - size, center[1] + size])
91+
|> close()
92+
|> extrude(length = 10)
9693
}
9794
9895
part001 = cube(center = [0, 0], size = 10)
9996
part002 = cube(center = [7, 3], size = 5)
100-
|> translate(z = 1)
97+
|> translate(z = 1)
10198
102-
// This is the equivalent of: union([part001, part002])
103-
// Programmers will understand `|` as a union operation, but mechanical engineers
99+
// This is the equivalent of: union([part001, part002])
100+
// Programmers will understand `|` as a union operation, but mechanical engineers
104101
// will understand `+`, we made both work.
105102
unionedPart = part001 | part002
106103
```

content/pages/docs/kcl-std/index.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ layout: manual
9393
* [`chamfer`](/docs/kcl-std/functions/std-solid-chamfer)
9494
* [`fillet`](/docs/kcl-std/functions/std-solid-fillet)
9595
* [`hollow`](/docs/kcl-std/functions/std-solid-hollow)
96-
* [`intersect`](/docs/kcl-std/intersect)
97-
* [`patternCircular3d`](/docs/kcl-std/patternCircular3d)
98-
* [`patternLinear3d`](/docs/kcl-std/patternLinear3d)
96+
* [`intersect`](/docs/kcl-std/functions/std-solid-intersect)
97+
* [`patternCircular3d`](/docs/kcl-std/functions/std-solid-patternCircular3d)
98+
* [`patternLinear3d`](/docs/kcl-std/functions/std-solid-patternLinear3d)
9999
* [`patternTransform`](/docs/kcl-std/functions/std-solid-patternTransform)
100100
* [`shell`](/docs/kcl-std/functions/std-solid-shell)
101-
* [`subtract`](/docs/kcl-std/subtract)
102-
* [`union`](/docs/kcl-std/union)
101+
* [`subtract`](/docs/kcl-std/functions/std-solid-subtract)
102+
* [`union`](/docs/kcl-std/functions/std-solid-union)
103103
* [**std::transform**](/docs/kcl-std/modules/std-transform)
104104
* [`mirror2d`](/docs/kcl-std/functions/std-transform-mirror2d)
105105
* [`rotate`](/docs/kcl-std/rotate)

content/pages/docs/kcl-std/modules/std-solid.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ This module contains functions for modifying solids, e.g., by adding a fillet or
1515
* [`chamfer`](/docs/kcl-std/functions/std-solid-chamfer)
1616
* [`fillet`](/docs/kcl-std/functions/std-solid-fillet)
1717
* [`hollow`](/docs/kcl-std/functions/std-solid-hollow)
18-
* [`intersect`](/docs/kcl-std/intersect)
19-
* [`patternCircular3d`](/docs/kcl-std/patternCircular3d)
20-
* [`patternLinear3d`](/docs/kcl-std/patternLinear3d)
18+
* [`intersect`](/docs/kcl-std/functions/std-solid-intersect)
19+
* [`patternCircular3d`](/docs/kcl-std/functions/std-solid-patternCircular3d)
20+
* [`patternLinear3d`](/docs/kcl-std/functions/std-solid-patternLinear3d)
2121
* [`patternTransform`](/docs/kcl-std/functions/std-solid-patternTransform)
2222
* [`shell`](/docs/kcl-std/functions/std-solid-shell)
23-
* [`subtract`](/docs/kcl-std/subtract)
24-
* [`union`](/docs/kcl-std/union)
23+
* [`subtract`](/docs/kcl-std/functions/std-solid-subtract)
24+
* [`union`](/docs/kcl-std/functions/std-solid-union)
2525

0 commit comments

Comments
 (0)