Move the wasm lib, and cleanup rust directory and all references (#5585)

* git mv src/wasm-lib rust

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mv wasm-lib to workspace

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mv kcl-lib

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* mv derive docs

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* resolve file paths

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* clippy

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* move more shit

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix more paths

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* make yarn build:wasm work

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix scripts

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixups

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* better references

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix cargo ci

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix reference

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix more ci

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* cargo sort

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix script

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fmt

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fix a dep

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* sort

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* remove unused deps

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* Revert "remove unused deps"

This reverts commit fbabdb062e275fd5cbc1476f8480a1afee15d972.

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* deps;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* fixes

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-03-01 13:59:01 -08:00
committed by GitHub
parent 0a2bf4b55f
commit c3bdc6f106
1443 changed files with 509 additions and 4274 deletions

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands add_lots.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart add_lots.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fn f(i) {
return i * 2
}
x = f(0) + f(1) + f(2) + f(3) + f(4) + f(5) + f(6) + f(7) + f(8) + f(9) + f(10) + f(11) + f(12) + f(13) + f(14) + f(15) + f(16) + f(17) + f(18) + f(19) + f(20) + f(21) + f(22) + f(23) + f(24) + f(25) + f(26) + f(27) + f(28) + f(29) + f(30) + f(31) + f(32) + f(33) + f(34) + f(35) + f(36) + f(37) + f(38) + f(39) + f(40) + f(41) + f(42) + f(43) + f(44) + f(45) + f(46) + f(47) + f(48) + f(49) + f(50) + f(51) + f(52) + f(53) + f(54) + f(55) + f(56) + f(57) + f(58) + f(59) + f(60) + f(61) + f(62) + f(63) + f(64) + f(65) + f(66) + f(67) + f(68) + f(69) + f(70) + f(71) + f(72) + f(73) + f(74) + f(75) + f(76) + f(77) + f(78) + f(79) + f(80) + f(81) + f(82) + f(83) + f(84) + f(85) + f(86) + f(87) + f(88) + f(89) + f(90) + f(91) + f(92) + f(93) + f(94) + f(95) + f(96) + f(97) + f(98) + f(99) + f(100)
assertEqual(x, 10100, 0.1, "Big sum")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,728 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands angled_line.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
10,
29,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
35,
67,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
35,
67,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
35,
67,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 4.83,
"y": 12.56,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
73,
97,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 15.1,
"y": 2.48,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
103,
142,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 3.15,
"y": -9.85,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
148,
174,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -15.17,
"y": -4.1,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
180,
217,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 3.7618,
"y": -11.7631,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
223,
250,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -13.02,
"y": 10.03,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
256,
264,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
256,
264,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 4.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
270,
289,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart angled_line.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,82 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[35, 67, 0]"]
3["Segment<br>[73, 97, 0]"]
4["Segment<br>[103, 142, 0]"]
5["Segment<br>[148, 174, 0]"]
6["Segment<br>[180, 217, 0]"]
7["Segment<br>[223, 250, 0]"]
8["Segment<br>[256, 264, 0]"]
9[Solid2d]
end
1["Plane<br>[10, 29, 0]"]
10["Sweep Extrusion<br>[270, 289, 0]"]
11[Wall]
12[Wall]
13[Wall]
14[Wall]
15[Wall]
16[Wall]
17["Cap Start"]
18["Cap End"]
19["SweepEdge Opposite"]
20["SweepEdge Adjacent"]
21["SweepEdge Opposite"]
22["SweepEdge Adjacent"]
23["SweepEdge Opposite"]
24["SweepEdge Adjacent"]
25["SweepEdge Opposite"]
26["SweepEdge Adjacent"]
27["SweepEdge Opposite"]
28["SweepEdge Adjacent"]
29["SweepEdge Opposite"]
30["SweepEdge Adjacent"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 --- 7
2 --- 8
2 ---- 10
2 --- 9
3 --- 16
3 --- 29
3 --- 30
4 --- 15
4 --- 27
4 --- 28
5 --- 14
5 --- 25
5 --- 26
6 --- 13
6 --- 23
6 --- 24
7 --- 12
7 --- 21
7 --- 22
8 --- 11
8 --- 19
8 --- 20
10 --- 11
10 --- 12
10 --- 13
10 --- 14
10 --- 15
10 --- 16
10 --- 17
10 --- 18
10 --- 19
10 --- 20
10 --- 21
10 --- 22
10 --- 23
10 --- 24
10 --- 25
10 --- 26
10 --- 27
10 --- 28
10 --- 29
10 --- 30
```

View File

@ -0,0 +1,473 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing angled_line.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 289,
"id": {
"end": 7,
"name": "part001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 28,
"raw": "'XY'",
"start": 24,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 23,
"name": "startSketchOn",
"start": 10,
"type": "Identifier"
},
"end": 29,
"start": 10,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 55,
"raw": "4.83",
"start": 51,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.83,
"suffix": "None"
}
},
{
"end": 62,
"raw": "12.56",
"start": 57,
"type": "Literal",
"type": "Literal",
"value": {
"value": 12.56,
"suffix": "None"
}
}
],
"end": 63,
"start": 50,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 66,
"start": 65,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 49,
"name": "startProfileAt",
"start": 35,
"type": "Identifier"
},
"end": 67,
"start": 35,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 89,
"raw": "15.1",
"start": 85,
"type": "Literal",
"type": "Literal",
"value": {
"value": 15.1,
"suffix": "None"
}
},
{
"end": 95,
"raw": "2.48",
"start": 91,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.48,
"suffix": "None"
}
}
],
"end": 96,
"start": 84,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 77,
"name": "line",
"start": 73,
"type": "Identifier"
},
"end": 97,
"start": 73,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 119,
"raw": "3.15",
"start": 115,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.15,
"suffix": "None"
}
},
{
"argument": {
"end": 126,
"raw": "9.85",
"start": 122,
"type": "Literal",
"type": "Literal",
"value": {
"value": 9.85,
"suffix": "None"
}
},
"end": 126,
"operator": "-",
"start": 121,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 127,
"start": 114,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "tag"
},
"arg": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
}
],
"callee": {
"end": 107,
"name": "line",
"start": 103,
"type": "Identifier"
},
"end": 142,
"start": 103,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"argument": {
"end": 166,
"raw": "15.17",
"start": 161,
"type": "Literal",
"type": "Literal",
"value": {
"value": 15.17,
"suffix": "None"
}
},
"end": 166,
"operator": "-",
"start": 160,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 172,
"raw": "4.1",
"start": 169,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.1,
"suffix": "None"
}
},
"end": 172,
"operator": "-",
"start": 168,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 173,
"start": 159,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 152,
"name": "line",
"start": 148,
"type": "Identifier"
},
"end": 174,
"start": 148,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"elements": [
{
"arguments": [
{
"end": 204,
"name": "seg01",
"start": 199,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 198,
"name": "segAng",
"start": 192,
"type": "Identifier"
},
"end": 205,
"start": 192,
"type": "CallExpression",
"type": "CallExpression"
},
{
"end": 212,
"raw": "12.35",
"start": 207,
"type": "Literal",
"type": "Literal",
"value": {
"value": 12.35,
"suffix": "None"
}
}
],
"end": 213,
"start": 191,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 216,
"start": 215,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 190,
"name": "angledLine",
"start": 180,
"type": "Identifier"
},
"end": 217,
"start": 180,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"argument": {
"end": 241,
"raw": "13.02",
"start": 236,
"type": "Literal",
"type": "Literal",
"value": {
"value": 13.02,
"suffix": "None"
}
},
"end": 241,
"operator": "-",
"start": 235,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 248,
"raw": "10.03",
"start": 243,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.03,
"suffix": "None"
}
}
],
"end": 249,
"start": 234,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 227,
"name": "line",
"start": 223,
"type": "Identifier"
},
"end": 250,
"start": 223,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"end": 263,
"start": 262,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 261,
"name": "close",
"start": 256,
"type": "Identifier"
},
"end": 264,
"start": 256,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "length"
},
"arg": {
"end": 288,
"raw": "4",
"start": 287,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
}
}
],
"callee": {
"end": 277,
"name": "extrude",
"start": 270,
"type": "Identifier"
},
"end": 289,
"start": 270,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 289,
"start": 10,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 289,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 290,
"start": 0
}
}

View File

@ -0,0 +1,9 @@
part001 = startSketchOn('XY')
|> startProfileAt([4.83, 12.56], %)
|> line(end = [15.1, 2.48])
|> line(end = [3.15, -9.85], tag = $seg01)
|> line(end = [-15.17, -4.1])
|> angledLine([segAng(seg01), 12.35], %)
|> line(end = [-13.02, 10.03])
|> close(%)
|> extrude(length = 4)

View File

@ -0,0 +1,73 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed angled_line.kcl
---
[
{
"labeledArgs": {
"data": {
"value": {
"type": "String",
"value": "XY"
},
"sourceRange": [
24,
28,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
10,
29,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 4.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
287,
288,
0
]
}
},
"name": "extrude",
"sourceRange": [
270,
289,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": [
0,
0,
0
]
}
}
]

View File

@ -0,0 +1,444 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing angled_line.kcl
---
{
"part001": {
"type": "Solid",
"value": {
"type": "Solid",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": [
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
73,
97,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
103,
142,
0
],
"tag": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
148,
174,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
180,
217,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
223,
250,
0
],
"tag": null,
"type": "extrudePlane"
},
{
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
256,
264,
0
],
"tag": null,
"type": "extrudePlane"
}
],
"sketch": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
73,
97,
0
]
},
"from": [
4.83,
12.56
],
"tag": null,
"to": [
19.93,
15.04
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
103,
142,
0
]
},
"from": [
19.93,
15.04
],
"tag": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
23.08,
5.19
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
148,
174,
0
]
},
"from": [
23.08,
5.19
],
"tag": null,
"to": [
7.91,
1.09
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
180,
217,
0
]
},
"from": [
7.91,
1.09
],
"tag": null,
"to": [
11.6718,
-10.6731
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
223,
250,
0
]
},
"from": [
11.6718,
-10.6731
],
"tag": null,
"to": [
-1.3482,
-0.6431
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
256,
264,
0
]
},
"from": [
-1.3482,
-0.6431
],
"tag": null,
"to": [
4.83,
12.56
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XY",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"zAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"units": {
"type": "Mm"
},
"__meta": []
},
"start": {
"from": [
4.83,
12.56
],
"to": [
4.83,
12.56
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
35,
67,
0
]
}
},
"tags": {
"seg01": {
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
103,
142,
0
]
},
"from": [
19.93,
15.04
],
"tag": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
23.08,
5.19
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
103,
142,
0
],
"tag": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
135,
141,
0
]
}
]
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
},
"__meta": [
{
"sourceRange": [
35,
67,
0
]
}
]
},
"height": 4.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Mm"
},
"__meta": [
{
"sourceRange": [
35,
67,
0
]
}
]
}
},
"seg01": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "seg01",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
103,
142,
0
]
},
"from": [
19.93,
15.04
],
"tag": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"value": "seg01"
},
"to": [
23.08,
5.19
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": {
"faceId": "[uuid]",
"id": "[uuid]",
"sourceRange": [
103,
142,
0
],
"tag": {
"end": 141,
"start": 135,
"type": "TagDeclarator",
"value": "seg01"
},
"type": "extrudePlane"
}
},
"__meta": [
{
"sourceRange": [
135,
141,
0
]
}
]
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands argument_error.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart argument_error.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,142 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing argument_error.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 22,
"id": {
"end": 4,
"name": "f",
"start": 3,
"type": "Identifier"
},
"init": {
"body": {
"body": [
{
"argument": {
"end": 20,
"raw": "5",
"start": 19,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 20,
"start": 12,
"type": "ReturnStatement",
"type": "ReturnStatement"
}
],
"end": 22,
"start": 8
},
"end": 22,
"params": [
{
"type": "Parameter",
"identifier": {
"end": 6,
"name": "i",
"start": 5,
"type": "Identifier"
}
}
],
"start": 4,
"type": "FunctionExpression",
"type": "FunctionExpression"
},
"start": 3,
"type": "VariableDeclarator"
},
"end": 22,
"kind": "fn",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 38,
"expression": {
"arguments": [
{
"end": 29,
"name": "f",
"start": 28,
"type": "Identifier",
"type": "Identifier"
},
{
"elements": [
{
"end": 33,
"raw": "0",
"start": 32,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 36,
"raw": "1",
"start": 35,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
}
],
"end": 37,
"start": 31,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": {
"end": 27,
"name": "map",
"start": 24,
"type": "Identifier"
},
"end": 38,
"start": 24,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 24,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 39,
"nonCodeMeta": {
"nonCodeNodes": {
"0": [
{
"end": 24,
"start": 22,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,13 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing argument_error.kcl
---
KCL Type error
× type: Expected an array but found Function
╭─[5:5]
4 │
5 │ map(f, [0, 1])
· ┬
· ╰── tests/argument_error/input.kcl
╰────

View File

@ -0,0 +1,5 @@
fn f(i) {
return 5
}
map(f, [0, 1])

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed argument_error.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_elem_pop.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_elem_pop.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,413 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_elem_pop.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 35,
"id": {
"end": 24,
"name": "new_arr1",
"start": 16,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 34,
"name": "arr",
"start": 31,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 30,
"name": "pop",
"start": 27,
"type": "Identifier"
},
"end": 35,
"start": 27,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 16,
"type": "VariableDeclarator"
},
"end": 35,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 60,
"id": {
"end": 44,
"name": "new_arr2",
"start": 36,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 59,
"name": "new_arr1",
"start": 51,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 50,
"name": "pop",
"start": 47,
"type": "Identifier"
},
"end": 60,
"start": 47,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 36,
"type": "VariableDeclarator"
},
"end": 60,
"kind": "const",
"start": 36,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 85,
"id": {
"end": 69,
"name": "new_arr3",
"start": 61,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 84,
"name": "new_arr2",
"start": 76,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 75,
"name": "pop",
"start": 72,
"type": "Identifier"
},
"end": 85,
"start": 72,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 61,
"type": "VariableDeclarator"
},
"end": 85,
"kind": "const",
"start": 61,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 159,
"expression": {
"arguments": [
{
"computed": false,
"end": 109,
"object": {
"end": 106,
"name": "new_arr1",
"start": 98,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 108,
"raw": "0",
"start": 107,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 98,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 112,
"raw": "1",
"start": 111,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 121,
"raw": "0.00001",
"start": 114,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 158,
"raw": "\"element 0 should not have changed\"",
"start": 123,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"end": 97,
"name": "assertEqual",
"start": 86,
"type": "Identifier"
},
"end": 159,
"start": 86,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 86,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 233,
"expression": {
"arguments": [
{
"computed": false,
"end": 183,
"object": {
"end": 180,
"name": "new_arr1",
"start": 172,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 182,
"raw": "1",
"start": 181,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 172,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 186,
"raw": "2",
"start": 185,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 195,
"raw": "0.00001",
"start": 188,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 232,
"raw": "\"element 1 should not have changed\"",
"start": 197,
"type": "Literal",
"type": "Literal",
"value": "element 1 should not have changed"
}
],
"callee": {
"end": 171,
"name": "assertEqual",
"start": 160,
"type": "Identifier"
},
"end": 233,
"start": 160,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 160,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 307,
"expression": {
"arguments": [
{
"computed": false,
"end": 257,
"object": {
"end": 254,
"name": "new_arr2",
"start": 246,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 256,
"raw": "0",
"start": 255,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 246,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 260,
"raw": "1",
"start": 259,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 269,
"raw": "0.00001",
"start": 262,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 306,
"raw": "\"element 0 should not have changed\"",
"start": 271,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"end": 245,
"name": "assertEqual",
"start": 234,
"type": "Identifier"
},
"end": 307,
"start": 234,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 234,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 308,
"start": 0
}
}

View File

@ -0,0 +1,7 @@
arr = [1, 2, 3]
new_arr1 = pop(arr)
new_arr2 = pop(new_arr1)
new_arr3 = pop(new_arr2)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")

View File

@ -0,0 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_pop.kcl
---
[]

View File

@ -0,0 +1,193 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing array_elem_pop.kcl
---
{
"arr": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
7,
8,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
10,
11,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
13,
14,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
6,
15,
0
]
}
]
},
"new_arr1": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
7,
8,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
10,
11,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
27,
35,
0
]
}
]
},
"new_arr2": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
7,
8,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
47,
60,
0
]
}
]
},
"new_arr3": {
"type": "Array",
"value": [],
"__meta": [
{
"sourceRange": [
72,
85,
0
]
}
]
}
}

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_elem_pop_empty_fail.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_elem_pop_empty_fail.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,76 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_elem_pop_empty_fail.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 8,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [],
"end": 8,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 8,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 24,
"id": {
"end": 13,
"name": "fail",
"start": 9,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 23,
"name": "arr",
"start": 20,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 19,
"name": "pop",
"start": 16,
"type": "Identifier"
},
"end": 24,
"start": 16,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 9,
"type": "VariableDeclarator"
},
"end": 24,
"kind": "const",
"start": 9,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 25,
"start": 0
}
}

View File

@ -0,0 +1,13 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing array_elem_pop_empty_fail.kcl
---
KCL Semantic error
× semantic: Cannot pop from an empty array
╭─[2:8]
1 │ arr = []
2 │ fail = pop(arr)
· ────┬───
· ╰── tests/array_elem_pop_empty_fail/input.kcl
╰────

View File

@ -0,0 +1,2 @@
arr = []
fail = pop(arr)

View File

@ -0,0 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_pop_empty_fail.kcl
---
[]

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_elem_pop_fail.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_elem_pop_fail.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,153 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_elem_pop_fail.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 36,
"id": {
"end": 25,
"name": "pushedArr",
"start": 16,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 35,
"name": "arr",
"start": 32,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 31,
"name": "pop",
"start": 28,
"type": "Identifier"
},
"end": 36,
"start": 28,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 16,
"type": "VariableDeclarator"
},
"end": 36,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 56,
"id": {
"end": 41,
"name": "fail",
"start": 37,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 56,
"object": {
"end": 53,
"name": "pushedArr",
"start": 44,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 55,
"raw": "2",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 44,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 37,
"type": "VariableDeclarator"
},
"end": 56,
"kind": "const",
"start": 37,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 57,
"start": 0
}
}

View File

@ -0,0 +1,13 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing array_elem_pop_fail.kcl
---
KCL UndefinedValue error
× undefined value: The array doesn't have any item at index 2
╭─[3:8]
2 │ pushedArr = pop(arr)
3 │ fail = pushedArr[2]
· ──────┬─────
· ╰── tests/array_elem_pop_fail/input.kcl
╰────

View File

@ -0,0 +1,3 @@
arr = [1, 2, 3]
pushedArr = pop(arr)
fail = pushedArr[2]

View File

@ -0,0 +1,5 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_pop_fail.kcl
---
[]

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_elem_push.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_elem_push.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,846 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_elem_push.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 39,
"id": {
"end": 24,
"name": "new_arr1",
"start": 16,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 35,
"name": "arr",
"start": 32,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 38,
"raw": "4",
"start": 37,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
}
],
"callee": {
"end": 31,
"name": "push",
"start": 27,
"type": "Identifier"
},
"end": 39,
"start": 27,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 16,
"type": "VariableDeclarator"
},
"end": 39,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 68,
"id": {
"end": 48,
"name": "new_arr2",
"start": 40,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 64,
"name": "new_arr1",
"start": 56,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 67,
"raw": "5",
"start": 66,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
}
],
"callee": {
"end": 55,
"name": "push",
"start": 51,
"type": "Identifier"
},
"end": 68,
"start": 51,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 40,
"type": "VariableDeclarator"
},
"end": 68,
"kind": "const",
"start": 40,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 142,
"expression": {
"arguments": [
{
"computed": false,
"end": 92,
"object": {
"end": 89,
"name": "new_arr1",
"start": 81,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 91,
"raw": "0",
"start": 90,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 81,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 95,
"raw": "1",
"start": 94,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 104,
"raw": "0.00001",
"start": 97,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 141,
"raw": "\"element 0 should not have changed\"",
"start": 106,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"end": 80,
"name": "assertEqual",
"start": 69,
"type": "Identifier"
},
"end": 142,
"start": 69,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 69,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 216,
"expression": {
"arguments": [
{
"computed": false,
"end": 166,
"object": {
"end": 163,
"name": "new_arr1",
"start": 155,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 165,
"raw": "1",
"start": 164,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 155,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 169,
"raw": "2",
"start": 168,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 178,
"raw": "0.00001",
"start": 171,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 215,
"raw": "\"element 1 should not have changed\"",
"start": 180,
"type": "Literal",
"type": "Literal",
"value": "element 1 should not have changed"
}
],
"callee": {
"end": 154,
"name": "assertEqual",
"start": 143,
"type": "Identifier"
},
"end": 216,
"start": 143,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 143,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 290,
"expression": {
"arguments": [
{
"computed": false,
"end": 240,
"object": {
"end": 237,
"name": "new_arr1",
"start": 229,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 239,
"raw": "2",
"start": 238,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 229,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 243,
"raw": "3",
"start": 242,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
{
"end": 252,
"raw": "0.00001",
"start": 245,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 289,
"raw": "\"element 2 should not have changed\"",
"start": 254,
"type": "Literal",
"type": "Literal",
"value": "element 2 should not have changed"
}
],
"callee": {
"end": 228,
"name": "assertEqual",
"start": 217,
"type": "Identifier"
},
"end": 290,
"start": 217,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 217,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 366,
"expression": {
"arguments": [
{
"computed": false,
"end": 314,
"object": {
"end": 311,
"name": "new_arr1",
"start": 303,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 313,
"raw": "3",
"start": 312,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 303,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 317,
"raw": "4",
"start": 316,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 326,
"raw": "0.00001",
"start": 319,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 365,
"raw": "\"4 was added to the end of the array\"",
"start": 328,
"type": "Literal",
"type": "Literal",
"value": "4 was added to the end of the array"
}
],
"callee": {
"end": 302,
"name": "assertEqual",
"start": 291,
"type": "Identifier"
},
"end": 366,
"start": 291,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 291,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 440,
"expression": {
"arguments": [
{
"computed": false,
"end": 390,
"object": {
"end": 387,
"name": "new_arr2",
"start": 379,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 389,
"raw": "0",
"start": 388,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 379,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 393,
"raw": "1",
"start": 392,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 402,
"raw": "0.00001",
"start": 395,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 439,
"raw": "\"element 0 should not have changed\"",
"start": 404,
"type": "Literal",
"type": "Literal",
"value": "element 0 should not have changed"
}
],
"callee": {
"end": 378,
"name": "assertEqual",
"start": 367,
"type": "Identifier"
},
"end": 440,
"start": 367,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 367,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 514,
"expression": {
"arguments": [
{
"computed": false,
"end": 464,
"object": {
"end": 461,
"name": "new_arr2",
"start": 453,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 463,
"raw": "1",
"start": 462,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 453,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 467,
"raw": "2",
"start": 466,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 476,
"raw": "0.00001",
"start": 469,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 513,
"raw": "\"element 1 should not have changed\"",
"start": 478,
"type": "Literal",
"type": "Literal",
"value": "element 1 should not have changed"
}
],
"callee": {
"end": 452,
"name": "assertEqual",
"start": 441,
"type": "Identifier"
},
"end": 514,
"start": 441,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 441,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 588,
"expression": {
"arguments": [
{
"computed": false,
"end": 538,
"object": {
"end": 535,
"name": "new_arr2",
"start": 527,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 537,
"raw": "2",
"start": 536,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 527,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 541,
"raw": "3",
"start": 540,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
{
"end": 550,
"raw": "0.00001",
"start": 543,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 587,
"raw": "\"element 2 should not have changed\"",
"start": 552,
"type": "Literal",
"type": "Literal",
"value": "element 2 should not have changed"
}
],
"callee": {
"end": 526,
"name": "assertEqual",
"start": 515,
"type": "Identifier"
},
"end": 588,
"start": 515,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 515,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 664,
"expression": {
"arguments": [
{
"computed": false,
"end": 612,
"object": {
"end": 609,
"name": "new_arr2",
"start": 601,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 611,
"raw": "3",
"start": 610,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 601,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 615,
"raw": "4",
"start": 614,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 624,
"raw": "0.00001",
"start": 617,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 663,
"raw": "\"4 was added to the end of the array\"",
"start": 626,
"type": "Literal",
"type": "Literal",
"value": "4 was added to the end of the array"
}
],
"callee": {
"end": 600,
"name": "assertEqual",
"start": 589,
"type": "Identifier"
},
"end": 664,
"start": 589,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 589,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 740,
"expression": {
"arguments": [
{
"computed": false,
"end": 688,
"object": {
"end": 685,
"name": "new_arr2",
"start": 677,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 687,
"raw": "4",
"start": 686,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 677,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 691,
"raw": "5",
"start": 690,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
{
"end": 700,
"raw": "0.00001",
"start": 693,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 739,
"raw": "\"5 was added to the end of the array\"",
"start": 702,
"type": "Literal",
"type": "Literal",
"value": "5 was added to the end of the array"
}
],
"callee": {
"end": 676,
"name": "assertEqual",
"start": 665,
"type": "Identifier"
},
"end": 740,
"start": 665,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 665,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 741,
"start": 0
}
}

View File

@ -0,0 +1,12 @@
arr = [1, 2, 3]
new_arr1 = push(arr, 4)
new_arr2 = push(new_arr1, 5)
assertEqual(new_arr1[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr1[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr1[2], 3, 0.00001, "element 2 should not have changed")
assertEqual(new_arr1[3], 4, 0.00001, "4 was added to the end of the array")
assertEqual(new_arr2[0], 1, 0.00001, "element 0 should not have changed")
assertEqual(new_arr2[1], 2, 0.00001, "element 1 should not have changed")
assertEqual(new_arr2[2], 3, 0.00001, "element 2 should not have changed")
assertEqual(new_arr2[3], 4, 0.00001, "4 was added to the end of the array")
assertEqual(new_arr2[4], 5, 0.00001, "5 was added to the end of the array")

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_push.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,312 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing array_elem_push.kcl
---
{
"arr": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
7,
8,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
10,
11,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
13,
14,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
6,
15,
0
]
}
]
},
"new_arr1": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
7,
8,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
10,
11,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
13,
14,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
37,
38,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
27,
39,
0
]
}
]
},
"new_arr2": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
7,
8,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
10,
11,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
13,
14,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
37,
38,
0
]
}
]
},
{
"type": "Number",
"value": 5.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
66,
67,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
51,
68,
0
]
}
]
}
}

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_elem_push_fail.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_elem_push_fail.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,164 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_elem_push_fail.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 15,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [
{
"end": 8,
"raw": "1",
"start": 7,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 11,
"raw": "2",
"start": 10,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 14,
"raw": "3",
"start": 13,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
],
"end": 15,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 15,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 40,
"id": {
"end": 25,
"name": "pushedArr",
"start": 16,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 36,
"name": "arr",
"start": 33,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 39,
"raw": "4",
"start": 38,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
}
],
"callee": {
"end": 32,
"name": "push",
"start": 28,
"type": "Identifier"
},
"end": 40,
"start": 28,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 16,
"type": "VariableDeclarator"
},
"end": 40,
"kind": "const",
"start": 16,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 54,
"id": {
"end": 45,
"name": "fail",
"start": 41,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 54,
"object": {
"end": 51,
"name": "arr",
"start": 48,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 53,
"raw": "3",
"start": 52,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 48,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 41,
"type": "VariableDeclarator"
},
"end": 54,
"kind": "const",
"start": 41,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 55,
"start": 0
}
}

View File

@ -0,0 +1,13 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing array_elem_push_fail.kcl
---
KCL UndefinedValue error
× undefined value: The array doesn't have any item at index 3
╭─[3:8]
2 │ pushedArr = push(arr, 4)
3 │ fail = arr[3]
· ───┬──
· ╰── tests/array_elem_push_fail/input.kcl
╰────

View File

@ -0,0 +1,3 @@
arr = [1, 2, 3]
pushedArr = push(arr, 4)
fail = arr[3]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_elem_push_fail.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_index_oob.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_index_oob.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,80 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_index_oob.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 8,
"id": {
"end": 3,
"name": "arr",
"start": 0,
"type": "Identifier"
},
"init": {
"elements": [],
"end": 8,
"start": 6,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 8,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 19,
"id": {
"end": 10,
"name": "x",
"start": 9,
"type": "Identifier"
},
"init": {
"computed": false,
"end": 19,
"object": {
"end": 16,
"name": "arr",
"start": 13,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 18,
"raw": "0",
"start": 17,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 13,
"type": "MemberExpression",
"type": "MemberExpression"
},
"start": 9,
"type": "VariableDeclarator"
},
"end": 19,
"kind": "const",
"start": 9,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 20,
"start": 0
}
}

View File

@ -0,0 +1,13 @@
---
source: kcl/src/simulation_tests.rs
description: Error from executing array_index_oob.kcl
---
KCL UndefinedValue error
× undefined value: The array doesn't have any item at index 0
╭─[2:5]
1 │ arr = []
2 │ x = arr[0]
· ───┬──
· ╰── tests/array_index_oob/input.kcl
╰────

View File

@ -0,0 +1,2 @@
arr = []
x = arr[0]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_index_oob.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_range_expr.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_range_expr.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,915 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_range_expr.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 11,
"id": {
"end": 2,
"name": "r1",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 11,
"endElement": {
"end": 10,
"raw": "4",
"start": 9,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"endInclusive": true,
"start": 5,
"startElement": {
"end": 7,
"raw": "0",
"start": 6,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 11,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 70,
"expression": {
"arguments": [
{
"computed": false,
"end": 29,
"object": {
"end": 26,
"name": "r1",
"start": 24,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 28,
"raw": "4",
"start": 27,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 24,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 32,
"raw": "4",
"start": 31,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 41,
"raw": "0.00001",
"start": 34,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 69,
"raw": "\"last element is included\"",
"start": 43,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 23,
"name": "assertEqual",
"start": 12,
"type": "Identifier"
},
"end": 70,
"start": 12,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 12,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 80,
"id": {
"end": 76,
"name": "four",
"start": 72,
"type": "Identifier"
},
"init": {
"end": 80,
"raw": "4",
"start": 79,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 72,
"type": "VariableDeclarator"
},
"end": 80,
"kind": "const",
"start": 72,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 89,
"id": {
"end": 85,
"name": "zero",
"start": 81,
"type": "Identifier"
},
"init": {
"end": 89,
"raw": "0",
"start": 88,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 81,
"type": "VariableDeclarator"
},
"end": 89,
"kind": "const",
"start": 81,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 107,
"id": {
"end": 92,
"name": "r2",
"start": 90,
"type": "Identifier"
},
"init": {
"end": 107,
"endElement": {
"end": 106,
"name": "four",
"start": 102,
"type": "Identifier",
"type": "Identifier"
},
"endInclusive": true,
"start": 95,
"startElement": {
"end": 100,
"name": "zero",
"start": 96,
"type": "Identifier",
"type": "Identifier"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 90,
"type": "VariableDeclarator"
},
"end": 107,
"kind": "const",
"start": 90,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 166,
"expression": {
"arguments": [
{
"computed": false,
"end": 125,
"object": {
"end": 122,
"name": "r2",
"start": 120,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 124,
"raw": "4",
"start": 123,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 120,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 128,
"raw": "4",
"start": 127,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 137,
"raw": "0.00001",
"start": 130,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 165,
"raw": "\"last element is included\"",
"start": 139,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 119,
"name": "assertEqual",
"start": 108,
"type": "Identifier"
},
"end": 166,
"start": 108,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 108,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 188,
"id": {
"end": 172,
"name": "five",
"start": 168,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 187,
"left": {
"end": 183,
"name": "four",
"start": 179,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"end": 187,
"raw": "1",
"start": 186,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 179,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 178,
"name": "int",
"start": 175,
"type": "Identifier"
},
"end": 188,
"start": 175,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 168,
"type": "VariableDeclarator"
},
"end": 188,
"kind": "const",
"start": 168,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 206,
"id": {
"end": 191,
"name": "r3",
"start": 189,
"type": "Identifier"
},
"init": {
"end": 206,
"endElement": {
"end": 205,
"name": "five",
"start": 201,
"type": "Identifier",
"type": "Identifier"
},
"endInclusive": true,
"start": 194,
"startElement": {
"end": 199,
"name": "zero",
"start": 195,
"type": "Identifier",
"type": "Identifier"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 189,
"type": "VariableDeclarator"
},
"end": 206,
"kind": "const",
"start": 189,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 275,
"expression": {
"arguments": [
{
"computed": false,
"end": 224,
"object": {
"end": 221,
"name": "r3",
"start": 219,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 223,
"raw": "4",
"start": 222,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
"start": 219,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 227,
"raw": "4",
"start": 226,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 236,
"raw": "0.00001",
"start": 229,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 274,
"raw": "\"second-to-last element is included\"",
"start": 238,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is included"
}
],
"callee": {
"end": 218,
"name": "assertEqual",
"start": 207,
"type": "Identifier"
},
"end": 275,
"start": 207,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 207,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 334,
"expression": {
"arguments": [
{
"computed": false,
"end": 293,
"object": {
"end": 290,
"name": "r3",
"start": 288,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 292,
"raw": "5",
"start": 291,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"start": 288,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 296,
"raw": "5",
"start": 295,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
{
"end": 305,
"raw": "0.00001",
"start": 298,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 333,
"raw": "\"last element is included\"",
"start": 307,
"type": "Literal",
"type": "Literal",
"value": "last element is included"
}
],
"callee": {
"end": 287,
"name": "assertEqual",
"start": 276,
"type": "Identifier"
},
"end": 334,
"start": 276,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 276,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"declaration": {
"end": 373,
"id": {
"end": 338,
"name": "r4",
"start": 336,
"type": "Identifier"
},
"init": {
"end": 373,
"endElement": {
"arguments": [
{
"end": 371,
"left": {
"end": 367,
"name": "five",
"start": 363,
"type": "Identifier",
"type": "Identifier"
},
"operator": "-",
"right": {
"end": 371,
"raw": "1",
"start": 370,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 363,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 362,
"name": "int",
"start": 359,
"type": "Identifier"
},
"end": 372,
"start": 359,
"type": "CallExpression",
"type": "CallExpression"
},
"endInclusive": true,
"start": 341,
"startElement": {
"arguments": [
{
"end": 354,
"left": {
"end": 350,
"name": "zero",
"start": 346,
"type": "Identifier",
"type": "Identifier"
},
"operator": "+",
"right": {
"end": 354,
"raw": "1",
"start": 353,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
"start": 346,
"type": "BinaryExpression",
"type": "BinaryExpression"
}
],
"callee": {
"end": 345,
"name": "int",
"start": 342,
"type": "Identifier"
},
"end": 355,
"start": 342,
"type": "CallExpression",
"type": "CallExpression"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 336,
"type": "VariableDeclarator"
},
"end": 373,
"kind": "const",
"start": 336,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 426,
"expression": {
"arguments": [
{
"computed": false,
"end": 391,
"object": {
"end": 388,
"name": "r4",
"start": 386,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 390,
"raw": "0",
"start": 389,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 386,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 394,
"raw": "1",
"start": 393,
"type": "Literal",
"type": "Literal",
"value": {
"value": 1.0,
"suffix": "None"
}
},
{
"end": 403,
"raw": "0.00001",
"start": 396,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 425,
"raw": "\"first element is 1\"",
"start": 405,
"type": "Literal",
"type": "Literal",
"value": "first element is 1"
}
],
"callee": {
"end": 385,
"name": "assertEqual",
"start": 374,
"type": "Identifier"
},
"end": 426,
"start": 374,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 374,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 488,
"expression": {
"arguments": [
{
"computed": false,
"end": 444,
"object": {
"end": 441,
"name": "r4",
"start": 439,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 443,
"raw": "2",
"start": 442,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"start": 439,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 447,
"raw": "3",
"start": 446,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
{
"end": 456,
"raw": "0.00001",
"start": 449,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 487,
"raw": "\"second-to-last element is 3\"",
"start": 458,
"type": "Literal",
"type": "Literal",
"value": "second-to-last element is 3"
}
],
"callee": {
"end": 438,
"name": "assertEqual",
"start": 427,
"type": "Identifier"
},
"end": 488,
"start": 427,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 427,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
},
{
"end": 540,
"expression": {
"arguments": [
{
"computed": false,
"end": 506,
"object": {
"end": 503,
"name": "r4",
"start": 501,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 505,
"raw": "3",
"start": 504,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"start": 501,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"end": 509,
"raw": "4",
"start": 508,
"type": "Literal",
"type": "Literal",
"value": {
"value": 4.0,
"suffix": "None"
}
},
{
"end": 518,
"raw": "0.00001",
"start": 511,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.00001,
"suffix": "None"
}
},
{
"end": 539,
"raw": "\"last element is 4\"",
"start": 520,
"type": "Literal",
"type": "Literal",
"value": "last element is 4"
}
],
"callee": {
"end": 500,
"name": "assertEqual",
"start": 489,
"type": "Identifier"
},
"end": 540,
"start": 489,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 489,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 541,
"nonCodeMeta": {
"nonCodeNodes": {
"1": [
{
"end": 72,
"start": 70,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"5": [
{
"end": 168,
"start": 166,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
],
"9": [
{
"end": 336,
"start": 334,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,17 @@
r1 = [0..4]
assertEqual(r1[4], 4, 0.00001, "last element is included")
four = 4
zero = 0
r2 = [zero..four]
assertEqual(r2[4], 4, 0.00001, "last element is included")
five = int(four + 1)
r3 = [zero..five]
assertEqual(r3[4], 4, 0.00001, "second-to-last element is included")
assertEqual(r3[5], 5, 0.00001, "last element is included")
r4 = [int(zero + 1) .. int(five - 1)]
assertEqual(r4[0], 1, 0.00001, "first element is 1")
assertEqual(r4[2], 3, 0.00001, "second-to-last element is 3")
assertEqual(r4[3], 4, 0.00001, "last element is 4")

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_range_expr.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,468 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing array_range_expr.kcl
---
{
"five": {
"type": "Number",
"value": 5.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
175,
188,
0
]
}
]
},
"four": {
"type": "Number",
"value": 4.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
79,
80,
0
]
}
]
},
"r1": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
11,
0
]
}
]
},
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
11,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
11,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
11,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
11,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
5,
11,
0
]
}
]
},
"r2": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
95,
107,
0
]
}
]
},
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
95,
107,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
95,
107,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
95,
107,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
95,
107,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
95,
107,
0
]
}
]
},
"r3": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
},
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
},
{
"type": "Number",
"value": 5.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
194,
206,
0
]
}
]
},
"r4": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
341,
373,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
341,
373,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
341,
373,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
341,
373,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
341,
373,
0
]
}
]
},
"zero": {
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
},
"__meta": [
{
"sourceRange": [
88,
89,
0
]
}
]
}
}

View File

@ -0,0 +1,285 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands array_range_negative_expr.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart array_range_negative_expr.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,3 @@
```mermaid
flowchart LR
```

View File

@ -0,0 +1,162 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing array_range_negative_expr.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 19,
"id": {
"end": 2,
"name": "xs",
"start": 0,
"type": "Identifier"
},
"init": {
"end": 19,
"endElement": {
"end": 18,
"raw": "5",
"start": 17,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"endInclusive": true,
"start": 5,
"startElement": {
"arguments": [
{
"argument": {
"end": 12,
"raw": "5",
"start": 11,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 12,
"operator": "-",
"start": 10,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"callee": {
"end": 9,
"name": "int",
"start": 6,
"type": "Identifier"
},
"end": 13,
"start": 6,
"type": "CallExpression",
"type": "CallExpression"
},
"type": "ArrayRangeExpression",
"type": "ArrayRangeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 19,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 72,
"expression": {
"arguments": [
{
"computed": false,
"end": 37,
"object": {
"end": 34,
"name": "xs",
"start": 32,
"type": "Identifier",
"type": "Identifier"
},
"property": {
"end": 36,
"raw": "0",
"start": 35,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
"start": 32,
"type": "MemberExpression",
"type": "MemberExpression"
},
{
"argument": {
"end": 41,
"raw": "5",
"start": 40,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 41,
"operator": "-",
"start": 39,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 48,
"raw": "0.001",
"start": 43,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.001,
"suffix": "None"
}
},
{
"end": 71,
"raw": "\"first element is -5\"",
"start": 50,
"type": "Literal",
"type": "Literal",
"value": "first element is -5"
}
],
"callee": {
"end": 31,
"name": "assertEqual",
"start": 20,
"type": "Identifier"
},
"end": 72,
"start": 20,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 20,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 73,
"start": 0
}
}

View File

@ -0,0 +1,2 @@
xs = [int(-5) .. 5]
assertEqual(xs[0], -5, 0.001, "first element is -5")

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed array_range_negative_expr.kcl
snapshot_kind: text
---
[]

View File

@ -0,0 +1,207 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing array_range_negative_expr.kcl
---
{
"xs": {
"type": "Array",
"value": [
{
"type": "Number",
"value": -5.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": -4.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": -3.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": -2.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": -1.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": 1.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": 2.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": 3.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": 4.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
},
{
"type": "Number",
"value": 5.0,
"ty": {
"type": "Known",
"type": "Count"
},
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
}
],
"__meta": [
{
"sourceRange": [
5,
19,
0
]
}
]
}
}

View File

@ -0,0 +1,936 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands artifact_graph_example_code1.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
12,
31,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
37,
64,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
37,
64,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
37,
64,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -5.0,
"y": -5.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
70,
89,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": 10.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
95,
131,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 10.55,
"y": 0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
137,
171,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": -10.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
177,
233,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -5.0,
"y": -5.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
239,
246,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
239,
246,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
292,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
298,
332,
0
],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 5.0,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [
383,
410,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": null
}
},
{
"cmdId": "[uuid]",
"range": [
383,
410,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
383,
410,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -2.0,
"y": -6.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
416,
434,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 2.0,
"y": 3.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
440,
459,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 2.0,
"y": -3.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
465,
521,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -2.0,
"y": -6.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
527,
534,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": null
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 5.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
548,
578,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart artifact_graph_example_code1.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,111 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[37, 64, 0]"]
3["Segment<br>[70, 89, 0]"]
4["Segment<br>[95, 131, 0]"]
5["Segment<br>[137, 171, 0]"]
6["Segment<br>[177, 233, 0]"]
7["Segment<br>[239, 246, 0]"]
8[Solid2d]
end
subgraph path25 [Path]
25["Path<br>[383, 410, 0]"]
26["Segment<br>[416, 434, 0]"]
27["Segment<br>[440, 459, 0]"]
28["Segment<br>[465, 521, 0]"]
29["Segment<br>[527, 534, 0]"]
30[Solid2d]
end
1["Plane<br>[12, 31, 0]"]
9["Sweep Extrusion<br>[260, 292, 0]"]
10[Wall]
11[Wall]
12[Wall]
13[Wall]
14["Cap Start"]
15["Cap End"]
16["SweepEdge Opposite"]
17["SweepEdge Adjacent"]
18["SweepEdge Opposite"]
19["SweepEdge Adjacent"]
20["SweepEdge Opposite"]
21["SweepEdge Adjacent"]
22["SweepEdge Opposite"]
23["SweepEdge Adjacent"]
24["EdgeCut Fillet<br>[298, 332, 0]"]
31["Sweep Extrusion<br>[548, 578, 0]"]
32[Wall]
33[Wall]
34[Wall]
35["Cap End"]
36["SweepEdge Opposite"]
37["SweepEdge Adjacent"]
38["SweepEdge Opposite"]
39["SweepEdge Adjacent"]
40["SweepEdge Opposite"]
41["SweepEdge Adjacent"]
42["StartSketchOnFace<br>[345, 377, 0]"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 --- 7
2 ---- 9
2 --- 8
3 --- 13
3 --- 22
3 --- 23
4 --- 12
4 --- 20
4 --- 21
4 --- 24
5 --- 11
5 --- 18
5 --- 19
6 --- 10
6 --- 16
6 --- 17
9 --- 10
9 --- 11
9 --- 12
9 --- 13
9 --- 14
9 --- 15
9 --- 16
9 --- 17
9 --- 18
9 --- 19
9 --- 20
9 --- 21
9 --- 22
9 --- 23
11 --- 25
25 --- 26
25 --- 27
25 --- 28
25 --- 29
25 ---- 31
25 --- 30
26 --- 34
26 --- 40
26 --- 41
27 --- 33
27 --- 38
27 --- 39
28 --- 32
28 --- 36
28 --- 37
31 --- 32
31 --- 33
31 --- 34
31 --- 35
31 --- 36
31 --- 37
31 --- 38
31 --- 39
31 --- 40
31 --- 41
11 <--x 42
```

View File

@ -0,0 +1,895 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code1.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 246,
"id": {
"end": 9,
"name": "sketch001",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 30,
"raw": "'XY'",
"start": 26,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
],
"callee": {
"end": 25,
"name": "startSketchOn",
"start": 12,
"type": "Identifier"
},
"end": 31,
"start": 12,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 55,
"raw": "5",
"start": 54,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 55,
"operator": "-",
"start": 53,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 59,
"raw": "5",
"start": 58,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
},
"end": 59,
"operator": "-",
"start": 57,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 60,
"start": 52,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 63,
"start": 62,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 51,
"name": "startProfileAt",
"start": 37,
"type": "Identifier"
},
"end": 64,
"start": 37,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 83,
"raw": "0",
"start": 82,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 87,
"raw": "10",
"start": 85,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
],
"end": 88,
"start": 81,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 74,
"name": "line",
"start": 70,
"type": "Identifier"
},
"end": 89,
"start": 70,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 112,
"raw": "10.55",
"start": 107,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.55,
"suffix": "None"
}
},
{
"end": 115,
"raw": "0",
"start": 114,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 116,
"start": 106,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "tag"
},
"arg": {
"end": 130,
"start": 124,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
}
],
"callee": {
"end": 99,
"name": "line",
"start": 95,
"type": "Identifier"
},
"end": 131,
"start": 95,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 150,
"raw": "0",
"start": 149,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"argument": {
"end": 155,
"raw": "10",
"start": 153,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
"end": 155,
"operator": "-",
"start": 152,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 156,
"start": 148,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
},
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "tag"
},
"arg": {
"end": 170,
"start": 164,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg02"
}
}
],
"callee": {
"end": 141,
"name": "line",
"start": 137,
"type": "Identifier"
},
"end": 171,
"start": 137,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "endAbsolute"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 212,
"start": 211,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 210,
"name": "profileStartX",
"start": 197,
"type": "Identifier"
},
"end": 213,
"start": 197,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 230,
"start": 229,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 228,
"name": "profileStartY",
"start": 215,
"type": "Identifier"
},
"end": 231,
"start": 215,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 232,
"start": 196,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 181,
"name": "line",
"start": 177,
"type": "Identifier"
},
"end": 233,
"start": 177,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 244,
"name": "close",
"start": 239,
"type": "Identifier"
},
"end": 246,
"start": 239,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 246,
"start": 12,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 246,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 332,
"id": {
"end": 257,
"name": "extrude001",
"start": 247,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "length"
},
"arg": {
"argument": {
"end": 291,
"raw": "10",
"start": 289,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
},
"end": 291,
"operator": "-",
"start": 288,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"end": 267,
"name": "extrude",
"start": 260,
"type": "Identifier"
},
"end": 292,
"start": 260,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 277,
"name": "sketch001",
"start": 268,
"type": "Identifier",
"type": "Identifier"
}
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "radius"
},
"arg": {
"end": 315,
"raw": "5",
"start": 314,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
}
},
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "tags"
},
"arg": {
"elements": [
{
"end": 330,
"name": "seg01",
"start": 325,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 331,
"start": 324,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 304,
"name": "fillet",
"start": 298,
"type": "Identifier"
},
"end": 332,
"start": 298,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 332,
"start": 260,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 247,
"type": "VariableDeclarator"
},
"end": 332,
"kind": "const",
"start": 247,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 534,
"id": {
"end": 342,
"name": "sketch002",
"start": 333,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 369,
"name": "extrude001",
"start": 359,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 376,
"name": "seg02",
"start": 371,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 358,
"name": "startSketchOn",
"start": 345,
"type": "Identifier"
},
"end": 377,
"start": 345,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 401,
"raw": "2",
"start": 400,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
"end": 401,
"operator": "-",
"start": 399,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 405,
"raw": "6",
"start": 404,
"type": "Literal",
"type": "Literal",
"value": {
"value": 6.0,
"suffix": "None"
}
},
"end": 405,
"operator": "-",
"start": 403,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 406,
"start": 398,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 409,
"start": 408,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 397,
"name": "startProfileAt",
"start": 383,
"type": "Identifier"
},
"end": 410,
"start": 383,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 429,
"raw": "2",
"start": 428,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"end": 432,
"raw": "3",
"start": 431,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
}
],
"end": 433,
"start": 427,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 420,
"name": "line",
"start": 416,
"type": "Identifier"
},
"end": 434,
"start": 416,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 453,
"raw": "2",
"start": 452,
"type": "Literal",
"type": "Literal",
"value": {
"value": 2.0,
"suffix": "None"
}
},
{
"argument": {
"end": 457,
"raw": "3",
"start": 456,
"type": "Literal",
"type": "Literal",
"value": {
"value": 3.0,
"suffix": "None"
}
},
"end": 457,
"operator": "-",
"start": 455,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 458,
"start": 451,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 444,
"name": "line",
"start": 440,
"type": "Identifier"
},
"end": 459,
"start": 440,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "endAbsolute"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 500,
"start": 499,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 498,
"name": "profileStartX",
"start": 485,
"type": "Identifier"
},
"end": 501,
"start": 485,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 518,
"start": 517,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 516,
"name": "profileStartY",
"start": 503,
"type": "Identifier"
},
"end": 519,
"start": 503,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 520,
"start": 484,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 469,
"name": "line",
"start": 465,
"type": "Identifier"
},
"end": 521,
"start": 465,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 532,
"name": "close",
"start": 527,
"type": "Identifier"
},
"end": 534,
"start": 527,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 534,
"start": 345,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 333,
"type": "VariableDeclarator"
},
"end": 534,
"kind": "const",
"start": 333,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 578,
"id": {
"end": 545,
"name": "extrude002",
"start": 535,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "length"
},
"arg": {
"end": 577,
"raw": "5",
"start": 576,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.0,
"suffix": "None"
}
}
}
],
"callee": {
"end": 555,
"name": "extrude",
"start": 548,
"type": "Identifier"
},
"end": 578,
"start": 548,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 565,
"name": "sketch002",
"start": 556,
"type": "Identifier",
"type": "Identifier"
}
},
"start": 535,
"type": "VariableDeclarator"
},
"end": 578,
"kind": "const",
"start": 535,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 579,
"start": 0
}
}

View File

@ -0,0 +1,16 @@
sketch001 = startSketchOn('XY')
|> startProfileAt([-5, -5], %)
|> line(end = [0, 10])
|> line(end = [10.55, 0], tag = $seg01)
|> line(end = [0, -10], tag = $seg02)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude001 = extrude(sketch001, length = -10)
|> fillet(radius = 5, tags = [seg01])
sketch002 = startSketchOn(extrude001, seg02)
|> startProfileAt([-2, -6], %)
|> line(end = [2, 3])
|> line(end = [2, -3])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
extrude002 = extrude(sketch002, length = 5)

View File

@ -0,0 +1,216 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed artifact_graph_example_code1.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"value": {
"type": "String",
"value": "XY"
},
"sourceRange": [
26,
30,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
12,
31,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": -10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
288,
291,
0
]
}
},
"name": "extrude",
"sourceRange": [
260,
292,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": [
268,
277,
0
]
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 5.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
314,
315,
0
]
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "TagIdentifier",
"value": "seg01",
"artifact_id": "[uuid]"
}
]
},
"sourceRange": [
324,
331,
0
]
}
},
"name": "fillet",
"sourceRange": [
298,
332,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": [
0,
0,
0
]
}
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": [
359,
369,
0
]
},
"tag": {
"value": {
"type": "TagIdentifier",
"value": "seg02",
"artifact_id": "[uuid]"
},
"sourceRange": [
371,
376,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
345,
377,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"value": {
"type": "Number",
"value": 5.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
576,
577,
0
]
}
},
"name": "extrude",
"sourceRange": [
548,
578,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": [
556,
565,
0
]
}
}
]

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

