more csg regression tests (#7032)

* more csg regression tests

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* artifacts

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2025-05-18 16:50:51 -07:00
committed by GitHub
parent 57a977e6be
commit bd01059a92
30 changed files with 29441 additions and 0 deletions

View File

@ -3214,3 +3214,66 @@ mod subtract_regression07 {
super::execute(TEST_NAME, true).await
}
}
mod subtract_regression08 {
const TEST_NAME: &str = "subtract_regression08";
/// 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_regression09 {
const TEST_NAME: &str = "subtract_regression09";
/// 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_regression10 {
const TEST_NAME: &str = "subtract_regression10";
/// 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
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -0,0 +1,578 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact commands subtract_regression08.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": 0.0,
"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": 23.7998,
"y": 0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 23.7998,
"y": 58.7502
},
"radius": 58.7502,
"start": {
"unit": "degrees",
"value": 270.0
},
"end": {
"unit": "degrees",
"value": 360.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": 23.7998,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 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": 1.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 0.0,
"y": 0.0
},
"radius": 30.162499999999998,
"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": 30.1625,
"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": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sweep",
"target": "[uuid]",
"trajectory": "[uuid]",
"sectional": true,
"tolerance": 0.0000001,
"relative_to": "trajectory_curve"
}
},
{
"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": 0.0,
"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": 23.7998,
"y": 0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 23.7998,
"y": 58.7502
},
"radius": 58.7502,
"start": {
"unit": "degrees",
"value": 270.0
},
"end": {
"unit": "degrees",
"value": 360.0
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 0.0,
"y": 23.7998,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "make_plane",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"x_axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"y_axis": {
"x": 0.0,
"y": 0.0,
"z": 1.0
},
"size": 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": 1.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 0.0,
"y": 0.0
},
"radius": 23.8125,
"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": 23.8125,
"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": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_visible",
"object_id": "[uuid]",
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_extrusion_face_info",
"object_id": "[uuid]",
"edge_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sweep",
"target": "[uuid]",
"trajectory": "[uuid]",
"sectional": true,
"tolerance": 0.0000001,
"relative_to": "trajectory_curve"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "boolean_subtract",
"target_ids": [
"[uuid]"
],
"tool_ids": [
"[uuid]"
],
"tolerance": 0.0000001
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart subtract_regression08.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,105 @@
```mermaid
flowchart LR
subgraph path5 [Path]
5["Path<br>[88, 124, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
9["Segment<br>[130, 151, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
10["Segment<br>[157, 238, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
11["Segment<br>[244, 265, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
end
subgraph path6 [Path]
6["Path<br>[320, 379, 0]"]
%% [ProgramBodyItem { index: 3 }, VariableDeclarationDeclaration, VariableDeclarationInit]
12["Segment<br>[320, 379, 0]"]
%% [ProgramBodyItem { index: 3 }, VariableDeclarationDeclaration, VariableDeclarationInit]
17[Solid2d]
end
subgraph path7 [Path]
7["Path<br>[535, 571, 0]"]
%% [ProgramBodyItem { index: 6 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
13["Segment<br>[577, 598, 0]"]
%% [ProgramBodyItem { index: 6 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
14["Segment<br>[604, 685, 0]"]
%% [ProgramBodyItem { index: 6 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
15["Segment<br>[691, 712, 0]"]
%% [ProgramBodyItem { index: 6 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
end
subgraph path8 [Path]
8["Path<br>[767, 826, 0]"]
%% [ProgramBodyItem { index: 8 }, VariableDeclarationDeclaration, VariableDeclarationInit]
16["Segment<br>[767, 826, 0]"]
%% [ProgramBodyItem { index: 8 }, VariableDeclarationDeclaration, VariableDeclarationInit]
18[Solid2d]
end
1["Plane<br>[47, 64, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit]
2["Plane<br>[279, 296, 0]"]
%% [ProgramBodyItem { index: 2 }, VariableDeclarationDeclaration, VariableDeclarationInit]
3["Plane<br>[494, 511, 0]"]
%% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit]
4["Plane<br>[726, 743, 0]"]
%% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit]
19["Sweep Sweep<br>[399, 480, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit]
20["Sweep Sweep<br>[849, 929, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit]
21["CompositeSolid Subtract<br>[945, 998, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit]
22[Wall]
%% face_code_ref=Missing NodePath
23[Wall]
%% face_code_ref=Missing NodePath
24[Wall]
%% face_code_ref=Missing NodePath
25[Wall]
%% face_code_ref=Missing NodePath
26[Wall]
%% face_code_ref=Missing NodePath
27[Wall]
%% face_code_ref=Missing NodePath
28["Cap Start"]
%% face_code_ref=Missing NodePath
29["Cap Start"]
%% face_code_ref=Missing NodePath
30["Cap End"]
%% face_code_ref=Missing NodePath
31["Cap End"]
%% face_code_ref=Missing NodePath
1 --- 5
1 --- 7
2 --- 6
4 --- 8
5 --- 9
5 --- 10
5 --- 11
6 --- 12
6 --- 17
6 ---- 19
6 --- 21
7 --- 13
7 --- 14
7 --- 15
8 --- 16
8 --- 18
8 ---- 20
8 --- 21
12 --- 22
12 <--x 23
12 <--x 24
16 <--x 25
16 <--x 26
16 --- 27
19 --- 22
19 --- 23
19 --- 24
19 --- 29
19 --- 31
20 --- 25
20 --- 26
20 --- 27
20 --- 28
20 --- 30
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
@settings(defaultLengthUnit = in)
sketch001 = startSketchOn(XY)
sketch001Profile000 = startProfile(sketch001, at = [0, 0])
|> xLine(length = 0.937)
|> arc(
angleStart = 270,
angleEnd = 360,
radius = 2.313
)
|> yLine(length = 0.937)
sketch000 = startSketchOn(YZ)
sketch000Profile000 = circle(
sketch000,
center = [0, 0],
radius = 1.1875
)
sweepExtrude000 = sweep(
sketch000Profile000,
path = sketch001Profile000,
sectional = true,
)
sketch003 = startSketchOn(XY)
sketch003Profile000 = startProfile(sketch001, at = [0, 0])
|> xLine(length = 0.937)
|> arc(
angleStart = 270,
angleEnd = 360,
radius = 2.313
)
|> yLine(length = 0.937)
sketch002 = startSketchOn(YZ)
sketch002Profile000 = circle(
sketch002,
center = [0, 0],
radius = 0.9375
)
sweepCut000Extrude = sweep(
sketch002Profile000,
path = sketch003Profile000,
sectional = true
)
sweepCut000 = subtract(sweepExtrude000, tools = sweepCut000Extrude)

View File

@ -0,0 +1,147 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Operations executed subtract_regression08.kcl
---
[
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
{
"labeledArgs": {
"path": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"sectional": {
"value": {
"type": "Bool",
"value": true
},
"sourceRange": []
}
},
"name": "sweep",
"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": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
{
"labeledArgs": {
"path": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
},
"sectional": {
"value": {
"type": "Bool",
"value": true
},
"sourceRange": []
}
},
"name": "sweep",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"tools": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
"name": "subtract",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
}
]

View File

@ -0,0 +1,882 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Variables in memory after executing subtract_regression08.kcl
---
{
"sketch000": {
"type": "Plane",
"value": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
}
},
"sketch000Profile000": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"ccw": true,
"center": [
0.0,
0.0
],
"from": [
1.1875,
0.0
],
"radius": 1.1875,
"tag": null,
"to": [
1.1875,
0.0
],
"type": "Circle",
"units": {
"type": "Inches"
}
}
],
"on": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"type": "plane",
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
},
"start": {
"from": [
1.1875,
0.0
],
"to": [
1.1875,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
}
},
"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"
}
}
}
},
"sketch001Profile000": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
0.0,
0.0
],
"tag": null,
"to": [
0.937,
0.0
],
"type": "ToPoint",
"units": {
"type": "Inches"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"ccw": true,
"center": [
0.937,
2.313
],
"from": [
0.937,
0.0
],
"radius": 2.313,
"tag": null,
"to": [
3.25,
2.313
],
"type": "Arc",
"units": {
"type": "Inches"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
3.25,
2.313
],
"tag": null,
"to": [
3.25,
3.25
],
"type": "ToPoint",
"units": {
"type": "Inches"
}
}
],
"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": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
}
},
"sketch002": {
"type": "Plane",
"value": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
}
},
"sketch002Profile000": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"ccw": true,
"center": [
0.0,
0.0
],
"from": [
0.9375,
0.0
],
"radius": 0.9375,
"tag": null,
"to": [
0.9375,
0.0
],
"type": "Circle",
"units": {
"type": "Inches"
}
}
],
"on": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"type": "plane",
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
},
"start": {
"from": [
0.9375,
0.0
],
"to": [
0.9375,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
}
},
"sketch003": {
"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"
}
}
}
},
"sketch003Profile000": {
"type": "Sketch",
"value": {
"type": "Sketch",
"id": "[uuid]",
"paths": [
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
0.0,
0.0
],
"tag": null,
"to": [
0.937,
0.0
],
"type": "ToPoint",
"units": {
"type": "Inches"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"ccw": true,
"center": [
0.937,
2.313
],
"from": [
0.937,
0.0
],
"radius": 2.313,
"tag": null,
"to": [
3.25,
2.313
],
"type": "Arc",
"units": {
"type": "Inches"
}
},
{
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
},
"from": [
3.25,
2.313
],
"tag": null,
"to": [
3.25,
3.25
],
"type": "ToPoint",
"units": {
"type": "Inches"
}
}
],
"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": [
0.0,
0.0
],
"to": [
0.0,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
}
},
"sweepCut000": {
"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": [
0.0,
0.0
],
"from": [
1.1875,
0.0
],
"radius": 1.1875,
"tag": null,
"to": [
1.1875,
0.0
],
"type": "Circle",
"units": {
"type": "Inches"
}
}
],
"on": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"type": "plane",
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
},
"start": {
"from": [
1.1875,
0.0
],
"to": [
1.1875,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
},
"height": 0.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Inches"
},
"sectional": true
}
},
"sweepCut000Extrude": {
"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": [
0.0,
0.0
],
"from": [
0.9375,
0.0
],
"radius": 0.9375,
"tag": null,
"to": [
0.9375,
0.0
],
"type": "Circle",
"units": {
"type": "Inches"
}
}
],
"on": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"type": "plane",
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
},
"start": {
"from": [
0.9375,
0.0
],
"to": [
0.9375,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
},
"height": 0.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Inches"
},
"sectional": true
}
},
"sweepExtrude000": {
"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": [
0.0,
0.0
],
"from": [
1.1875,
0.0
],
"radius": 1.1875,
"tag": null,
"to": [
1.1875,
0.0
],
"type": "Circle",
"units": {
"type": "Inches"
}
}
],
"on": {
"artifactId": "[uuid]",
"id": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0,
"units": {
"type": "Mm"
}
},
"type": "plane",
"value": "YZ",
"xAxis": {
"x": 0.0,
"y": 1.0,
"z": 0.0,
"units": {
"type": "Unknown"
}
},
"yAxis": {
"x": 0.0,
"y": 0.0,
"z": 1.0,
"units": {
"type": "Unknown"
}
}
},
"start": {
"from": [
1.1875,
0.0
],
"to": [
1.1875,
0.0
],
"units": {
"type": "Inches"
},
"tag": null,
"__geoMeta": {
"id": "[uuid]",
"sourceRange": []
}
},
"artifactId": "[uuid]",
"originalId": "[uuid]",
"units": {
"type": "Inches"
}
},
"height": 0.0,
"startCapId": "[uuid]",
"endCapId": "[uuid]",
"units": {
"type": "Inches"
},
"sectional": true
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -0,0 +1,33 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing subtract_regression08.kcl
---
@settings(defaultLengthUnit = in)
sketch001 = startSketchOn(XY)
sketch001Profile000 = startProfile(sketch001, at = [0, 0])
|> xLine(length = 0.937)
|> arc(angleStart = 270, angleEnd = 360, radius = 2.313)
|> yLine(length = 0.937)
sketch000 = startSketchOn(YZ)
sketch000Profile000 = circle(sketch000, center = [0, 0], radius = 1.1875)
sweepExtrude000 = sweep(sketch000Profile000, path = sketch001Profile000, sectional = true)
sketch003 = startSketchOn(XY)
sketch003Profile000 = startProfile(sketch001, at = [0, 0])
|> xLine(length = 0.937)
|> arc(angleStart = 270, angleEnd = 360, radius = 2.313)
|> yLine(length = 0.937)
sketch002 = startSketchOn(YZ)
sketch002Profile000 = circle(sketch002, center = [0, 0], radius = 0.9375)
sweepCut000Extrude = sweep(sketch002Profile000, path = sketch003Profile000, sectional = true)
sweepCut000 = subtract(sweepExtrude000, tools = sweepCut000Extrude)

View File

@ -0,0 +1,555 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact commands subtract_regression09.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": 0.0,
"y": 1.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": 1.0,
"y": 0.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 5.0,
"y": 3.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": 0.0,
"y": -6.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": 24.972,
"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": 6.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -24.972,
"y": 0.0,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "close_path",
"path_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "object_bring_to_front",
"object_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "revolve",
"target": "[uuid]",
"origin": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"axis": {
"x": 0.0,
"y": 1.0,
"z": 0.0
},
"axis_is_2d": true,
"angle": {
"unit": "degrees",
"value": 360.0
},
"tolerance": 0.0000001,
"opposite": "None"
}
},
{
"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.1882,
"y": 27.4971,
"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": -0.1771,
"y": 0.7408,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": -4.1275,
"y": 27.0095
},
"radius": 5.283446,
"start": {
"unit": "degrees",
"value": 13.4444
},
"end": {
"unit": "degrees",
"value": 38.6282
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 4.7625,
"y": 27.0095
},
"radius": 5.793095,
"start": {
"unit": "degrees",
"value": 145.2955
},
"end": {
"unit": "degrees",
"value": 14.7045
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 13.1164,
"y": 23.9689
},
"radius": 5.283446,
"start": {
"unit": "degrees",
"value": 121.3718
},
"end": {
"unit": "degrees",
"value": 146.5556
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "line",
"end": {
"x": -0.4198,
"y": -0.6355,
"z": 0.0
},
"relative": true
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 1.4162,
"y": 30.8507
},
"radius": 8.272375,
"start": {
"unit": "degrees",
"value": 326.1703
},
"end": {
"unit": "degrees",
"value": 311.294
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": 4.7625,
"y": 27.0095
},
"radius": 3.178087,
"start": {
"unit": "degrees",
"value": 311.6667
},
"end": {
"unit": "degrees",
"value": 208.3333
},
"relative": false
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "tangential_arc_to",
"to": {
"x": -0.7769,
"y": 1.9959,
"z": 0.0
},
"angle_snap_increment": null
}
}
},
{
"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": 10.0,
"faces": null,
"opposite": {
"Other": 10.0
}
}
},
{
"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]"
],
"tool_ids": [
"[uuid]"
],
"tolerance": 0.0000001
}
}
]

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart subtract_regression09.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,235 @@
```mermaid
flowchart LR
subgraph path3 [Path]
3["Path<br>[88, 124, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
5["Segment<br>[130, 148, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
6["Segment<br>[154, 176, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
7["Segment<br>[182, 199, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
8["Segment<br>[205, 228, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
9["Segment<br>[234, 241, 0]"]
%% [ProgramBodyItem { index: 1 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
19[Solid2d]
end
subgraph path4 [Path]
4["Path<br>[362, 413, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
10["Segment<br>[419, 452, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
11["Segment<br>[458, 554, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
12["Segment<br>[560, 657, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
13["Segment<br>[663, 761, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
14["Segment<br>[767, 801, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
15["Segment<br>[807, 905, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
16["Segment<br>[911, 1009, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
17["Segment<br>[1015, 1073, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
18["Segment<br>[1198, 1205, 0]"]
%% [ProgramBodyItem { index: 4 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }]
20[Solid2d]
end
1["Plane<br>[47, 64, 0]"]
%% [ProgramBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit]
2["Plane<br>[321, 338, 0]"]
%% [ProgramBodyItem { index: 3 }, VariableDeclarationDeclaration, VariableDeclarationInit]
21["Sweep Revolve<br>[256, 307, 0]"]
%% [ProgramBodyItem { index: 2 }, VariableDeclarationDeclaration, VariableDeclarationInit]
22["Sweep Extrusion<br>[1223, 1292, 0]"]
%% [ProgramBodyItem { index: 5 }, VariableDeclarationDeclaration, VariableDeclarationInit]
23["CompositeSolid Subtract<br>[1294, 1337, 0]"]
%% [ProgramBodyItem { index: 6 }, ExpressionStatementExpr]
24[Wall]
%% face_code_ref=Missing NodePath
25[Wall]
%% face_code_ref=Missing NodePath
26[Wall]
%% face_code_ref=Missing NodePath
27[Wall]
%% face_code_ref=Missing NodePath
28[Wall]
%% face_code_ref=Missing NodePath
29[Wall]
%% face_code_ref=Missing NodePath
30[Wall]
%% face_code_ref=Missing NodePath
31[Wall]
%% face_code_ref=Missing NodePath
32[Wall]
%% face_code_ref=Missing NodePath
33[Wall]
%% face_code_ref=Missing NodePath
34[Wall]
%% face_code_ref=Missing NodePath
35[Wall]
%% face_code_ref=Missing NodePath
36["Cap Start"]
%% face_code_ref=Missing NodePath
37["Cap End"]
%% face_code_ref=Missing NodePath
38["SweepEdge Opposite"]
39["SweepEdge Opposite"]
40["SweepEdge Opposite"]
41["SweepEdge Opposite"]
42["SweepEdge Opposite"]
43["SweepEdge Opposite"]
44["SweepEdge Opposite"]
45["SweepEdge Opposite"]
46["SweepEdge Adjacent"]
47["SweepEdge Adjacent"]
48["SweepEdge Adjacent"]
49["SweepEdge Adjacent"]
50["SweepEdge Adjacent"]
51["SweepEdge Adjacent"]
52["SweepEdge Adjacent"]
53["SweepEdge Adjacent"]
54["SweepEdge Adjacent"]
55["SweepEdge Adjacent"]
56["SweepEdge Adjacent"]
1 --- 3
2 --- 4
3 --- 5
3 --- 6
3 --- 7
3 --- 8
3 --- 9
3 --- 19
3 ---- 21
3 --- 23
4 --- 10
4 --- 11
4 --- 12
4 --- 13
4 --- 14
4 --- 15
4 --- 16
4 --- 17
4 --- 18
4 --- 20
4 ---- 22
4 --- 23
21 <--x 5
5 --- 27
5 x--> 46
21 <--x 6
6 --- 25
6 --- 46
21 <--x 7
7 --- 24
7 --- 47
21 <--x 8
8 --- 26
8 --- 48
10 --- 29
10 x--> 36
10 --- 45
10 --- 56
11 --- 34
11 x--> 36
11 --- 44
11 --- 55
12 --- 30
12 x--> 36
12 --- 43
12 --- 54
13 --- 35
13 x--> 36
13 --- 42
13 --- 53
14 --- 28
14 x--> 36
14 --- 41
14 --- 52
15 --- 32
15 x--> 36
15 --- 40
15 --- 51
16 --- 33
16 x--> 36
16 --- 39
16 --- 50
17 --- 31
17 x--> 36
17 --- 38
17 --- 49
21 --- 24
21 --- 25
21 --- 26
21 --- 27
21 --- 46
21 --- 47
21 --- 48
22 --- 28
22 --- 29
22 --- 30
22 --- 31
22 --- 32
22 --- 33
22 --- 34
22 --- 35
22 --- 36
22 --- 37
22 --- 38
22 --- 39
22 --- 40
22 --- 41
22 --- 42
22 --- 43
22 --- 44
22 --- 45
22 --- 49
22 --- 50
22 --- 51
22 --- 52
22 --- 53
22 --- 54
22 --- 55
22 --- 56
24 --- 47
25 --- 46
47 <--x 26
26 --- 48
27 --- 46
48 <--x 27
28 --- 41
51 <--x 28
28 --- 52
29 --- 45
55 <--x 29
29 --- 56
30 --- 43
53 <--x 30
30 --- 54
31 --- 38
31 --- 49
56 <--x 31
32 --- 40
50 <--x 32
32 --- 51
33 --- 39
49 <--x 33
33 --- 50
34 --- 44
54 <--x 34
34 --- 55
35 --- 42
52 <--x 35
35 --- 53
38 <--x 37
39 <--x 37
40 <--x 37
41 <--x 37
42 <--x 37
43 <--x 37
44 <--x 37
45 <--x 37
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
@settings(defaultLengthUnit = mm)
sketch001 = startSketchOn(YZ)
sketch001Profile000 = startProfile(sketch001, at = [5, 3])
|> yLine(length = -6)
|> xLine(length = 24.972)
|> yLine(length = 6)
|> xLine(length = -24.972)
|> close()
revolve000 = revolve(sketch001Profile000, axis = Y, angle = 360)
sketch003 = startSketchOn(XY)
sketch003Profile000 = startProfile(sketch003, at = [1.188246, 27.497102])
|> line(end = [-0.177089, 0.740791])
|> arc(
angleStart = 13.444444,
angleEnd = 38.628165,
radius = 5.283446,
)
|> arc(
angleStart = 145.295512,
angleEnd = 14.704488,
radius = 5.793095,
)
|> arc(
angleStart = 121.371835,
angleEnd = 146.555556,
radius = 5.283446,
)
|> line(end = [-0.419774, -0.635548])
|> arc(
angleStart = 326.170267,
angleEnd = 311.293981,
radius = 8.272375,
)
|> arc(
angleStart = 311.666667,
angleEnd = 208.333333,
radius = 3.178087,
)
|> tangentialArc(
endAbsolute = [1.188246, 27.497102]
)
// |> arc(
// angleStart = 208.706019,
// angleEnd = 193.829733,
// radius = 8.272375,
// )
|> close()
cut000Extrude = extrude([sketch003Profile000], length = 10, bidirectionalLength = 10)
subtract(revolve000, tools = cut000Extrude)

View File

@ -0,0 +1,217 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Operations executed subtract_regression09.kcl
---
[
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
{
"type": "KclStdLibCall",
"name": "revolve",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
},
"labeledArgs": {
"angle": {
"value": {
"type": "Number",
"value": 360.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"axis": {
"value": {
"type": "Object",
"value": {
"direction": {
"type": "Array",
"value": [
{
"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"
}
}
}
]
},
"origin": {
"type": "Array",
"value": [
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
{
"type": "Number",
"value": 0.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
}
]
}
}
},
"sourceRange": []
}
},
"sourceRange": []
},
{
"labeledArgs": {},
"name": "startSketchOn",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Plane",
"artifact_id": "[uuid]"
},
"sourceRange": []
}
},
{
"labeledArgs": {
"bidirectionalLength": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"length": {
"value": {
"type": "Number",
"value": 10.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
}
},
"name": "extrude",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Array",
"value": [
{
"type": "Sketch",
"value": {
"artifactId": "[uuid]"
}
}
]
},
"sourceRange": []
}
},
{
"labeledArgs": {
"tools": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
"name": "subtract",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
}
]

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,38 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing subtract_regression09.kcl
---
@settings(defaultLengthUnit = mm)
sketch001 = startSketchOn(YZ)
sketch001Profile000 = startProfile(sketch001, at = [5, 3])
|> yLine(length = -6)
|> xLine(length = 24.972)
|> yLine(length = 6)
|> xLine(length = -24.972)
|> close()
revolve000 = revolve(sketch001Profile000, axis = Y, angle = 360)
sketch003 = startSketchOn(XY)
sketch003Profile000 = startProfile(sketch003, at = [1.188246, 27.497102])
|> line(end = [-0.177089, 0.740791])
|> arc(angleStart = 13.444444, angleEnd = 38.628165, radius = 5.283446)
|> arc(angleStart = 145.295512, angleEnd = 14.704488, radius = 5.793095)
|> arc(angleStart = 121.371835, angleEnd = 146.555556, radius = 5.283446)
|> line(end = [-0.419774, -0.635548])
|> arc(angleStart = 326.170267, angleEnd = 311.293981, radius = 8.272375)
|> arc(angleStart = 311.666667, angleEnd = 208.333333, radius = 3.178087)
|> tangentialArc(endAbsolute = [1.188246, 27.497102])
// |> arc(
// angleStart = 208.706019,
// angleEnd = 193.829733,
// radius = 8.272375,
// )
|> close()
cut000Extrude = extrude([sketch003Profile000], length = 10, bidirectionalLength = 10)
subtract(revolve000, tools = cut000Extrude)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Artifact graph flowchart subtract_regression10.kcl
extension: md
snapshot_kind: binary
---

View File

@ -0,0 +1,672 @@
```mermaid
flowchart LR
subgraph path10 [Path]
10["Path<br>[497, 539, 0]"]
%% [ProgramBodyItem { index: 8 }, ExpressionStatementExpr, PipeBodyItem { index: 0 }]
20["Segment<br>[545, 608, 0]"]
%% [ProgramBodyItem { index: 8 }, ExpressionStatementExpr, PipeBodyItem { index: 1 }]
21["Segment<br>[614, 787, 0]"]
%% [ProgramBodyItem { index: 8 }, ExpressionStatementExpr, PipeBodyItem { index: 2 }]
22["Segment<br>[793, 857, 0]"]
%% [ProgramBodyItem { index: 8 }, ExpressionStatementExpr, PipeBodyItem { index: 3 }]
end
subgraph path11 [Path]
11["Path<br>[1105, 1249, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
23["Segment<br>[1255, 1279, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
24["Segment<br>[1285, 1303, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
25["Segment<br>[1309, 1327, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
26["Segment<br>[1333, 1351, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
27["Segment<br>[1357, 1374, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
28["Segment<br>[1380, 1398, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
29["Segment<br>[1404, 1422, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
30["Segment<br>[1428, 1446, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }]
31["Segment<br>[1452, 1469, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 10 }]
32["Segment<br>[1475, 1493, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 11 }]
33["Segment<br>[1499, 1517, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 12 }]
34["Segment<br>[1523, 1541, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 13 }]
35["Segment<br>[1547, 1564, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 14 }]
36["Segment<br>[1570, 1626, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 15 }]
37["Segment<br>[1632, 1650, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 16 }]
38["Segment<br>[1656, 1710, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 17 }]
39["Segment<br>[1716, 1760, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 18 }]
40["Segment<br>[1766, 1803, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 19 }]
41["Segment<br>[1809, 1865, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 20 }]
42["Segment<br>[1871, 1878, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 21 }]
85[Solid2d]
end
subgraph path12 [Path]
12["Path<br>[2014, 2178, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
43["Segment<br>[2184, 2217, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
44["Segment<br>[2223, 2244, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
45["Segment<br>[2250, 2287, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
46["Segment<br>[2293, 2349, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
47["Segment<br>[2355, 2362, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
89[Solid2d]
end
subgraph path13 [Path]
13["Path<br>[2795, 3000, 0]"]
%% [ProgramBodyItem { index: 13 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
48["Segment<br>[2795, 3000, 0]"]
%% [ProgramBodyItem { index: 13 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
90[Solid2d]
end
subgraph path14 [Path]
14["Path<br>[3228, 3394, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
49["Segment<br>[3400, 3418, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
50["Segment<br>[3424, 3606, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
51["Segment<br>[3612, 3634, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
52["Segment<br>[3640, 3662, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
53["Segment<br>[3692, 3699, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
87[Solid2d]
end
subgraph path15 [Path]
15["Path<br>[3956, 4116, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
54["Segment<br>[4122, 4186, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
55["Segment<br>[4192, 4229, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
56["Segment<br>[4235, 4299, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
57["Segment<br>[4305, 4343, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
58["Segment<br>[4349, 4413, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
59["Segment<br>[4419, 4482, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
60["Segment<br>[4488, 4552, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
61["Segment<br>[4558, 4596, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }]
62["Segment<br>[4602, 4666, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 10 }]
63["Segment<br>[4672, 4720, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 11 }]
64["Segment<br>[4726, 4822, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 12 }]
65["Segment<br>[4828, 4866, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 13 }]
66["Segment<br>[4872, 4936, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 14 }]
67["Segment<br>[4942, 4980, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 15 }]
68["Segment<br>[4986, 5050, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 16 }]
69["Segment<br>[5056, 5151, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 17 }]
70["Segment<br>[5157, 5257, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 18 }]
71["Segment<br>[5263, 5340, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 19 }]
72["Segment<br>[5374, 5381, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 21 }]
86[Solid2d]
end
subgraph path16 [Path]
16["Path<br>[5900, 5941, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
73["Segment<br>[5947, 5964, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
74["Segment<br>[5970, 6007, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
75["Segment<br>[6013, 6069, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
76["Segment<br>[6075, 6112, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
77["Segment<br>[6118, 6155, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
78["Segment<br>[6185, 6192, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
83[Solid2d]
end
subgraph path17 [Path]
17["Path<br>[6473, 6567, 0]"]
%% [ProgramBodyItem { index: 21 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
79["Segment<br>[6473, 6567, 0]"]
%% [ProgramBodyItem { index: 21 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
84[Solid2d]
end
subgraph path18 [Path]
18["Path<br>[6627, 6829, 0]"]
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
80["Segment<br>[6627, 6829, 0]"]
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
88[Solid2d]
end
subgraph path19 [Path]
19["Path<br>[7102, 7138, 0]"]
%% [ProgramBodyItem { index: 24 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
81["Segment<br>[7102, 7138, 0]"]
%% [ProgramBodyItem { index: 24 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
82[Solid2d]
end
1["Plane<br>[479, 496, 0]"]
%% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit]
2["Plane<br>[1082, 1099, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
3["Plane<br>[1991, 2008, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
4["Plane<br>[2772, 2789, 0]"]
%% [ProgramBodyItem { index: 13 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
5["Plane<br>[3205, 3222, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
6["Plane<br>[3933, 3950, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
7["Plane<br>[5861, 5894, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
8["Plane<br>[6443, 6460, 0]"]
%% [ProgramBodyItem { index: 20 }, VariableDeclarationDeclaration, VariableDeclarationInit]
9["Plane<br>[7063, 7096, 0]"]
%% [ProgramBodyItem { index: 24 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
91["Sweep Revolve<br>[1884, 1914, 0]"]
%% [ProgramBodyItem { index: 9 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 22 }]
92["Sweep Extrusion<br>[2368, 2407, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
93["Sweep Extrusion<br>[3006, 3046, 0]"]
%% [ProgramBodyItem { index: 13 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
94["Sweep Extrusion<br>[3705, 3744, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
95["Sweep Extrusion<br>[5387, 5425, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 22 }]
96["Sweep Extrusion<br>[6198, 6237, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }]
97["Sweep Extrusion<br>[6573, 6611, 0]"]
%% [ProgramBodyItem { index: 21 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
98["Sweep Extrusion<br>[6835, 6873, 0]"]
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
99["Sweep Extrusion<br>[7278, 7299, 0]"]
%% [ProgramBodyItem { index: 24 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
100["Sweep Extrusion<br>[7278, 7299, 0]"]
%% [ProgramBodyItem { index: 24 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
101["CompositeSolid Union<br>[6973, 7005, 0]"]
%% [ProgramBodyItem { index: 23 }, VariableDeclarationDeclaration, VariableDeclarationInit, CallKwArg { index: 0 }]
102["CompositeSolid Subtract<br>[2677, 2725, 0]"]
%% [ProgramBodyItem { index: 12 }, VariableDeclarationDeclaration, VariableDeclarationInit]
103["CompositeSolid Union<br>[7355, 7371, 0]"]
%% [ProgramBodyItem { index: 25 }, VariableDeclarationDeclaration, VariableDeclarationInit, CallKwArg { index: 0 }]
104["CompositeSolid Intersect<br>[6268, 6327, 0]"]
%% [ProgramBodyItem { index: 19 }, VariableDeclarationDeclaration, VariableDeclarationInit]
105["CompositeSolid Subtract<br>[3781, 3825, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit]
106["CompositeSolid Union<br>[2708, 2724, 0]"]
%% [ProgramBodyItem { index: 12 }, VariableDeclarationDeclaration, VariableDeclarationInit, CallKwArg { index: 0 }]
107["CompositeSolid Subtract<br>[7317, 7372, 0]"]
%% [ProgramBodyItem { index: 25 }, VariableDeclarationDeclaration, VariableDeclarationInit]
108["CompositeSolid Subtract<br>[6926, 7006, 0]"]
%% [ProgramBodyItem { index: 23 }, VariableDeclarationDeclaration, VariableDeclarationInit]
109[Wall]
%% face_code_ref=Missing NodePath
110[Wall]
%% face_code_ref=Missing NodePath
111[Wall]
%% face_code_ref=Missing NodePath
112[Wall]
%% face_code_ref=Missing NodePath
113[Wall]
%% face_code_ref=Missing NodePath
114[Wall]
%% face_code_ref=Missing NodePath
115[Wall]
%% face_code_ref=Missing NodePath
116[Wall]
%% face_code_ref=Missing NodePath
117[Wall]
%% face_code_ref=Missing NodePath
118[Wall]
%% face_code_ref=Missing NodePath
119[Wall]
%% face_code_ref=Missing NodePath
120[Wall]
%% face_code_ref=Missing NodePath
121[Wall]
%% face_code_ref=Missing NodePath
122[Wall]
%% face_code_ref=Missing NodePath
123[Wall]
%% face_code_ref=Missing NodePath
124[Wall]
%% face_code_ref=Missing NodePath
125[Wall]
%% face_code_ref=Missing NodePath
126[Wall]
%% face_code_ref=Missing NodePath
127[Wall]
%% face_code_ref=Missing NodePath
128[Wall]
%% face_code_ref=Missing NodePath
129[Wall]
%% face_code_ref=Missing NodePath
130[Wall]
%% face_code_ref=Missing NodePath
131[Wall]
%% face_code_ref=Missing NodePath
132[Wall]
%% face_code_ref=Missing NodePath
133[Wall]
%% face_code_ref=Missing NodePath
134[Wall]
%% face_code_ref=Missing NodePath
135[Wall]
%% face_code_ref=Missing NodePath
136["Cap Start"]
%% face_code_ref=Missing NodePath
137["Cap Start"]
%% face_code_ref=Missing NodePath
138["Cap Start"]
%% face_code_ref=Missing NodePath
139["Cap Start"]
%% face_code_ref=Missing NodePath
140["Cap Start"]
%% face_code_ref=Missing NodePath
141["Cap End"]
%% face_code_ref=Missing NodePath
142["Cap End"]
%% face_code_ref=Missing NodePath
143["Cap End"]
%% face_code_ref=Missing NodePath
144["Cap End"]
%% face_code_ref=Missing NodePath
145["Cap End"]
%% face_code_ref=Missing NodePath
146["SweepEdge Opposite"]
147["SweepEdge Opposite"]
148["SweepEdge Opposite"]
149["SweepEdge Opposite"]
150["SweepEdge Opposite"]
151["SweepEdge Opposite"]
152["SweepEdge Opposite"]
153["SweepEdge Opposite"]
154["SweepEdge Adjacent"]
155["SweepEdge Adjacent"]
156["SweepEdge Adjacent"]
157["SweepEdge Adjacent"]
158["SweepEdge Adjacent"]
159["SweepEdge Adjacent"]
160["SweepEdge Adjacent"]
161["SweepEdge Adjacent"]
162["SweepEdge Adjacent"]
163["SweepEdge Adjacent"]
164["SweepEdge Adjacent"]
165["SweepEdge Adjacent"]
166["SweepEdge Adjacent"]
167["SweepEdge Adjacent"]
168["SweepEdge Adjacent"]
169["SweepEdge Adjacent"]
170["SweepEdge Adjacent"]
171["SweepEdge Adjacent"]
172["SweepEdge Adjacent"]
173["SweepEdge Adjacent"]
174["SweepEdge Adjacent"]
175["SweepEdge Adjacent"]
176["SweepEdge Adjacent"]
177["SweepEdge Adjacent"]
178["SweepEdge Adjacent"]
179["SweepEdge Adjacent"]
180["EdgeCut Fillet<br>[3052, 3126, 0]"]
%% [ProgramBodyItem { index: 13 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
181["EdgeCut Fillet<br>[3052, 3126, 0]"]
%% [ProgramBodyItem { index: 13 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
1 --- 10
2 --- 11
3 --- 12
4 --- 13
5 --- 14
6 --- 15
7 --- 16
8 --- 17
8 --- 18
9 --- 19
10 --- 20
10 --- 21
10 --- 22
11 --- 23
11 --- 24
11 --- 25
11 --- 26
11 --- 27
11 --- 28
11 --- 29
11 --- 30
11 --- 31
11 --- 32
11 --- 33
11 --- 34
11 --- 35
11 --- 36
11 --- 37
11 --- 38
11 --- 39
11 --- 40
11 --- 41
11 --- 42
11 --- 85
11 ---- 91
11 --- 102
12 --- 43
12 --- 44
12 --- 45
12 --- 46
12 --- 47
12 --- 89
12 ---- 92
12 --- 106
13 --- 48
13 --- 90
13 ---- 93
14 --- 49
14 --- 50
14 --- 51
14 --- 52
14 --- 53
14 --- 87
14 ---- 94
14 --- 105
15 --- 54
15 --- 55
15 --- 56
15 --- 57
15 --- 58
15 --- 59
15 --- 60
15 --- 61
15 --- 62
15 --- 63
15 --- 64
15 --- 65
15 --- 66
15 --- 67
15 --- 68
15 --- 69
15 --- 70
15 --- 71
15 --- 72
15 --- 86
15 ---- 95
15 --- 104
16 --- 73
16 --- 74
16 --- 75
16 --- 76
16 --- 77
16 --- 78
16 --- 83
16 ---- 96
16 --- 104
17 --- 79
17 --- 84
17 ---- 97
17 --- 101
18 --- 80
18 --- 88
18 ---- 98
18 --- 101
19 --- 81
19 --- 82
19 ---- 99
19 --- 103
91 <--x 23
23 --- 127
23 x--> 155
91 <--x 24
24 --- 114
24 --- 155
91 <--x 25
25 --- 115
25 --- 156
91 <--x 26
26 --- 128
26 --- 157
91 <--x 27
27 --- 124
27 --- 158
91 <--x 28
28 --- 119
28 --- 159
91 <--x 29
29 --- 112
29 --- 160
91 <--x 30
30 --- 125
30 --- 161
91 <--x 31
31 --- 113
31 --- 162
91 <--x 32
32 --- 126
32 --- 163
91 <--x 33
33 --- 111
33 --- 164
91 <--x 34
34 --- 122
34 --- 165
91 <--x 35
35 --- 123
35 --- 166
91 <--x 36
36 --- 120
36 --- 167
91 <--x 37
37 --- 121
37 --- 168
91 <--x 38
38 --- 118
38 --- 169
91 <--x 39
39 --- 116
39 --- 170
91 <--x 40
40 --- 117
40 --- 171
91 <--x 41
41 --- 110
41 --- 172
43 --- 132
43 x--> 138
43 --- 150
43 --- 176
44 --- 133
44 x--> 138
44 --- 151
44 --- 177
45 --- 134
45 x--> 138
45 --- 152
45 --- 178
46 --- 135
46 x--> 138
46 --- 153
46 --- 179
48 --- 130
48 x--> 137
48 --- 148
48 --- 174
48 --- 181
79 --- 131
79 x--> 139
79 --- 149
79 --- 175
80 --- 129
80 x--> 136
80 --- 147
80 --- 173
81 --- 109
81 x--> 140
81 --- 146
81 --- 154
91 --- 110
91 --- 111
91 --- 112
91 --- 113
91 --- 114
91 --- 115
91 --- 116
91 --- 117
91 --- 118
91 --- 119
91 --- 120
91 --- 121
91 --- 122
91 --- 123
91 --- 124
91 --- 125
91 --- 126
91 --- 127
91 --- 128
91 --- 155
91 --- 156
91 --- 157
91 --- 158
91 --- 159
91 --- 160
91 --- 161
91 --- 162
91 --- 163
91 --- 164
91 --- 165
91 --- 166
91 --- 167
91 --- 168
91 --- 169
91 --- 170
91 --- 171
91 --- 172
92 --- 132
92 --- 133
92 --- 134
92 --- 135
92 --- 138
92 --- 143
92 --- 150
92 --- 151
92 --- 152
92 --- 153
92 --- 176
92 --- 177
92 --- 178
92 --- 179
93 --- 130
93 --- 137
93 --- 142
93 --- 148
93 --- 174
97 --- 131
97 --- 139
97 --- 144
97 --- 149
97 --- 175
98 --- 129
98 --- 136
98 --- 141
98 --- 147
98 --- 173
99 --- 109
99 --- 140
99 --- 145
99 --- 146
99 --- 154
101 --- 108
102 --- 105
106 --- 102
103 --- 107
104 --- 108
108 --- 107
109 --- 146
109 --- 154
171 <--x 110
110 --- 172
163 <--x 111
111 --- 164
159 <--x 112
112 --- 160
161 <--x 113
113 --- 162
114 --- 155
115 --- 156
169 <--x 116
116 --- 170
170 <--x 117
117 --- 171
168 <--x 118
118 --- 169
158 <--x 119
119 --- 159
166 <--x 120
120 --- 167
167 <--x 121
121 --- 168
164 <--x 122
122 --- 165
165 <--x 123
123 --- 166
157 <--x 124
124 --- 158
160 <--x 125
125 --- 161
162 <--x 126
126 --- 163
127 --- 155
172 <--x 127
156 <--x 128
128 --- 157
129 --- 147
129 --- 173
130 --- 148
130 --- 174
131 --- 149
131 --- 175
132 --- 150
132 --- 176
179 <--x 132
133 --- 151
176 <--x 133
133 --- 177
134 --- 152
177 <--x 134
134 --- 178
135 --- 153
178 <--x 135
135 --- 179
147 <--x 141
148 <--x 142
150 <--x 143
151 <--x 143
152 <--x 143
153 <--x 143
149 <--x 144
146 <--x 145
148 <--x 180
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,205 @@
// Piston
// A piston is the component of an engine that transfers linear motion into circular motion. The piston head is accelerated by exploding fuel, which drives a connecting rod to rotate a crankshaft.
// Set units
@settings(defaultLengthUnit = mm)
// Define parameters
stroke = 110
bore = 92
pistonHeight = 75
crankPos = 40deg
crankRadius = 36
pinHeight = 35
rodLength = 201.2
// A simple sketch to define piston position at different crank parameters
kinematicSketch = startSketchOn(XZ)
startProfile(kinematicSketch, at = [0, 0])
|> angledLine(angle = crankPos, length = stroke / 2, tag = $seg01)
|> line(
endAbsolute = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
tag = $seg02,
)
|> angledLine(angle = segAng(seg02) - 90, length = 1, tag = $seg03)
// Sketch a profile with a total width equal to half the bore of the piston head. Include lands and gaps for compression rings. Then revolve the profile about the center axis to form the start of a piston head
pistonBore = startSketchOn(XZ)
|> startProfile(at = [
0.1,
pinHeight + stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
])
|> xLine(length = bore / 2)
|> yLine(length = -3)
|> xLine(length = -3)
|> yLine(length = -2)
|> xLine(length = 3)
|> yLine(length = -3)
|> xLine(length = -3)
|> yLine(length = -2)
|> xLine(length = 3)
|> yLine(length = -3)
|> xLine(length = -3)
|> yLine(length = -2)
|> xLine(length = 3)
|> yLine(endAbsolute = profileStartY(%) - pistonHeight - 3)
|> xLine(length = -8)
|> yLine(endAbsolute = profileStartY(%) - 8 - (bore / 4))
|> tangentialArc(angle = 90, radius = bore / 4)
|> xLine(endAbsolute = profileStartX(%))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve(angle = 360, axis = Y)
// Create a square profile divot to subtract from the piston head
divots = startSketchOn(YZ)
|> startProfile(at = [
bore / 2 - 6,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2)) + pistonHeight / 4 / 2
])
|> yLine(length = -pistonHeight / 4)
|> xLine(length = 25.75)
|> yLine(endAbsolute = profileStartY(%))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 314, symmetric = true)
// Rotate another divot to the opposite side
cutDivots = patternCircular3d(
divots,
instances = 2,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = true,
)
// Cut the divots from the piston head
// WORKED PREVIOUSLY
pistonDiv = subtract([pistonBore], tools = union(cutDivots))
// Extrude and fillet a wrist pin
wristPin = startSketchOn(XZ)
|> circle(
center = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
radius = pistonHeight / 10,
tag = $seg04,
)
|> extrude(length = bore, symmetric = true)
|> fillet(radius = pistonHeight / 40, tags = [getOppositeEdge(seg04), seg04])
// Cut a rounded profile to arc the bottom of the piston skirt
pistonSkirt = startSketchOn(XZ)
|> startProfile(at = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2)) + pinHeight - (pistonHeight * 0.95)
])
|> xLine(length = .1)
|> tangentialArc(endAbsolute = [
bore / 2 + 4,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2)) + pinHeight - pistonHeight - 3
])
|> yLine(endAbsolute = 0)
|> xLine(endAbsolute = 0)
|> mirror2d(axis = Y)
|> close()
|> extrude(length = 314, symmetric = true)
// WORKED PREVIOUSLY
pistonHead = subtract([pistonDiv], tools = [pistonSkirt])
// Create a connecting rod that spans from the crank position to the piston height
connectingRodProfile = startSketchOn(XZ)
|> startProfile(at = [
segEndX(seg01) - (1.25 * crankRadius * cos(segAng(seg02))),
segEndY(seg01) - (1.25 * crankRadius * sin(segAng(seg02)))
])
|> angledLine(angle = segAng(seg02) - 90, length = crankRadius / 2)
|> tangentialArc(angle = 45, radius = 5)
|> angledLine(angle = segAng(seg02) - 45, length = crankRadius / 2)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) - 90, length = crankRadius / 2)
|> angledLine(angle = segAng(seg02), length = crankRadius * 1.625)
|> angledLine(angle = segAng(seg02) + 90, length = crankRadius / 2)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) + 45, length = crankRadius / 2)
|> tangentialArc(angle = -45, radius = crankRadius)
|> angledLineThatIntersects(angle = segAng(seg02), intersectTag = seg03, offset = -crankRadius / 2)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) - 45, length = crankRadius / 5)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) - 90, length = crankRadius / 5)
|> angledLineThatIntersects(angle = segAng(seg02), intersectTag = seg03, offset = crankRadius / 3)
|> angledLineThatIntersects(angle = segAng(seg02) + 45, intersectTag = seg03, offset = crankRadius / 2)
|> angledLineThatIntersects(%, angle = segAng(seg02) + 90, intersectTag = seg02)
|> mirror2d(axis = seg02)
|> close()
|> extrude(length = 54, symmetric = true)
// Define a plane perpendicular to the connecting rod
connectingRodPlane = {
origin = [
0,
0.0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
xAxis = [
-1 * sin(segAng(seg02)),
0,
1 * cos(segAng(seg02))
],
yAxis = [0.0, 1.0, 0.0]
}
// Extrude an oval profile through the connecting rod to define its boundaries in the other dimensions
connectingRodShape = startSketchOn(connectingRodPlane)
|> startProfile(at = [crankRadius * 1.5, 0])
|> yLine(length = 4)
|> tangentialArc(angle = 80, radius = 8)
|> tangentialArc(endAbsolute = [-lastSegX(%), lastSegY(%)])
|> tangentialArc(angle = 80, radius = 8)
|> yLine(endAbsolute = profileStartY(%))
|> mirror2d(axis = X)
|> close()
|> extrude(length = 554, symmetric = true)
connectingRodShapeSubtract = intersect([
connectingRodProfile,
connectingRodShape
])
// Bore holes in the connecting rod for the wrist pin and crank
// REPLACED POLYGON CUTS WITH CIRCLES
boreHoles = startSketchOn(XZ)
crankBore = circle(boreHoles, center = polar(angle = crankPos, length = stroke / 2), radius = crankRadius)
|> extrude(length = 54, symmetric = true)
wristPinHole = circle(
boreHoles,
center = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
radius = pistonHeight / 10,
)
|> extrude(length = 54, symmetric = true)
// Subtract out the bore holes
connectingRodBore = subtract([connectingRodShapeSubtract], tools = union([wristPinHole, crankBore]))
// Bore holes for the connecting rod bolts
boltHoles = startSketchOn(connectingRodPlane)
|> circle(center = [45, 0], radius = 5)
|> patternCircular2d(
instances = 2,
center = [0, 0],
arcDegrees = 360,
rotateDuplicates = true,
)
|> extrude(length = 300)
connectingRod = subtract([connectingRodBore], tools = union(boltHoles))

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

View File

@ -0,0 +1,209 @@
---
source: kcl-lib/src/simulation_tests.rs
description: Result of unparsing subtract_regression10.kcl
---
// Piston
// A piston is the component of an engine that transfers linear motion into circular motion. The piston head is accelerated by exploding fuel, which drives a connecting rod to rotate a crankshaft.
// Set units
@settings(defaultLengthUnit = mm)
// Define parameters
stroke = 110
bore = 92
pistonHeight = 75
crankPos = 40deg
crankRadius = 36
pinHeight = 35
rodLength = 201.2
// A simple sketch to define piston position at different crank parameters
kinematicSketch = startSketchOn(XZ)
startProfile(kinematicSketch, at = [0, 0])
|> angledLine(angle = crankPos, length = stroke / 2, tag = $seg01)
|> line(
endAbsolute = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
tag = $seg02,
)
|> angledLine(angle = segAng(seg02) - 90, length = 1, tag = $seg03)
// Sketch a profile with a total width equal to half the bore of the piston head. Include lands and gaps for compression rings. Then revolve the profile about the center axis to form the start of a piston head
pistonBore = startSketchOn(XZ)
|> startProfile(at = [
0.1,
pinHeight + stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
])
|> xLine(length = bore / 2)
|> yLine(length = -3)
|> xLine(length = -3)
|> yLine(length = -2)
|> xLine(length = 3)
|> yLine(length = -3)
|> xLine(length = -3)
|> yLine(length = -2)
|> xLine(length = 3)
|> yLine(length = -3)
|> xLine(length = -3)
|> yLine(length = -2)
|> xLine(length = 3)
|> yLine(endAbsolute = profileStartY(%) - pistonHeight - 3)
|> xLine(length = -8)
|> yLine(endAbsolute = profileStartY(%) - 8 - (bore / 4))
|> tangentialArc(angle = 90, radius = bore / 4)
|> xLine(endAbsolute = profileStartX(%))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> revolve(angle = 360, axis = Y)
// Create a square profile divot to subtract from the piston head
divots = startSketchOn(YZ)
|> startProfile(at = [
bore / 2 - 6,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2)) + pistonHeight / 4 / 2
])
|> yLine(length = -pistonHeight / 4)
|> xLine(length = 25.75)
|> yLine(endAbsolute = profileStartY(%))
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
|> extrude(length = 314, symmetric = true)
// Rotate another divot to the opposite side
cutDivots = patternCircular3d(
divots,
instances = 2,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = true,
)
// Cut the divots from the piston head
// WORKED PREVIOUSLY
pistonDiv = subtract([pistonBore], tools = union(cutDivots))
// Extrude and fillet a wrist pin
wristPin = startSketchOn(XZ)
|> circle(
center = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
radius = pistonHeight / 10,
tag = $seg04,
)
|> extrude(length = bore, symmetric = true)
|> fillet(radius = pistonHeight / 40, tags = [getOppositeEdge(seg04), seg04])
// Cut a rounded profile to arc the bottom of the piston skirt
pistonSkirt = startSketchOn(XZ)
|> startProfile(at = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2)) + pinHeight - (pistonHeight * 0.95)
])
|> xLine(length = .1)
|> tangentialArc(endAbsolute = [
bore / 2 + 4,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2)) + pinHeight - pistonHeight - 3
])
|> yLine(endAbsolute = 0)
|> xLine(endAbsolute = 0)
|> mirror2d(axis = Y)
|> close()
|> extrude(length = 314, symmetric = true)
// WORKED PREVIOUSLY
pistonHead = subtract([pistonDiv], tools = [pistonSkirt])
// Create a connecting rod that spans from the crank position to the piston height
connectingRodProfile = startSketchOn(XZ)
|> startProfile(at = [
segEndX(seg01) - (1.25 * crankRadius * cos(segAng(seg02))),
segEndY(seg01) - (1.25 * crankRadius * sin(segAng(seg02)))
])
|> angledLine(angle = segAng(seg02) - 90, length = crankRadius / 2)
|> tangentialArc(angle = 45, radius = 5)
|> angledLine(angle = segAng(seg02) - 45, length = crankRadius / 2)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) - 90, length = crankRadius / 2)
|> angledLine(angle = segAng(seg02), length = crankRadius * 1.625)
|> angledLine(angle = segAng(seg02) + 90, length = crankRadius / 2)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) + 45, length = crankRadius / 2)
|> tangentialArc(angle = -45, radius = crankRadius)
|> angledLineThatIntersects(angle = segAng(seg02), intersectTag = seg03, offset = -crankRadius / 2)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) - 45, length = crankRadius / 5)
|> tangentialArc(angle = -45, radius = 5)
|> angledLine(angle = segAng(seg02) - 90, length = crankRadius / 5)
|> angledLineThatIntersects(angle = segAng(seg02), intersectTag = seg03, offset = crankRadius / 3)
|> angledLineThatIntersects(angle = segAng(seg02) + 45, intersectTag = seg03, offset = crankRadius / 2)
|> angledLineThatIntersects(%, angle = segAng(seg02) + 90, intersectTag = seg02)
|> mirror2d(axis = seg02)
|> close()
|> extrude(length = 54, symmetric = true)
// Define a plane perpendicular to the connecting rod
connectingRodPlane = {
origin = [
0,
0.0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
xAxis = [
-1 * sin(segAng(seg02)),
0,
1 * cos(segAng(seg02))
],
yAxis = [0.0, 1.0, 0.0]
}
// Extrude an oval profile through the connecting rod to define its boundaries in the other dimensions
connectingRodShape = startSketchOn(connectingRodPlane)
|> startProfile(at = [crankRadius * 1.5, 0])
|> yLine(length = 4)
|> tangentialArc(angle = 80, radius = 8)
|> tangentialArc(endAbsolute = [-lastSegX(%), lastSegY(%)])
|> tangentialArc(angle = 80, radius = 8)
|> yLine(endAbsolute = profileStartY(%))
|> mirror2d(axis = X)
|> close()
|> extrude(length = 554, symmetric = true)
connectingRodShapeSubtract = intersect([
connectingRodProfile,
connectingRodShape
])
// Bore holes in the connecting rod for the wrist pin and crank
// REPLACED POLYGON CUTS WITH CIRCLES
boreHoles = startSketchOn(XZ)
crankBore = circle(boreHoles, center = polar(angle = crankPos, length = stroke / 2), radius = crankRadius)
|> extrude(length = 54, symmetric = true)
wristPinHole = circle(
boreHoles,
center = [
0,
stroke / 2 * sin(crankPos) + sqrt(rodLength ^ 2 - ((stroke / 2 * cos(crankPos)) ^ 2))
],
radius = pistonHeight / 10,
)
|> extrude(length = 54, symmetric = true)
// Subtract out the bore holes
connectingRodBore = subtract([connectingRodShapeSubtract], tools = union([wristPinHole, crankBore]))
// Bore holes for the connecting rod bolts
boltHoles = startSketchOn(connectingRodPlane)
|> circle(center = [45, 0], radius = 5)
|> patternCircular2d(
instances = 2,
center = [0, 0],
arcDegrees = 360,
rotateDuplicates = true,
)
|> extrude(length = 300)
connectingRod = subtract([connectingRodBore], tools = union(boltHoles))