You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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")
Copy file name to clipboardExpand all lines: content/pages/docs/kcl-std/functions/std-sketch-circle.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ layout: manual
9
9
10
10
```kcl
11
11
circle(
12
-
@sketch_or_surface: Sketch | Plane | Face,
12
+
@sketchOrSurface: Sketch | Plane | Face,
13
13
center: Point2d,
14
14
radius?: number(Length),
15
15
diameter?: number(Length),
@@ -24,7 +24,7 @@ the provided (x, y) origin point.
24
24
25
25
| Name | Type | Description | Required |
26
26
|----------|------|-------------|----------|
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 |
28
28
|`center`|[`Point2d`](/docs/kcl-std/types/std-types-Point2d)| The center of the circle. | Yes |
29
29
|`radius`|[`number(Length)`](/docs/kcl-std/types/std-types-number)| The radius of the circle. Incompatible with `diameter`. | No |
30
30
|`diameter`|[`number(Length)`](/docs/kcl-std/types/std-types-number)| The diameter of the circle. Incompatible with `radius`. | No |
Copy file name to clipboardExpand all lines: content/pages/docs/kcl-std/functions/std-sketch-circleThreePoint.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,11 @@ Construct a circle derived from 3 points.
9
9
10
10
```kcl
11
11
circleThreePoint(
12
-
@sketchSurfaceOrGroup: Sketch | Plane | Face,
12
+
@sketchOrSurface: Sketch | Plane | Face,
13
13
p1: Point2d,
14
14
p2: Point2d,
15
15
p3: Point2d,
16
-
tag?: TagDeclarator,
16
+
tag?: tag,
17
17
): Sketch
18
18
```
19
19
@@ -23,11 +23,11 @@ circleThreePoint(
23
23
24
24
| Name | Type | Description | Required |
25
25
|----------|------|-------------|----------|
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 |
27
27
|`p1`|[`Point2d`](/docs/kcl-std/types/std-types-Point2d)| 1st point to derive the circle. | Yes |
28
28
|`p2`|[`Point2d`](/docs/kcl-std/types/std-types-Point2d)| 2nd point to derive the circle. | Yes |
29
29
|`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 |
Copy file name to clipboardExpand all lines: content/pages/docs/kcl-std/functions/std-sketch-extrude.md
+59-23Lines changed: 59 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,43 @@
1
1
---
2
2
title: "extrude"
3
3
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: ""
5
5
layout: manual
6
6
---
7
7
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
+
9
9
10
10
```kcl
11
11
extrude(
12
-
@sketches: [Sketch],
13
-
length: number,
12
+
@sketches: [Sketch; 1+],
13
+
length: number(Length),
14
14
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+]
19
19
```
20
20
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.
22
26
23
27
### Arguments
24
28
25
29
| Name | Type | Description | Required |
26
30
|----------|------|-------------|----------|
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 |
29
33
|`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 |
Copy file name to clipboardExpand all lines: content/pages/docs/kcl-std/functions/std-sketch-patternCircular2d.md
+16-14Lines changed: 16 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,39 +1,41 @@
1
1
---
2
2
title: "patternCircular2d"
3
3
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: ""
5
5
layout: manual
6
6
---
7
7
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
+
9
9
10
10
```kcl
11
11
patternCircular2d(
12
-
@sketchSet: [Sketch],
13
-
instances: number,
12
+
@sketches: [Sketch; 1+],
13
+
instances: number(_),
14
14
center: Point2d,
15
-
arcDegrees?: number,
15
+
arcDegrees?: number(Angle),
16
16
rotateDuplicates?: bool,
17
17
useOriginal?: bool,
18
-
): [Sketch]
18
+
): [Sketch; 1+]
19
19
```
20
20
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.
22
24
23
25
### Arguments
24
26
25
27
| Name | Type | Description | Required |
26
28
|----------|------|-------------|----------|
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 |
29
31
|`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 |
0 commit comments