View File

@ -0,0 +1,609 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands artifact_graph_example_code_no_3d.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
12,
31,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
37,
65,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 1.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
37,
65,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
37,
65,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 5.82,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
71,
121,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -11.54,
"y": 0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
127,
227,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": 8.21,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
233,
353,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 11.54,
"y": -0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
359,
415,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 5.82,
"y": 0.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
421,
428,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
421,
428,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
441,
461,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
467,
496,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 1.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
467,
496,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
467,
496,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 0.0,
"y": 14.36,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
502,
527,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 15.49,
"y": 0.05,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
533,
559,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "tangential_arc_to",
"to": {
"x": -15.49,
"y": -14.41,
"z": 0.0
},
"angle_snap_increment": null
}
}
},
{
"cmdId": "[uuid]",
"range": [
565,
597,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "tangential_arc_to",
"to": {
"x": -6.8,
"y": 8.17,
"z": 0.0
},
"angle_snap_increment": null
}
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart artifact_graph_example_code_no_3d.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,31 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[37, 65, 0]"]
3["Segment<br>[71, 121, 0]"]
4["Segment<br>[127, 227, 0]"]
5["Segment<br>[233, 353, 0]"]
6["Segment<br>[359, 415, 0]"]
7["Segment<br>[421, 428, 0]"]
8[Solid2d]
end
subgraph path10 [Path]
10["Path<br>[467, 496, 0]"]
11["Segment<br>[502, 527, 0]"]
12["Segment<br>[533, 559, 0]"]
13["Segment<br>[565, 597, 0]"]
end
1["Plane<br>[12, 31, 0]"]
9["Plane<br>[441, 461, 0]"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 --- 7
2 --- 8
9 --- 10
10 --- 11
10 --- 12
10 --- 13
```

View File

@ -0,0 +1,676 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code_no_3d.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 428,
"id": {
"end": 9,
"name": "sketch003",
"start": 0,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 30,
"raw": "'YZ'",
"start": 26,
"type": "Literal",
"type": "Literal",
"value": "YZ"
}
],
"callee": {
"end": 25,
"name": "startSketchOn",
"start": 12,
"type": "Identifier"
},
"end": 31,
"start": 12,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 57,
"raw": "5.82",
"start": 53,
"type": "Literal",
"type": "Literal",
"value": {
"value": 5.82,
"suffix": "None"
}
},
{
"end": 60,
"raw": "0",
"start": 59,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 61,
"start": 52,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 64,
"start": 63,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 51,
"name": "startProfileAt",
"start": 37,
"type": "Identifier"
},
"end": 65,
"start": 37,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 86,
"raw": "180",
"start": 83,
"type": "Literal",
"type": "Literal",
"value": {
"value": 180.0,
"suffix": "None"
}
},
{
"end": 93,
"raw": "11.54",
"start": 88,
"type": "Literal",
"type": "Literal",
"value": {
"value": 11.54,
"suffix": "None"
}
}
],
"end": 94,
"start": 82,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 97,
"start": 96,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 120,
"start": 99,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
}
],
"callee": {
"end": 81,
"name": "angledLine",
"start": 71,
"type": "Identifier"
},
"end": 121,
"start": 71,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 180,
"left": {
"arguments": [
{
"end": 174,
"name": "rectangleSegmentA001",
"start": 154,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 153,
"name": "segAng",
"start": 147,
"type": "Identifier"
},
"end": 175,
"start": 147,
"type": "CallExpression",
"type": "CallExpression"
},
"operator": "-",
"right": {
"end": 180,
"raw": "90",
"start": 178,
"type": "Literal",
"type": "Literal",
"value": {
"value": 90.0,
"suffix": "None"
}
},
"start": 147,
"type": "BinaryExpression",
"type": "BinaryExpression"
},
{
"end": 193,
"raw": "8.21",
"start": 189,
"type": "Literal",
"type": "Literal",
"value": {
"value": 8.21,
"suffix": "None"
}
}
],
"end": 200,
"start": 138,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 203,
"start": 202,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 226,
"start": 205,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
}
],
"callee": {
"end": 137,
"name": "angledLine",
"start": 127,
"type": "Identifier"
},
"end": 227,
"start": 127,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"arguments": [
{
"end": 280,
"name": "rectangleSegmentA001",
"start": 260,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 259,
"name": "segAng",
"start": 253,
"type": "Identifier"
},
"end": 281,
"start": 253,
"type": "CallExpression",
"type": "CallExpression"
},
{
"argument": {
"arguments": [
{
"end": 318,
"name": "rectangleSegmentA001",
"start": 298,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 297,
"name": "segLen",
"start": 291,
"type": "Identifier"
},
"end": 319,
"start": 291,
"type": "CallExpression",
"type": "CallExpression"
},
"end": 319,
"operator": "-",
"start": 290,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 326,
"start": 244,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 329,
"start": 328,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 352,
"start": 331,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
}
],
"callee": {
"end": 243,
"name": "angledLine",
"start": 233,
"type": "Identifier"
},
"end": 353,
"start": 233,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "endAbsolute"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 394,
"start": 393,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 392,
"name": "profileStartX",
"start": 379,
"type": "Identifier"
},
"end": 395,
"start": 379,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 412,
"start": 411,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 410,
"name": "profileStartY",
"start": 397,
"type": "Identifier"
},
"end": 413,
"start": 397,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 414,
"start": 378,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 363,
"name": "line",
"start": 359,
"type": "Identifier"
},
"end": 415,
"start": 359,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 426,
"name": "close",
"start": 421,
"type": "Identifier"
},
"end": 428,
"start": 421,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 428,
"start": 12,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 428,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 597,
"id": {
"end": 438,
"name": "sketch004",
"start": 429,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 460,
"raw": "'-XZ'",
"start": 455,
"type": "Literal",
"type": "Literal",
"value": "-XZ"
}
],
"callee": {
"end": 454,
"name": "startSketchOn",
"start": 441,
"type": "Identifier"
},
"end": 461,
"start": 441,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 484,
"raw": "0",
"start": 483,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 491,
"raw": "14.36",
"start": 486,
"type": "Literal",
"type": "Literal",
"value": {
"value": 14.36,
"suffix": "None"
}
}
],
"end": 492,
"start": 482,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 495,
"start": 494,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 481,
"name": "startProfileAt",
"start": 467,
"type": "Identifier"
},
"end": 496,
"start": 467,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 519,
"raw": "15.49",
"start": 514,
"type": "Literal",
"type": "Literal",
"value": {
"value": 15.49,
"suffix": "None"
}
},
{
"end": 525,
"raw": "0.05",
"start": 521,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.05,
"suffix": "None"
}
}
],
"end": 526,
"start": 513,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 506,
"name": "line",
"start": 502,
"type": "Identifier"
},
"end": 527,
"start": 502,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"elements": [
{
"end": 551,
"raw": "0",
"start": 550,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 554,
"raw": "0",
"start": 553,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 555,
"start": 549,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 558,
"start": 557,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 548,
"name": "tangentialArcTo",
"start": 533,
"type": "Identifier"
},
"end": 559,
"start": 533,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 586,
"raw": "6.8",
"start": 583,
"type": "Literal",
"type": "Literal",
"value": {
"value": 6.8,
"suffix": "None"
}
},
"end": 586,
"operator": "-",
"start": 582,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 592,
"raw": "8.17",
"start": 588,
"type": "Literal",
"type": "Literal",
"value": {
"value": 8.17,
"suffix": "None"
}
}
],
"end": 593,
"start": 581,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 596,
"start": 595,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 580,
"name": "tangentialArcTo",
"start": 565,
"type": "Identifier"
},
"end": 597,
"start": 565,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 597,
"start": 441,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 429,
"type": "VariableDeclarator"
},
"end": 597,
"kind": "const",
"start": 429,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 598,
"start": 0
}
}

View File

@ -0,0 +1,18 @@
sketch003 = startSketchOn('YZ')
|> startProfileAt([5.82, 0], %)
|> angledLine([180, 11.54], %, $rectangleSegmentA001)
|> angledLine([
segAng(rectangleSegmentA001) - 90,
8.21
], %, $rectangleSegmentB001)
|> angledLine([
segAng(rectangleSegmentA001),
-segLen(rectangleSegmentA001)
], %, $rectangleSegmentC001)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
sketch004 = startSketchOn('-XZ')
|> startProfileAt([0, 14.36], %)
|> line(end = [15.49, 0.05])
|> tangentialArcTo([0, 0], %)
|> tangentialArcTo([-6.8, 8.17], %)

View File

@ -0,0 +1,52 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed artifact_graph_example_code_no_3d.kcl
---
[
{
"labeledArgs": {
"data": {
"value": {
"type": "String",
"value": "YZ"
},
"sourceRange": [
26,
30,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
12,
31,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"value": {
"type": "String",
"value": "-XZ"
},
"sourceRange": [
455,
460,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
441,
461,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,652 @@
---
source: kcl/src/simulation_tests.rs
description: Variables in memory after executing artifact_graph_example_code_no_3d.kcl
---
{
"rectangleSegmentA001": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentA001",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
71,
121,
0
]
},
"from": [
5.82,
0.0
],
"tag": {
"end": 120,
"start": 99,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
-5.72,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": null
},
"__meta": [
{
"sourceRange": [
99,
120,
0
]
}
]
},
"rectangleSegmentB001": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentB001",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
227,
0
]
},
"from": [
-5.72,
0.0
],
"tag": {
"end": 226,
"start": 205,
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
},
"to": [
-5.72,
8.21
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": null
},
"__meta": [
{
"sourceRange": [
205,
226,
0
]
}
]
},
"rectangleSegmentC001": {
"type": "TagIdentifier",
"type": "TagIdentifier",
"value": "rectangleSegmentC001",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
233,
353,
0
]
},
"from": [
-5.72,
8.21
],
"tag": {
"end": 352,
"start": 331,
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
},
"to": [
5.82,
8.21
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": null
},
"__meta": [
{
"sourceRange": [
331,
352,
0
]
}
]
},
"sketch003": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
71,
121,
0
]
},
"from": [
5.82,
0.0
],
"tag": {
"end": 120,
"start": 99,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
-5.72,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
227,
0
]
},
"from": [
-5.72,
0.0
],
"tag": {
"end": 226,
"start": 205,
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
},
"to": [
-5.72,
8.21
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
233,
353,
0
]
},
"from": [
-5.72,
8.21
],
"tag": {
"end": 352,
"start": 331,
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
},
"to": [
5.82,
8.21
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
359,
415,
0
]
},
"from": [
5.82,
8.21
],
"tag": null,
"to": [
5.82,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
421,
428,
0
]
},
"from": [
5.82,
0.0
],
"tag": null,
"to": [
5.82,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "YZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"zAxis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"units": {
"type": "Mm"
},
"__meta": []
},
"start": {
"from": [
5.82,
0.0
],
"to": [
5.82,
0.0
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
37,
65,
0
]
}
},
"tags": {
"rectangleSegmentA001": {
"type": "TagIdentifier",
"value": "rectangleSegmentA001",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
71,
121,
0
]
},
"from": [
5.82,
0.0
],
"tag": {
"end": 120,
"start": 99,
"type": "TagDeclarator",
"value": "rectangleSegmentA001"
},
"to": [
-5.72,
0.0
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": null
},
"__meta": [
{
"sourceRange": [
99,
120,
0
]
}
]
},
"rectangleSegmentB001": {
"type": "TagIdentifier",
"value": "rectangleSegmentB001",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
127,
227,
0
]
},
"from": [
-5.72,
0.0
],
"tag": {
"end": 226,
"start": 205,
"type": "TagDeclarator",
"value": "rectangleSegmentB001"
},
"to": [
-5.72,
8.21
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": null
},
"__meta": [
{
"sourceRange": [
205,
226,
0
]
}
]
},
"rectangleSegmentC001": {
"type": "TagIdentifier",
"value": "rectangleSegmentC001",
"info": {
"type": "TagEngineInfo",
"id": "[uuid]",
"sketch": "[uuid]",
"path": {
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
233,
353,
0
]
},
"from": [
-5.72,
8.21
],
"tag": {
"end": 352,
"start": 331,
"type": "TagDeclarator",
"value": "rectangleSegmentC001"
},
"to": [
5.82,
8.21
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
"surface": null
},
"__meta": [
{
"sourceRange": [
331,
352,
0
]
}
]
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
},
"__meta": [
{
"sourceRange": [
37,
65,
0
]
}
]
}
},
"sketch004": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
502,
527,
0
]
},
"from": [
0.0,
14.36
],
"tag": null,
"to": [
15.49,
14.41
],
"type": "ToPoint",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
533,
559,
0
]
},
"ccw": false,
"center": [
15.5403,
-1.1745
],
"from": [
15.49,
14.41
],
"tag": null,
"to": [
0.0,
0.0
],
"type": "TangentialArcTo",
"units": {
"type": "Mm"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
565,
597,
0
]
},
"ccw": true,
"center": [
-7.6164,
0.5757
],
"from": [
0.0,
0.0
],
"tag": null,
"to": [
-6.8,
8.17
],
"type": "TangentialArcTo",
"units": {
"type": "Mm"
}
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "XZ",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"xAxis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"zAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"units": {
"type": "Mm"
},
"__meta": []
},
"start": {
"from": [
0.0,
14.36
],
"to": [
0.0,
14.36
],
"units": {
"type": "Mm"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
467,
496,
0
]
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
},
"__meta": [
{
"sourceRange": [
467,
496,
0
]
}
]
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -0,0 +1,508 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands artifact_graph_example_code_offset_planes.kcl
snapshot_kind: text
---
[
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.7,
"g": 0.28,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.7,
"b": 0.28,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.28,
"g": 0.28,
"b": 0.7,
"a": 0.4
}
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": -1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": -1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "edge_lines_visible",
"hidden": false
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "set_scene_units",
"unit": "mm"
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
0,
0,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [
17,
47,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 20.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"size": 100.0,
"clobber": false,
"hide": false
}
},
{
"cmdId": "[uuid]",
"range": [
17,
47,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.6,
"g": 0.6,
"b": 0.6,
"a": 0.3
}
}
},
{
"cmdId": "[uuid]",
"range": [
65,
96,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 50.0,
"z": 0.0
},
"x_axis": {
"x": 1.0,
"y": 0.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": false
}
},
{
"cmdId": "[uuid]",
"range": [
65,
96,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.6,
"g": 0.6,
"b": 0.6,
"a": 0.3
}
}
},
{
"cmdId": "[uuid]",
"range": [
114,
144,
0
],
"command": {
"type": "make_plane",
"origin": {
"x": 10.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 100.0,
"clobber": false,
"hide": false
}
},
{
"cmdId": "[uuid]",
"range": [
114,
144,
0
],
"command": {
"type": "plane_set_color",
"plane_id": "[uuid]",
"color": {
"r": 0.6,
"g": 0.6,
"b": 0.6,
"a": 0.3
}
}
},
{
"cmdId": "[uuid]",
"range": [
193,
218,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": {
"x": 0.0,
"y": 0.0,
"z": 1.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
193,
218,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
193,
218,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 0.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
224,
249,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 6.78,
"y": 15.01,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
193,
218,
0
],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact graph flowchart artifact_graph_example_code_offset_planes.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,14 @@
```mermaid
flowchart LR
subgraph path4 [Path]
4["Path<br>[193, 218, 0]"]
5["Segment<br>[224, 249, 0]"]
end
1["Plane<br>[17, 47, 0]"]
2["Plane<br>[65, 96, 0]"]
3["Plane<br>[114, 144, 0]"]
6["StartSketchOnPlane<br>[158, 187, 0]"]
1 --- 4
4 --- 5
1 <--x 6
```

View File

@ -0,0 +1,358 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code_offset_planes.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 47,
"id": {
"end": 14,
"name": "offsetPlane001",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "offset"
},
"arg": {
"end": 46,
"raw": "20",
"start": 44,
"type": "Literal",
"type": "Literal",
"value": {
"value": 20.0,
"suffix": "None"
}
}
}
],
"callee": {
"end": 28,
"name": "offsetPlane",
"start": 17,
"type": "Identifier"
},
"end": 47,
"start": 17,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 33,
"raw": "\"XY\"",
"start": 29,
"type": "Literal",
"type": "Literal",
"value": "XY"
}
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 47,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 96,
"id": {
"end": 62,
"name": "offsetPlane002",
"start": 48,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "offset"
},
"arg": {
"argument": {
"end": 95,
"raw": "50",
"start": 93,
"type": "Literal",
"type": "Literal",
"value": {
"value": 50.0,
"suffix": "None"
}
},
"end": 95,
"operator": "-",
"start": 92,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
}
],
"callee": {
"end": 76,
"name": "offsetPlane",
"start": 65,
"type": "Identifier"
},
"end": 96,
"start": 65,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 81,
"raw": "\"XZ\"",
"start": 77,
"type": "Literal",
"type": "Literal",
"value": "XZ"
}
},
"start": 48,
"type": "VariableDeclarator"
},
"end": 96,
"kind": "const",
"start": 48,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 144,
"id": {
"end": 111,
"name": "offsetPlane003",
"start": 97,
"type": "Identifier"
},
"init": {
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "offset"
},
"arg": {
"end": 143,
"raw": "10",
"start": 141,
"type": "Literal",
"type": "Literal",
"value": {
"value": 10.0,
"suffix": "None"
}
}
}
],
"callee": {
"end": 125,
"name": "offsetPlane",
"start": 114,
"type": "Identifier"
},
"end": 144,
"start": 114,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": {
"end": 130,
"raw": "\"YZ\"",
"start": 126,
"type": "Literal",
"type": "Literal",
"value": "YZ"
}
},
"start": 97,
"type": "VariableDeclarator"
},
"end": 144,
"kind": "const",
"start": 97,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 249,
"id": {
"end": 155,
"name": "sketch002",
"start": 146,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 186,
"name": "offsetPlane001",
"start": 172,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 171,
"name": "startSketchOn",
"start": 158,
"type": "Identifier"
},
"end": 187,
"start": 158,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 210,
"raw": "0",
"start": 209,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
},
{
"end": 213,
"raw": "0",
"start": 212,
"type": "Literal",
"type": "Literal",
"value": {
"value": 0.0,
"suffix": "None"
}
}
],
"end": 214,
"start": 208,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 217,
"start": 216,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 207,
"name": "startProfileAt",
"start": 193,
"type": "Identifier"
},
"end": 218,
"start": 193,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 240,
"raw": "6.78",
"start": 236,
"type": "Literal",
"type": "Literal",
"value": {
"value": 6.78,
"suffix": "None"
}
},
{
"end": 247,
"raw": "15.01",
"start": 242,
"type": "Literal",
"type": "Literal",
"value": {
"value": 15.01,
"suffix": "None"
}
}
],
"end": 248,
"start": 235,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 228,
"name": "line",
"start": 224,
"type": "Identifier"
},
"end": 249,
"start": 224,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
}
],
"end": 249,
"start": 158,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 146,
"type": "VariableDeclarator"
},
"end": 249,
"kind": "const",
"start": 146,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 250,
"nonCodeMeta": {
"nonCodeNodes": {
"2": [
{
"end": 146,
"start": 144,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,7 @@
offsetPlane001 = offsetPlane("XY", offset = 20)
offsetPlane002 = offsetPlane("XZ", offset = -50)
offsetPlane003 = offsetPlane("YZ", offset = 10)
sketch002 = startSketchOn(offsetPlane001)
|> startProfileAt([0, 0], %)
|> line(end = [6.78, 15.01])

View File

@ -0,0 +1,155 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed artifact_graph_example_code_offset_planes.kcl
---
[
{
"labeledArgs": {
"offset": {
"value": {
"type": "Number",
"value": 20.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
44,
46,
0
]
}
},
"name": "offsetPlane",
"sourceRange": [
17,
47,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "String",
"value": "XY"
},
"sourceRange": [
29,
33,
0
]
}
},
{
"labeledArgs": {
"offset": {
"value": {
"type": "Number",
"value": -50.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
92,
95,
0
]
}
},
"name": "offsetPlane",
"sourceRange": [
65,
96,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "String",
"value": "XZ"
},
"sourceRange": [
77,
81,
0
]
}
},
{
"labeledArgs": {
"offset": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": [
141,
143,
0
]
}
},
"name": "offsetPlane",
"sourceRange": [
114,
144,
0
],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "String",
"value": "YZ"
},
"sourceRange": [
126,
130,
0
]
}
},
{
"labeledArgs": {
"data": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": [
172,
186,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
158,
187,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

Some files were not shown because too many files have changed in this diff Show More