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:
Jess Frazelle
2025-04-11 19:06:12 -07:00
committed by GitHub
parent 9365186bed
commit 95b72d839b
25 changed files with 9324 additions and 1057 deletions

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 pattern_into_union.kcl
extension: md
snapshot_kind: binary
---

View File

@ -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
```

File diff suppressed because it is too large Load Diff

View 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
╰────

View 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])

View 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
}
]

View 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])