diff --git a/rust/kcl-lib/src/simulation_tests.rs b/rust/kcl-lib/src/simulation_tests.rs index 6caabc668..d6ab7d670 100644 --- a/rust/kcl-lib/src/simulation_tests.rs +++ b/rust/kcl-lib/src/simulation_tests.rs @@ -3642,3 +3642,27 @@ mod var_ref_in_own_def_decl { super::execute(TEST_NAME, true).await } } +mod user_reported_union_2_bug { + // TODO IF THIS TEST START PASSING, CLOSE THE FOLLOWING ISSUE + // https://github.com/KittyCAD/modeling-app/issues/7310 + // and https://github.com/KittyCAD/engine/issues/3539 + const TEST_NAME: &str = "user_reported_union_2_bug"; + + /// Test parsing KCL. + #[test] + fn parse() { + super::parse(TEST_NAME) + } + + /// Test that parsing and unparsing KCL produces the original KCL input. + #[tokio::test(flavor = "multi_thread")] + async fn unparse() { + super::unparse(TEST_NAME).await + } + + /// Test that KCL is executed correctly. + #[tokio::test(flavor = "multi_thread")] + async fn kcl_test_execute() { + super::execute(TEST_NAME, false).await + } +} diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_commands.snap b/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_commands.snap new file mode 100644 index 000000000..07638dcc4 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_commands.snap @@ -0,0 +1,18 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact commands user_reported_union_2_bug.kcl +--- +{ + "rust/kcl-lib/tests/user_reported_union_2_bug/input.kcl": [], + "std::appearance": [], + "std::array": [], + "std::math": [], + "std::prelude": [], + "std::sketch": [], + "std::solid": [], + "std::sweep": [], + "std::transform": [], + "std::turns": [], + "std::types": [], + "std::units": [] +} diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_graph_flowchart.snap b/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_graph_flowchart.snap new file mode 100644 index 000000000..7acc2f139 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_graph_flowchart.snap @@ -0,0 +1,6 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact graph flowchart user_reported_union_2_bug.kcl +extension: md +snapshot_kind: binary +--- diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_graph_flowchart.snap.md new file mode 100644 index 000000000..a592d9e71 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/artifact_graph_flowchart.snap.md @@ -0,0 +1,165 @@ +```mermaid +flowchart LR + subgraph path3 [Path] + 3["Path
[445, 518, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 5["Segment
[526, 600, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 6["Segment
[608, 682, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 7["Segment
[690, 764, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 8["Segment
[772, 779, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] + 13[Solid2d] + end + subgraph path4 [Path] + 4["Path
[1045, 1086, 0]"] + %% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 9["Segment
[1092, 1139, 0]"] + %% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 10["Segment
[1145, 1206, 0]"] + %% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 11["Segment
[1212, 1231, 0]"] + %% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 12[Solid2d] + end + 1["Plane
[420, 437, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 2["Plane
[1022, 1039, 0]"] + %% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 14["Sweep Extrusion
[839, 877, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 1 }, ReturnStatementArg] + 15["Sweep Extrusion
[1251, 1286, 0]"] + %% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 16[Wall] + %% face_code_ref=Missing NodePath + 17[Wall] + %% face_code_ref=Missing NodePath + 18[Wall] + %% face_code_ref=Missing NodePath + 19[Wall] + %% face_code_ref=Missing NodePath + 20[Wall] + %% face_code_ref=Missing NodePath + 21[Wall] + %% face_code_ref=Missing NodePath + 22[Wall] + %% face_code_ref=Missing NodePath + 23["Cap Start"] + %% face_code_ref=Missing NodePath + 24["Cap Start"] + %% face_code_ref=Missing NodePath + 25["Cap End"] + %% face_code_ref=Missing NodePath + 26["Cap End"] + %% face_code_ref=Missing NodePath + 27["SweepEdge Opposite"] + 28["SweepEdge Opposite"] + 29["SweepEdge Opposite"] + 30["SweepEdge Opposite"] + 31["SweepEdge Opposite"] + 32["SweepEdge Opposite"] + 33["SweepEdge Opposite"] + 34["SweepEdge Adjacent"] + 35["SweepEdge Adjacent"] + 36["SweepEdge Adjacent"] + 37["SweepEdge Adjacent"] + 38["SweepEdge Adjacent"] + 39["SweepEdge Adjacent"] + 40["SweepEdge Adjacent"] + 1 --- 3 + 2 --- 4 + 3 --- 5 + 3 --- 6 + 3 --- 7 + 3 --- 8 + 3 --- 13 + 3 ---- 14 + 4 --- 9 + 4 --- 10 + 4 --- 11 + 4 --- 12 + 4 ---- 15 + 5 --- 19 + 5 x--> 23 + 5 --- 27 + 5 --- 34 + 6 --- 17 + 6 x--> 23 + 6 --- 28 + 6 --- 35 + 7 --- 16 + 7 x--> 23 + 7 --- 29 + 7 --- 36 + 8 --- 18 + 8 x--> 23 + 8 --- 30 + 8 --- 37 + 9 --- 21 + 9 x--> 24 + 9 --- 31 + 9 --- 38 + 10 --- 22 + 10 x--> 24 + 10 --- 32 + 10 --- 39 + 11 --- 20 + 11 x--> 24 + 11 --- 33 + 11 --- 40 + 14 --- 16 + 14 --- 17 + 14 --- 18 + 14 --- 19 + 14 --- 23 + 14 --- 25 + 14 --- 27 + 14 --- 28 + 14 --- 29 + 14 --- 30 + 14 --- 34 + 14 --- 35 + 14 --- 36 + 14 --- 37 + 15 --- 20 + 15 --- 21 + 15 --- 22 + 15 --- 24 + 15 --- 26 + 15 --- 31 + 15 --- 32 + 15 --- 33 + 15 --- 38 + 15 --- 39 + 15 --- 40 + 16 --- 29 + 35 <--x 16 + 16 --- 36 + 17 --- 28 + 34 <--x 17 + 17 --- 35 + 18 --- 30 + 36 <--x 18 + 18 --- 37 + 19 --- 27 + 19 --- 34 + 37 <--x 19 + 20 --- 33 + 39 <--x 20 + 20 --- 40 + 21 --- 31 + 21 --- 38 + 40 <--x 21 + 22 --- 32 + 38 <--x 22 + 22 --- 39 + 27 <--x 25 + 28 <--x 25 + 29 <--x 25 + 30 <--x 25 + 31 <--x 26 + 32 <--x 26 + 33 <--x 26 +``` diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/ast.snap b/rust/kcl-lib/tests/user_reported_union_2_bug/ast.snap new file mode 100644 index 000000000..cdf74edf0 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/ast.snap @@ -0,0 +1,2375 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of parsing user_reported_union_2_bug.kcl +--- +{ + "Ok": { + "body": [ + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "triangleSide", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "140", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 140.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "preComments": [ + "// Define dimensions" + ], + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "triangleHeight", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "60", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 60.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "triangleFilletRadius", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "3", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 3.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "delta", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "cubeSize", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "5", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 5.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "cubeLength", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "45", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 45.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "cubeSpacing", + "start": 0, + "type": "Identifier" + }, + "init": { + "commentStart": 0, + "end": 0, + "raw": "30", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 30.0, + "suffix": "None" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "createCube", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": { + "body": [ + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "cubeSketch", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "startSketchOn", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "XY", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "-", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSize", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "-", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeLength", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "startProfile", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "endAbsolute", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "+", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSize", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "-", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeLength", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "line", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "endAbsolute", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "+", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSize", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "+", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeLength", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "line", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "endAbsolute", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "-", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSize", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "left": { + "commentStart": 0, + "computed": false, + "end": 0, + "object": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "property": { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + "start": 0, + "type": "MemberExpression", + "type": "MemberExpression" + }, + "operator": "+", + "right": { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeLength", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "line", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "close", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "x", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "y", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "left": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeLength", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "z", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "translate", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + } + ], + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "argument": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSize", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "extrude", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSketch", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "ReturnStatement", + "type": "ReturnStatement" + } + ], + "commentStart": 0, + "end": 0, + "start": 0 + }, + "commentStart": 0, + "end": 0, + "params": [ + { + "type": "Parameter", + "identifier": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + } + } + ], + "start": 0, + "type": "FunctionExpression", + "type": "FunctionExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "fn", + "preComments": [ + "", + "", + "// Function to create a cube" + ], + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "cube1", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cubeSpacing", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "delta", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "createCube", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "preComments": [ + "", + "", + "// Create 4 cubes around the triangle" + ], + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "triangleSketch", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "startSketchOn", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "XY", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "triangleSide", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "4", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 4.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "startProfile", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "end", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "triangleSide", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tag", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "TagDeclarator", + "type": "TagDeclarator", + "value": "edge1" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "line", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "end", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "left": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "triangleSide", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + "operator": "/", + "right": { + "commentStart": 0, + "end": 0, + "raw": "4", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 4.0, + "suffix": "None" + } + }, + "start": 0, + "type": "BinaryExpression", + "type": "BinaryExpression" + }, + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "triangleHeight", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tag", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "TagDeclarator", + "type": "TagDeclarator", + "value": "edge2" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "line", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tag", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "TagDeclarator", + "type": "TagDeclarator", + "value": "edge3" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "close", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + } + ], + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "preComments": [ + "", + "", + "// Create the rounded triangle" + ], + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "roundedTriangle", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "5", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 5.0, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "extrude", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "triangleSketch", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "roll", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "3", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 3.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "pitch", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "yaw", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "rotate", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": null + } + ], + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "intermediateUnion1", + "start": 0, + "type": "Identifier" + }, + "init": { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "union", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "elements": [ + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "roundedTriangle", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cube1", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + } + ], + "commentStart": 0, + "end": 0, + "innerAttrs": [ + { + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "settings", + "start": 0, + "type": "Identifier" + }, + "properties": [ + { + "commentStart": 0, + "end": 0, + "key": { + "commentStart": 0, + "end": 0, + "name": "defaultLengthUnit", + "start": 0, + "type": "Identifier" + }, + "start": 0, + "type": "ObjectProperty", + "value": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "mm", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + } + ], + "start": 0, + "type": "Annotation" + } + ], + "nonCodeMeta": { + "nonCodeNodes": { + "3": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "9": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "10": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "startNodes": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "blockComment", + "value": "TODO IF THIS TEST START PASSING, CLOSE THE FOLLOWING ISSUE", + "style": "line" + } + }, + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "blockComment", + "value": "https://github.com/KittyCAD/modeling-app/issues/7310", + "style": "line" + } + }, + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "blockComment", + "value": "and https://github.com/KittyCAD/engine/issues/3539", + "style": "line" + } + }, + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + }, + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "start": 0 + } +} diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/execution_error.snap b/rust/kcl-lib/tests/user_reported_union_2_bug/execution_error.snap new file mode 100644 index 000000000..63e515d0e --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/execution_error.snap @@ -0,0 +1,26 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Error from executing user_reported_union_2_bug.kcl +--- +KCL Engine error + + × engine: The Zoo engine cannot handle this 3D union yet. Please report + │ this as an issue + ╭─[44:22] + 43 │ + 44 │ intermediateUnion1 = union([roundedTriangle, cube1]) + · ───────────────┬───────────────┬ + · ╰── tests/user_reported_union_2_bug/input.kcl + · ╰── tests/user_reported_union_2_bug/input.kcl + ╰──── + ╰─▶ KCL Engine error + + × engine: The Zoo engine cannot handle this 3D union yet. Please + │ report this as an issue + ╭─[44:22] + 43 │ + 44 │ intermediateUnion1 = union([roundedTriangle, cube1]) + · ───────────────┬─────────────── + · ╰── tests/ + user_reported_union_2_bug/input.kcl + ╰──── diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/input.kcl b/rust/kcl-lib/tests/user_reported_union_2_bug/input.kcl new file mode 100644 index 000000000..bf6ffe643 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/input.kcl @@ -0,0 +1,44 @@ +// TODO IF THIS TEST START PASSING, CLOSE THE FOLLOWING ISSUE +// https://github.com/KittyCAD/modeling-app/issues/7310 +// and https://github.com/KittyCAD/engine/issues/3539 + +@settings(defaultLengthUnit = mm) + +// Define dimensions +triangleSide = 140 +triangleHeight = 60 +triangleFilletRadius = 3 +delta = 1 + +cubeSize = 5 +cubeLength = 45 +cubeSpacing = 30 + +// Function to create a cube +fn createCube(center) { + cubeSketch = startSketchOn(XY) + |> startProfile(at = [center[0] - cubeSize / 2, center[1] - cubeLength / 2]) + |> line(endAbsolute = [center[0] + cubeSize / 2, center[1] - cubeLength / 2]) + |> line(endAbsolute = [center[0] + cubeSize / 2, center[1] + cubeLength / 2]) + |> line(endAbsolute = [center[0] - cubeSize / 2, center[1] + cubeLength / 2]) + |> close() + |> translate(x = 0, y = -cubeLength/2, z = 0) + return extrude(cubeSketch, length = cubeSize) +} + +// Create 4 cubes around the triangle +cube1 = createCube(center = [cubeSpacing /2, delta]) + + +// Create the rounded triangle +triangleSketch = startSketchOn(XY) + |> startProfile(at = [-triangleSide / 4, 0]) + |> line(end = [triangleSide / 2, 0], tag = $edge1) + |> line(end = [-triangleSide / 4, triangleHeight], tag = $edge2) + |> close(tag = $edge3) + +roundedTriangle = extrude(triangleSketch, length = 5) + |> rotate(roll=3, pitch=0, yaw=0) + + +intermediateUnion1 = union([roundedTriangle, cube1]) diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/ops.snap b/rust/kcl-lib/tests/user_reported_union_2_bug/ops.snap new file mode 100644 index 000000000..1fabb5768 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/ops.snap @@ -0,0 +1,18 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Operations executed user_reported_union_2_bug.kcl +--- +{ + "rust/kcl-lib/tests/user_reported_union_2_bug/input.kcl": [], + "std::appearance": [], + "std::array": [], + "std::math": [], + "std::prelude": [], + "std::sketch": [], + "std::solid": [], + "std::sweep": [], + "std::transform": [], + "std::turns": [], + "std::types": [], + "std::units": [] +} diff --git a/rust/kcl-lib/tests/user_reported_union_2_bug/unparsed.snap b/rust/kcl-lib/tests/user_reported_union_2_bug/unparsed.snap new file mode 100644 index 000000000..df9a05f75 --- /dev/null +++ b/rust/kcl-lib/tests/user_reported_union_2_bug/unparsed.snap @@ -0,0 +1,61 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing user_reported_union_2_bug.kcl +--- +// TODO IF THIS TEST START PASSING, CLOSE THE FOLLOWING ISSUE +// https://github.com/KittyCAD/modeling-app/issues/7310 +// and https://github.com/KittyCAD/engine/issues/3539 + + + + +@settings(defaultLengthUnit = mm) + +// Define dimensions +triangleSide = 140 +triangleHeight = 60 +triangleFilletRadius = 3 +delta = 1 + +cubeSize = 5 +cubeLength = 45 +cubeSpacing = 30 + +// Function to create a cube +fn createCube(center) { + cubeSketch = startSketchOn(XY) + |> startProfile(at = [ + center[0] - (cubeSize / 2), + center[1] - (cubeLength / 2) + ]) + |> line(endAbsolute = [ + center[0] + cubeSize / 2, + center[1] - (cubeLength / 2) + ]) + |> line(endAbsolute = [ + center[0] + cubeSize / 2, + center[1] + cubeLength / 2 + ]) + |> line(endAbsolute = [ + center[0] - (cubeSize / 2), + center[1] + cubeLength / 2 + ]) + |> close() + |> translate(x = 0, y = -cubeLength / 2, z = 0) + return extrude(cubeSketch, length = cubeSize) +} + +// Create 4 cubes around the triangle +cube1 = createCube(center = [cubeSpacing / 2, delta]) + +// Create the rounded triangle +triangleSketch = startSketchOn(XY) + |> startProfile(at = [-triangleSide / 4, 0]) + |> line(end = [triangleSide / 2, 0], tag = $edge1) + |> line(end = [-triangleSide / 4, triangleHeight], tag = $edge2) + |> close(tag = $edge3) + +roundedTriangle = extrude(triangleSketch, length = 5) + |> rotate(roll = 3, pitch = 0, yaw = 0) + +intermediateUnion1 = union([roundedTriangle, cube1])