From bb4ed59191d65e6dd615aece911b1544e52c39e8 Mon Sep 17 00:00:00 2001 From: Jonathan Tran Date: Mon, 31 Mar 2025 19:46:29 -0400 Subject: [PATCH] Fix patterning in module to not fail when importing function from the module (#6082) * Add failing test * Update output to show execution error * Fix circular pattern to not error in isolated or mock mode * Update output after fix * Add failing test for pattern linear 2D * Add failing output * Fix isolated execution in linear patterns * Update output after linear fix --- rust/kcl-lib/src/simulation_tests.rs | 42 + rust/kcl-lib/src/std/patterns.rs | 39 +- .../artifact_commands.snap | 700 +++++++++++++++ .../artifact_graph_flowchart.snap | 6 + .../artifact_graph_flowchart.snap.md | 63 ++ .../tests/pattern_circular_in_module/ast.snap | 89 ++ .../pattern_circular_in_module/input.kcl | 3 + .../tests/pattern_circular_in_module/ops.snap | 176 ++++ .../program_memory.snap | 9 + .../rendered_model.png | Bin 0 -> 21093 bytes .../pattern_circular_in_module/thing.kcl | 19 + .../pattern_circular_in_module/unparsed.snap | 7 + .../unparsed@thing.kcl.snap | 23 + .../artifact_commands.snap | 808 ++++++++++++++++++ .../artifact_graph_flowchart.snap | 6 + .../artifact_graph_flowchart.snap.md | 33 + .../tests/pattern_linear_in_module/ast.snap | 89 ++ .../tests/pattern_linear_in_module/input.kcl | 3 + .../tests/pattern_linear_in_module/ops.snap | 344 ++++++++ .../program_memory.snap | 9 + .../rendered_model.png | Bin 0 -> 47683 bytes .../tests/pattern_linear_in_module/thing.kcl | 13 + .../pattern_linear_in_module/unparsed.snap | 7 + .../unparsed@thing.kcl.snap | 13 + 24 files changed, 2492 insertions(+), 9 deletions(-) create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/artifact_commands.snap create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap.md create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/ast.snap create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/input.kcl create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/ops.snap create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/program_memory.snap create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/rendered_model.png create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/thing.kcl create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/unparsed.snap create mode 100644 rust/kcl-lib/tests/pattern_circular_in_module/unparsed@thing.kcl.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/artifact_commands.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap.md create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/ast.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/input.kcl create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/ops.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/program_memory.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/rendered_model.png create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/thing.kcl create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/unparsed.snap create mode 100644 rust/kcl-lib/tests/pattern_linear_in_module/unparsed@thing.kcl.snap diff --git a/rust/kcl-lib/src/simulation_tests.rs b/rust/kcl-lib/src/simulation_tests.rs index 30358e57f..10514ffbd 100644 --- a/rust/kcl-lib/src/simulation_tests.rs +++ b/rust/kcl-lib/src/simulation_tests.rs @@ -1258,6 +1258,48 @@ mod linear_pattern3d_a_pattern { super::execute(TEST_NAME, true).await } } +mod pattern_circular_in_module { + const TEST_NAME: &str = "pattern_circular_in_module"; + + /// 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, true).await + } +} +mod pattern_linear_in_module { + const TEST_NAME: &str = "pattern_linear_in_module"; + + /// 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, true).await + } +} mod tangential_arc { const TEST_NAME: &str = "tangential_arc"; diff --git a/rust/kcl-lib/src/std/patterns.rs b/rust/kcl-lib/src/std/patterns.rs index 184bbc7a8..545637307 100644 --- a/rust/kcl-lib/src/std/patterns.rs +++ b/rust/kcl-lib/src/std/patterns.rs @@ -381,6 +381,7 @@ async fn send_pattern_transform( args: &Args, ) -> Result, KclError> { let id = exec_state.next_uuid(); + let extra_instances = transforms.len(); let resp = args .send_modeling_cmd( @@ -393,10 +394,19 @@ async fn send_pattern_transform( ) .await?; - let OkWebSocketResponseData::Modeling { + let mut mock_ids = Vec::new(); + let entity_ids = if let OkWebSocketResponseData::Modeling { modeling_response: OkModelingCmdResponse::EntityLinearPatternTransform(pattern_info), } = &resp - else { + { + &pattern_info.entity_ids + } else if args.ctx.no_engine_commands().await { + mock_ids.reserve(extra_instances); + for _ in 0..extra_instances { + mock_ids.push(exec_state.next_uuid()); + } + &mock_ids + } else { return Err(KclError::Engine(KclErrorDetails { message: format!("EntityLinearPattern response was not as expected: {:?}", resp), source_ranges: vec![args.source_range], @@ -404,7 +414,7 @@ async fn send_pattern_transform( }; let mut geometries = vec![solid.clone()]; - for id in pattern_info.entity_ids.iter().copied() { + for id in entity_ids.iter().copied() { let mut new_solid = solid.clone(); new_solid.set_id(id); geometries.push(new_solid); @@ -1280,10 +1290,21 @@ async fn pattern_circular( ) .await?; - let OkWebSocketResponseData::Modeling { + // The common case is borrowing from the response. Instead of cloning, + // create a Vec to borrow from in mock mode. + let mut mock_ids = Vec::new(); + let entity_ids = if let OkWebSocketResponseData::Modeling { modeling_response: OkModelingCmdResponse::EntityCircularPattern(pattern_info), } = &resp - else { + { + &pattern_info.entity_ids + } else if args.ctx.no_engine_commands().await { + mock_ids.reserve(num_repetitions as usize); + for _ in 0..num_repetitions { + mock_ids.push(exec_state.next_uuid()); + } + &mock_ids + } else { return Err(KclError::Engine(KclErrorDetails { message: format!("EntityCircularPattern response was not as expected: {:?}", resp), source_ranges: vec![args.source_range], @@ -1293,18 +1314,18 @@ async fn pattern_circular( let geometries = match geometry { Geometry::Sketch(sketch) => { let mut geometries = vec![sketch.clone()]; - for id in pattern_info.entity_ids.iter() { + for id in entity_ids.iter().copied() { let mut new_sketch = sketch.clone(); - new_sketch.id = *id; + new_sketch.id = id; geometries.push(new_sketch); } Geometries::Sketches(geometries) } Geometry::Solid(solid) => { let mut geometries = vec![solid.clone()]; - for id in pattern_info.entity_ids.iter() { + for id in entity_ids.iter().copied() { let mut new_solid = solid.clone(); - new_solid.id = *id; + new_solid.id = id; geometries.push(new_solid); } Geometries::Solids(geometries) diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/artifact_commands.snap b/rust/kcl-lib/tests/pattern_circular_in_module/artifact_commands.snap new file mode 100644 index 000000000..94a381555 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/artifact_commands.snap @@ -0,0 +1,700 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact commands pattern_circular_in_module.kcl +--- +[ + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "edge_lines_visible", + "hidden": false + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_visible", + "object_id": "[uuid]", + "hidden": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_visible", + "object_id": "[uuid]", + "hidden": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "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": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 0.5, + "y": 25.0, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 0.0, + "y": 5.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -1.0, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 0.0, + "y": -5.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_circular_pattern", + "entity_id": "[uuid]", + "axis": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "center": { + "x": 0.0, + "y": 0.0, + "z": 0.0 + }, + "num_repetitions": 3, + "arc_degrees": 360.0, + "rotate_duplicates": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + } +] diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap b/rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap new file mode 100644 index 000000000..29d246f42 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap @@ -0,0 +1,6 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact graph flowchart pattern_circular_in_module.kcl +extension: md +snapshot_kind: binary +--- diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap.md new file mode 100644 index 000000000..ded3c1d62 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/artifact_graph_flowchart.snap.md @@ -0,0 +1,63 @@ +```mermaid +flowchart LR + subgraph path2 [Path] + 2["Path
[63, 90, 5]"] + 3["Segment
[98, 116, 5]"] + 4["Segment
[124, 143, 5]"] + 5["Segment
[151, 170, 5]"] + 6["Segment
[178, 185, 5]"] + 7[Solid2d] + end + 1["Plane
[38, 55, 5]"] + 8["Sweep Extrusion
[342, 376, 5]"] + 9[Wall] + 10[Wall] + 11[Wall] + 12[Wall] + 13["Cap Start"] + 14["Cap End"] + 15["SweepEdge Opposite"] + 16["SweepEdge Adjacent"] + 17["SweepEdge Opposite"] + 18["SweepEdge Adjacent"] + 19["SweepEdge Opposite"] + 20["SweepEdge Adjacent"] + 21["SweepEdge Opposite"] + 22["SweepEdge Adjacent"] + 23["Sweep Extrusion
[342, 376, 5]"] + 24["Sweep Extrusion
[342, 376, 5]"] + 25["Sweep Extrusion
[342, 376, 5]"] + 1 --- 2 + 2 --- 3 + 2 --- 4 + 2 --- 5 + 2 --- 6 + 2 ---- 8 + 2 --- 7 + 3 --- 9 + 3 --- 15 + 3 --- 16 + 4 --- 10 + 4 --- 17 + 4 --- 18 + 5 --- 11 + 5 --- 19 + 5 --- 20 + 6 --- 12 + 6 --- 21 + 6 --- 22 + 8 --- 9 + 8 --- 10 + 8 --- 11 + 8 --- 12 + 8 --- 13 + 8 --- 14 + 8 --- 15 + 8 --- 16 + 8 --- 17 + 8 --- 18 + 8 --- 19 + 8 --- 20 + 8 --- 21 + 8 --- 22 +``` diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/ast.snap b/rust/kcl-lib/tests/pattern_circular_in_module/ast.snap new file mode 100644 index 000000000..c51772b1a --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/ast.snap @@ -0,0 +1,89 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of parsing pattern_circular_in_module.kcl +--- +{ + "Ok": { + "body": [ + { + "commentStart": 0, + "end": 0, + "path": { + "type": "Kcl", + "filename": "thing.kcl" + }, + "selector": { + "type": "List", + "items": [ + { + "alias": null, + "commentStart": 7, + "end": 0, + "name": { + "commentStart": 7, + "end": 0, + "name": "thing", + "start": 0, + "type": "Identifier" + }, + "start": 0, + "type": "ImportItem" + } + ] + }, + "start": 0, + "type": "ImportStatement", + "type": "ImportStatement" + }, + { + "commentStart": 29, + "end": 0, + "expression": { + "arguments": [], + "callee": { + "abs_path": false, + "commentStart": 31, + "end": 0, + "name": { + "commentStart": 31, + "end": 0, + "name": "thing", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 31, + "end": 0, + "start": 0, + "type": "CallExpression", + "type": "CallExpression" + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" + } + ], + "commentStart": 0, + "end": 0, + "nonCodeMeta": { + "nonCodeNodes": { + "0": [ + { + "commentStart": 29, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "startNodes": [] + }, + "start": 0 + } +} diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/input.kcl b/rust/kcl-lib/tests/pattern_circular_in_module/input.kcl new file mode 100644 index 000000000..7060ff276 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/input.kcl @@ -0,0 +1,3 @@ +import thing from "thing.kcl" + +thing() diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/ops.snap b/rust/kcl-lib/tests/pattern_circular_in_module/ops.snap new file mode 100644 index 000000000..38aa7bb3b --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/ops.snap @@ -0,0 +1,176 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Operations executed pattern_circular_in_module.kcl +--- +[ + { + "type": "UserDefinedFunctionCall", + "name": "thing", + "functionSourceRange": [ + 15, + 378, + 5 + ], + "unlabeledArg": null, + "labeledArgs": {}, + "sourceRange": [] + }, + { + "labeledArgs": { + "data": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": null + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + }, + { + "type": "UserDefinedFunctionReturn" + }, + { + "type": "UserDefinedFunctionCall", + "name": "thing", + "functionSourceRange": [ + 15, + 378, + 5 + ], + "unlabeledArg": null, + "labeledArgs": {}, + "sourceRange": [] + }, + { + "labeledArgs": { + "data": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": null + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + }, + { + "type": "UserDefinedFunctionReturn" + } +] diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/program_memory.snap b/rust/kcl-lib/tests/pattern_circular_in_module/program_memory.snap new file mode 100644 index 000000000..e4265fe09 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/program_memory.snap @@ -0,0 +1,9 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Variables in memory after executing pattern_circular_in_module.kcl +--- +{ + "thing": { + "type": "Function" + } +} diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/rendered_model.png b/rust/kcl-lib/tests/pattern_circular_in_module/rendered_model.png new file mode 100644 index 0000000000000000000000000000000000000000..307949e1e3f137800b8bbcf4e5553574ac563992 GIT binary patch literal 21093 zcmeHP4Ny~87JkYq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zA#7nWd{`UCX&gKDvka zmo`Dl7czs7Yjas;1-5s0&(%YYSnSAI@Ajna;21Mu`m=Sdt&274aImAoK31Z36)Q&H zW(%ZuD$UTM!D+_8bq-TxMBg@c7CMa8O^=-ue#y53ZDo}nLLcnEkr_0y+`Eqdh@ADJ zrFy;oC=gauR8;A*4u6#;_!bh1)>Uy!*sL4bEDHR+TDMZJaV4q8uka8Cp z1P|@od26F)s`GhJ65*Ly8^lewh)OW^4)q`4Hfh8*qP{~(8Szf+V~8HHk6|Cf&scZ@ z1}6DH2nT5!Lf8xb(ZIKYfr=1EH(MtI*$2x9BS}%#UXvsz)CaBWuDIdsqW6P*#7d^ zQ-S38H4ib%OlqT^ghihr;Bm>u*ag*$CMc0!TBVotLvChH1D`Vh7$ay)j?t1s33wyt z8U=rD6c}E3C{Z41;`TkX>;90LmWOU+b;x#$L#H-K_A;xGIeM(r!;7Nl+9Q9s6lsRn zl^`wHaxb6#sD-389i5%;#>WQ`LfE3gT-dp2&6@Plflz|wHZ28#5hsj?9(bVT?1N~~ zmDXQGaZjHJ#;@@*dQ~b_m+xzmwq?kDzH1reh7RSt2>kT`h%x*B#K9v)8CXW2M|fac z_JLFg_%ZJVtB~0{Oz8cP#|(^n5Fp_;0@$0GlnApZm_@-4o8xl~f8!F20~i%yZQ#yK zL>s=m0tOEZ9 startProfileAt([.5, 25], %) + |> line(end = [0, 5]) + |> line(end = [-1, 0]) + |> line(end = [0, -5]) + |> close() + |> patternCircular2d( + center = [0, 0], + instances = 4, + arcDegrees = 360, + rotateDuplicates = true, + ) + + return extrude(exampleSketch, length = 1) +} + +// This makes it run in isolated mode when the function is imported. +thing() diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/unparsed.snap b/rust/kcl-lib/tests/pattern_circular_in_module/unparsed.snap new file mode 100644 index 000000000..4e86f609f --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/unparsed.snap @@ -0,0 +1,7 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing pattern_circular_in_module.kcl +--- +import thing from "thing.kcl" + +thing() diff --git a/rust/kcl-lib/tests/pattern_circular_in_module/unparsed@thing.kcl.snap b/rust/kcl-lib/tests/pattern_circular_in_module/unparsed@thing.kcl.snap new file mode 100644 index 000000000..58b9ca134 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_circular_in_module/unparsed@thing.kcl.snap @@ -0,0 +1,23 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing tests/pattern_circular_in_module/thing.kcl +--- +export fn thing() { + exampleSketch = startSketchOn(XZ) + |> startProfileAt([.5, 25], %) + |> line(end = [0, 5]) + |> line(end = [-1, 0]) + |> line(end = [0, -5]) + |> close() + |> patternCircular2d( + center = [0, 0], + instances = 4, + arcDegrees = 360, + rotateDuplicates = true, + ) + + return extrude(exampleSketch, length = 1) +} + +// This makes it run in isolated mode when the function is imported. +thing() diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/artifact_commands.snap b/rust/kcl-lib/tests/pattern_linear_in_module/artifact_commands.snap new file mode 100644 index 000000000..d3c89da73 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/artifact_commands.snap @@ -0,0 +1,808 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact commands pattern_linear_in_module.kcl +--- +[ + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "edge_lines_visible", + "hidden": false + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_visible", + "object_id": "[uuid]", + "hidden": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_visible", + "object_id": "[uuid]", + "hidden": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "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": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 1.0, + "y": 0.0, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": 0.0, + "y": 0.0 + }, + "radius": 1.0, + "start": { + "unit": "degrees", + "value": 0.0 + }, + "end": { + "unit": "degrees", + "value": 360.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_linear_pattern_transform", + "entity_id": "[uuid]", + "transform": [], + "transforms": [ + [ + { + "translate": { + "x": 4.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "rotation": { + "axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "angle": { + "unit": "degrees", + "value": 0.0 + }, + "origin": { + "type": "local" + } + }, + "replicate": true + } + ], + [ + { + "translate": { + "x": 8.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "rotation": { + "axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "angle": { + "unit": "degrees", + "value": 0.0 + }, + "origin": { + "type": "local" + } + }, + "replicate": true + } + ], + [ + { + "translate": { + "x": 12.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "rotation": { + "axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "angle": { + "unit": "degrees", + "value": 0.0 + }, + "origin": { + "type": "local" + } + }, + "replicate": true + } + ], + [ + { + "translate": { + "x": 16.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "rotation": { + "axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "angle": { + "unit": "degrees", + "value": 0.0 + }, + "origin": { + "type": "local" + } + }, + "replicate": true + } + ], + [ + { + "translate": { + "x": 20.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "rotation": { + "axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "angle": { + "unit": "degrees", + "value": 0.0 + }, + "origin": { + "type": "local" + } + }, + "replicate": true + } + ], + [ + { + "translate": { + "x": 24.0, + "y": 0.0, + "z": 0.0 + }, + "scale": { + "x": 1.0, + "y": 1.0, + "z": 1.0 + }, + "rotation": { + "axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "angle": { + "unit": "degrees", + "value": 0.0 + }, + "origin": { + "type": "local" + } + }, + "replicate": true + } + ] + ] + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "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": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 1.0, + "faces": null + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_opposite_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_next_adjacent_edge", + "object_id": "[uuid]", + "edge_id": "[uuid]", + "face_id": "[uuid]" + } + } +] diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap b/rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap new file mode 100644 index 000000000..b7966628b --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap @@ -0,0 +1,6 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact graph flowchart pattern_linear_in_module.kcl +extension: md +snapshot_kind: binary +--- diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap.md new file mode 100644 index 000000000..b8510d85e --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/artifact_graph_flowchart.snap.md @@ -0,0 +1,33 @@ +```mermaid +flowchart LR + subgraph path2 [Path] + 2["Path
[54, 89, 5]"] + 3["Segment
[54, 89, 5]"] + 4[Solid2d] + end + 1["Plane
[29, 46, 5]"] + 5["Sweep Extrusion
[200, 219, 5]"] + 6[Wall] + 7["Cap Start"] + 8["Cap End"] + 9["SweepEdge Opposite"] + 10["SweepEdge Adjacent"] + 11["Sweep Extrusion
[200, 219, 5]"] + 12["Sweep Extrusion
[200, 219, 5]"] + 13["Sweep Extrusion
[200, 219, 5]"] + 14["Sweep Extrusion
[200, 219, 5]"] + 15["Sweep Extrusion
[200, 219, 5]"] + 16["Sweep Extrusion
[200, 219, 5]"] + 1 --- 2 + 2 --- 3 + 2 ---- 5 + 2 --- 4 + 3 --- 6 + 3 --- 9 + 3 --- 10 + 5 --- 6 + 5 --- 7 + 5 --- 8 + 5 --- 9 + 5 --- 10 +``` diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/ast.snap b/rust/kcl-lib/tests/pattern_linear_in_module/ast.snap new file mode 100644 index 000000000..b9fcea5c2 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/ast.snap @@ -0,0 +1,89 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of parsing pattern_linear_in_module.kcl +--- +{ + "Ok": { + "body": [ + { + "commentStart": 0, + "end": 0, + "path": { + "type": "Kcl", + "filename": "thing.kcl" + }, + "selector": { + "type": "List", + "items": [ + { + "alias": null, + "commentStart": 7, + "end": 0, + "name": { + "commentStart": 7, + "end": 0, + "name": "thing", + "start": 0, + "type": "Identifier" + }, + "start": 0, + "type": "ImportItem" + } + ] + }, + "start": 0, + "type": "ImportStatement", + "type": "ImportStatement" + }, + { + "commentStart": 29, + "end": 0, + "expression": { + "arguments": [], + "callee": { + "abs_path": false, + "commentStart": 31, + "end": 0, + "name": { + "commentStart": 31, + "end": 0, + "name": "thing", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 31, + "end": 0, + "start": 0, + "type": "CallExpression", + "type": "CallExpression" + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" + } + ], + "commentStart": 0, + "end": 0, + "nonCodeMeta": { + "nonCodeNodes": { + "0": [ + { + "commentStart": 29, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "startNodes": [] + }, + "start": 0 + } +} diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/input.kcl b/rust/kcl-lib/tests/pattern_linear_in_module/input.kcl new file mode 100644 index 000000000..7060ff276 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/input.kcl @@ -0,0 +1,3 @@ +import thing from "thing.kcl" + +thing() diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/ops.snap b/rust/kcl-lib/tests/pattern_linear_in_module/ops.snap new file mode 100644 index 000000000..589583cb2 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/ops.snap @@ -0,0 +1,344 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Operations executed pattern_linear_in_module.kcl +--- +[ + { + "type": "UserDefinedFunctionCall", + "name": "thing", + "functionSourceRange": [ + 15, + 221, + 5 + ], + "unlabeledArg": null, + "labeledArgs": {}, + "sourceRange": [] + }, + { + "labeledArgs": { + "data": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": null + }, + { + "type": "UserDefinedFunctionCall", + "name": "circle", + "functionSourceRange": [ + 0, + 0, + 0 + ], + "unlabeledArg": null, + "labeledArgs": { + "center": { + "value": { + "type": "Array", + "value": [ + { + "type": "Number", + "value": 0.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + { + "type": "Number", + "value": 0.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + } + ] + }, + "sourceRange": [] + }, + "radius": { + "value": { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "sourceRange": [] + }, + { + "type": "UserDefinedFunctionReturn" + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + }, + { + "type": "UserDefinedFunctionReturn" + }, + { + "type": "UserDefinedFunctionCall", + "name": "thing", + "functionSourceRange": [ + 15, + 221, + 5 + ], + "unlabeledArg": null, + "labeledArgs": {}, + "sourceRange": [] + }, + { + "labeledArgs": { + "data": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": null + }, + { + "type": "UserDefinedFunctionCall", + "name": "circle", + "functionSourceRange": [ + 0, + 0, + 0 + ], + "unlabeledArg": null, + "labeledArgs": { + "center": { + "value": { + "type": "Array", + "value": [ + { + "type": "Number", + "value": 0.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + { + "type": "Number", + "value": 0.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + } + ] + }, + "sourceRange": [] + }, + "radius": { + "value": { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "sourceRange": [] + }, + { + "type": "UserDefinedFunctionReturn" + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + }, + { + "type": "UserDefinedFunctionReturn" + } +] diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/program_memory.snap b/rust/kcl-lib/tests/pattern_linear_in_module/program_memory.snap new file mode 100644 index 000000000..77112d383 --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/program_memory.snap @@ -0,0 +1,9 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Variables in memory after executing pattern_linear_in_module.kcl +--- +{ + "thing": { + "type": "Function" + } +} diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/rendered_model.png b/rust/kcl-lib/tests/pattern_linear_in_module/rendered_model.png new file mode 100644 index 0000000000000000000000000000000000000000..a84c6737af54c6f909a1e7f681db2505fda95ede GIT binary patch literal 47683 zcmeIbdt8-e_CEX|DwQdzm6Zynl;d=uvcvpSJ~NzZCpFMQkMhiiJ{kNlXkFKF7n>!wV4 zy8g|-Ub@;R;qUZm&!k`F_IS&V)Xx`Q<@R_Xd&pzw|M*PuoNbo(yC2MDMZ0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; zydjnn6{oDjlTGi(&aZ2~=jJ}5lhP={+oe{mN)P|X*J_!D%{qbdNzU$Z^{hNSQyM)!v9{-bqcFvTCWNx4RiBTGl2i&(gFY;3^y7AH< z*Iih$R#;4|yc0mp4XAJfz0J7~dIgRe@yJI(a{vn}$~Zh#n}#^IUFj3g`~F91K60`q zMH#vm8i*FM^Nn~seteIYq0F^!MeIb4xvof=Ifu?W(iGr0-@vuZ<)uk0RS;7vCZ{vh zYfI*HNpMOdV^Ff_CA^G8LwQLj?7y6l~_Bzeh@ zkXuwk-)w4*qXpn}=4cpNYC0tM7N<_F)rGL|HipsrI-Lc!pTvp@THp}~}>-~2I zh5zh+9la~!{9p4%X~v-L2kS;fMGi$A{Q4V5H!60c;!PV|*T9uY=zsomSIFo@kZ$JD z1y8%#eV6Fcowjs(N;jqI;wc1_Zt&=`B;DZA4IbV3SQjCqn|ZkMu&=w*mhQBrTM2f} zMY>fg*VX8zR9#o2yV}x)U{34K$GY>eZc5cnsk&>>t~k(*imt2CUHI#=8r_uY{|}`q c^LD%WM15rP3p468{BO!*Pfz;x(U+I~Kl@w37ytkO literal 0 HcmV?d00001 diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/thing.kcl b/rust/kcl-lib/tests/pattern_linear_in_module/thing.kcl new file mode 100644 index 000000000..c9532988e --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/thing.kcl @@ -0,0 +1,13 @@ +export fn thing() { + return startSketchOn(XZ) + |> circle(center = [0, 0], radius = 1) + |> patternLinear2d( + axis = [1, 0], + instances = 7, + distance = 4 + ) + |> extrude(length = 1) +} + +// This makes it run in isolated mode when the function is imported. +thing() diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/unparsed.snap b/rust/kcl-lib/tests/pattern_linear_in_module/unparsed.snap new file mode 100644 index 000000000..00bb2a9de --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/unparsed.snap @@ -0,0 +1,7 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing pattern_linear_in_module.kcl +--- +import thing from "thing.kcl" + +thing() diff --git a/rust/kcl-lib/tests/pattern_linear_in_module/unparsed@thing.kcl.snap b/rust/kcl-lib/tests/pattern_linear_in_module/unparsed@thing.kcl.snap new file mode 100644 index 000000000..bbea38e2f --- /dev/null +++ b/rust/kcl-lib/tests/pattern_linear_in_module/unparsed@thing.kcl.snap @@ -0,0 +1,13 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing tests/pattern_linear_in_module/thing.kcl +--- +export fn thing() { + return startSketchOn(XZ) + |> circle(center = [0, 0], radius = 1) + |> patternLinear2d(axis = [1, 0], instances = 7, distance = 4) + |> extrude(length = 1) +} + +// This makes it run in isolated mode when the function is imported. +thing()