Rust artifact graph (#5068)

* Start porting artifact graph creation to Rust

* Add most of artifact graph creation

* Add handling loft command from recent PR

* Refactor artifact merge code so that it errors when a new artifact type is added

* Add sweep subtype

* Finish implementation of build artifact graph

* Fix wasm.ts to use new combined generated ts-rs file

* Fix Rust lints

* Fix lints

* Fix up replacement code

* Add artifact graph to WASM outcome

* Add artifact graph to simulation test output

* Add new artifact graph output snapshots

* Fix wall field and reduce unreachable code

* Change field order for subtype

* Change subtype to be determined from the request, like the TS

* Fix plane sweep_id

* Condense code

* Change ID types to be properly optional

* Change to favor the new ID, the same as TS

* Fix to make error impossible

* Rename artifact type tag values to match TS

* Fix name of field on Cap

* Update outputs

* Change to use Rust source range

* Update output snapshots

* Add conversion to mermaid mind map and add to snapshot tests

* Add new mermaid mind map output

* Add flowchart

* Remove raw artifact graph from tests

* Remove JSON artifact graph output

* Update output file with header

* Update output after adding flowchart

* Fix flowchart to not have duplicate edges, one in each direction

* Fix not not output duplicate edges in flowcharts

* Change flowchart edge style to be more obvious when a direction is missing

* Update output after deduplication of edges

* Fix not not skip sketch-on-face artifacts

* Add docs

* Fix edge iteration order to be stable

* Update output after fixing order

* Port TS artifactGraph.test.ts tests to simulation tests

* Add grouping segments and solid2ds with their path

* Update output flowcharts since grouping paths

* Remove TS artifactGraph tests

* Remove unused d3 dependencies

* Fix to track loft ID on paths

* Add command ID to error messages

* Move artifact graph test code to a separate file since it's a large file

* Reduce function visibility

* Remove TS artifact graph code

* Fix spelling error with serde

* Add TODO for edge cut consumed ID

* Add comment about mermaid edge rank

* Fix mermaid flowchart edge cuts to appear as children of their edges

* Update output since fixing flowchart order

* Fix to always build the artifact graph even when there's a KCL error

* Add artifact graph to error output

* Change optional ID merge to match TS

* Remove redundant SourceRange definition

* Remove Rust-flavored default source range function

* Add helper for source range creation

* Update doc comment for the website

* Update docs after doc comment change

* Fix to save engine responses in execution cache

* Remove unused import

* Fix to not call WASM function before beforeAll callback is run

* Remove more unused imports
This commit is contained in:
Jonathan Tran
2025-01-17 14:34:36 -05:00
committed by GitHub
parent 0592d3b5da
commit 0698432abf
328 changed files with 47357 additions and 2593 deletions

View File

@ -0,0 +1,937 @@
---
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,
86,
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": [
92,
119,
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": [
125,
150,
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": [
156,
203,
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": [
209,
217,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
209,
217,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
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": [
231,
254,
0
],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -10.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
231,
254,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
260,
301,
0
],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 5.0,
"tolerance": 0.0000001,
"cut_type": "fillet",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
352,
379,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": null
}
},
{
"cmdId": "[uuid]",
"range": [
352,
379,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
352,
379,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -2.0,
"y": -6.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
385,
400,
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": [
406,
422,
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": [
428,
475,
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": [
481,
489,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "enable_sketch_mode",
"entity_id": "[uuid]",
"ortho": false,
"animated": false,
"adjust_camera": false,
"planar_normal": null
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 5.0,
"faces": null
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
503,
524,
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,109 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[37, 64, 0]"]
3["Segment<br>[70, 86, 0]"]
4["Segment<br>[92, 119, 0]"]
5["Segment<br>[125, 150, 0]"]
6["Segment<br>[156, 203, 0]"]
7["Segment<br>[209, 217, 0]"]
8[Solid2d]
end
subgraph path25 [Path]
25["Path<br>[352, 379, 0]"]
26["Segment<br>[385, 400, 0]"]
27["Segment<br>[406, 422, 0]"]
28["Segment<br>[428, 475, 0]"]
29["Segment<br>[481, 489, 0]"]
30[Solid2d]
end
1["Plane<br>[12, 31, 0]"]
9["Sweep Extrusion<br>[231, 254, 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>[260, 301, 0]"]
31["Sweep Extrusion<br>[503, 524, 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"]
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
```

View File

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

View File

@ -0,0 +1,92 @@
```mermaid
mindmap
root
Plane
Path
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
EdgeCut Fillet
Segment
Wall
Path
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Sweep Extrusion
Wall
Wall
Wall
Cap End
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
Solid2d
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Sweep Extrusion
Wall
Wall
Path
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Sweep Extrusion
Wall
Wall
Wall
Cap End
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
Solid2d
Wall
Wall
Cap Start
Cap End
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
Solid2d
```

View File

@ -0,0 +1,837 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing artifact_graph_example_code1.kcl
snapshot_kind: text
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 217,
"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": 5.0
},
"end": 55,
"operator": "-",
"start": 53,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 59,
"raw": "5",
"start": 58,
"type": "Literal",
"type": "Literal",
"value": 5.0
},
"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": [
{
"elements": [
{
"end": 77,
"raw": "0",
"start": 76,
"type": "Literal",
"type": "Literal",
"value": 0.0
},
{
"end": 81,
"raw": "10",
"start": 79,
"type": "Literal",
"type": "Literal",
"value": 10.0
}
],
"end": 82,
"start": 75,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 85,
"start": 84,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 74,
"name": "line",
"start": 70,
"type": "Identifier"
},
"end": 86,
"start": 70,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 103,
"raw": "10.55",
"start": 98,
"type": "Literal",
"type": "Literal",
"value": 10.55
},
{
"end": 106,
"raw": "0",
"start": 105,
"type": "Literal",
"type": "Literal",
"value": 0.0
}
],
"end": 107,
"start": 97,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 110,
"start": 109,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 118,
"start": 112,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg01"
}
],
"callee": {
"end": 96,
"name": "line",
"start": 92,
"type": "Identifier"
},
"end": 119,
"start": 92,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 132,
"raw": "0",
"start": 131,
"type": "Literal",
"type": "Literal",
"value": 0.0
},
{
"argument": {
"end": 137,
"raw": "10",
"start": 135,
"type": "Literal",
"type": "Literal",
"value": 10.0
},
"end": 137,
"operator": "-",
"start": 134,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 138,
"start": 130,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 141,
"start": 140,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
},
{
"end": 149,
"start": 143,
"type": "TagDeclarator",
"type": "TagDeclarator",
"value": "seg02"
}
],
"callee": {
"end": 129,
"name": "line",
"start": 125,
"type": "Identifier"
},
"end": 150,
"start": 125,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"arguments": [
{
"end": 179,
"start": 178,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 177,
"name": "profileStartX",
"start": 164,
"type": "Identifier"
},
"end": 180,
"start": 164,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 197,
"start": 196,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 195,
"name": "profileStartY",
"start": 182,
"type": "Identifier"
},
"end": 198,
"start": 182,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 199,
"start": 163,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 202,
"start": 201,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 162,
"name": "lineTo",
"start": 156,
"type": "Identifier"
},
"end": 203,
"start": 156,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 216,
"start": 215,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 214,
"name": "close",
"start": 209,
"type": "Identifier"
},
"end": 217,
"start": 209,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 217,
"start": 12,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 217,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 301,
"id": {
"end": 228,
"name": "extrude001",
"start": 218,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"argument": {
"end": 242,
"raw": "10",
"start": 240,
"type": "Literal",
"type": "Literal",
"value": 10.0
},
"end": 242,
"operator": "-",
"start": 239,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"end": 253,
"name": "sketch001",
"start": 244,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 238,
"name": "extrude",
"start": 231,
"type": "Identifier"
},
"end": 254,
"start": 231,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 297,
"properties": [
{
"end": 279,
"key": {
"end": 275,
"name": "radius",
"start": 269,
"type": "Identifier"
},
"start": 269,
"type": "ObjectProperty",
"value": {
"end": 279,
"raw": "5",
"start": 278,
"type": "Literal",
"type": "Literal",
"value": 5.0
}
},
{
"end": 295,
"key": {
"end": 285,
"name": "tags",
"start": 281,
"type": "Identifier"
},
"start": 281,
"type": "ObjectProperty",
"value": {
"elements": [
{
"end": 294,
"name": "seg01",
"start": 289,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 295,
"start": 288,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"start": 267,
"type": "ObjectExpression",
"type": "ObjectExpression"
},
{
"end": 300,
"start": 299,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 266,
"name": "fillet",
"start": 260,
"type": "Identifier"
},
"end": 301,
"start": 260,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 301,
"start": 231,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 218,
"type": "VariableDeclarator"
},
"end": 301,
"kind": "const",
"start": 218,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 489,
"id": {
"end": 311,
"name": "sketch002",
"start": 302,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"end": 338,
"name": "extrude001",
"start": 328,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 345,
"name": "seg02",
"start": 340,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 327,
"name": "startSketchOn",
"start": 314,
"type": "Identifier"
},
"end": 346,
"start": 314,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"argument": {
"end": 370,
"raw": "2",
"start": 369,
"type": "Literal",
"type": "Literal",
"value": 2.0
},
"end": 370,
"operator": "-",
"start": 368,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 374,
"raw": "6",
"start": 373,
"type": "Literal",
"type": "Literal",
"value": 6.0
},
"end": 374,
"operator": "-",
"start": 372,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 375,
"start": 367,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 378,
"start": 377,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 366,
"name": "startProfileAt",
"start": 352,
"type": "Identifier"
},
"end": 379,
"start": 352,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 392,
"raw": "2",
"start": 391,
"type": "Literal",
"type": "Literal",
"value": 2.0
},
{
"end": 395,
"raw": "3",
"start": 394,
"type": "Literal",
"type": "Literal",
"value": 3.0
}
],
"end": 396,
"start": 390,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 399,
"start": 398,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 389,
"name": "line",
"start": 385,
"type": "Identifier"
},
"end": 400,
"start": 385,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"end": 413,
"raw": "2",
"start": 412,
"type": "Literal",
"type": "Literal",
"value": 2.0
},
{
"argument": {
"end": 417,
"raw": "3",
"start": 416,
"type": "Literal",
"type": "Literal",
"value": 3.0
},
"end": 417,
"operator": "-",
"start": 415,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 418,
"start": 411,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 421,
"start": 420,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 410,
"name": "line",
"start": 406,
"type": "Identifier"
},
"end": 422,
"start": 406,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"elements": [
{
"arguments": [
{
"end": 451,
"start": 450,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 449,
"name": "profileStartX",
"start": 436,
"type": "Identifier"
},
"end": 452,
"start": 436,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 469,
"start": 468,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 467,
"name": "profileStartY",
"start": 454,
"type": "Identifier"
},
"end": 470,
"start": 454,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 471,
"start": 435,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 474,
"start": 473,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 434,
"name": "lineTo",
"start": 428,
"type": "Identifier"
},
"end": 475,
"start": 428,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 488,
"start": 487,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 486,
"name": "close",
"start": 481,
"type": "Identifier"
},
"end": 489,
"start": 481,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 489,
"start": 314,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 302,
"type": "VariableDeclarator"
},
"end": 489,
"kind": "const",
"start": 302,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 524,
"id": {
"end": 500,
"name": "extrude002",
"start": 490,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 512,
"raw": "5",
"start": 511,
"type": "Literal",
"type": "Literal",
"value": 5.0
},
{
"end": 523,
"name": "sketch002",
"start": 514,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 510,
"name": "extrude",
"start": 503,
"type": "Identifier"
},
"end": 524,
"start": 503,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 490,
"type": "VariableDeclarator"
},
"end": 524,
"kind": "const",
"start": 490,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
}
],
"end": 525,
"start": 0
}
}

View File

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

View File

@ -0,0 +1,130 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed artifact_graph_example_code1.kcl
snapshot_kind: text
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
26,
30,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
12,
31,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
239,
242,
0
]
},
"sketch_set": {
"sourceRange": [
244,
253,
0
]
}
},
"name": "extrude",
"sourceRange": [
231,
254,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
267,
297,
0
]
},
"solid": {
"sourceRange": [
299,
300,
0
]
}
},
"name": "fillet",
"sourceRange": [
260,
301,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
328,
338,
0
]
},
"tag": {
"sourceRange": [
340,
345,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
314,
346,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"length": {
"sourceRange": [
511,
512,
0
]
},
"sketch_set": {
"sourceRange": [
514,
523,
0
]
}
},
"name": "extrude",
"sourceRange": [
503,
524,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB