diff --git a/rust/Cargo.lock b/rust/Cargo.lock index cdb6deaf5..881a75059 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -1815,7 +1815,7 @@ dependencies = [ [[package]] name = "kcl-bumper" -version = "0.1.73" +version = "0.1.74" dependencies = [ "anyhow", "clap", @@ -1826,7 +1826,7 @@ dependencies = [ [[package]] name = "kcl-derive-docs" -version = "0.1.73" +version = "0.1.74" dependencies = [ "Inflector", "anyhow", @@ -1845,7 +1845,7 @@ dependencies = [ [[package]] name = "kcl-directory-test-macro" -version = "0.1.73" +version = "0.1.74" dependencies = [ "convert_case", "proc-macro2", @@ -1855,7 +1855,7 @@ dependencies = [ [[package]] name = "kcl-language-server" -version = "0.2.73" +version = "0.2.74" dependencies = [ "anyhow", "clap", @@ -1876,7 +1876,7 @@ dependencies = [ [[package]] name = "kcl-language-server-release" -version = "0.1.73" +version = "0.1.74" dependencies = [ "anyhow", "clap", @@ -1896,7 +1896,7 @@ dependencies = [ [[package]] name = "kcl-lib" -version = "0.2.73" +version = "0.2.74" dependencies = [ "anyhow", "approx 0.5.1", @@ -1973,7 +1973,7 @@ dependencies = [ [[package]] name = "kcl-python-bindings" -version = "0.3.73" +version = "0.3.74" dependencies = [ "anyhow", "kcl-lib", @@ -1988,7 +1988,7 @@ dependencies = [ [[package]] name = "kcl-test-server" -version = "0.1.73" +version = "0.1.74" dependencies = [ "anyhow", "hyper 0.14.32", @@ -2001,7 +2001,7 @@ dependencies = [ [[package]] name = "kcl-to-core" -version = "0.1.73" +version = "0.1.74" dependencies = [ "anyhow", "async-trait", @@ -2015,7 +2015,7 @@ dependencies = [ [[package]] name = "kcl-wasm-lib" -version = "0.1.73" +version = "0.1.74" dependencies = [ "anyhow", "bson", diff --git a/rust/kcl-bumper/Cargo.toml b/rust/kcl-bumper/Cargo.toml index 8026c4f6c..d518b79ac 100644 --- a/rust/kcl-bumper/Cargo.toml +++ b/rust/kcl-bumper/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kcl-bumper" -version = "0.1.73" +version = "0.1.74" edition = "2021" repository = "https://github.com/KittyCAD/modeling-api" rust-version = "1.76" diff --git a/rust/kcl-derive-docs/Cargo.toml b/rust/kcl-derive-docs/Cargo.toml index 2f25a23f0..016cc8f54 100644 --- a/rust/kcl-derive-docs/Cargo.toml +++ b/rust/kcl-derive-docs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kcl-derive-docs" description = "A tool for generating documentation from Rust derive macros" -version = "0.1.73" +version = "0.1.74" edition = "2021" license = "MIT" repository = "https://github.com/KittyCAD/modeling-app" diff --git a/rust/kcl-directory-test-macro/Cargo.toml b/rust/kcl-directory-test-macro/Cargo.toml index 7a4907ace..e6a9b1d05 100644 --- a/rust/kcl-directory-test-macro/Cargo.toml +++ b/rust/kcl-directory-test-macro/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kcl-directory-test-macro" description = "A tool for generating tests from a directory of kcl files" -version = "0.1.73" +version = "0.1.74" edition = "2021" license = "MIT" repository = "https://github.com/KittyCAD/modeling-app" diff --git a/rust/kcl-language-server-release/Cargo.toml b/rust/kcl-language-server-release/Cargo.toml index b1a7b8568..93e6b6050 100644 --- a/rust/kcl-language-server-release/Cargo.toml +++ b/rust/kcl-language-server-release/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kcl-language-server-release" -version = "0.1.73" +version = "0.1.74" edition = "2021" authors = ["KittyCAD Inc "] publish = false diff --git a/rust/kcl-language-server/Cargo.toml b/rust/kcl-language-server/Cargo.toml index e63950338..731ec595d 100644 --- a/rust/kcl-language-server/Cargo.toml +++ b/rust/kcl-language-server/Cargo.toml @@ -2,7 +2,7 @@ name = "kcl-language-server" description = "A language server for KCL." authors = ["KittyCAD Inc "] -version = "0.2.73" +version = "0.2.74" edition = "2021" license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/rust/kcl-lib/Cargo.toml b/rust/kcl-lib/Cargo.toml index 310aef0c9..87796b213 100644 --- a/rust/kcl-lib/Cargo.toml +++ b/rust/kcl-lib/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kcl-lib" description = "KittyCAD Language implementation and tools" -version = "0.2.73" +version = "0.2.74" edition = "2021" license = "MIT" repository = "https://github.com/KittyCAD/modeling-app" diff --git a/rust/kcl-lib/src/simulation_tests.rs b/rust/kcl-lib/src/simulation_tests.rs index 36bb77a64..3cf10b5a3 100644 --- a/rust/kcl-lib/src/simulation_tests.rs +++ b/rust/kcl-lib/src/simulation_tests.rs @@ -3086,6 +3086,48 @@ mod error_revolve_on_edge_get_edge { super::execute(TEST_NAME, true).await } } +mod subtract_with_pattern { + const TEST_NAME: &str = "subtract_with_pattern"; + + /// 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 subtract_with_pattern_cut_thru { + const TEST_NAME: &str = "subtract_with_pattern_cut_thru"; + + /// 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 sketch_on_face_union { const TEST_NAME: &str = "sketch_on_face_union"; @@ -3107,6 +3149,27 @@ mod sketch_on_face_union { super::execute(TEST_NAME, true).await } } +mod multi_target_csg { + const TEST_NAME: &str = "multi_target_csg"; + + /// 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 revolve_colinear { const TEST_NAME: &str = "revolve-colinear"; diff --git a/rust/kcl-lib/src/std/csg.rs b/rust/kcl-lib/src/std/csg.rs index a55ba7170..b56b547a5 100644 --- a/rust/kcl-lib/src/std/csg.rs +++ b/rust/kcl-lib/src/std/csg.rs @@ -293,20 +293,6 @@ pub async fn subtract(exec_state: &mut ExecState, args: Args) -> Result = args.get_unlabeled_kw_arg_typed("solids", &RuntimeType::solids(), exec_state)?; let tools: Vec = args.get_kw_arg_typed("tools", &RuntimeType::solids(), exec_state)?; - if solids.len() > 1 { - return Err(KclError::UndefinedValue(KclErrorDetails { - message: "Only one solid is allowed for a subtract operation, currently.".to_string(), - source_ranges: vec![args.source_range], - })); - } - - if tools.len() > 1 { - return Err(KclError::UndefinedValue(KclErrorDetails { - message: "Only one tool is allowed for a subtract operation, currently.".to_string(), - source_ranges: vec![args.source_range], - })); - } - let tolerance: Option = args.get_kw_arg_opt_typed("tolerance", &RuntimeType::length(), exec_state)?; let solids = inner_subtract(solids, tools, tolerance, exec_state, args).await?; diff --git a/rust/kcl-lib/tests/multi_target_csg/artifact_commands.snap b/rust/kcl-lib/tests/multi_target_csg/artifact_commands.snap new file mode 100644 index 000000000..fbe82a6cb --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/artifact_commands.snap @@ -0,0 +1,1050 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact commands multi_target_csg.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": "move_path_pen", + "path": "[uuid]", + "to": { + "x": -4.1275, + "y": 4.7625, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 8.255, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": 4.1275, + "y": 4.1275 + }, + "radius": 0.635, + "start": { + "unit": "degrees", + "value": 90.0 + }, + "end": { + "unit": "degrees", + "value": 0.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 0.0, + "y": -8.255, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": 4.1275, + "y": -4.1275 + }, + "radius": 0.635, + "start": { + "unit": "degrees", + "value": 360.0 + }, + "end": { + "unit": "degrees", + "value": 270.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -8.255, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": -4.1275, + "y": -4.1275 + }, + "radius": 0.635, + "start": { + "unit": "degrees", + "value": 270.0 + }, + "end": { + "unit": "degrees", + "value": 180.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 0.0, + "y": 8.255, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": -4.1275, + "y": 4.1275 + }, + "radius": 0.635, + "start": { + "unit": "degrees", + "value": 180.0 + }, + "end": { + "unit": "degrees", + "value": 90.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_visible", + "object_id": "[uuid]", + "hidden": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid2d_add_hole", + "object_id": "[uuid]", + "hole_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_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": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": -0.0, + "y": -0.0 + }, + "radius": 0.9921747999999999, + "start": { + "unit": "degrees", + "value": 0.0 + }, + "end": { + "unit": "degrees", + "value": 360.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 0.9922, + "y": -0.0, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "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.5875, + "faces": null, + "opposite": "None" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "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": 1.0, + "z": 0.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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": -1.4178, + "y": -5.5562, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 1.2318, + "y": 5.5562, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -2.2299, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -0.6775, + "y": -3.056, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 1.4896, + "y": -2.5003, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 0.186, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 0.186, + "y": 0.0, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 2.2299, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 0.6775, + "y": -3.056, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -1.4896, + "y": -2.5003, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -0.186, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -1.2318, + "y": 5.5562, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "enable_sketch_mode", + "entity_id": "[uuid]", + "ortho": false, + "animated": false, + "adjust_camera": false, + "planar_normal": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 2.54, + "faces": null, + "opposite": { + "Other": 2.54 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 2.54, + "faces": null, + "opposite": { + "Other": 2.54 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_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_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "make_plane", + "origin": { + "x": 0.0, + "y": 2.54, + "z": 0.0 + }, + "x_axis": { + "x": -1.0, + "y": 0.0, + "z": 0.0 + }, + "y_axis": { + "x": 0.0, + "y": 0.0, + "z": 1.0 + }, + "size": 100.0, + "clobber": false, + "hide": false + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "plane_set_color", + "plane_id": "[uuid]", + "color": { + "r": 0.6, + "g": 0.6, + "b": 0.6, + "a": 0.3 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_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": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": -0.0, + "y": -0.0 + }, + "radius": 0.9921747999999999, + "start": { + "unit": "degrees", + "value": 0.0 + }, + "end": { + "unit": "degrees", + "value": 360.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 0.9922, + "y": -0.0, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_visible", + "object_id": "[uuid]", + "hidden": true + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "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": -25.4, + "faces": null, + "opposite": "None" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "boolean_subtract", + "target_ids": [ + "[uuid]", + "[uuid]" + ], + "tool_ids": [ + "[uuid]" + ], + "tolerance": 0.0000001 + } + } +] diff --git a/rust/kcl-lib/tests/multi_target_csg/artifact_graph_flowchart.snap b/rust/kcl-lib/tests/multi_target_csg/artifact_graph_flowchart.snap new file mode 100644 index 000000000..8ea14d1a8 --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/artifact_graph_flowchart.snap @@ -0,0 +1,6 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact graph flowchart multi_target_csg.kcl +extension: md +snapshot_kind: binary +--- diff --git a/rust/kcl-lib/tests/multi_target_csg/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/multi_target_csg/artifact_graph_flowchart.snap.md new file mode 100644 index 000000000..81d71e469 --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/artifact_graph_flowchart.snap.md @@ -0,0 +1,466 @@ +```mermaid +flowchart LR + subgraph path5 [Path] + 5["Path
[89, 136, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 10["Segment
[142, 163, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 11["Segment
[169, 247, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 12["Segment
[253, 275, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 13["Segment
[281, 362, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 14["Segment
[368, 390, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] + 15["Segment
[396, 477, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }] + 16["Segment
[483, 504, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }] + 17["Segment
[510, 590, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }] + 18["Segment
[596, 603, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }] + 34[Solid2d] + end + subgraph path6 [Path] + 6["Path
[627, 695, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 10 }, CallKwArg { index: 0 }] + 19["Segment
[627, 695, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 10 }, CallKwArg { index: 0 }] + 37[Solid2d] + end + subgraph path7 [Path] + 7["Path
[811, 861, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 20["Segment
[867, 898, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 21["Segment
[904, 929, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 22["Segment
[935, 969, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 23["Segment
[975, 1008, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 24["Segment
[1014, 1038, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] + 25["Segment
[1044, 1051, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }] + 33[Solid2d] + end + subgraph path8 [Path] + 8["Path
[1075, 1118, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 26["Segment
[1124, 1148, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 27["Segment
[1154, 1187, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 28["Segment
[1193, 1227, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 29["Segment
[1233, 1258, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 30["Segment
[1264, 1296, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] + 31["Segment
[1302, 1309, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }] + 36[Solid2d] + end + subgraph path9 [Path] + 9["Path
[1499, 1562, 0]"] + %% [ProgramBodyItem { index: 8 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 32["Segment
[1499, 1562, 0]"] + %% [ProgramBodyItem { index: 8 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 35[Solid2d] + end + 1["Plane
[47, 65, 0]"] + %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 2["Plane
[770, 787, 0]"] + %% [ProgramBodyItem { index: 3 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 3["Plane
[1444, 1474, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, CallKwUnlabeledArg] + 4["StartSketchOnPlane
[1430, 1475, 0]"] + %% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 38["Sweep Extrusion
[711, 756, 0]"] + %% [ProgramBodyItem { index: 2 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 39["Sweep Extrusion
[1324, 1416, 0]"] + %% [ProgramBodyItem { index: 6 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 40["Sweep Extrusion
[1324, 1416, 0]"] + %% [ProgramBodyItem { index: 6 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 41["Sweep Extrusion
[1580, 1623, 0]"] + %% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 42[Wall] + %% face_code_ref=Missing NodePath + 43[Wall] + %% face_code_ref=Missing NodePath + 44[Wall] + %% face_code_ref=Missing NodePath + 45[Wall] + %% face_code_ref=Missing NodePath + 46[Wall] + %% face_code_ref=Missing NodePath + 47[Wall] + %% face_code_ref=Missing NodePath + 48[Wall] + %% face_code_ref=Missing NodePath + 49[Wall] + %% face_code_ref=Missing NodePath + 50[Wall] + %% face_code_ref=Missing NodePath + 51[Wall] + %% face_code_ref=Missing NodePath + 52[Wall] + %% face_code_ref=Missing NodePath + 53[Wall] + %% face_code_ref=Missing NodePath + 54[Wall] + %% face_code_ref=Missing NodePath + 55[Wall] + %% face_code_ref=Missing NodePath + 56[Wall] + %% face_code_ref=Missing NodePath + 57[Wall] + %% face_code_ref=Missing NodePath + 58[Wall] + %% face_code_ref=Missing NodePath + 59[Wall] + %% face_code_ref=Missing NodePath + 60[Wall] + %% face_code_ref=Missing NodePath + 61[Wall] + %% face_code_ref=Missing NodePath + 62[Wall] + %% face_code_ref=Missing NodePath + 63["Cap Start"] + %% face_code_ref=Missing NodePath + 64["Cap Start"] + %% face_code_ref=Missing NodePath + 65["Cap Start"] + %% face_code_ref=Missing NodePath + 66["Cap Start"] + %% face_code_ref=Missing NodePath + 67["Cap End"] + %% face_code_ref=Missing NodePath + 68["Cap End"] + %% face_code_ref=Missing NodePath + 69["Cap End"] + %% face_code_ref=Missing NodePath + 70["Cap End"] + %% face_code_ref=Missing NodePath + 71["SweepEdge Opposite"] + 72["SweepEdge Opposite"] + 73["SweepEdge Opposite"] + 74["SweepEdge Opposite"] + 75["SweepEdge Opposite"] + 76["SweepEdge Opposite"] + 77["SweepEdge Opposite"] + 78["SweepEdge Opposite"] + 79["SweepEdge Opposite"] + 80["SweepEdge Opposite"] + 81["SweepEdge Opposite"] + 82["SweepEdge Opposite"] + 83["SweepEdge Opposite"] + 84["SweepEdge Opposite"] + 85["SweepEdge Opposite"] + 86["SweepEdge Opposite"] + 87["SweepEdge Opposite"] + 88["SweepEdge Opposite"] + 89["SweepEdge Opposite"] + 90["SweepEdge Opposite"] + 91["SweepEdge Opposite"] + 92["SweepEdge Adjacent"] + 93["SweepEdge Adjacent"] + 94["SweepEdge Adjacent"] + 95["SweepEdge Adjacent"] + 96["SweepEdge Adjacent"] + 97["SweepEdge Adjacent"] + 98["SweepEdge Adjacent"] + 99["SweepEdge Adjacent"] + 100["SweepEdge Adjacent"] + 101["SweepEdge Adjacent"] + 102["SweepEdge Adjacent"] + 103["SweepEdge Adjacent"] + 104["SweepEdge Adjacent"] + 105["SweepEdge Adjacent"] + 106["SweepEdge Adjacent"] + 107["SweepEdge Adjacent"] + 108["SweepEdge Adjacent"] + 109["SweepEdge Adjacent"] + 110["SweepEdge Adjacent"] + 111["SweepEdge Adjacent"] + 112["SweepEdge Adjacent"] + 1 --- 5 + 1 --- 6 + 2 --- 7 + 2 --- 8 + 3 <--x 4 + 3 --- 9 + 5 --- 10 + 5 --- 11 + 5 --- 12 + 5 --- 13 + 5 --- 14 + 5 --- 15 + 5 --- 16 + 5 --- 17 + 5 --- 18 + 5 --- 34 + 5 ---- 38 + 6 --- 19 + 6 --- 37 + 7 --- 20 + 7 --- 21 + 7 --- 22 + 7 --- 23 + 7 --- 24 + 7 --- 25 + 7 --- 33 + 7 ---- 40 + 8 --- 26 + 8 --- 27 + 8 --- 28 + 8 --- 29 + 8 --- 30 + 8 --- 31 + 8 --- 36 + 8 ---- 39 + 9 --- 32 + 9 --- 35 + 9 ---- 41 + 10 --- 58 + 10 x--> 65 + 10 --- 91 + 10 --- 112 + 11 --- 57 + 11 x--> 65 + 11 --- 90 + 11 --- 111 + 12 --- 59 + 12 x--> 65 + 12 --- 89 + 12 --- 110 + 13 --- 56 + 13 x--> 65 + 13 --- 88 + 13 --- 109 + 14 --- 55 + 14 x--> 65 + 14 --- 87 + 14 --- 108 + 15 --- 60 + 15 x--> 65 + 15 --- 86 + 15 --- 107 + 16 --- 62 + 16 x--> 65 + 16 --- 85 + 16 --- 106 + 17 --- 61 + 17 x--> 65 + 17 --- 84 + 17 --- 105 + 20 --- 49 + 20 x--> 63 + 20 --- 78 + 20 --- 99 + 21 --- 54 + 21 x--> 63 + 21 --- 79 + 21 --- 100 + 22 --- 52 + 22 x--> 63 + 22 --- 80 + 22 --- 101 + 23 --- 51 + 23 x--> 63 + 23 --- 81 + 23 --- 102 + 24 --- 53 + 24 x--> 63 + 24 --- 82 + 24 --- 103 + 25 --- 50 + 25 x--> 63 + 25 --- 83 + 25 --- 104 + 26 --- 44 + 26 x--> 64 + 26 --- 76 + 26 --- 97 + 27 --- 45 + 27 x--> 64 + 27 --- 75 + 27 --- 96 + 28 --- 47 + 28 x--> 64 + 28 --- 74 + 28 --- 95 + 29 --- 42 + 29 x--> 64 + 29 --- 73 + 29 --- 94 + 30 --- 46 + 30 x--> 64 + 30 --- 72 + 30 --- 93 + 31 --- 43 + 31 x--> 64 + 31 --- 71 + 31 --- 92 + 32 --- 48 + 32 x--> 70 + 32 --- 77 + 32 --- 98 + 38 --- 55 + 38 --- 56 + 38 --- 57 + 38 --- 58 + 38 --- 59 + 38 --- 60 + 38 --- 61 + 38 --- 62 + 38 --- 65 + 38 --- 69 + 38 --- 84 + 38 --- 85 + 38 --- 86 + 38 --- 87 + 38 --- 88 + 38 --- 89 + 38 --- 90 + 38 --- 91 + 38 --- 105 + 38 --- 106 + 38 --- 107 + 38 --- 108 + 38 --- 109 + 38 --- 110 + 38 --- 111 + 38 --- 112 + 39 --- 42 + 39 --- 43 + 39 --- 44 + 39 --- 45 + 39 --- 46 + 39 --- 47 + 39 --- 64 + 39 --- 68 + 39 --- 71 + 39 --- 72 + 39 --- 73 + 39 --- 74 + 39 --- 75 + 39 --- 76 + 39 --- 92 + 39 --- 93 + 39 --- 94 + 39 --- 95 + 39 --- 96 + 39 --- 97 + 40 --- 49 + 40 --- 50 + 40 --- 51 + 40 --- 52 + 40 --- 53 + 40 --- 54 + 40 --- 63 + 40 --- 67 + 40 --- 78 + 40 --- 79 + 40 --- 80 + 40 --- 81 + 40 --- 82 + 40 --- 83 + 40 --- 99 + 40 --- 100 + 40 --- 101 + 40 --- 102 + 40 --- 103 + 40 --- 104 + 41 --- 48 + 41 --- 66 + 41 --- 70 + 41 --- 77 + 41 --- 98 + 42 --- 73 + 42 --- 94 + 95 <--x 42 + 43 --- 71 + 43 --- 92 + 93 <--x 43 + 44 --- 76 + 92 <--x 44 + 44 --- 97 + 45 --- 75 + 45 --- 96 + 97 <--x 45 + 46 --- 72 + 46 --- 93 + 94 <--x 46 + 47 --- 74 + 47 --- 95 + 96 <--x 47 + 48 --- 77 + 48 --- 98 + 49 --- 78 + 49 --- 99 + 104 <--x 49 + 50 --- 83 + 103 <--x 50 + 50 --- 104 + 51 --- 81 + 101 <--x 51 + 51 --- 102 + 52 --- 80 + 100 <--x 52 + 52 --- 101 + 53 --- 82 + 102 <--x 53 + 53 --- 103 + 54 --- 79 + 99 <--x 54 + 54 --- 100 + 55 --- 87 + 55 --- 108 + 109 <--x 55 + 56 --- 88 + 56 --- 109 + 110 <--x 56 + 57 --- 90 + 57 --- 111 + 112 <--x 57 + 58 --- 91 + 105 <--x 58 + 58 --- 112 + 59 --- 89 + 59 --- 110 + 111 <--x 59 + 60 --- 86 + 60 --- 107 + 108 <--x 60 + 61 --- 84 + 61 --- 105 + 106 <--x 61 + 62 --- 85 + 62 --- 106 + 107 <--x 62 + 77 <--x 66 + 78 <--x 67 + 79 <--x 67 + 80 <--x 67 + 81 <--x 67 + 82 <--x 67 + 83 <--x 67 + 71 <--x 68 + 72 <--x 68 + 73 <--x 68 + 74 <--x 68 + 75 <--x 68 + 76 <--x 68 + 84 <--x 69 + 85 <--x 69 + 86 <--x 69 + 87 <--x 69 + 88 <--x 69 + 89 <--x 69 + 90 <--x 69 + 91 <--x 69 +``` diff --git a/rust/kcl-lib/tests/multi_target_csg/ast.snap b/rust/kcl-lib/tests/multi_target_csg/ast.snap new file mode 100644 index 000000000..231d8e825 --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/ast.snap @@ -0,0 +1,3507 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of parsing multi_target_csg.kcl +--- +{ + "Ok": { + "body": [ + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "sketch002", + "start": 0, + "type": "Identifier" + }, + "init": { + "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": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "XZ", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + }, + "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": "sketch002Profile000", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.1625", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.1625, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "raw": "0.1875", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.1875, + "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": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.325", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.325, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": "angleStart", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "90", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 90.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "angleEnd", + "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": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.025", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.025, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "arc", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.325", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.325, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yLine", + "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": "angleStart", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "360", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 360.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "angleEnd", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "270", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 270.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.025", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.025, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "arc", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.325", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.325, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": "angleStart", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "270", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 270.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "angleEnd", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "180", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 180.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.025", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.025, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "arc", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.325", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.325, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yLine", + "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": "angleStart", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "180", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 180.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "angleEnd", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "90", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 90.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.025", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.025, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "arc", + "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": "tool", + "start": 0, + "type": "Identifier" + }, + "arg": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.039062", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.039062, + "suffix": "None" + } + } + }, + { + "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": "hole001" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "circle", + "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": "subtract2d", + "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": "extrude000", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.0625", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0625, + "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": "sketch002Profile000", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "sketch003", + "start": 0, + "type": "Identifier" + }, + "init": { + "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" + } + }, + "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": "sketch003Profile000", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.05582", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.05582, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.21875", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.21875, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "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": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch003", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "end", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0.048496", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.048496, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "0.21875", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.21875, + "suffix": "None" + } + } + ], + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.087793", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.087793, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.026673", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.026673, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.120313", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.120313, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "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": "end", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0.058646", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.058646, + "suffix": "None" + } + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.098438", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.098438, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.007324", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.007324, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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 + } + ], + "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": "sketch003Profile001", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0.007324", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.007324, + "suffix": "None" + } + }, + { + "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": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch003", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.087793", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.087793, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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, + "raw": "0.026673", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.026673, + "suffix": "None" + } + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.120313", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.120313, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "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": "end", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.058646", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.058646, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.098438", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.098438, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.007324", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.007324, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0.048496", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.048496, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "commentStart": 0, + "end": 0, + "raw": "0.21875", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.21875, + "suffix": "None" + } + } + ], + "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 + } + ], + "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": "extrude001", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.1, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "bidirectionalLength", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.1, + "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": { + "commentStart": 0, + "elements": [ + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch003Profile000", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch003Profile001", + "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, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "sketch004", + "start": 0, + "type": "Identifier" + }, + "init": { + "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": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "offset", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.1, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "offsetPlane", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "XZ", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + }, + "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": "sketch004Profile000", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "center", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + }, + { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.039062", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.039062, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "circle", + "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": "sketch004", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "cut000Extrude", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "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": { + "commentStart": 0, + "elements": [ + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch004Profile000", + "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, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "cut000", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tools", + "start": 0, + "type": "Identifier" + }, + "arg": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "cut000Extrude", + "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": "subtract", + "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": "extrude001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "sketch005", + "start": 0, + "type": "Identifier" + }, + "init": { + "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": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "offset", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.07", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.07, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "offsetPlane", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "XZ", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + }, + "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": "sketch005Profile000", + "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, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "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": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.052734", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.052734, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "circle", + "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": "sketch005", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "sketch006", + "start": 0, + "type": "Identifier" + }, + "init": { + "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": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "offset", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.0325", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0325, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "offsetPlane", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "argument": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "XZ", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + }, + "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": "sketch006Profile000", + "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, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "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": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "0.03", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.03, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "circle", + "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": "sketch006", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "draftCut000Extrude", + "start": 0, + "type": "Identifier" + }, + "init": { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "loft", + "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": "sketch005Profile000", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + }, + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch006Profile000", + "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, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "draftCut000", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tools", + "start": 0, + "type": "Identifier" + }, + "arg": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "draftCut000Extrude", + "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": "subtract", + "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": "extrude000", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "in", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + } + ], + "start": 0, + "type": "Annotation" + } + ], + "nonCodeMeta": { + "nonCodeNodes": { + "0": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "1": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "2": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "3": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "4": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "5": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "6": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "7": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "8": [ + { + "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" + } + } + ], + "11": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "12": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "13": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "14": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "15": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "startNodes": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "start": 0 + } +} diff --git a/rust/kcl-lib/tests/multi_target_csg/execution_error.snap b/rust/kcl-lib/tests/multi_target_csg/execution_error.snap new file mode 100644 index 000000000..206fdd29c --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/execution_error.snap @@ -0,0 +1,14 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Error from executing multi_target_csg.kcl +--- +KCL Engine error + + × engine: Currently the engine does not support multiple targets on subtract + ╭─[69:10] + 68 │ + 69 │ cut000 = subtract(extrude001, tools = cut000Extrude) + · ─────────────────────┬───────────────────── + · ╰── tests/multi_target_csg/input.kcl + 70 │ + ╰──── diff --git a/rust/kcl-lib/tests/multi_target_csg/input.kcl b/rust/kcl-lib/tests/multi_target_csg/input.kcl new file mode 100644 index 000000000..6e86ab884 --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/input.kcl @@ -0,0 +1,89 @@ +@settings(defaultLengthUnit = in) + +sketch002 = startSketchOn(-XZ) + +sketch002Profile000 = startProfile(sketch002, at = [-0.1625, 0.1875]) + |> xLine(length = 0.325) + |> arc( + angleStart = 90, + angleEnd = 0, + radius = 0.025, + ) + |> yLine(length = -0.325) + |> arc( + angleStart = 360, + angleEnd = 270, + radius = 0.025, + ) + |> xLine(length = -0.325) + |> arc( + angleStart = 270, + angleEnd = 180, + radius = 0.025, + ) + |> yLine(length = 0.325) + |> arc( + angleStart = 180, + angleEnd = 90, + radius = 0.025, + ) + |> close() + |> subtract2d(tool = circle( + center = [-0, -0], + radius = 0.039062, + tag = $hole001 +)) + +extrude000 = extrude(sketch002Profile000, length = 0.0625) + +sketch003 = startSketchOn(XY) + +sketch003Profile000 = startProfile(sketch003, at = [-0.05582, -0.21875]) + |> line(end = [0.048496, 0.21875]) + |> xLine(length = -0.087793) + |> line(end = [-0.026673, -0.120313]) + |> line(end = [0.058646, -0.098438]) + |> xLine(length = 0.007324) + |> close() + +sketch003Profile001 = startProfile(sketch003, at = [0.007324, 0]) + |> xLine(length = 0.087793) + |> line(end = [0.026673, -0.120313]) + |> line(end = [-0.058646, -0.098438]) + |> xLine(length = -0.007324) + |> line(end = [-0.048496, 0.21875]) + |> close() + +extrude001 = extrude([sketch003Profile000, sketch003Profile001], length = 0.1, bidirectionalLength = 0.1) + +sketch004 = startSketchOn(offsetPlane(-XZ, offset = 0.1)) + +sketch004Profile000 = circle( + sketch004, + center = [-0, -0], + radius = 0.039062 +) + +cut000Extrude = extrude([sketch004Profile000], length = -1) + +cut000 = subtract(extrude001, tools = cut000Extrude) + +sketch005 = startSketchOn(offsetPlane(-XZ, offset = 0.07)) + +sketch005Profile000 = circle( + sketch005, + center = [0, 0], + radius = 0.052734 +) + +sketch006 = startSketchOn(offsetPlane(-XZ, offset = 0.0325)) + +sketch006Profile000 = circle( + sketch006, + center = [0, 0], + radius = 0.03 +) + +draftCut000Extrude = loft([sketch005Profile000, sketch006Profile000]) + +draftCut000 = subtract(extrude000, tools = draftCut000Extrude) diff --git a/rust/kcl-lib/tests/multi_target_csg/ops.snap b/rust/kcl-lib/tests/multi_target_csg/ops.snap new file mode 100644 index 000000000..d2a2d841a --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/ops.snap @@ -0,0 +1,265 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Operations executed multi_target_csg.kcl +--- +[ + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "tool": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + "name": "subtract2d", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 0.0625, + "ty": { + "type": "Default", + "len": { + "type": "Inches" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "bidirectionalLength": { + "value": { + "type": "Number", + "value": 0.1, + "ty": { + "type": "Default", + "len": { + "type": "Inches" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + }, + "length": { + "value": { + "type": "Number", + "value": 0.1, + "ty": { + "type": "Default", + "len": { + "type": "Inches" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + }, + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "type": "KclStdLibCall", + "name": "offsetPlane", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + }, + "labeledArgs": { + "offset": { + "value": { + "type": "Number", + "value": 0.1, + "ty": { + "type": "Default", + "len": { + "type": "Inches" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "sourceRange": [] + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": -1.0, + "ty": { + "type": "Default", + "len": { + "type": "Inches" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + }, + { + "isError": true, + "labeledArgs": { + "tools": { + "value": { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + "name": "subtract", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + } +] diff --git a/rust/kcl-lib/tests/multi_target_csg/unparsed.snap b/rust/kcl-lib/tests/multi_target_csg/unparsed.snap new file mode 100644 index 000000000..a0853ebf6 --- /dev/null +++ b/rust/kcl-lib/tests/multi_target_csg/unparsed.snap @@ -0,0 +1,71 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing multi_target_csg.kcl +--- +@settings(defaultLengthUnit = in) + +sketch002 = startSketchOn(-XZ) + +sketch002Profile000 = startProfile(sketch002, at = [-0.1625, 0.1875]) + |> xLine(length = 0.325) + |> arc(angleStart = 90, angleEnd = 0, radius = 0.025) + |> yLine(length = -0.325) + |> arc(angleStart = 360, angleEnd = 270, radius = 0.025) + |> xLine(length = -0.325) + |> arc(angleStart = 270, angleEnd = 180, radius = 0.025) + |> yLine(length = 0.325) + |> arc(angleStart = 180, angleEnd = 90, radius = 0.025) + |> close() + |> subtract2d(tool = circle(center = [-0, -0], radius = 0.039062, tag = $hole001)) + +extrude000 = extrude(sketch002Profile000, length = 0.0625) + +sketch003 = startSketchOn(XY) + +sketch003Profile000 = startProfile(sketch003, at = [-0.05582, -0.21875]) + |> line(end = [0.048496, 0.21875]) + |> xLine(length = -0.087793) + |> line(end = [-0.026673, -0.120313]) + |> line(end = [0.058646, -0.098438]) + |> xLine(length = 0.007324) + |> close() + +sketch003Profile001 = startProfile(sketch003, at = [0.007324, 0]) + |> xLine(length = 0.087793) + |> line(end = [0.026673, -0.120313]) + |> line(end = [-0.058646, -0.098438]) + |> xLine(length = -0.007324) + |> line(end = [-0.048496, 0.21875]) + |> close() + +extrude001 = extrude( + [ + sketch003Profile000, + sketch003Profile001 + ], + length = 0.1, + bidirectionalLength = 0.1, +) + +sketch004 = startSketchOn(offsetPlane(-XZ, offset = 0.1)) + +sketch004Profile000 = circle(sketch004, center = [-0, -0], radius = 0.039062) + +cut000Extrude = extrude([sketch004Profile000], length = -1) + +cut000 = subtract(extrude001, tools = cut000Extrude) + +sketch005 = startSketchOn(offsetPlane(-XZ, offset = 0.07)) + +sketch005Profile000 = circle(sketch005, center = [0, 0], radius = 0.052734) + +sketch006 = startSketchOn(offsetPlane(-XZ, offset = 0.0325)) + +sketch006Profile000 = circle(sketch006, center = [0, 0], radius = 0.03) + +draftCut000Extrude = loft([ + sketch005Profile000, + sketch006Profile000 +]) + +draftCut000 = subtract(extrude000, tools = draftCut000Extrude) diff --git a/rust/kcl-lib/tests/subtract_with_pattern/artifact_commands.snap b/rust/kcl-lib/tests/subtract_with_pattern/artifact_commands.snap new file mode 100644 index 000000000..e35d2c34d --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/artifact_commands.snap @@ -0,0 +1,717 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact commands subtract_with_pattern.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": 1.0, + "z": 0.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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 2.65, + "y": 12.2, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 23.49, + "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": -22.68, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -24.2, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 2.65, + "y": 12.2, + "z": 0.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 500.0, + "faces": null, + "opposite": "None" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "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": "close_path", + "path_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": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": 17.5, + "y": 22.02 + }, + "radius": 10.16, + "start": { + "unit": "degrees", + "value": 0.0 + }, + "end": { + "unit": "degrees", + "value": 360.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 27.66, + "y": 22.02, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "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": 50.0, + "faces": null, + "opposite": "None" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_linear_pattern_transform", + "entity_id": "[uuid]", + "transform": [], + "transforms": [ + [ + { + "translate": { + "x": 0.0, + "y": 0.0, + "z": 30.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": 0.0, + "y": 0.0, + "z": 60.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": 0.0, + "y": 0.0, + "z": 90.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": 0.0, + "y": 0.0, + "z": 120.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": 0.0, + "y": 0.0, + "z": 150.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": 0.0, + "y": 0.0, + "z": 180.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": 0.0, + "y": 0.0, + "z": 210.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": 0.0, + "y": 0.0, + "z": 240.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": 0.0, + "y": 0.0, + "z": 270.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": "boolean_subtract", + "target_ids": [ + "[uuid]" + ], + "tool_ids": [ + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]" + ], + "tolerance": 0.0000001 + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "set_object_transform", + "object_id": "[uuid]", + "transforms": [ + { + "translate": null, + "rotate_rpy": null, + "rotate_angle_axis": { + "property": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "w": 90.0 + }, + "set": false, + "is_local": true + }, + "scale": null + } + ] + } + } +] diff --git a/rust/kcl-lib/tests/subtract_with_pattern/artifact_graph_flowchart.snap b/rust/kcl-lib/tests/subtract_with_pattern/artifact_graph_flowchart.snap new file mode 100644 index 000000000..2a145ce13 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/artifact_graph_flowchart.snap @@ -0,0 +1,6 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact graph flowchart subtract_with_pattern.kcl +extension: md +snapshot_kind: binary +--- diff --git a/rust/kcl-lib/tests/subtract_with_pattern/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/subtract_with_pattern/artifact_graph_flowchart.snap.md new file mode 100644 index 000000000..8b401d7ed --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/artifact_graph_flowchart.snap.md @@ -0,0 +1,135 @@ +```mermaid +flowchart LR + subgraph path3 [Path] + 3["Path
[43, 85, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 5["Segment
[93, 114, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 6["Segment
[122, 144, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 7["Segment
[152, 173, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 8["Segment
[181, 237, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 9["Segment
[245, 252, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] + 12[Solid2d] + end + subgraph path4 [Path] + 4["Path
[349, 406, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 10["Segment
[349, 406, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 11[Solid2d] + end + 1["Plane
[12, 29, 0]"] + %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 2["Plane
[317, 334, 0]"] + %% [ProgramBodyItem { index: 3 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 13["Sweep Extrusion
[268, 301, 0]"] + %% [ProgramBodyItem { index: 2 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 14["Sweep Extrusion
[422, 454, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 15["CompositeSolid Subtract
[641, 685, 0]"] + %% [ProgramBodyItem { index: 7 }, ExpressionStatementExpr, 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["Cap Start"] + %% face_code_ref=Missing NodePath + 22["Cap Start"] + %% face_code_ref=Missing NodePath + 23["Cap End"] + %% face_code_ref=Missing NodePath + 24["Cap End"] + %% face_code_ref=Missing NodePath + 25["SweepEdge Opposite"] + 26["SweepEdge Opposite"] + 27["SweepEdge Opposite"] + 28["SweepEdge Opposite"] + 29["SweepEdge Opposite"] + 30["SweepEdge Adjacent"] + 31["SweepEdge Adjacent"] + 32["SweepEdge Adjacent"] + 33["SweepEdge Adjacent"] + 34["SweepEdge Adjacent"] + 1 --- 3 + 2 --- 4 + 3 --- 5 + 3 --- 6 + 3 --- 7 + 3 --- 8 + 3 --- 9 + 3 --- 12 + 3 ---- 13 + 3 --- 15 + 4 --- 10 + 4 --- 11 + 4 ---- 14 + 4 --- 15 + 5 --- 19 + 5 x--> 21 + 5 --- 28 + 5 --- 33 + 6 --- 17 + 6 x--> 21 + 6 --- 27 + 6 --- 32 + 7 --- 16 + 7 x--> 21 + 7 --- 26 + 7 --- 31 + 8 --- 18 + 8 x--> 21 + 8 --- 25 + 8 --- 30 + 10 --- 20 + 10 x--> 22 + 10 --- 29 + 10 --- 34 + 13 --- 16 + 13 --- 17 + 13 --- 18 + 13 --- 19 + 13 --- 21 + 13 --- 23 + 13 --- 25 + 13 --- 26 + 13 --- 27 + 13 --- 28 + 13 --- 30 + 13 --- 31 + 13 --- 32 + 13 --- 33 + 14 --- 20 + 14 --- 22 + 14 --- 24 + 14 --- 29 + 14 --- 34 + 16 --- 26 + 16 --- 31 + 32 <--x 16 + 17 --- 27 + 17 --- 32 + 33 <--x 17 + 18 --- 25 + 18 --- 30 + 31 <--x 18 + 19 --- 28 + 30 <--x 19 + 19 --- 33 + 20 --- 29 + 20 --- 34 + 25 <--x 23 + 26 <--x 23 + 27 <--x 23 + 28 <--x 23 + 29 <--x 24 +``` diff --git a/rust/kcl-lib/tests/subtract_with_pattern/ast.snap b/rust/kcl-lib/tests/subtract_with_pattern/ast.snap new file mode 100644 index 000000000..b09fa8340 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/ast.snap @@ -0,0 +1,1258 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of parsing subtract_with_pattern.kcl +--- +{ + "Ok": { + "body": [ + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "sketch001", + "start": 0, + "type": "Identifier" + }, + "init": { + "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" + } + }, + "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": "profile001", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "2.65", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.65, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "12.2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 12.2, + "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": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "23.49", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 23.49, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "22.68", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 22.68, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yLine", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "24.2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 24.2, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": [ + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "profileStartX", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + }, + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "profileStartY", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + } + ], + "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 + } + ], + "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": "extrude001", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "500", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 500.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": "profile001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "sketch002", + "start": 0, + "type": "Identifier" + }, + "init": { + "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": "XZ", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "profile002", + "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, + "raw": "17.5", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 17.5, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "22.02", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 22.02, + "suffix": "None" + } + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "10.16", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 10.16, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "circle", + "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": "sketch002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "extrude002", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "50", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 50.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": "profile002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "myPatterns", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "instances", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "10", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 10.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "distance", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "30", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 30.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "axis", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.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": "patternLinear3d", + "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": "extrude002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + }, + { + "commentStart": 0, + "end": 0, + "expression": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tools", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "myPatterns", + "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": "subtract", + "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": "extrude001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "angle", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "90", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 90.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "axis", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + { + "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": "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, + "nonCodeMeta": { + "nonCodeNodes": { + "1": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "inlineComment", + "value": "we do this to ensure the id is okay after the subtract", + "style": "line" + } + } + ] + }, + "startNodes": [] + }, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "ExpressionStatement", + "type": "ExpressionStatement" + } + ], + "commentStart": 0, + "end": 0, + "nonCodeMeta": { + "nonCodeNodes": { + "1": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "2": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "4": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "6": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "7": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "startNodes": [] + }, + "start": 0 + } +} diff --git a/rust/kcl-lib/tests/subtract_with_pattern/input.kcl b/rust/kcl-lib/tests/subtract_with_pattern/input.kcl new file mode 100644 index 000000000..1a5dbd392 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/input.kcl @@ -0,0 +1,22 @@ +sketch001 = startSketchOn(XY) +profile001 = startProfile(sketch001, at = [2.65, 12.2]) + |> xLine(length = 23.49) + |> yLine(length = -22.68) + |> xLine(length = -24.2) + |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) + |> close() + +extrude001 = extrude(profile001, length = 500) + +sketch002 = startSketchOn(XZ) +profile002 = circle(sketch002, center = [17.5, 22.02], radius = 10.16) + +extrude002 = extrude(profile002, length = 50) +myPatterns = patternLinear3d(extrude002, + instances = 10, + distance = 30, + axis = [0,0,1]) + +subtract([extrude001], tools = [myPatterns]) + |> rotate(angle = 90, axis = [0,1,0]) // we do this to ensure the id is okay after the subtract + diff --git a/rust/kcl-lib/tests/subtract_with_pattern/ops.snap b/rust/kcl-lib/tests/subtract_with_pattern/ops.snap new file mode 100644 index 000000000..3c35e852f --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/ops.snap @@ -0,0 +1,285 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Operations executed subtract_with_pattern.kcl +--- +[ + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 500.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 50.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "axis": { + "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" + } + } + }, + { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + } + ] + }, + "sourceRange": [] + }, + "distance": { + "value": { + "type": "Number", + "value": 30.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + }, + "instances": { + "value": { + "type": "Number", + "value": 10.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "patternLinear3d", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "tools": { + "value": { + "type": "Array", + "value": [ + { + "type": "Array", + "value": [ + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + } + ] + } + ] + }, + "sourceRange": [] + } + }, + "name": "subtract", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + } +] diff --git a/rust/kcl-lib/tests/subtract_with_pattern/program_memory.snap b/rust/kcl-lib/tests/subtract_with_pattern/program_memory.snap new file mode 100644 index 000000000..a1a7a717d --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/program_memory.snap @@ -0,0 +1,1706 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Variables in memory after executing subtract_with_pattern.kcl +--- +{ + "extrude001": { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + -10.48 + ], + "tag": null, + "to": [ + 1.94, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 1.94, + -10.48 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 2.65, + 12.2 + ], + "to": [ + 2.65, + 12.2 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 500.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + "extrude002": { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + "myPatterns": { + "type": "HomArray", + "value": [ + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + } + ] + }, + "profile001": { + "type": "Sketch", + "value": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + -10.48 + ], + "tag": null, + "to": [ + 1.94, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 1.94, + -10.48 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 2.65, + 12.2 + ], + "to": [ + 2.65, + 12.2 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + } + }, + "profile002": { + "type": "Sketch", + "value": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 22.02 + ], + "from": [ + 27.66, + 22.02 + ], + "radius": 10.16, + "tag": null, + "to": [ + 27.66, + 22.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 27.66, + 22.02 + ], + "to": [ + 27.66, + 22.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + } + }, + "sketch001": { + "type": "Plane", + "value": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + } + }, + "sketch002": { + "type": "Plane", + "value": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + } + } +} diff --git a/rust/kcl-lib/tests/subtract_with_pattern/rendered_model.png b/rust/kcl-lib/tests/subtract_with_pattern/rendered_model.png new file mode 100644 index 000000000..68d442107 Binary files /dev/null and b/rust/kcl-lib/tests/subtract_with_pattern/rendered_model.png differ diff --git a/rust/kcl-lib/tests/subtract_with_pattern/unparsed.snap b/rust/kcl-lib/tests/subtract_with_pattern/unparsed.snap new file mode 100644 index 000000000..335a5fea0 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern/unparsed.snap @@ -0,0 +1,27 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing subtract_with_pattern.kcl +--- +sketch001 = startSketchOn(XY) +profile001 = startProfile(sketch001, at = [2.65, 12.2]) + |> xLine(length = 23.49) + |> yLine(length = -22.68) + |> xLine(length = -24.2) + |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) + |> close() + +extrude001 = extrude(profile001, length = 500) + +sketch002 = startSketchOn(XZ) +profile002 = circle(sketch002, center = [17.5, 22.02], radius = 10.16) + +extrude002 = extrude(profile002, length = 50) +myPatterns = patternLinear3d( + extrude002, + instances = 10, + distance = 30, + axis = [0, 0, 1], +) + +subtract([extrude001], tools = [myPatterns]) + |> rotate(angle = 90, axis = [0, 1, 0]) // we do this to ensure the id is okay after the subtract diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_commands.snap b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_commands.snap new file mode 100644 index 000000000..64bc48c22 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_commands.snap @@ -0,0 +1,591 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact commands subtract_with_pattern_cut_thru.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": 1.0, + "z": 0.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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 2.65, + "y": 12.2, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 23.49, + "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": -22.68, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": -24.2, + "y": 0.0, + "z": 0.0 + }, + "relative": true + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extend_path", + "path": "[uuid]", + "segment": { + "type": "line", + "end": { + "x": 2.65, + "y": 12.2, + "z": 0.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "close_path", + "path_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": 0.0, + "z": 1.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "extrude", + "target": "[uuid]", + "distance": 500.0, + "faces": null, + "opposite": "None" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "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": "close_path", + "path_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": "extend_path", + "path": "[uuid]", + "segment": { + "type": "arc", + "center": { + "x": 17.5, + "y": 42.02 + }, + "radius": 30.16, + "start": { + "unit": "degrees", + "value": 0.0 + }, + "end": { + "unit": "degrees", + "value": 360.0 + }, + "relative": false + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "move_path_pen", + "path": "[uuid]", + "to": { + "x": 47.66, + "y": 42.02, + "z": 0.0 + } + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "start_path" + } + }, + { + "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": 50.0, + "faces": null, + "opposite": "None" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "object_bring_to_front", + "object_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "sketch_mode_disable" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_adjacency_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "solid3d_get_extrusion_face_info", + "object_id": "[uuid]", + "edge_id": "[uuid]" + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "set_object_transform", + "object_id": "[uuid]", + "transforms": [ + { + "translate": { + "property": { + "x": 0.0, + "y": 30.0, + "z": 0.0 + }, + "set": false, + "is_local": true + }, + "rotate_rpy": null, + "rotate_angle_axis": null, + "scale": null + } + ] + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "entity_linear_pattern_transform", + "entity_id": "[uuid]", + "transform": [], + "transforms": [ + [ + { + "translate": { + "x": 0.0, + "y": 0.0, + "z": 80.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": 0.0, + "y": 0.0, + "z": 160.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": 0.0, + "y": 0.0, + "z": 240.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": 0.0, + "y": 0.0, + "z": 320.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": "boolean_subtract", + "target_ids": [ + "[uuid]" + ], + "tool_ids": [ + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]", + "[uuid]" + ], + "tolerance": 0.0000001 + } + }, + { + "cmdId": "[uuid]", + "range": [], + "command": { + "type": "set_object_transform", + "object_id": "[uuid]", + "transforms": [ + { + "translate": null, + "rotate_rpy": null, + "rotate_angle_axis": { + "property": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "w": 90.0 + }, + "set": false, + "is_local": true + }, + "scale": null + } + ] + } + } +] diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_graph_flowchart.snap b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_graph_flowchart.snap new file mode 100644 index 000000000..9c236e6bb --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_graph_flowchart.snap @@ -0,0 +1,6 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Artifact graph flowchart subtract_with_pattern_cut_thru.kcl +extension: md +snapshot_kind: binary +--- diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_graph_flowchart.snap.md b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_graph_flowchart.snap.md new file mode 100644 index 000000000..a16c30ffc --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/artifact_graph_flowchart.snap.md @@ -0,0 +1,135 @@ +```mermaid +flowchart LR + subgraph path3 [Path] + 3["Path
[43, 85, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 5["Segment
[93, 114, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }] + 6["Segment
[122, 144, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }] + 7["Segment
[152, 173, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }] + 8["Segment
[181, 237, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }] + 9["Segment
[245, 252, 0]"] + %% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }] + 12[Solid2d] + end + subgraph path4 [Path] + 4["Path
[349, 406, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 10["Segment
[349, 406, 0]"] + %% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 11[Solid2d] + end + 1["Plane
[12, 29, 0]"] + %% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 2["Plane
[317, 334, 0]"] + %% [ProgramBodyItem { index: 3 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 13["Sweep Extrusion
[268, 301, 0]"] + %% [ProgramBodyItem { index: 2 }, VariableDeclarationDeclaration, VariableDeclarationInit] + 14["Sweep Extrusion
[422, 454, 0]"] + %% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }] + 15["CompositeSolid Subtract
[686, 730, 0]"] + %% [ProgramBodyItem { index: 7 }, 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["Cap Start"] + %% face_code_ref=Missing NodePath + 22["Cap Start"] + %% face_code_ref=Missing NodePath + 23["Cap End"] + %% face_code_ref=Missing NodePath + 24["Cap End"] + %% face_code_ref=Missing NodePath + 25["SweepEdge Opposite"] + 26["SweepEdge Opposite"] + 27["SweepEdge Opposite"] + 28["SweepEdge Opposite"] + 29["SweepEdge Opposite"] + 30["SweepEdge Adjacent"] + 31["SweepEdge Adjacent"] + 32["SweepEdge Adjacent"] + 33["SweepEdge Adjacent"] + 34["SweepEdge Adjacent"] + 1 --- 3 + 2 --- 4 + 3 --- 5 + 3 --- 6 + 3 --- 7 + 3 --- 8 + 3 --- 9 + 3 --- 12 + 3 ---- 13 + 3 --- 15 + 4 --- 10 + 4 --- 11 + 4 ---- 14 + 4 --- 15 + 5 --- 19 + 5 x--> 21 + 5 --- 28 + 5 --- 33 + 6 --- 17 + 6 x--> 21 + 6 --- 27 + 6 --- 32 + 7 --- 16 + 7 x--> 21 + 7 --- 26 + 7 --- 31 + 8 --- 18 + 8 x--> 21 + 8 --- 25 + 8 --- 30 + 10 --- 20 + 10 x--> 22 + 10 --- 29 + 10 --- 34 + 13 --- 16 + 13 --- 17 + 13 --- 18 + 13 --- 19 + 13 --- 21 + 13 --- 23 + 13 --- 25 + 13 --- 26 + 13 --- 27 + 13 --- 28 + 13 --- 30 + 13 --- 31 + 13 --- 32 + 13 --- 33 + 14 --- 20 + 14 --- 22 + 14 --- 24 + 14 --- 29 + 14 --- 34 + 16 --- 26 + 16 --- 31 + 32 <--x 16 + 17 --- 27 + 17 --- 32 + 33 <--x 17 + 18 --- 25 + 18 --- 30 + 31 <--x 18 + 19 --- 28 + 30 <--x 19 + 19 --- 33 + 20 --- 29 + 20 --- 34 + 25 <--x 23 + 26 <--x 23 + 27 <--x 23 + 28 <--x 23 + 29 <--x 24 +``` diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/ast.snap b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/ast.snap new file mode 100644 index 000000000..acf0cd726 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/ast.snap @@ -0,0 +1,1328 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of parsing subtract_with_pattern_cut_thru.kcl +--- +{ + "Ok": { + "body": [ + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "sketch001", + "start": 0, + "type": "Identifier" + }, + "init": { + "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" + } + }, + "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": "profile001", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "at", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "2.65", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 2.65, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "12.2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 12.2, + "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": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "sketch001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "23.49", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 23.49, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "22.68", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 22.68, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "yLine", + "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": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "argument": { + "commentStart": 0, + "end": 0, + "raw": "24.2", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 24.2, + "suffix": "None" + } + }, + "commentStart": 0, + "end": 0, + "operator": "-", + "start": 0, + "type": "UnaryExpression", + "type": "UnaryExpression" + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "xLine", + "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": [ + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "profileStartX", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + }, + { + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "profileStartY", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name" + }, + "commentStart": 0, + "end": 0, + "start": 0, + "type": "CallExpressionKw", + "type": "CallExpressionKw", + "unlabeled": { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "PipeSubstitution", + "type": "PipeSubstitution" + } + } + ], + "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 + } + ], + "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": "extrude001", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "length", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "500", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 500.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": "profile001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "sketch002", + "start": 0, + "type": "Identifier" + }, + "init": { + "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": "XZ", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "profile002", + "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, + "raw": "17.5", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 17.5, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "42.02", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 42.02, + "suffix": "None" + } + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "radius", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "30.16", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 30.16, + "suffix": "None" + } + } + } + ], + "callee": { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "circle", + "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": "sketch002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "extrude002", + "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": "50", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 50.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": "profile002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "y", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "30", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 30.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" + }, + { + "commentStart": 0, + "declaration": { + "commentStart": 0, + "end": 0, + "id": { + "commentStart": 0, + "end": 0, + "name": "myPatterns", + "start": 0, + "type": "Identifier" + }, + "init": { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "instances", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "5", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 5.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "distance", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "80", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 80.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "axis", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.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": "patternLinear3d", + "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": "extrude002", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + }, + "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": "results", + "start": 0, + "type": "Identifier" + }, + "init": { + "body": [ + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "tools", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "abs_path": false, + "commentStart": 0, + "end": 0, + "name": { + "commentStart": 0, + "end": 0, + "name": "myPatterns", + "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": "subtract", + "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": "extrude001", + "start": 0, + "type": "Identifier" + }, + "path": [], + "start": 0, + "type": "Name", + "type": "Name" + } + ], + "end": 0, + "start": 0, + "type": "ArrayExpression", + "type": "ArrayExpression" + } + }, + { + "arguments": [ + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "angle", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "end": 0, + "raw": "90", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 90.0, + "suffix": "None" + } + } + }, + { + "type": "LabeledArg", + "label": { + "commentStart": 0, + "end": 0, + "name": "axis", + "start": 0, + "type": "Identifier" + }, + "arg": { + "commentStart": 0, + "elements": [ + { + "commentStart": 0, + "end": 0, + "raw": "0", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 0.0, + "suffix": "None" + } + }, + { + "commentStart": 0, + "end": 0, + "raw": "1", + "start": 0, + "type": "Literal", + "type": "Literal", + "value": { + "value": 1.0, + "suffix": "None" + } + }, + { + "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": "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, + "nonCodeMeta": { + "nonCodeNodes": { + "1": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "inlineComment", + "value": "we do this to ensure the id is okay after the subtract", + "style": "line" + } + } + ] + }, + "startNodes": [] + }, + "start": 0, + "type": "PipeExpression", + "type": "PipeExpression" + }, + "start": 0, + "type": "VariableDeclarator" + }, + "end": 0, + "kind": "const", + "start": 0, + "type": "VariableDeclaration", + "type": "VariableDeclaration" + } + ], + "commentStart": 0, + "end": 0, + "nonCodeMeta": { + "nonCodeNodes": { + "1": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "2": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "4": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "5": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ], + "6": [ + { + "commentStart": 0, + "end": 0, + "start": 0, + "type": "NonCodeNode", + "value": { + "type": "newLine" + } + } + ] + }, + "startNodes": [] + }, + "start": 0 + } +} diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/input.kcl b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/input.kcl new file mode 100644 index 000000000..7dc0acb39 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/input.kcl @@ -0,0 +1,23 @@ +sketch001 = startSketchOn(XY) +profile001 = startProfile(sketch001, at = [2.65, 12.2]) + |> xLine(length = 23.49) + |> yLine(length = -22.68) + |> xLine(length = -24.2) + |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) + |> close() + +extrude001 = extrude(profile001, length = 500) + +sketch002 = startSketchOn(XZ) +profile002 = circle(sketch002, center = [17.5, 42.02], radius = 30.16) + +extrude002 = extrude(profile002, length = 50) + |> translate(y=30) + +myPatterns = patternLinear3d(extrude002, + instances = 5, + distance = 80, + axis = [0,0,1]) + +results = subtract([extrude001], tools = [myPatterns]) + |> rotate(angle = 90, axis = [0,1,0]) // we do this to ensure the id is okay after the subtract diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/ops.snap b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/ops.snap new file mode 100644 index 000000000..081181ae1 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/ops.snap @@ -0,0 +1,255 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Operations executed subtract_with_pattern_cut_thru.kcl +--- +[ + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 500.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": {}, + "name": "startSketchOn", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Plane", + "artifact_id": "[uuid]" + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "length": { + "value": { + "type": "Number", + "value": 50.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "extrude", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Sketch", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "axis": { + "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" + } + } + }, + { + "type": "Number", + "value": 1.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + } + ] + }, + "sourceRange": [] + }, + "distance": { + "value": { + "type": "Number", + "value": 80.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + }, + "instances": { + "value": { + "type": "Number", + "value": 5.0, + "ty": { + "type": "Default", + "len": { + "type": "Mm" + }, + "angle": { + "type": "Degrees" + } + } + }, + "sourceRange": [] + } + }, + "name": "patternLinear3d", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + "sourceRange": [] + } + }, + { + "labeledArgs": { + "tools": { + "value": { + "type": "Array", + "value": [ + { + "type": "Array", + "value": [ + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + }, + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + } + ] + } + ] + }, + "sourceRange": [] + } + }, + "name": "subtract", + "sourceRange": [], + "type": "StdLibCall", + "unlabeledArg": { + "value": { + "type": "Array", + "value": [ + { + "type": "Solid", + "value": { + "artifactId": "[uuid]" + } + } + ] + }, + "sourceRange": [] + } + } +] diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/program_memory.snap b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/program_memory.snap new file mode 100644 index 000000000..2abc5182a --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/program_memory.snap @@ -0,0 +1,1365 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Variables in memory after executing subtract_with_pattern_cut_thru.kcl +--- +{ + "extrude001": { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + -10.48 + ], + "tag": null, + "to": [ + 1.94, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 1.94, + -10.48 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 2.65, + 12.2 + ], + "to": [ + 2.65, + 12.2 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 500.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + "extrude002": { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + "myPatterns": { + "type": "HomArray", + "value": [ + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudeArc" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 50.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + } + ] + }, + "profile001": { + "type": "Sketch", + "value": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + -10.48 + ], + "tag": null, + "to": [ + 1.94, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 1.94, + -10.48 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 2.65, + 12.2 + ], + "to": [ + 2.65, + 12.2 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + } + }, + "profile002": { + "type": "Sketch", + "value": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "ccw": true, + "center": [ + 17.5, + 42.02 + ], + "from": [ + 47.66, + 42.02 + ], + "radius": 30.16, + "tag": null, + "to": [ + 47.66, + 42.02 + ], + "type": "Circle", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 47.66, + 42.02 + ], + "to": [ + 47.66, + 42.02 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + } + }, + "results": { + "type": "Solid", + "value": { + "type": "Solid", + "id": "[uuid]", + "artifactId": "[uuid]", + "value": [ + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + }, + { + "faceId": "[uuid]", + "id": "[uuid]", + "sourceRange": [], + "tag": null, + "type": "extrudePlane" + } + ], + "sketch": { + "type": "Sketch", + "id": "[uuid]", + "paths": [ + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + 12.2 + ], + "tag": null, + "to": [ + 26.14, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 26.14, + -10.48 + ], + "tag": null, + "to": [ + 1.94, + -10.48 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 1.94, + -10.48 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + }, + { + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + }, + "from": [ + 2.65, + 12.2 + ], + "tag": null, + "to": [ + 2.65, + 12.2 + ], + "type": "ToPoint", + "units": { + "type": "Mm" + } + } + ], + "on": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "type": "plane", + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + }, + "start": { + "from": [ + 2.65, + 12.2 + ], + "to": [ + 2.65, + 12.2 + ], + "units": { + "type": "Mm" + }, + "tag": null, + "__geoMeta": { + "id": "[uuid]", + "sourceRange": [] + } + }, + "artifactId": "[uuid]", + "originalId": "[uuid]", + "units": { + "type": "Mm" + } + }, + "height": 500.0, + "startCapId": "[uuid]", + "endCapId": "[uuid]", + "units": { + "type": "Mm" + }, + "sectional": false + } + }, + "sketch001": { + "type": "Plane", + "value": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "value": "XY", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 1.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + } + } + }, + "sketch002": { + "type": "Plane", + "value": { + "artifactId": "[uuid]", + "id": "[uuid]", + "origin": { + "x": 0.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Mm" + } + }, + "value": "XZ", + "xAxis": { + "x": 1.0, + "y": 0.0, + "z": 0.0, + "units": { + "type": "Unknown" + } + }, + "yAxis": { + "x": 0.0, + "y": 0.0, + "z": 1.0, + "units": { + "type": "Unknown" + } + } + } + } +} diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/rendered_model.png b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/rendered_model.png new file mode 100644 index 000000000..1c4724023 Binary files /dev/null and b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/rendered_model.png differ diff --git a/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/unparsed.snap b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/unparsed.snap new file mode 100644 index 000000000..f14fef584 --- /dev/null +++ b/rust/kcl-lib/tests/subtract_with_pattern_cut_thru/unparsed.snap @@ -0,0 +1,29 @@ +--- +source: kcl-lib/src/simulation_tests.rs +description: Result of unparsing subtract_with_pattern_cut_thru.kcl +--- +sketch001 = startSketchOn(XY) +profile001 = startProfile(sketch001, at = [2.65, 12.2]) + |> xLine(length = 23.49) + |> yLine(length = -22.68) + |> xLine(length = -24.2) + |> line(endAbsolute = [profileStartX(%), profileStartY(%)]) + |> close() + +extrude001 = extrude(profile001, length = 500) + +sketch002 = startSketchOn(XZ) +profile002 = circle(sketch002, center = [17.5, 42.02], radius = 30.16) + +extrude002 = extrude(profile002, length = 50) + |> translate(y = 30) + +myPatterns = patternLinear3d( + extrude002, + instances = 5, + distance = 80, + axis = [0, 0, 1], +) + +results = subtract([extrude001], tools = [myPatterns]) + |> rotate(angle = 90, axis = [0, 1, 0]) // we do this to ensure the id is okay after the subtract diff --git a/rust/kcl-python-bindings/Cargo.toml b/rust/kcl-python-bindings/Cargo.toml index c423c4987..1ee30281c 100644 --- a/rust/kcl-python-bindings/Cargo.toml +++ b/rust/kcl-python-bindings/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kcl-python-bindings" -version = "0.3.73" +version = "0.3.74" edition = "2021" repository = "https://github.com/kittycad/modeling-app" exclude = ["tests/*", "files/*", "venv/*"] diff --git a/rust/kcl-test-server/Cargo.toml b/rust/kcl-test-server/Cargo.toml index a0aec3330..09294be15 100644 --- a/rust/kcl-test-server/Cargo.toml +++ b/rust/kcl-test-server/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kcl-test-server" description = "A test server for KCL" -version = "0.1.73" +version = "0.1.74" edition = "2021" license = "MIT" diff --git a/rust/kcl-to-core/Cargo.toml b/rust/kcl-to-core/Cargo.toml index bc7a44461..eaa0f5bf1 100644 --- a/rust/kcl-to-core/Cargo.toml +++ b/rust/kcl-to-core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kcl-to-core" description = "Utility methods to convert kcl to engine core executable tests" -version = "0.1.73" +version = "0.1.74" edition = "2021" license = "MIT" repository = "https://github.com/KittyCAD/modeling-app" diff --git a/rust/kcl-wasm-lib/Cargo.toml b/rust/kcl-wasm-lib/Cargo.toml index 5b40f3d07..685ec23f1 100644 --- a/rust/kcl-wasm-lib/Cargo.toml +++ b/rust/kcl-wasm-lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "kcl-wasm-lib" -version = "0.1.73" +version = "0.1.74" edition = "2021" repository = "https://github.com/KittyCAD/modeling-app" rust-version = "1.83"