Compare commits

...

2 Commits

Author SHA1 Message Date
e4c94dbc3d Add the actual loft command 2025-02-07 12:40:51 -05:00
794722739d Add loft test 2025-02-07 12:40:14 -05:00
11 changed files with 2183 additions and 0 deletions

View File

@ -1796,6 +1796,27 @@ mod kw_fn_with_defaults {
super::execute(TEST_NAME, false).await
}
}
mod loft_graph {
const TEST_NAME: &str = "loft_graph";
/// Test parsing KCL.
#[test]
fn parse() {
super::parse(TEST_NAME)
}
/// Test that parsing and unparsing KCL produces the original KCL input.
#[test]
fn unparse() {
super::unparse(TEST_NAME)
}
/// Test that KCL is executed correctly.
#[tokio::test(flavor = "multi_thread")]
async fn kcl_test_execute() {
super::execute(TEST_NAME, true).await
}
}
mod boolean_logical_and {
const TEST_NAME: &str = "boolean_logical_and";

View File

@ -0,0 +1,769 @@
---
source: kcl/src/simulation_tests.rs
description: Artifact commands loft_graph.kcl
---
[
{
"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": 0.0,
"z": 1.0
},
"size": 60.0,
"clobber": false,
"hide": true
}
},
{
"cmdId": "[uuid]",
"range": [
45,
80,
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": [
45,
80,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
45,
80,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 34.0,
"y": 42.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
86,
108,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 102.0,
"y": 152.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
114,
136,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 76.0,
"y": -138.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
142,
198,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 34.0,
"y": 42.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
204,
211,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
204,
211,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
223,
244,
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": [
223,
244,
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": [
294,
330,
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": [
294,
330,
0
],
"command": {
"type": "start_path"
}
},
{
"cmdId": "[uuid]",
"range": [
294,
330,
0
],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 39.0,
"y": 172.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [
336,
349,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 184.0,
"y": 0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
355,
378,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -78.0,
"y": -145.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [
384,
440,
0
],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 39.0,
"y": 172.0,
"z": 0.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [
446,
453,
0
],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
446,
453,
0
],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "loft",
"section_ids": [
"[uuid]",
"[uuid]"
],
"v_degree": 2,
"bez_approximate_rational": false,
"base_curve_index": null,
"tolerance": 0.0000001
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
455,
485,
0
],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [
294,
330,
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 loft_graph.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,64 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[45, 80, 0]"]
3["Segment<br>[86, 108, 0]"]
4["Segment<br>[114, 136, 0]"]
5["Segment<br>[142, 198, 0]"]
6["Segment<br>[204, 211, 0]"]
7[Solid2d]
end
subgraph path9 [Path]
9["Path<br>[294, 330, 0]"]
13["Segment<br>[446, 453, 0]"]
14[Solid2d]
end
1["Plane<br>[12, 31, 0]"]
8["Plane<br>[223, 244, 0]"]
10["SweepEdge Opposite"]
11["SweepEdge Opposite"]
12["SweepEdge Opposite"]
15["Sweep Loft<br>[455, 485, 0]"]
16[Wall]
17[Wall]
18[Wall]
19["Cap Start"]
20["Cap End"]
21["SweepEdge Adjacent"]
22["SweepEdge Adjacent"]
23["SweepEdge Adjacent"]
1 --- 2
2 --- 3
2 --- 4
2 --- 5
2 --- 6
2 ---- 15
2 --- 7
3 --- 16
3 --- 10
3 --- 21
4 --- 17
4 --- 11
4 --- 22
5 --- 18
5 --- 12
5 --- 23
8 --- 9
9 x--> 10
9 x--> 11
9 x--> 12
9 --- 13
9 x---> 15
9 --- 14
15 --- 10
15 --- 11
15 --- 12
15 --- 16
15 --- 17
15 --- 18
15 --- 19
15 --- 20
15 --- 21
15 --- 22
15 --- 23
```

View File

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

View File

@ -0,0 +1,51 @@
```mermaid
mindmap
root
Plane
Path
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Wall
SweepEdge Opposite
SweepEdge Adjacent
Segment
Sweep Loft
Wall
Wall
Wall
Cap Start
Cap End
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
Solid2d
Plane
Path
SweepEdge Opposite
SweepEdge Opposite
SweepEdge Opposite
Segment
Sweep Loft
Wall
Wall
Wall
Cap Start
Cap End
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
SweepEdge Opposite
SweepEdge Adjacent
Solid2d
```

View File

@ -0,0 +1,727 @@
---
source: kcl/src/simulation_tests.rs
description: Result of parsing loft_graph.kcl
---
{
"Ok": {
"body": [
{
"declaration": {
"end": 31,
"id": {
"end": 9,
"name": "sketch001",
"start": 0,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 30,
"raw": "'XZ'",
"start": 26,
"type": "Literal",
"type": "Literal",
"value": "XZ"
}
],
"callee": {
"end": 25,
"name": "startSketchOn",
"start": 12,
"type": "Identifier"
},
"end": 31,
"start": 12,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 0,
"type": "VariableDeclarator"
},
"end": 31,
"kind": "const",
"start": 0,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 211,
"id": {
"end": 42,
"name": "profile001",
"start": 32,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"elements": [
{
"end": 63,
"raw": "34",
"start": 61,
"type": "Literal",
"type": "Literal",
"value": {
"value": 34.0,
"suffix": "None"
}
},
{
"end": 67,
"raw": "42",
"start": 65,
"type": "Literal",
"type": "Literal",
"value": {
"value": 42.0,
"suffix": "None"
}
}
],
"end": 68,
"start": 60,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 79,
"name": "sketch001",
"start": 70,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 59,
"name": "startProfileAt",
"start": 45,
"type": "Identifier"
},
"end": 80,
"start": 45,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 101,
"raw": "102",
"start": 98,
"type": "Literal",
"type": "Literal",
"value": {
"value": 102.0,
"suffix": "None"
}
},
{
"end": 106,
"raw": "152",
"start": 103,
"type": "Literal",
"type": "Literal",
"value": {
"value": 152.0,
"suffix": "None"
}
}
],
"end": 107,
"start": 97,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 90,
"name": "line",
"start": 86,
"type": "Identifier"
},
"end": 108,
"start": 86,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"end": 128,
"raw": "76",
"start": 126,
"type": "Literal",
"type": "Literal",
"value": {
"value": 76.0,
"suffix": "None"
}
},
{
"argument": {
"end": 134,
"raw": "138",
"start": 131,
"type": "Literal",
"type": "Literal",
"value": {
"value": 138.0,
"suffix": "None"
}
},
"end": 134,
"operator": "-",
"start": 130,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 135,
"start": 125,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 118,
"name": "line",
"start": 114,
"type": "Identifier"
},
"end": 136,
"start": 114,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "endAbsolute"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 177,
"start": 176,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 175,
"name": "profileStartX",
"start": 162,
"type": "Identifier"
},
"end": 178,
"start": 162,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 195,
"start": 194,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 193,
"name": "profileStartY",
"start": 180,
"type": "Identifier"
},
"end": 196,
"start": 180,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 197,
"start": 161,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 146,
"name": "line",
"start": 142,
"type": "Identifier"
},
"end": 198,
"start": 142,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 209,
"name": "close",
"start": 204,
"type": "Identifier"
},
"end": 211,
"start": 204,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 211,
"start": 45,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 32,
"type": "VariableDeclarator"
},
"end": 211,
"kind": "const",
"start": 32,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 244,
"id": {
"end": 220,
"name": "plane001",
"start": 212,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 239,
"raw": "'XZ'",
"start": 235,
"type": "Literal",
"type": "Literal",
"value": "XZ"
},
{
"end": 243,
"raw": "50",
"start": 241,
"type": "Literal",
"type": "Literal",
"value": {
"value": 50.0,
"suffix": "None"
}
}
],
"callee": {
"end": 234,
"name": "offsetPlane",
"start": 223,
"type": "Identifier"
},
"end": 244,
"start": 223,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 212,
"type": "VariableDeclarator"
},
"end": 244,
"kind": "const",
"start": 212,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 280,
"id": {
"end": 254,
"name": "sketch002",
"start": 245,
"type": "Identifier"
},
"init": {
"arguments": [
{
"end": 279,
"name": "plane001",
"start": 271,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 270,
"name": "startSketchOn",
"start": 257,
"type": "Identifier"
},
"end": 280,
"start": 257,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 245,
"type": "VariableDeclarator"
},
"end": 280,
"kind": "const",
"start": 245,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"declaration": {
"end": 453,
"id": {
"end": 291,
"name": "profile002",
"start": 281,
"type": "Identifier"
},
"init": {
"body": [
{
"arguments": [
{
"elements": [
{
"end": 312,
"raw": "39",
"start": 310,
"type": "Literal",
"type": "Literal",
"value": {
"value": 39.0,
"suffix": "None"
}
},
{
"end": 317,
"raw": "172",
"start": 314,
"type": "Literal",
"type": "Literal",
"value": {
"value": 172.0,
"suffix": "None"
}
}
],
"end": 318,
"start": 309,
"type": "ArrayExpression",
"type": "ArrayExpression"
},
{
"end": 329,
"name": "sketch002",
"start": 320,
"type": "Identifier",
"type": "Identifier"
}
],
"callee": {
"end": 308,
"name": "startProfileAt",
"start": 294,
"type": "Identifier"
},
"end": 330,
"start": 294,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 345,
"raw": "184",
"start": 342,
"type": "Literal",
"type": "Literal",
"value": {
"value": 184.0,
"suffix": "None"
}
},
{
"end": 348,
"start": 347,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 341,
"name": "xLine",
"start": 336,
"type": "Identifier"
},
"end": 349,
"start": 336,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "end"
},
"arg": {
"elements": [
{
"argument": {
"end": 370,
"raw": "78",
"start": 368,
"type": "Literal",
"type": "Literal",
"value": {
"value": 78.0,
"suffix": "None"
}
},
"end": 370,
"operator": "-",
"start": 367,
"type": "UnaryExpression",
"type": "UnaryExpression"
},
{
"argument": {
"end": 376,
"raw": "145",
"start": 373,
"type": "Literal",
"type": "Literal",
"value": {
"value": 145.0,
"suffix": "None"
}
},
"end": 376,
"operator": "-",
"start": 372,
"type": "UnaryExpression",
"type": "UnaryExpression"
}
],
"end": 377,
"start": 366,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 359,
"name": "line",
"start": 355,
"type": "Identifier"
},
"end": 378,
"start": 355,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [
{
"type": "LabeledArg",
"label": {
"type": "Identifier",
"name": "endAbsolute"
},
"arg": {
"elements": [
{
"arguments": [
{
"end": 419,
"start": 418,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 417,
"name": "profileStartX",
"start": 404,
"type": "Identifier"
},
"end": 420,
"start": 404,
"type": "CallExpression",
"type": "CallExpression"
},
{
"arguments": [
{
"end": 437,
"start": 436,
"type": "PipeSubstitution",
"type": "PipeSubstitution"
}
],
"callee": {
"end": 435,
"name": "profileStartY",
"start": 422,
"type": "Identifier"
},
"end": 438,
"start": 422,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 439,
"start": 403,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
}
],
"callee": {
"end": 388,
"name": "line",
"start": 384,
"type": "Identifier"
},
"end": 440,
"start": 384,
"type": "CallExpressionKw",
"type": "CallExpressionKw",
"unlabeled": null
},
{
"arguments": [],
"callee": {
"end": 451,
"name": "close",
"start": 446,
"type": "Identifier"
},
"end": 453,
"start": 446,
"type": "CallExpression",
"type": "CallExpression"
}
],
"end": 453,
"start": 294,
"type": "PipeExpression",
"type": "PipeExpression"
},
"start": 281,
"type": "VariableDeclarator"
},
"end": 453,
"kind": "const",
"start": 281,
"type": "VariableDeclaration",
"type": "VariableDeclaration"
},
{
"end": 485,
"expression": {
"arguments": [
{
"elements": [
{
"end": 471,
"name": "profile001",
"start": 461,
"type": "Identifier",
"type": "Identifier"
},
{
"end": 483,
"name": "profile002",
"start": 473,
"type": "Identifier",
"type": "Identifier"
}
],
"end": 484,
"start": 460,
"type": "ArrayExpression",
"type": "ArrayExpression"
}
],
"callee": {
"end": 459,
"name": "loft",
"start": 455,
"type": "Identifier"
},
"end": 485,
"start": 455,
"type": "CallExpression",
"type": "CallExpression"
},
"start": 455,
"type": "ExpressionStatement",
"type": "ExpressionStatement"
}
],
"end": 486,
"nonCodeMeta": {
"nonCodeNodes": {
"4": [
{
"end": 455,
"start": 453,
"type": "NonCodeNode",
"value": {
"type": "newLine"
}
}
]
},
"startNodes": []
},
"start": 0
}
}

View File

@ -0,0 +1,15 @@
sketch001 = startSketchOn('XZ')
profile001 = startProfileAt([34, 42], sketch001)
|> line(end = [102, 152])
|> line(end = [76, -138])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
plane001 = offsetPlane('XZ', 50)
sketch002 = startSketchOn(plane001)
profile002 = startProfileAt([39, 172], sketch002)
|> xLine(184, %)
|> line(end = [-78, -145])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
loft([profile001, profile002])

View File

@ -0,0 +1,89 @@
---
source: kcl/src/simulation_tests.rs
description: Operations executed loft_graph.kcl
---
[
{
"labeledArgs": {
"data": {
"sourceRange": [
26,
30,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
12,
31,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"offset": {
"sourceRange": [
241,
243,
0
]
},
"std_plane": {
"sourceRange": [
235,
239,
0
]
}
},
"name": "offsetPlane",
"sourceRange": [
223,
244,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"data": {
"sourceRange": [
271,
279,
0
]
}
},
"name": "startSketchOn",
"sourceRange": [
257,
280,
0
],
"type": "StdLibCall",
"unlabeledArg": null
},
{
"labeledArgs": {
"sketches": {
"sourceRange": [
460,
484,
0
]
}
},
"name": "loft",
"sourceRange": [
455,
485,
0
],
"type": "StdLibCall",
"unlabeledArg": null
}
]

View File

@ -0,0 +1,435 @@
---
source: kcl/src/simulation_tests.rs
description: Program memory after executing loft_graph.kcl
---
{
"environments": [
{
"bindings": {
"HALF_TURN": {
"type": "Number",
"value": 180.0,
"__meta": []
},
"QUARTER_TURN": {
"type": "Number",
"value": 90.0,
"__meta": []
},
"THREE_QUARTER_TURN": {
"type": "Number",
"value": 270.0,
"__meta": []
},
"ZERO": {
"type": "Number",
"value": 0.0,
"__meta": []
},
"plane001": {
"type": "Plane",
"value": {
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "Custom",
"origin": {
"x": 0.0,
"y": -50.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": []
}
},
"profile001": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
86,
108,
0
]
},
"from": [
34.0,
42.0
],
"tag": null,
"to": [
136.0,
194.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
114,
136,
0
]
},
"from": [
136.0,
194.0
],
"tag": null,
"to": [
212.0,
56.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
142,
198,
0
]
},
"from": [
212.0,
56.0
],
"tag": null,
"to": [
34.0,
42.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
204,
211,
0
]
},
"from": [
34.0,
42.0
],
"tag": null,
"to": [
34.0,
42.0
],
"type": "ToPoint"
}
],
"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": [
34.0,
42.0
],
"to": [
34.0,
42.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
45,
80,
0
]
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
},
"__meta": [
{
"sourceRange": [
45,
80,
0
]
}
]
}
},
"profile002": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
336,
349,
0
]
},
"from": [
39.0,
172.0
],
"tag": null,
"to": [
223.0,
172.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
355,
378,
0
]
},
"from": [
223.0,
172.0
],
"tag": null,
"to": [
145.0,
27.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
384,
440,
0
]
},
"from": [
145.0,
27.0
],
"tag": null,
"to": [
39.0,
172.0
],
"type": "ToPoint"
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
446,
453,
0
]
},
"from": [
39.0,
172.0
],
"tag": null,
"to": [
39.0,
172.0
],
"type": "ToPoint"
}
],
"on": {
"type": "plane",
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "Custom",
"origin": {
"x": 0.0,
"y": -50.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": [
39.0,
172.0
],
"to": [
39.0,
172.0
],
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": [
294,
330,
0
]
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Mm"
},
"__meta": [
{
"sourceRange": [
294,
330,
0
]
}
]
}
},
"sketch001": {
"type": "Plane",
"value": {
"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": []
}
},
"sketch002": {
"type": "Plane",
"value": {
"id": "[uuid]",
"artifactId": "[uuid]",
"value": "Custom",
"origin": {
"x": 0.0,
"y": -50.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": []
}
}
},
"parent": null
}
],
"currentEnv": 0,
"return": null
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB