Skip to content

Commit 45e0b9e

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

16 files changed

+26882
-104896
lines changed

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

Lines changed: 0 additions & 64 deletions
This file was deleted.

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

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "assert"
3+
subtitle: "Function in std"
4+
excerpt: ""
5+
layout: manual
6+
---
7+
8+
9+
10+
```kcl
11+
assert(
12+
@actual: number,
13+
isGreaterThan?: number,
14+
isLessThan?: number,
15+
isGreaterThanOrEqual?: number,
16+
isLessThanOrEqual?: number,
17+
isEqualTo?: number,
18+
tolerance?: number,
19+
error?: string,
20+
)
21+
```
22+
23+
Check a value meets some expected conditions at runtime. Program terminates with an error if conditions aren't met.
24+
If you provide multiple conditions, they will all be checked and all must be met.
25+
26+
### Arguments
27+
28+
| Name | Type | Description | Required |
29+
|----------|------|-------------|----------|
30+
| `actual` | [`number`](/docs/kcl-std/types/std-types-number) | Value to check. If this is the boolean value true, assert passes. Otherwise it fails.. | Yes |
31+
| `isGreaterThan` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is greater than this. | No |
32+
| `isLessThan` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than this. | No |
33+
| `isGreaterThanOrEqual` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is greater than or equal to this. | No |
34+
| `isLessThanOrEqual` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
35+
| `isEqualTo` | [`number`](/docs/kcl-std/types/std-types-number) | Comparison argument. If given, checks the `actual` value is less than or equal to this. | No |
36+
| `tolerance` | [`number`](/docs/kcl-std/types/std-types-number) | If `isEqualTo` is used, this is the tolerance to allow for the comparison. This tolerance is used because KCL's number system has some floating-point imprecision when used with very large decimal places. | No |
37+
| `error` | [`string`](/docs/kcl-std/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
38+
39+
40+
### Examples
41+
42+
```kcl
43+
n = 10
44+
assert(n, isEqualTo = 10)
45+
assert(n, isGreaterThanOrEqual = 0, isLessThan = 100, error = "number should be between 0 and 100")
46+
assert(1.0000000000012, isEqualTo = 1, tolerance = 0.0001, error = "number should be almost exactly 1")
47+
```
48+
49+
50+
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: "assertIs"
3+
subtitle: "Function in std"
4+
excerpt: "Asserts that a value is the boolean value true."
5+
layout: manual
6+
---
7+
8+
Asserts that a value is the boolean value true.
9+
10+
```kcl
11+
assertIs(
12+
@actual: bool,
13+
error?: string,
14+
)
15+
```
16+
17+
18+
19+
### Arguments
20+
21+
| Name | Type | Description | Required |
22+
|----------|------|-------------|----------|
23+
| `actual` | [`bool`](/docs/kcl-std/types/std-types-bool) | Value to check. If this is the boolean value true, assert passes. Otherwise it fails.. | Yes |
24+
| `error` | [`string`](/docs/kcl-std/types/std-types-string) | If the value was false, the program will terminate with this error message | No |
25+
26+
27+
### Examples
28+
29+
```kcl
30+
kclIsFun = true
31+
assertIs(kclIsFun)
32+
```
33+
34+
35+

content/pages/docs/kcl-std/functions/std-sketch-circle.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ layout: manual
99

1010
```kcl
1111
circle(
12-
@sketch_or_surface: Sketch | Plane | Face,
12+
@sketchOrSurface: Sketch | Plane | Face,
1313
center: Point2d,
1414
radius?: number(Length),
1515
diameter?: number(Length),
@@ -24,7 +24,7 @@ the provided (x, y) origin point.
2424

2525
| Name | Type | Description | Required |
2626
|----------|------|-------------|----------|
27-
| `sketch_or_surface` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
27+
| `sketchOrSurface` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Sketch to extend, or plane or surface to sketch on. | Yes |
2828
| `center` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The center of the circle. | Yes |
2929
| `radius` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The radius of the circle. Incompatible with `diameter`. | No |
3030
| `diameter` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | The diameter of the circle. Incompatible with `radius`. | No |

content/pages/docs/kcl-std/circleThreePoint.md renamed to content/pages/docs/kcl-std/functions/std-sketch-circleThreePoint.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ Construct a circle derived from 3 points.
99

1010
```kcl
1111
circleThreePoint(
12-
@sketchSurfaceOrGroup: Sketch | Plane | Face,
12+
@sketchOrSurface: Sketch | Plane | Face,
1313
p1: Point2d,
1414
p2: Point2d,
1515
p3: Point2d,
16-
tag?: TagDeclarator,
16+
tag?: tag,
1717
): Sketch
1818
```
1919

@@ -23,11 +23,11 @@ circleThreePoint(
2323

2424
| Name | Type | Description | Required |
2525
|----------|------|-------------|----------|
26-
| `sketchSurfaceOrGroup` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Plane or surface to sketch on. | Yes |
26+
| `sketchOrSurface` | [`Sketch`](/docs/kcl-std/types/std-types-Sketch) or [`Plane`](/docs/kcl-std/types/std-types-Plane) or [`Face`](/docs/kcl-std/types/std-types-Face) | Plane or surface to sketch on. | Yes |
2727
| `p1` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 1st point to derive the circle. | Yes |
2828
| `p2` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 2nd point to derive the circle. | Yes |
2929
| `p3` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | 3rd point to derive the circle. | Yes |
30-
| [`tag`](/docs/kcl-std/types/std-types-tag) | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | Identifier for the circle to reference elsewhere. | No |
30+
| [`tag`](/docs/kcl-std/types/std-types-tag) | [`tag`](/docs/kcl-std/types/std-types-tag) | Identifier for the circle to reference elsewhere. | No |
3131

3232
### Returns
3333

@@ -38,7 +38,7 @@ circleThreePoint(
3838

3939
```kcl
4040
exampleSketch = startSketchOn(XY)
41-
|> circleThreePoint(p1 = [10, 10], p2 = [20, 8], p3 = [15, 5])
41+
|> circleThreePoint(p1 = [10,10], p2 = [20,8], p3 = [15,5])
4242
|> extrude(length = 5)
4343
```
4444

content/pages/docs/kcl-std/extrude.md renamed to content/pages/docs/kcl-std/functions/std-sketch-extrude.md

Lines changed: 59 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
11
---
22
title: "extrude"
33
subtitle: "Function in std::sketch"
4-
excerpt: "Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid."
4+
excerpt: ""
55
layout: manual
66
---
77

8-
Extend a 2-dimensional sketch through a third dimension in order to create new 3-dimensional volume, or if extruded into an existing volume, cut into an existing solid.
8+
99

1010
```kcl
1111
extrude(
12-
@sketches: [Sketch],
13-
length: number,
12+
@sketches: [Sketch; 1+],
13+
length: number(Length),
1414
symmetric?: bool,
15-
bidirectionalLength?: number,
16-
tagStart?: TagDeclarator,
17-
tagEnd?: TagDeclarator,
18-
): [Solid]
15+
bidirectionalLength?: number(Length),
16+
tagStart?: tag,
17+
tagEnd?: tag,
18+
): [Solid; 1+]
1919
```
2020

21-
You can provide more than one sketch to extrude, and they will all be extruded in the same direction.
21+
Extend a 2-dimensional sketch through a third dimension in order to
22+
create new 3-dimensional volume, or if extruded into an existing volume,cut into an existing solid.
23+
24+
You can provide more than one sketch to extrude, and they will all be
25+
extruded in the same direction.
2226

2327
### Arguments
2428

2529
| Name | Type | Description | Required |
2630
|----------|------|-------------|----------|
27-
| `sketches` | [`[Sketch]`](/docs/kcl-std/types/std-types-Sketch) | Which sketch or sketches should be extruded | Yes |
28-
| `length` | [`number`](/docs/kcl-std/types/std-types-number) | How far to extrude the given sketches | Yes |
31+
| `sketches` | [`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch) | Which sketch or sketches should be extruded. | Yes |
32+
| `length` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | How far to extrude the given sketches. | Yes |
2933
| `symmetric` | [`bool`](/docs/kcl-std/types/std-types-bool) | If true, the extrusion will happen symmetrically around the sketch. Otherwise, the extrusion will happen on only one side of the sketch. | No |
30-
| `bidirectionalLength` | [`number`](/docs/kcl-std/types/std-types-number) | If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored. | No |
31-
| `tagStart` | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | A named tag for the face at the start of the extrusion, i.e. the original sketch | No |
32-
| `tagEnd` | [`TagDeclarator`](/docs/kcl-lang/types#TagDeclarator) | A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch | No |
34+
| `bidirectionalLength` | [`number(Length)`](/docs/kcl-std/types/std-types-number) | If specified, will also extrude in the opposite direction to 'distance' to the specified distance. If 'symmetric' is true, this value is ignored. | No |
35+
| `tagStart` | [`tag`](/docs/kcl-std/types/std-types-tag) | A named tag for the face at the start of the extrusion, i.e. the original sketch. | No |
36+
| `tagEnd` | [`tag`](/docs/kcl-std/types/std-types-tag) | A named tag for the face at the end of the extrusion, i.e. the new face created by extruding the original sketch. | No |
3337

3438
### Returns
3539

36-
[`[Solid]`](/docs/kcl-std/types/std-types-Solid)
40+
[`[Solid; 1+]`](/docs/kcl-std/types/std-types-Solid)
3741

3842

3943
### Examples
@@ -42,10 +46,18 @@ You can provide more than one sketch to extrude, and they will all be extruded i
4246
example = startSketchOn(XZ)
4347
|> startProfile(at = [0, 0])
4448
|> line(end = [10, 0])
45-
|> arc(angleStart = 120, angleEnd = 0, radius = 5)
49+
|> arc(
50+
angleStart = 120,
51+
angleEnd = 0,
52+
radius = 5,
53+
)
4654
|> line(end = [5, 0])
4755
|> line(end = [0, 10])
48-
|> bezierCurve(control1 = [-10, 0], control2 = [2, 10], end = [-5, 10])
56+
|> bezierCurve(
57+
control1 = [-10, 0],
58+
control2 = [2, 10],
59+
end = [-5, 10],
60+
)
4961
|> line(end = [-5, -2])
5062
|> close()
5163
|> extrude(length = 10)
@@ -56,10 +68,18 @@ example = startSketchOn(XZ)
5668
```kcl
5769
exampleSketch = startSketchOn(XZ)
5870
|> startProfile(at = [-10, 0])
59-
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
71+
|> arc(
72+
angleStart = 120,
73+
angleEnd = -60,
74+
radius = 5,
75+
)
6076
|> line(end = [10, 0])
6177
|> line(end = [5, 0])
62-
|> bezierCurve(control1 = [-3, 0], control2 = [2, 10], end = [-5, 10])
78+
|> bezierCurve(
79+
control1 = [-3, 0],
80+
control2 = [2, 10],
81+
end = [-5, 10],
82+
)
6383
|> line(end = [-4, 10])
6484
|> line(end = [-5, -2])
6585
|> close()
@@ -72,10 +92,18 @@ example = extrude(exampleSketch, length = 10)
7292
```kcl
7393
exampleSketch = startSketchOn(XZ)
7494
|> startProfile(at = [-10, 0])
75-
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
95+
|> arc(
96+
angleStart = 120,
97+
angleEnd = -60,
98+
radius = 5,
99+
)
76100
|> line(end = [10, 0])
77101
|> line(end = [5, 0])
78-
|> bezierCurve(control1 = [-3, 0], control2 = [2, 10], end = [-5, 10])
102+
|> bezierCurve(
103+
control1 = [-3, 0],
104+
control2 = [2, 10],
105+
end = [-5, 10],
106+
)
79107
|> line(end = [-4, 10])
80108
|> line(end = [-5, -2])
81109
|> close()
@@ -88,10 +116,18 @@ example = extrude(exampleSketch, length = 20, symmetric = true)
88116
```kcl
89117
exampleSketch = startSketchOn(XZ)
90118
|> startProfile(at = [-10, 0])
91-
|> arc(angleStart = 120, angleEnd = -60, radius = 5)
119+
|> arc(
120+
angleStart = 120,
121+
angleEnd = -60,
122+
radius = 5,
123+
)
92124
|> line(end = [10, 0])
93125
|> line(end = [5, 0])
94-
|> bezierCurve(control1 = [-3, 0], control2 = [2, 10], end = [-5, 10])
126+
|> bezierCurve(
127+
control1 = [-3, 0],
128+
control2 = [2, 10],
129+
end = [-5, 10],
130+
)
95131
|> line(end = [-4, 10])
96132
|> line(end = [-5, -2])
97133
|> close()

content/pages/docs/kcl-std/loft.md renamed to content/pages/docs/kcl-std/functions/std-sketch-loft.md

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

content/pages/docs/kcl-std/patternCircular2d.md renamed to content/pages/docs/kcl-std/functions/std-sketch-patternCircular2d.md

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
---
22
title: "patternCircular2d"
33
subtitle: "Function in std::sketch"
4-
excerpt: "Repeat a 2-dimensional sketch some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orientation of the solid with respect to the center of the circle is maintained."
4+
excerpt: ""
55
layout: manual
66
---
77

8-
Repeat a 2-dimensional sketch some number of times along a partial or complete circle some specified number of times. Each object may additionally be rotated along the circle, ensuring orientation of the solid with respect to the center of the circle is maintained.
8+
99

1010
```kcl
1111
patternCircular2d(
12-
@sketchSet: [Sketch],
13-
instances: number,
12+
@sketches: [Sketch; 1+],
13+
instances: number(_),
1414
center: Point2d,
15-
arcDegrees?: number,
15+
arcDegrees?: number(Angle),
1616
rotateDuplicates?: bool,
1717
useOriginal?: bool,
18-
): [Sketch]
18+
): [Sketch; 1+]
1919
```
2020

21-
21+
Repeat a 2-dimensional sketch some number of times along a partial or
22+
complete circle some specified number of times. Each object mayadditionally be rotated along the circle, ensuring orientation of the
23+
solid with respect to the center of the circle is maintained.
2224

2325
### Arguments
2426

2527
| Name | Type | Description | Required |
2628
|----------|------|-------------|----------|
27-
| `sketchSet` | [`[Sketch]`](/docs/kcl-std/types/std-types-Sketch) | Which sketch(es) to pattern | Yes |
28-
| `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 |
29+
| `sketches` | [`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch) | The sketch(es) to duplicate. | Yes |
30+
| `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 |
2931
| `center` | [`Point2d`](/docs/kcl-std/types/std-types-Point2d) | The center about which to make the pattern. This is a 2D vector. | Yes |
30-
| `arcDegrees` | [`number`](/docs/kcl-std/types/std-types-number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. Defaults to 360. | No |
31-
| `rotateDuplicates` | [`bool`](/docs/kcl-std/types/std-types-bool) | Whether or not to rotate the duplicates as they are copied. Defaults to true. | No |
32-
| `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. Defaults to false. | No |
32+
| `arcDegrees` | [`number(Angle)`](/docs/kcl-std/types/std-types-number) | The arc angle (in degrees) to place the repetitions. Must be greater than 0. | No |
33+
| `rotateDuplicates` | [`bool`](/docs/kcl-std/types/std-types-bool) | Whether or not to rotate the duplicates as they are copied. | No |
34+
| `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 |
3335

3436
### Returns
3537

36-
[`[Sketch]`](/docs/kcl-std/types/std-types-Sketch)
38+
[`[Sketch; 1+]`](/docs/kcl-std/types/std-types-Sketch)
3739

3840

3941
### Examples
@@ -49,7 +51,7 @@ exampleSketch = startSketchOn(XZ)
4951
center = [0, 0],
5052
instances = 13,
5153
arcDegrees = 360,
52-
rotateDuplicates = true,
54+
rotateDuplicates = true
5355
)
5456
5557
example = extrude(exampleSketch, length = 1)

0 commit comments

Comments
 (0)