KCL's `fillet` function takes an array of edges to fillet. Previously this would do `n` fillet API commands, one per edge. This PR combines them all into one call, which should improve performance. You can see the effect in the artifact_commands snapshots, e.g. `rust/kcl-lib/tests/kcl_samples/axial-fan/artifact_commands.snap`
Besides performance, this should fix a bug where some KCL fillets would fail, when they should have succeeded. Example from @max-mrgrsk:
```kcl
sketch001 = startSketchOn(XY)
|> startProfile(at = [-12, -6])
|> line(end = [0, 12], tag = $seg04)
|> line(end = [24, 0], tag = $seg03)
|> line(end = [0, -12], tag = $seg02)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg01)
|> close()
extrude001 = extrude(
sketch001,
length = 12,
tagEnd = $capEnd001,
tagStart = $capStart001,
)
|> fillet(
radius = 5,
tags = [
getCommonEdge(faces = [seg02, capEnd001]),
getCommonEdge(faces = [seg01, capEnd001]),
getCommonEdge(faces = [seg03, capEnd001]),
getCommonEdge(faces = [seg04, capEnd001])
],
)
```
This program fails on main, but succeeds on this branch.
14 KiB
14 KiB
flowchart LR
subgraph path6 [Path]
6["Path<br>[1246, 1327, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
11["Segment<br>[1333, 1361, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
12["Segment<br>[1367, 1428, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
13["Segment<br>[1434, 1515, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
14["Segment<br>[1521, 1583, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
15["Segment<br>[1589, 1625, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
16["Segment<br>[1631, 1660, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
17["Segment<br>[1666, 1728, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
18["Segment<br>[1734, 1788, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }]
19["Segment<br>[1794, 1855, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 10 }]
20["Segment<br>[1861, 1889, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 11 }]
21["Segment<br>[1895, 1934, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 12 }]
22["Segment<br>[1940, 1983, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 13 }]
23["Segment<br>[1989, 2051, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 14 }]
24["Segment<br>[2057, 2116, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 15 }]
25["Segment<br>[2122, 2183, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 16 }]
26["Segment<br>[2189, 2225, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 17 }]
27["Segment<br>[2231, 2261, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 18 }]
28["Segment<br>[2267, 2328, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 19 }]
29["Segment<br>[2334, 2393, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 20 }]
30["Segment<br>[2399, 2461, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 21 }]
31["Segment<br>[2467, 2510, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 22 }]
32["Segment<br>[2516, 2586, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 23 }]
33["Segment<br>[2592, 2599, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 24 }]
41[Solid2d]
end
subgraph path7 [Path]
7["Path<br>[2938, 3027, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
34["Segment<br>[2938, 3027, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
40[Solid2d]
end
subgraph path8 [Path]
8["Path<br>[3309, 3397, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
35["Segment<br>[3309, 3397, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
39[Solid2d]
end
subgraph path9 [Path]
9["Path<br>[3686, 3866, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
36["Segment<br>[3686, 3866, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
38[Solid2d]
end
subgraph path10 [Path]
10["Path<br>[4289, 4345, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
37["Segment<br>[4289, 4345, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
42[Solid2d]
end
1["Plane<br>[1223, 1240, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
2["StartSketchOnFace<br>[3637, 3680, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
3["StartSketchOnFace<br>[3260, 3303, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
4["StartSketchOnFace<br>[2889, 2932, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
5["StartSketchOnFace<br>[4240, 4283, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
43["Sweep Extrusion<br>[2605, 2638, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 25 }]
44["Sweep Extrusion<br>[3156, 3184, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
45["Sweep Extrusion<br>[3156, 3184, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
46["Sweep Extrusion<br>[3526, 3554, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
47["Sweep Extrusion<br>[3526, 3554, 0]"]
%% [ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
48["Sweep Extrusion<br>[4120, 4148, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
49["Sweep Extrusion<br>[4120, 4148, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
50["Sweep Extrusion<br>[4120, 4148, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
51["Sweep Extrusion<br>[4120, 4148, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
52["Sweep Extrusion<br>[4351, 4379, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
53[Wall]
%% face_code_ref=Missing NodePath
54[Wall]
%% face_code_ref=Missing NodePath
55[Wall]
%% face_code_ref=Missing NodePath
56[Wall]
%% face_code_ref=Missing NodePath
57[Wall]
%% face_code_ref=Missing NodePath
58[Wall]
%% face_code_ref=Missing NodePath
59[Wall]
%% face_code_ref=Missing NodePath
60[Wall]
%% face_code_ref=Missing NodePath
61[Wall]
%% face_code_ref=Missing NodePath
62[Wall]
%% face_code_ref=Missing NodePath
63[Wall]
%% face_code_ref=Missing NodePath
64[Wall]
%% face_code_ref=Missing NodePath
65[Wall]
%% face_code_ref=Missing NodePath
66[Wall]
%% face_code_ref=Missing NodePath
67[Wall]
%% face_code_ref=Missing NodePath
68[Wall]
%% face_code_ref=Missing NodePath
69[Wall]
%% face_code_ref=Missing NodePath
70[Wall]
%% face_code_ref=Missing NodePath
71[Wall]
%% face_code_ref=[ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
72[Wall]
%% face_code_ref=[ProgramBodyItem { index: 16 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
73[Wall]
%% face_code_ref=[ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
74[Wall]
%% face_code_ref=Missing NodePath
75[Wall]
%% face_code_ref=Missing NodePath
76[Wall]
%% face_code_ref=Missing NodePath
77["Cap Start"]
%% face_code_ref=Missing NodePath
78["Cap End"]
%% face_code_ref=Missing NodePath
79["SweepEdge Opposite"]
80["SweepEdge Opposite"]
81["SweepEdge Opposite"]
82["SweepEdge Opposite"]
83["SweepEdge Opposite"]
84["SweepEdge Opposite"]
85["SweepEdge Opposite"]
86["SweepEdge Opposite"]
87["SweepEdge Opposite"]
88["SweepEdge Opposite"]
89["SweepEdge Opposite"]
90["SweepEdge Opposite"]
91["SweepEdge Opposite"]
92["SweepEdge Opposite"]
93["SweepEdge Opposite"]
94["SweepEdge Opposite"]
95["SweepEdge Opposite"]
96["SweepEdge Opposite"]
97["SweepEdge Opposite"]
98["SweepEdge Opposite"]
99["SweepEdge Opposite"]
100["SweepEdge Opposite"]
101["SweepEdge Opposite"]
102["SweepEdge Opposite"]
103["SweepEdge Adjacent"]
104["SweepEdge Adjacent"]
105["SweepEdge Adjacent"]
106["SweepEdge Adjacent"]
107["SweepEdge Adjacent"]
108["SweepEdge Adjacent"]
109["SweepEdge Adjacent"]
110["SweepEdge Adjacent"]
111["SweepEdge Adjacent"]
112["SweepEdge Adjacent"]
113["SweepEdge Adjacent"]
114["SweepEdge Adjacent"]
115["SweepEdge Adjacent"]
116["SweepEdge Adjacent"]
117["SweepEdge Adjacent"]
118["SweepEdge Adjacent"]
119["SweepEdge Adjacent"]
120["SweepEdge Adjacent"]
121["SweepEdge Adjacent"]
122["SweepEdge Adjacent"]
123["SweepEdge Adjacent"]
124["SweepEdge Adjacent"]
125["SweepEdge Adjacent"]
126["SweepEdge Adjacent"]
127["EdgeCut Fillet<br>[2644, 2815, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 26 }]
1 --- 6
73 x--> 2
72 x--> 3
71 x--> 4
73 x--> 5
6 --- 11
6 --- 12
6 --- 13
6 --- 14
6 --- 15
6 --- 16
6 --- 17
6 --- 18
6 --- 19
6 --- 20
6 --- 21
6 --- 22
6 --- 23
6 --- 24
6 --- 25
6 --- 26
6 --- 27
6 --- 28
6 --- 29
6 --- 30
6 --- 31
6 --- 32
6 --- 33
6 --- 41
6 ---- 43
7 --- 34
7 --- 40
7 ---- 45
71 --- 7
8 --- 35
8 --- 39
8 ---- 47
72 --- 8
9 --- 36
9 --- 38
9 ---- 50
73 --- 9
10 --- 37
10 --- 42
10 ---- 52
73 --- 10
11 --- 67
11 x--> 77
11 --- 80
11 --- 104
12 --- 62
12 x--> 77
12 --- 81
12 --- 105
13 --- 61
13 x--> 77
13 --- 82
13 --- 106
14 --- 64
14 x--> 77
14 --- 83
14 --- 107
15 --- 58
15 x--> 77
15 --- 84
15 --- 108
17 --- 66
17 x--> 77
17 --- 85
17 --- 109
18 --- 70
18 x--> 77
18 --- 86
18 --- 110
19 --- 69
19 x--> 77
19 --- 87
19 --- 111
20 --- 56
20 x--> 77
20 --- 88
20 --- 112
21 --- 57
21 x--> 77
21 --- 89
21 --- 113
21 --- 127
22 --- 71
22 x--> 77
22 --- 90
22 --- 114
23 --- 65
23 x--> 77
23 --- 91
23 --- 115
24 --- 59
24 x--> 77
24 --- 92
24 --- 116
25 --- 55
25 x--> 77
25 --- 93
25 --- 117
26 --- 73
26 x--> 77
26 --- 94
26 --- 118
28 --- 68
28 x--> 77
28 --- 95
28 --- 119
29 --- 54
29 x--> 77
29 --- 96
29 --- 120
30 --- 63
30 x--> 77
30 --- 97
30 --- 121
31 --- 72
31 x--> 77
31 --- 98
31 --- 122
32 --- 60
32 x--> 77
32 --- 99
32 --- 123
34 x--> 71
34 --- 76
34 --- 102
34 --- 126
35 x--> 72
35 --- 75
35 --- 101
35 --- 125
36 --- 53
36 x--> 73
36 --- 79
36 --- 103
37 x--> 73
37 --- 74
37 --- 100
37 --- 124
43 --- 54
43 --- 55
43 --- 56
43 --- 57
43 --- 58
43 --- 59
43 --- 60
43 --- 61
43 --- 62
43 --- 63
43 --- 64
43 --- 65
43 --- 66
43 --- 67
43 --- 68
43 --- 69
43 --- 70
43 --- 71
43 --- 72
43 --- 73
43 --- 77
43 --- 78
43 --- 80
43 --- 81
43 --- 82
43 --- 83
43 --- 84
43 --- 85
43 --- 86
43 --- 87
43 --- 88
43 --- 89
43 --- 90
43 --- 91
43 --- 92
43 --- 93
43 --- 94
43 --- 95
43 --- 96
43 --- 97
43 --- 98
43 --- 99
43 --- 104
43 --- 105
43 --- 106
43 --- 107
43 --- 108
43 --- 109
43 --- 110
43 --- 111
43 --- 112
43 --- 113
43 --- 114
43 --- 115
43 --- 116
43 --- 117
43 --- 118
43 --- 119
43 --- 120
43 --- 121
43 --- 122
43 --- 123
45 --- 76
45 --- 102
45 --- 126
47 --- 75
47 --- 101
47 --- 125
50 --- 53
50 --- 79
50 --- 103
52 --- 74
52 --- 100
52 --- 124
53 --- 79
53 --- 103
54 --- 96
119 <--x 54
54 --- 120
55 --- 93
116 <--x 55
55 --- 117
56 --- 88
102 <--x 56
111 <--x 56
56 --- 112
57 --- 89
112 <--x 57
57 --- 113
79 <--x 58
58 --- 84
100 <--x 58
107 <--x 58
58 --- 108
59 --- 92
115 <--x 59
59 --- 116
60 --- 99
122 <--x 60
60 --- 123
61 --- 82
105 <--x 61
61 --- 106
62 --- 81
104 <--x 62
62 --- 105
63 --- 97
120 <--x 63
63 --- 121
64 --- 83
106 <--x 64
64 --- 107
65 --- 91
114 <--x 65
65 --- 115
66 --- 85
108 <--x 66
66 --- 109
67 --- 80
101 <--x 67
67 --- 104
123 <--x 67
68 --- 95
118 <--x 68
68 --- 119
69 --- 87
110 <--x 69
69 --- 111
70 --- 86
109 <--x 70
70 --- 110
71 --- 90
113 <--x 71
71 --- 114
72 --- 98
121 <--x 72
72 --- 122
73 --- 94
117 <--x 73
73 --- 118
74 --- 100
74 --- 124
75 --- 101
75 --- 125
76 --- 102
76 --- 126
80 <--x 78
81 <--x 78
82 <--x 78
83 <--x 78
84 <--x 78
85 <--x 78
86 <--x 78
87 <--x 78
88 <--x 78
89 <--x 78
90 <--x 78
91 <--x 78
92 <--x 78
93 <--x 78
94 <--x 78
95 <--x 78
96 <--x 78
97 <--x 78
98 <--x 78
99 <--x 78