coerce [single, HomArray[single]] into flattened HomArray (#6299)
* dont prompt for message in git tag Signed-off-by: Jess Frazelle <github@jessfraz.com> * more tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -1045,24 +1045,49 @@ impl KclValue {
|
|||||||
exec_state: &mut ExecState,
|
exec_state: &mut ExecState,
|
||||||
allow_shrink: bool,
|
allow_shrink: bool,
|
||||||
) -> Result<KclValue, CoercionError> {
|
) -> Result<KclValue, CoercionError> {
|
||||||
|
if len.satisfied(1, false).is_some() && self.has_type(ty) {
|
||||||
|
return Ok(KclValue::HomArray {
|
||||||
|
value: vec![self.clone()],
|
||||||
|
ty: ty.clone(),
|
||||||
|
});
|
||||||
|
}
|
||||||
match self {
|
match self {
|
||||||
KclValue::HomArray { value, ty: aty } if aty.subtype(ty) => len
|
KclValue::HomArray { value, ty: aty } => {
|
||||||
.satisfied(value.len(), allow_shrink)
|
if aty.subtype(ty) {
|
||||||
|
len.satisfied(value.len(), allow_shrink)
|
||||||
.map(|len| KclValue::HomArray {
|
.map(|len| KclValue::HomArray {
|
||||||
value: value[..len].to_vec(),
|
value: value[..len].to_vec(),
|
||||||
ty: aty.clone(),
|
ty: aty.clone(),
|
||||||
})
|
})
|
||||||
.ok_or(self.into()),
|
.ok_or(self.into())
|
||||||
value if len.satisfied(1, false).is_some() && value.has_type(ty) => Ok(KclValue::HomArray {
|
} else {
|
||||||
value: vec![value.clone()],
|
Err(self.into())
|
||||||
ty: ty.clone(),
|
}
|
||||||
}),
|
}
|
||||||
KclValue::MixedArray { value, .. } => {
|
KclValue::MixedArray { value, .. } => {
|
||||||
|
// Check if we have a nested homogeneous array that we can flatten.
|
||||||
|
let mut values = Vec::new();
|
||||||
|
for item in value {
|
||||||
|
if let KclValue::HomArray {
|
||||||
|
ty: inner_ty,
|
||||||
|
value: inner_value,
|
||||||
|
} = item
|
||||||
|
{
|
||||||
|
if inner_ty.subtype(ty) {
|
||||||
|
values.extend(inner_value.iter().cloned());
|
||||||
|
} else {
|
||||||
|
values.push(item.clone());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
values.push(item.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let len = len
|
let len = len
|
||||||
.satisfied(value.len(), allow_shrink)
|
.satisfied(values.len(), allow_shrink)
|
||||||
.ok_or(CoercionError::from(self))?;
|
.ok_or(CoercionError::from(self))?;
|
||||||
|
|
||||||
let value = value[..len]
|
let value = values[..len]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|v| v.coerce(ty, exec_state))
|
.map(|v| v.coerce(ty, exec_state))
|
||||||
.collect::<Result<Vec<_>, _>>()?;
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
@ -2482,3 +2482,45 @@ mod intersect_cubes {
|
|||||||
super::execute(TEST_NAME, true).await
|
super::execute(TEST_NAME, true).await
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mod pattern_into_union {
|
||||||
|
const TEST_NAME: &str = "pattern_into_union";
|
||||||
|
|
||||||
|
/// 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_doesnt_need_brackets {
|
||||||
|
const TEST_NAME: &str = "subtract_doesnt_need_brackets";
|
||||||
|
|
||||||
|
/// 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -48,7 +48,6 @@ flowchart LR
|
|||||||
42["SweepEdge Adjacent"]
|
42["SweepEdge Adjacent"]
|
||||||
43["SweepEdge Opposite"]
|
43["SweepEdge Opposite"]
|
||||||
44["SweepEdge Adjacent"]
|
44["SweepEdge Adjacent"]
|
||||||
45["CompositeSolid Intersect<br>[448, 477, 0]"]
|
|
||||||
1 --- 2
|
1 --- 2
|
||||||
2 --- 3
|
2 --- 3
|
||||||
2 --- 4
|
2 --- 4
|
||||||
@ -115,6 +114,4 @@ flowchart LR
|
|||||||
30 --- 42
|
30 --- 42
|
||||||
30 --- 43
|
30 --- 43
|
||||||
30 --- 44
|
30 --- 44
|
||||||
2 <--x 45
|
|
||||||
24 <--x 45
|
|
||||||
```
|
```
|
||||||
|
@ -7,9 +7,6 @@ description: Variables in memory after executing intersect_cubes.kcl
|
|||||||
"type": "Function"
|
"type": "Function"
|
||||||
},
|
},
|
||||||
"fullPart": {
|
"fullPart": {
|
||||||
"type": "HomArray",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -187,186 +184,6 @@ description: Variables in memory after executing intersect_cubes.kcl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"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": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
-10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"on": {
|
|
||||||
"type": "plane",
|
|
||||||
"id": "[uuid]",
|
|
||||||
"artifactId": "[uuid]",
|
|
||||||
"value": "XY",
|
|
||||||
"origin": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"xAxis": {
|
|
||||||
"x": 1.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"yAxis": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 1.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"zAxis": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 1.0
|
|
||||||
},
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"from": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
},
|
|
||||||
"tag": null,
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"artifactId": "[uuid]",
|
|
||||||
"originalId": "[uuid]",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"height": 20.0,
|
|
||||||
"startCapId": "[uuid]",
|
|
||||||
"endCapId": "[uuid]",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
|
2212
rust/kcl-lib/tests/pattern_into_union/artifact_commands.snap
Normal file
2212
rust/kcl-lib/tests/pattern_into_union/artifact_commands.snap
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart pattern_into_union.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,218 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[412, 437, 0]"]
|
||||||
|
3["Segment<br>[443, 484, 0]"]
|
||||||
|
4["Segment<br>[490, 536, 0]"]
|
||||||
|
5["Segment<br>[542, 567, 0]"]
|
||||||
|
6["Segment<br>[573, 604, 0]"]
|
||||||
|
7["Segment<br>[610, 639, 0]"]
|
||||||
|
8["Segment<br>[645, 691, 0]"]
|
||||||
|
9["Segment<br>[697, 732, 0]"]
|
||||||
|
10["Segment<br>[738, 745, 0]"]
|
||||||
|
11[Solid2d]
|
||||||
|
end
|
||||||
|
subgraph path40 [Path]
|
||||||
|
40["Path<br>[810, 851, 0]"]
|
||||||
|
41["Segment<br>[857, 900, 0]"]
|
||||||
|
42["Segment<br>[906, 1006, 0]"]
|
||||||
|
43["Segment<br>[1012, 1041, 0]"]
|
||||||
|
44["Segment<br>[1047, 1054, 0]"]
|
||||||
|
45[Solid2d]
|
||||||
|
end
|
||||||
|
subgraph path62 [Path]
|
||||||
|
62["Path<br>[1384, 1433, 0]"]
|
||||||
|
63["Segment<br>[1439, 1479, 0]"]
|
||||||
|
64["Segment<br>[1485, 1585, 0]"]
|
||||||
|
65["Segment<br>[1591, 1628, 0]"]
|
||||||
|
66["Segment<br>[1634, 1641, 0]"]
|
||||||
|
67[Solid2d]
|
||||||
|
end
|
||||||
|
1["Plane<br>[389, 406, 0]"]
|
||||||
|
12["Sweep Extrusion<br>[751, 775, 0]"]
|
||||||
|
13[Wall]
|
||||||
|
14[Wall]
|
||||||
|
15[Wall]
|
||||||
|
16[Wall]
|
||||||
|
17[Wall]
|
||||||
|
18[Wall]
|
||||||
|
19[Wall]
|
||||||
|
20[Wall]
|
||||||
|
21["Cap Start"]
|
||||||
|
22["Cap End"]
|
||||||
|
23["SweepEdge Opposite"]
|
||||||
|
24["SweepEdge Adjacent"]
|
||||||
|
25["SweepEdge Opposite"]
|
||||||
|
26["SweepEdge Adjacent"]
|
||||||
|
27["SweepEdge Opposite"]
|
||||||
|
28["SweepEdge Adjacent"]
|
||||||
|
29["SweepEdge Opposite"]
|
||||||
|
30["SweepEdge Adjacent"]
|
||||||
|
31["SweepEdge Opposite"]
|
||||||
|
32["SweepEdge Adjacent"]
|
||||||
|
33["SweepEdge Opposite"]
|
||||||
|
34["SweepEdge Adjacent"]
|
||||||
|
35["SweepEdge Opposite"]
|
||||||
|
36["SweepEdge Adjacent"]
|
||||||
|
37["SweepEdge Opposite"]
|
||||||
|
38["SweepEdge Adjacent"]
|
||||||
|
39["Plane<br>[787, 804, 0]"]
|
||||||
|
46["Sweep Extrusion<br>[1060, 1098, 0]"]
|
||||||
|
47[Wall]
|
||||||
|
48[Wall]
|
||||||
|
49[Wall]
|
||||||
|
50[Wall]
|
||||||
|
51["Cap Start"]
|
||||||
|
52["Cap End"]
|
||||||
|
53["SweepEdge Opposite"]
|
||||||
|
54["SweepEdge Adjacent"]
|
||||||
|
55["SweepEdge Opposite"]
|
||||||
|
56["SweepEdge Adjacent"]
|
||||||
|
57["SweepEdge Opposite"]
|
||||||
|
58["SweepEdge Adjacent"]
|
||||||
|
59["SweepEdge Opposite"]
|
||||||
|
60["SweepEdge Adjacent"]
|
||||||
|
61["Plane<br>[1361, 1378, 0]"]
|
||||||
|
68["Sweep Extrusion<br>[1647, 1685, 0]"]
|
||||||
|
69[Wall]
|
||||||
|
70[Wall]
|
||||||
|
71[Wall]
|
||||||
|
72[Wall]
|
||||||
|
73["Cap Start"]
|
||||||
|
74["Cap End"]
|
||||||
|
75["SweepEdge Opposite"]
|
||||||
|
76["SweepEdge Adjacent"]
|
||||||
|
77["SweepEdge Opposite"]
|
||||||
|
78["SweepEdge Adjacent"]
|
||||||
|
79["SweepEdge Opposite"]
|
||||||
|
80["SweepEdge Adjacent"]
|
||||||
|
81["SweepEdge Opposite"]
|
||||||
|
82["SweepEdge Adjacent"]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
2 --- 4
|
||||||
|
2 --- 5
|
||||||
|
2 --- 6
|
||||||
|
2 --- 7
|
||||||
|
2 --- 8
|
||||||
|
2 --- 9
|
||||||
|
2 --- 10
|
||||||
|
2 ---- 12
|
||||||
|
2 --- 11
|
||||||
|
3 --- 13
|
||||||
|
3 --- 23
|
||||||
|
3 --- 24
|
||||||
|
4 --- 14
|
||||||
|
4 --- 25
|
||||||
|
4 --- 26
|
||||||
|
5 --- 15
|
||||||
|
5 --- 27
|
||||||
|
5 --- 28
|
||||||
|
6 --- 16
|
||||||
|
6 --- 29
|
||||||
|
6 --- 30
|
||||||
|
7 --- 17
|
||||||
|
7 --- 31
|
||||||
|
7 --- 32
|
||||||
|
8 --- 18
|
||||||
|
8 --- 33
|
||||||
|
8 --- 34
|
||||||
|
9 --- 19
|
||||||
|
9 --- 35
|
||||||
|
9 --- 36
|
||||||
|
10 --- 20
|
||||||
|
10 --- 37
|
||||||
|
10 --- 38
|
||||||
|
12 --- 13
|
||||||
|
12 --- 14
|
||||||
|
12 --- 15
|
||||||
|
12 --- 16
|
||||||
|
12 --- 17
|
||||||
|
12 --- 18
|
||||||
|
12 --- 19
|
||||||
|
12 --- 20
|
||||||
|
12 --- 21
|
||||||
|
12 --- 22
|
||||||
|
12 --- 23
|
||||||
|
12 --- 24
|
||||||
|
12 --- 25
|
||||||
|
12 --- 26
|
||||||
|
12 --- 27
|
||||||
|
12 --- 28
|
||||||
|
12 --- 29
|
||||||
|
12 --- 30
|
||||||
|
12 --- 31
|
||||||
|
12 --- 32
|
||||||
|
12 --- 33
|
||||||
|
12 --- 34
|
||||||
|
12 --- 35
|
||||||
|
12 --- 36
|
||||||
|
12 --- 37
|
||||||
|
12 --- 38
|
||||||
|
39 --- 40
|
||||||
|
40 --- 41
|
||||||
|
40 --- 42
|
||||||
|
40 --- 43
|
||||||
|
40 --- 44
|
||||||
|
40 ---- 46
|
||||||
|
40 --- 45
|
||||||
|
41 --- 47
|
||||||
|
41 --- 53
|
||||||
|
41 --- 54
|
||||||
|
42 --- 48
|
||||||
|
42 --- 55
|
||||||
|
42 --- 56
|
||||||
|
43 --- 49
|
||||||
|
43 --- 57
|
||||||
|
43 --- 58
|
||||||
|
44 --- 50
|
||||||
|
44 --- 59
|
||||||
|
44 --- 60
|
||||||
|
46 --- 47
|
||||||
|
46 --- 48
|
||||||
|
46 --- 49
|
||||||
|
46 --- 50
|
||||||
|
46 --- 51
|
||||||
|
46 --- 52
|
||||||
|
46 --- 53
|
||||||
|
46 --- 54
|
||||||
|
46 --- 55
|
||||||
|
46 --- 56
|
||||||
|
46 --- 57
|
||||||
|
46 --- 58
|
||||||
|
46 --- 59
|
||||||
|
46 --- 60
|
||||||
|
61 --- 62
|
||||||
|
62 --- 63
|
||||||
|
62 --- 64
|
||||||
|
62 --- 65
|
||||||
|
62 --- 66
|
||||||
|
62 ---- 68
|
||||||
|
62 --- 67
|
||||||
|
63 --- 72
|
||||||
|
63 --- 81
|
||||||
|
63 --- 82
|
||||||
|
64 --- 71
|
||||||
|
64 --- 79
|
||||||
|
64 --- 80
|
||||||
|
65 --- 70
|
||||||
|
65 --- 77
|
||||||
|
65 --- 78
|
||||||
|
66 --- 69
|
||||||
|
66 --- 75
|
||||||
|
66 --- 76
|
||||||
|
68 --- 69
|
||||||
|
68 --- 70
|
||||||
|
68 --- 71
|
||||||
|
68 --- 72
|
||||||
|
68 --- 73
|
||||||
|
68 --- 74
|
||||||
|
68 --- 75
|
||||||
|
68 --- 76
|
||||||
|
68 --- 77
|
||||||
|
68 --- 78
|
||||||
|
68 --- 79
|
||||||
|
68 --- 80
|
||||||
|
68 --- 81
|
||||||
|
68 --- 82
|
||||||
|
```
|
3046
rust/kcl-lib/tests/pattern_into_union/ast.snap
Normal file
3046
rust/kcl-lib/tests/pattern_into_union/ast.snap
Normal file
File diff suppressed because it is too large
Load Diff
14
rust/kcl-lib/tests/pattern_into_union/execution_error.snap
Normal file
14
rust/kcl-lib/tests/pattern_into_union/execution_error.snap
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Error from executing pattern_into_union.kcl
|
||||||
|
---
|
||||||
|
KCL Engine error
|
||||||
|
|
||||||
|
× engine: Modeling command failed: [ApiError { error_code: InternalEngine,
|
||||||
|
│ message: "More than 2 solids were passed to the low-level CSG method" }]
|
||||||
|
╭─[67:1]
|
||||||
|
66 │
|
||||||
|
67 │ union([base,endTabs])
|
||||||
|
· ──────────┬──────────
|
||||||
|
· ╰── tests/pattern_into_union/input.kcl
|
||||||
|
╰────
|
67
rust/kcl-lib/tests/pattern_into_union/input.kcl
Normal file
67
rust/kcl-lib/tests/pattern_into_union/input.kcl
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
nPlates = 20
|
||||||
|
buildPlateThickness = 1 / 25.4 // 1mm w/ two stickers
|
||||||
|
buildPlateWidth = 10.125
|
||||||
|
widthTolerance = 0.2
|
||||||
|
thicknessTolerance = 0.020
|
||||||
|
endWidth = 0.5
|
||||||
|
endTabWidth = 2
|
||||||
|
endTabHeight = 1
|
||||||
|
endTabThickness = 0.1
|
||||||
|
width = buildPlateWidth + 2 * (widthTolerance + endWidth)
|
||||||
|
depth = nPlates * (buildPlateThickness + thicknessTolerance) + (nPlates + 1) * endTabThickness
|
||||||
|
baseHeight = 0.25
|
||||||
|
|
||||||
|
base = startSketchOn(XZ)
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> xLine(endAbsolute = width, tag = $seg01)
|
||||||
|
|> yLine(endAbsolute = baseHeight + endTabHeight)
|
||||||
|
|> xLine(length = -endWidth)
|
||||||
|
|> yLine(endAbsolute = baseHeight)
|
||||||
|
|> xLine(endAbsolute = endWidth)
|
||||||
|
|> yLine(endAbsolute = baseHeight + endTabHeight)
|
||||||
|
|> xLine(endAbsolute = 0,tag = $seg02)
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = -depth)
|
||||||
|
|
||||||
|
endTabs = startSketchOn(XZ)
|
||||||
|
|> startProfileAt([endWidth, baseHeight], %)
|
||||||
|
|> xLine(endAbsolute = endWidth + endTabWidth)
|
||||||
|
|> angledLine(
|
||||||
|
angle = 135,
|
||||||
|
endAbsoluteY = baseHeight + endTabHeight
|
||||||
|
,tag=$toFillet)
|
||||||
|
|> xLine(endAbsolute = endWidth)
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = -1 * endTabThickness)
|
||||||
|
|> fillet(
|
||||||
|
radius = 0.1,
|
||||||
|
tags = [getNextAdjacentEdge(toFillet)]
|
||||||
|
)
|
||||||
|
|> patternLinear3d(
|
||||||
|
axis = [0, 1, 0],
|
||||||
|
distance = buildPlateThickness + thicknessTolerance + endTabThickness,
|
||||||
|
instances = nPlates + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
endTabs2 = startSketchOn(XZ)
|
||||||
|
|> startProfileAt([width - endWidth, baseHeight], %)
|
||||||
|
|> xLine(endAbsolute = width - endTabWidth)
|
||||||
|
|> angledLine(
|
||||||
|
angle = 45,
|
||||||
|
endAbsoluteY = baseHeight + endTabHeight
|
||||||
|
,tag=$toFillet2)
|
||||||
|
|> xLine(endAbsolute = width - endWidth)
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = -1 * endTabThickness)
|
||||||
|
|> fillet(
|
||||||
|
radius = 0.1,
|
||||||
|
tags = [getNextAdjacentEdge(toFillet2)]
|
||||||
|
)
|
||||||
|
|> patternLinear3d(
|
||||||
|
axis = [0, 1, 0],
|
||||||
|
distance = buildPlateThickness + thicknessTolerance + endTabThickness,
|
||||||
|
instances = nPlates + 1
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
union([base,endTabs])
|
564
rust/kcl-lib/tests/pattern_into_union/ops.snap
Normal file
564
rust/kcl-lib/tests/pattern_into_union/ops.snap
Normal file
@ -0,0 +1,564 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed pattern_into_union.kcl
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"data": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": -3.28740157480315,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "extrude",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"data": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": -0.1,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "extrude",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"radius": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 0.1,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"value": {
|
||||||
|
"type": "Array",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"type": "Uuid",
|
||||||
|
"value": "[uuid]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "fillet",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Solid",
|
||||||
|
"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": 1.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": []
|
||||||
|
},
|
||||||
|
"distance": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 0.1593700787401575,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"instances": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 21.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": {
|
||||||
|
"data": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": -0.1,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "extrude",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"radius": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 0.1,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"value": {
|
||||||
|
"type": "Array",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"type": "Uuid",
|
||||||
|
"value": "[uuid]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "fillet",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Solid",
|
||||||
|
"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": 1.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": []
|
||||||
|
},
|
||||||
|
"distance": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 0.1593700787401575,
|
||||||
|
"ty": {
|
||||||
|
"type": "Known",
|
||||||
|
"type": "Count"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"instances": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 21.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "patternLinear3d",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Solid",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"isError": true,
|
||||||
|
"labeledArgs": {
|
||||||
|
"solids": {
|
||||||
|
"value": {
|
||||||
|
"type": "Array",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"type": "Solid",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Solid",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "union",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
}
|
||||||
|
]
|
50
rust/kcl-lib/tests/pattern_into_union/unparsed.snap
Normal file
50
rust/kcl-lib/tests/pattern_into_union/unparsed.snap
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing pattern_into_union.kcl
|
||||||
|
---
|
||||||
|
nPlates = 20
|
||||||
|
buildPlateThickness = 1 / 25.4 // 1mm w/ two stickers
|
||||||
|
buildPlateWidth = 10.125
|
||||||
|
widthTolerance = 0.2
|
||||||
|
thicknessTolerance = 0.020
|
||||||
|
endWidth = 0.5
|
||||||
|
endTabWidth = 2
|
||||||
|
endTabHeight = 1
|
||||||
|
endTabThickness = 0.1
|
||||||
|
width = buildPlateWidth + 2 * (widthTolerance + endWidth)
|
||||||
|
depth = nPlates * (buildPlateThickness + thicknessTolerance) + (nPlates + 1) * endTabThickness
|
||||||
|
baseHeight = 0.25
|
||||||
|
|
||||||
|
base = startSketchOn(XZ)
|
||||||
|
|> startProfileAt([0, 0], %)
|
||||||
|
|> xLine(endAbsolute = width, tag = $seg01)
|
||||||
|
|> yLine(endAbsolute = baseHeight + endTabHeight)
|
||||||
|
|> xLine(length = -endWidth)
|
||||||
|
|> yLine(endAbsolute = baseHeight)
|
||||||
|
|> xLine(endAbsolute = endWidth)
|
||||||
|
|> yLine(endAbsolute = baseHeight + endTabHeight)
|
||||||
|
|> xLine(endAbsolute = 0, tag = $seg02)
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = -depth)
|
||||||
|
|
||||||
|
endTabs = startSketchOn(XZ)
|
||||||
|
|> startProfileAt([endWidth, baseHeight], %)
|
||||||
|
|> xLine(endAbsolute = endWidth + endTabWidth)
|
||||||
|
|> angledLine(angle = 135, endAbsoluteY = baseHeight + endTabHeight, tag = $toFillet)
|
||||||
|
|> xLine(endAbsolute = endWidth)
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = -1 * endTabThickness)
|
||||||
|
|> fillet(radius = 0.1, tags = [getNextAdjacentEdge(toFillet)])
|
||||||
|
|> patternLinear3d(axis = [0, 1, 0], distance = buildPlateThickness + thicknessTolerance + endTabThickness, instances = nPlates + 1)
|
||||||
|
|
||||||
|
endTabs2 = startSketchOn(XZ)
|
||||||
|
|> startProfileAt([width - endWidth, baseHeight], %)
|
||||||
|
|> xLine(endAbsolute = width - endTabWidth)
|
||||||
|
|> angledLine(angle = 45, endAbsoluteY = baseHeight + endTabHeight, tag = $toFillet2)
|
||||||
|
|> xLine(endAbsolute = width - endWidth)
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = -1 * endTabThickness)
|
||||||
|
|> fillet(radius = 0.1, tags = [getNextAdjacentEdge(toFillet2)])
|
||||||
|
|> patternLinear3d(axis = [0, 1, 0], distance = buildPlateThickness + thicknessTolerance + endTabThickness, instances = nPlates + 1)
|
||||||
|
|
||||||
|
union([base, endTabs])
|
@ -36,7 +36,6 @@ flowchart LR
|
|||||||
30["Cap End"]
|
30["Cap End"]
|
||||||
31["SweepEdge Opposite"]
|
31["SweepEdge Opposite"]
|
||||||
32["SweepEdge Adjacent"]
|
32["SweepEdge Adjacent"]
|
||||||
33["CompositeSolid Subtract<br>[461, 497, 0]"]
|
|
||||||
1 --- 2
|
1 --- 2
|
||||||
2 --- 3
|
2 --- 3
|
||||||
2 --- 4
|
2 --- 4
|
||||||
@ -82,6 +81,4 @@ flowchart LR
|
|||||||
27 --- 30
|
27 --- 30
|
||||||
27 --- 31
|
27 --- 31
|
||||||
27 --- 32
|
27 --- 32
|
||||||
2 <--x 33
|
|
||||||
24 <--x 33
|
|
||||||
```
|
```
|
||||||
|
@ -7,9 +7,6 @@ description: Variables in memory after executing subtract_cylinder_from_cube.kcl
|
|||||||
"type": "Function"
|
"type": "Function"
|
||||||
},
|
},
|
||||||
"fullPart": {
|
"fullPart": {
|
||||||
"type": "HomArray",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -187,186 +184,6 @@ description: Variables in memory after executing subtract_cylinder_from_cube.kcl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"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": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
-10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"on": {
|
|
||||||
"type": "plane",
|
|
||||||
"id": "[uuid]",
|
|
||||||
"artifactId": "[uuid]",
|
|
||||||
"value": "XY",
|
|
||||||
"origin": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"xAxis": {
|
|
||||||
"x": 1.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"yAxis": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 1.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"zAxis": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 1.0
|
|
||||||
},
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"from": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
},
|
|
||||||
"tag": null,
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"artifactId": "[uuid]",
|
|
||||||
"originalId": "[uuid]",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"height": 10.0,
|
|
||||||
"startCapId": "[uuid]",
|
|
||||||
"endCapId": "[uuid]",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
|
@ -0,0 +1,586 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact commands subtract_doesnt_need_brackets.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": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": -10.0,
|
||||||
|
"y": -10.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 10.0,
|
||||||
|
"y": -10.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 10.0,
|
||||||
|
"y": 10.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": -10.0,
|
||||||
|
"y": 10.0,
|
||||||
|
"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": 10.0,
|
||||||
|
"faces": null,
|
||||||
|
"opposite": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_bring_to_front",
|
||||||
|
"object_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_extrusion_face_info",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "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": "start_path"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "move_path_pen",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"to": {
|
||||||
|
"x": 2.0,
|
||||||
|
"y": -2.0,
|
||||||
|
"z": 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 12.0,
|
||||||
|
"y": -2.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 12.0,
|
||||||
|
"y": 8.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"relative": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "extend_path",
|
||||||
|
"path": "[uuid]",
|
||||||
|
"segment": {
|
||||||
|
"type": "line",
|
||||||
|
"end": {
|
||||||
|
"x": 2.0,
|
||||||
|
"y": 8.0,
|
||||||
|
"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": 10.0,
|
||||||
|
"faces": null,
|
||||||
|
"opposite": "None"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "sketch_mode_disable"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "object_bring_to_front",
|
||||||
|
"object_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_extrusion_face_info",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_opposite_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "solid3d_get_next_adjacent_edge",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"edge_id": "[uuid]",
|
||||||
|
"face_id": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "set_object_transform",
|
||||||
|
"object_id": "[uuid]",
|
||||||
|
"transforms": [
|
||||||
|
{
|
||||||
|
"translate": {
|
||||||
|
"property": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"set": false,
|
||||||
|
"is_local": true
|
||||||
|
},
|
||||||
|
"rotate_rpy": null,
|
||||||
|
"rotate_angle_axis": null,
|
||||||
|
"scale": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmdId": "[uuid]",
|
||||||
|
"range": [],
|
||||||
|
"command": {
|
||||||
|
"type": "boolean_subtract",
|
||||||
|
"target_ids": [
|
||||||
|
"[uuid]"
|
||||||
|
],
|
||||||
|
"tool_ids": [
|
||||||
|
"[uuid]"
|
||||||
|
],
|
||||||
|
"tolerance": 0.0000001
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Artifact graph flowchart subtract_doesnt_need_brackets.kcl
|
||||||
|
extension: md
|
||||||
|
snapshot_kind: binary
|
||||||
|
---
|
@ -0,0 +1,117 @@
|
|||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
subgraph path2 [Path]
|
||||||
|
2["Path<br>[58, 113, 0]"]
|
||||||
|
3["Segment<br>[121, 177, 0]"]
|
||||||
|
4["Segment<br>[185, 241, 0]"]
|
||||||
|
5["Segment<br>[249, 305, 0]"]
|
||||||
|
6["Segment<br>[313, 320, 0]"]
|
||||||
|
7[Solid2d]
|
||||||
|
end
|
||||||
|
subgraph path24 [Path]
|
||||||
|
24["Path<br>[58, 113, 0]"]
|
||||||
|
25["Segment<br>[121, 177, 0]"]
|
||||||
|
26["Segment<br>[185, 241, 0]"]
|
||||||
|
27["Segment<br>[249, 305, 0]"]
|
||||||
|
28["Segment<br>[313, 320, 0]"]
|
||||||
|
29[Solid2d]
|
||||||
|
end
|
||||||
|
1["Plane<br>[33, 50, 0]"]
|
||||||
|
8["Sweep Extrusion<br>[328, 348, 0]"]
|
||||||
|
9[Wall]
|
||||||
|
10[Wall]
|
||||||
|
11[Wall]
|
||||||
|
12[Wall]
|
||||||
|
13["Cap Start"]
|
||||||
|
14["Cap End"]
|
||||||
|
15["SweepEdge Opposite"]
|
||||||
|
16["SweepEdge Adjacent"]
|
||||||
|
17["SweepEdge Opposite"]
|
||||||
|
18["SweepEdge Adjacent"]
|
||||||
|
19["SweepEdge Opposite"]
|
||||||
|
20["SweepEdge Adjacent"]
|
||||||
|
21["SweepEdge Opposite"]
|
||||||
|
22["SweepEdge Adjacent"]
|
||||||
|
23["Plane<br>[33, 50, 0]"]
|
||||||
|
30["Sweep Extrusion<br>[328, 348, 0]"]
|
||||||
|
31[Wall]
|
||||||
|
32[Wall]
|
||||||
|
33[Wall]
|
||||||
|
34[Wall]
|
||||||
|
35["Cap Start"]
|
||||||
|
36["Cap End"]
|
||||||
|
37["SweepEdge Opposite"]
|
||||||
|
38["SweepEdge Adjacent"]
|
||||||
|
39["SweepEdge Opposite"]
|
||||||
|
40["SweepEdge Adjacent"]
|
||||||
|
41["SweepEdge Opposite"]
|
||||||
|
42["SweepEdge Adjacent"]
|
||||||
|
43["SweepEdge Opposite"]
|
||||||
|
44["SweepEdge Adjacent"]
|
||||||
|
1 --- 2
|
||||||
|
2 --- 3
|
||||||
|
2 --- 4
|
||||||
|
2 --- 5
|
||||||
|
2 --- 6
|
||||||
|
2 ---- 8
|
||||||
|
2 --- 7
|
||||||
|
3 --- 9
|
||||||
|
3 --- 15
|
||||||
|
3 --- 16
|
||||||
|
4 --- 10
|
||||||
|
4 --- 17
|
||||||
|
4 --- 18
|
||||||
|
5 --- 11
|
||||||
|
5 --- 19
|
||||||
|
5 --- 20
|
||||||
|
6 --- 12
|
||||||
|
6 --- 21
|
||||||
|
6 --- 22
|
||||||
|
8 --- 9
|
||||||
|
8 --- 10
|
||||||
|
8 --- 11
|
||||||
|
8 --- 12
|
||||||
|
8 --- 13
|
||||||
|
8 --- 14
|
||||||
|
8 --- 15
|
||||||
|
8 --- 16
|
||||||
|
8 --- 17
|
||||||
|
8 --- 18
|
||||||
|
8 --- 19
|
||||||
|
8 --- 20
|
||||||
|
8 --- 21
|
||||||
|
8 --- 22
|
||||||
|
23 --- 24
|
||||||
|
24 --- 25
|
||||||
|
24 --- 26
|
||||||
|
24 --- 27
|
||||||
|
24 --- 28
|
||||||
|
24 ---- 30
|
||||||
|
24 --- 29
|
||||||
|
25 --- 31
|
||||||
|
25 --- 37
|
||||||
|
25 --- 38
|
||||||
|
26 --- 32
|
||||||
|
26 --- 39
|
||||||
|
26 --- 40
|
||||||
|
27 --- 33
|
||||||
|
27 --- 41
|
||||||
|
27 --- 42
|
||||||
|
28 --- 34
|
||||||
|
28 --- 43
|
||||||
|
28 --- 44
|
||||||
|
30 --- 31
|
||||||
|
30 --- 32
|
||||||
|
30 --- 33
|
||||||
|
30 --- 34
|
||||||
|
30 --- 35
|
||||||
|
30 --- 36
|
||||||
|
30 --- 37
|
||||||
|
30 --- 38
|
||||||
|
30 --- 39
|
||||||
|
30 --- 40
|
||||||
|
30 --- 41
|
||||||
|
30 --- 42
|
||||||
|
30 --- 43
|
||||||
|
30 --- 44
|
||||||
|
```
|
1134
rust/kcl-lib/tests/subtract_doesnt_need_brackets/ast.snap
Normal file
1134
rust/kcl-lib/tests/subtract_doesnt_need_brackets/ast.snap
Normal file
File diff suppressed because it is too large
Load Diff
15
rust/kcl-lib/tests/subtract_doesnt_need_brackets/input.kcl
Normal file
15
rust/kcl-lib/tests/subtract_doesnt_need_brackets/input.kcl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
fn cube(center, size) {
|
||||||
|
return startSketchOn(XY)
|
||||||
|
|> startProfileAt([center[0] - size, center[1] - size], %)
|
||||||
|
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||||
|
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||||
|
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
part001 = cube([0, 0], 10)
|
||||||
|
part002 = cube([7, 3], 5)
|
||||||
|
|> translate(z = 1)
|
||||||
|
|
||||||
|
subtractedPart = subtract(part001, tools = part002)
|
161
rust/kcl-lib/tests/subtract_doesnt_need_brackets/ops.snap
Normal file
161
rust/kcl-lib/tests/subtract_doesnt_need_brackets/ops.snap
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Operations executed subtract_doesnt_need_brackets.kcl
|
||||||
|
---
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"type": "GroupBegin",
|
||||||
|
"group": {
|
||||||
|
"type": "FunctionCall",
|
||||||
|
"name": "cube",
|
||||||
|
"functionSourceRange": [
|
||||||
|
7,
|
||||||
|
350,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"unlabeledArg": null,
|
||||||
|
"labeledArgs": {}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"data": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 10.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "extrude",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GroupEnd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GroupBegin",
|
||||||
|
"group": {
|
||||||
|
"type": "FunctionCall",
|
||||||
|
"name": "cube",
|
||||||
|
"functionSourceRange": [
|
||||||
|
7,
|
||||||
|
350,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"unlabeledArg": null,
|
||||||
|
"labeledArgs": {}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"data": {
|
||||||
|
"value": {
|
||||||
|
"type": "Plane",
|
||||||
|
"artifact_id": "[uuid]"
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "startSketchOn",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"length": {
|
||||||
|
"value": {
|
||||||
|
"type": "Number",
|
||||||
|
"value": 10.0,
|
||||||
|
"ty": {
|
||||||
|
"type": "Default",
|
||||||
|
"len": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"angle": {
|
||||||
|
"type": "Degrees"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "extrude",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Sketch",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "GroupEnd"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"labeledArgs": {
|
||||||
|
"tools": {
|
||||||
|
"value": {
|
||||||
|
"type": "Solid",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"name": "subtract",
|
||||||
|
"sourceRange": [],
|
||||||
|
"type": "StdLibCall",
|
||||||
|
"unlabeledArg": {
|
||||||
|
"value": {
|
||||||
|
"type": "Solid",
|
||||||
|
"value": {
|
||||||
|
"artifactId": "[uuid]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,543 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Variables in memory after executing subtract_doesnt_need_brackets.kcl
|
||||||
|
---
|
||||||
|
{
|
||||||
|
"cube": {
|
||||||
|
"type": "Function"
|
||||||
|
},
|
||||||
|
"part001": {
|
||||||
|
"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": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"type": "plane",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"value": "XY",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"zAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"height": 10.0,
|
||||||
|
"startCapId": "[uuid]",
|
||||||
|
"endCapId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"part002": {
|
||||||
|
"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.0,
|
||||||
|
-2.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
12.0,
|
||||||
|
-2.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
12.0,
|
||||||
|
-2.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
12.0,
|
||||||
|
8.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
12.0,
|
||||||
|
8.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
2.0,
|
||||||
|
8.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
2.0,
|
||||||
|
8.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
2.0,
|
||||||
|
-2.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"type": "plane",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"value": "XY",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"zAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
2.0,
|
||||||
|
-2.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
2.0,
|
||||||
|
-2.0
|
||||||
|
],
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"height": 10.0,
|
||||||
|
"startCapId": "[uuid]",
|
||||||
|
"endCapId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"subtractedPart": {
|
||||||
|
"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": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
},
|
||||||
|
"from": [
|
||||||
|
-10.0,
|
||||||
|
10.0
|
||||||
|
],
|
||||||
|
"tag": null,
|
||||||
|
"to": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"type": "ToPoint",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"on": {
|
||||||
|
"type": "plane",
|
||||||
|
"id": "[uuid]",
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"value": "XY",
|
||||||
|
"origin": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"xAxis": {
|
||||||
|
"x": 1.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"yAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 1.0,
|
||||||
|
"z": 0.0
|
||||||
|
},
|
||||||
|
"zAxis": {
|
||||||
|
"x": 0.0,
|
||||||
|
"y": 0.0,
|
||||||
|
"z": 1.0
|
||||||
|
},
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"start": {
|
||||||
|
"from": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"to": [
|
||||||
|
-10.0,
|
||||||
|
-10.0
|
||||||
|
],
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
},
|
||||||
|
"tag": null,
|
||||||
|
"__geoMeta": {
|
||||||
|
"id": "[uuid]",
|
||||||
|
"sourceRange": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"artifactId": "[uuid]",
|
||||||
|
"originalId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"height": 10.0,
|
||||||
|
"startCapId": "[uuid]",
|
||||||
|
"endCapId": "[uuid]",
|
||||||
|
"units": {
|
||||||
|
"type": "Mm"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 59 KiB |
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
source: kcl-lib/src/simulation_tests.rs
|
||||||
|
description: Result of unparsing subtract_doesnt_need_brackets.kcl
|
||||||
|
---
|
||||||
|
fn cube(center, size) {
|
||||||
|
return startSketchOn(XY)
|
||||||
|
|> startProfileAt([center[0] - size, center[1] - size], %)
|
||||||
|
|> line(endAbsolute = [center[0] + size, center[1] - size])
|
||||||
|
|> line(endAbsolute = [center[0] + size, center[1] + size])
|
||||||
|
|> line(endAbsolute = [center[0] - size, center[1] + size])
|
||||||
|
|> close()
|
||||||
|
|> extrude(length = 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
part001 = cube([0, 0], 10)
|
||||||
|
part002 = cube([7, 3], 5)
|
||||||
|
|> translate(z = 1)
|
||||||
|
|
||||||
|
subtractedPart = subtract(part001, tools = part002)
|
@ -48,7 +48,6 @@ flowchart LR
|
|||||||
42["SweepEdge Adjacent"]
|
42["SweepEdge Adjacent"]
|
||||||
43["SweepEdge Opposite"]
|
43["SweepEdge Opposite"]
|
||||||
44["SweepEdge Adjacent"]
|
44["SweepEdge Adjacent"]
|
||||||
45["CompositeSolid Union<br>[448, 473, 0]"]
|
|
||||||
1 --- 2
|
1 --- 2
|
||||||
2 --- 3
|
2 --- 3
|
||||||
2 --- 4
|
2 --- 4
|
||||||
@ -115,6 +114,4 @@ flowchart LR
|
|||||||
30 --- 42
|
30 --- 42
|
||||||
30 --- 43
|
30 --- 43
|
||||||
30 --- 44
|
30 --- 44
|
||||||
2 <--x 45
|
|
||||||
24 <--x 45
|
|
||||||
```
|
```
|
||||||
|
@ -7,9 +7,6 @@ description: Variables in memory after executing union_cubes.kcl
|
|||||||
"type": "Function"
|
"type": "Function"
|
||||||
},
|
},
|
||||||
"fullPart": {
|
"fullPart": {
|
||||||
"type": "HomArray",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
@ -187,186 +184,6 @@ description: Variables in memory after executing union_cubes.kcl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"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": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
},
|
|
||||||
"from": [
|
|
||||||
-10.0,
|
|
||||||
10.0
|
|
||||||
],
|
|
||||||
"tag": null,
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"type": "ToPoint",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"on": {
|
|
||||||
"type": "plane",
|
|
||||||
"id": "[uuid]",
|
|
||||||
"artifactId": "[uuid]",
|
|
||||||
"value": "XY",
|
|
||||||
"origin": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"xAxis": {
|
|
||||||
"x": 1.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"yAxis": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 1.0,
|
|
||||||
"z": 0.0
|
|
||||||
},
|
|
||||||
"zAxis": {
|
|
||||||
"x": 0.0,
|
|
||||||
"y": 0.0,
|
|
||||||
"z": 1.0
|
|
||||||
},
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"start": {
|
|
||||||
"from": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"to": [
|
|
||||||
-10.0,
|
|
||||||
-10.0
|
|
||||||
],
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
},
|
|
||||||
"tag": null,
|
|
||||||
"__geoMeta": {
|
|
||||||
"id": "[uuid]",
|
|
||||||
"sourceRange": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"artifactId": "[uuid]",
|
|
||||||
"originalId": "[uuid]",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"height": 20.0,
|
|
||||||
"startCapId": "[uuid]",
|
|
||||||
"endCapId": "[uuid]",
|
|
||||||
"units": {
|
|
||||||
"type": "Mm"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"part001": {
|
"part001": {
|
||||||
"type": "Solid",
|
"type": "Solid",
|
||||||
"value": {
|
"value": {
|
||||||
|
Reference in New Issue
Block a user