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.
15 KiB
15 KiB
flowchart LR
subgraph path6 [Path]
6["Path<br>[831, 869, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
13["Segment<br>[877, 927, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
14["Segment<br>[935, 984, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
15["Segment<br>[992, 1044, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
16["Segment<br>[1052, 1100, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
17["Segment<br>[1108, 1152, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
18["Segment<br>[1160, 1205, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
19["Segment<br>[1213, 1262, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
20["Segment<br>[1270, 1289, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 9 }]
42[Solid2d]
end
subgraph path7 [Path]
7["Path<br>[1992, 2046, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
21["Segment<br>[2052, 2105, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
22["Segment<br>[2111, 2161, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
23["Segment<br>[2167, 2221, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
24["Segment<br>[2227, 2247, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
39[Solid2d]
end
subgraph path8 [Path]
8["Path<br>[2271, 2434, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }, CallKwArg { index: 0 }]
25["Segment<br>[2271, 2434, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }, CallKwArg { index: 0 }]
41[Solid2d]
end
subgraph path9 [Path]
9["Path<br>[2816, 2871, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
26["Segment<br>[2877, 2931, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
27["Segment<br>[2937, 2987, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
28["Segment<br>[2993, 3046, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
29["Segment<br>[3052, 3072, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
43[Solid2d]
end
subgraph path10 [Path]
10["Path<br>[3096, 3262, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }, CallKwArg { index: 0 }]
30["Segment<br>[3096, 3262, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }, CallKwArg { index: 0 }]
38[Solid2d]
end
subgraph path11 [Path]
11["Path<br>[3842, 3883, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
31["Segment<br>[3889, 3909, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
32["Segment<br>[3915, 3938, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
33["Segment<br>[3944, 3951, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
40[Solid2d]
end
subgraph path12 [Path]
12["Path<br>[4066, 4106, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
34["Segment<br>[4112, 4132, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
35["Segment<br>[4138, 4159, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
36["Segment<br>[4165, 4186, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 4 }]
37["Segment<br>[4192, 4199, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
44[Solid2d]
end
1["Plane<br>[796, 823, 0]"]
%% [ProgramBodyItem { index: 10 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
2["Plane<br>[1963, 1986, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
3["Plane<br>[2787, 2810, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
4["Plane<br>[3813, 3836, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
5["Plane<br>[4037, 4060, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 0 }]
45["Sweep Extrusion<br>[1409, 1443, 0]"]
%% [ProgramBodyItem { index: 12 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 1 }]
46["Sweep Extrusion<br>[2441, 2466, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
47["Sweep Extrusion<br>[3269, 3294, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
48["Sweep Extrusion<br>[3957, 3985, 0]"]
%% [ProgramBodyItem { index: 17 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 5 }]
49["Sweep Extrusion<br>[4205, 4233, 0]"]
%% [ProgramBodyItem { index: 18 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 6 }]
50[Wall]
%% face_code_ref=Missing NodePath
51[Wall]
%% face_code_ref=Missing NodePath
52[Wall]
%% face_code_ref=Missing NodePath
53[Wall]
%% face_code_ref=Missing NodePath
54[Wall]
%% face_code_ref=Missing NodePath
55[Wall]
%% face_code_ref=Missing NodePath
56[Wall]
%% face_code_ref=Missing NodePath
57[Wall]
%% face_code_ref=Missing NodePath
58[Wall]
%% face_code_ref=Missing NodePath
59[Wall]
%% face_code_ref=Missing NodePath
60[Wall]
%% face_code_ref=Missing NodePath
61[Wall]
%% face_code_ref=Missing NodePath
62[Wall]
%% face_code_ref=Missing NodePath
63[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=Missing NodePath
72[Wall]
%% face_code_ref=Missing NodePath
73["Cap Start"]
%% face_code_ref=Missing NodePath
74["Cap Start"]
%% face_code_ref=Missing NodePath
75["Cap Start"]
%% face_code_ref=Missing NodePath
76["Cap Start"]
%% face_code_ref=Missing NodePath
77["Cap Start"]
%% face_code_ref=Missing NodePath
78["Cap End"]
%% face_code_ref=Missing NodePath
79["Cap End"]
%% face_code_ref=Missing NodePath
80["Cap End"]
%% face_code_ref=Missing NodePath
81["Cap End"]
%% face_code_ref=Missing NodePath
82["Cap End"]
%% face_code_ref=Missing NodePath
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 Opposite"]
104["SweepEdge Opposite"]
105["SweepEdge Opposite"]
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["SweepEdge Adjacent"]
128["SweepEdge Adjacent"]
129["EdgeCut Fillet<br>[1449, 1708, 0]"]
%% [ProgramBodyItem { index: 12 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 2 }]
130["EdgeCut Fillet<br>[2472, 2617, 0]"]
%% [ProgramBodyItem { index: 14 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
131["EdgeCut Fillet<br>[3300, 3445, 0]"]
%% [ProgramBodyItem { index: 15 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 8 }]
1 --- 6
2 --- 7
2 --- 8
3 --- 9
3 --- 10
4 --- 11
5 --- 12
6 --- 13
6 --- 14
6 --- 15
6 --- 16
6 --- 17
6 --- 18
6 --- 19
6 --- 20
6 --- 42
6 ---- 45
7 --- 21
7 --- 22
7 --- 23
7 --- 24
7 --- 39
7 ---- 46
8 --- 25
8 --- 41
9 --- 26
9 --- 27
9 --- 28
9 --- 29
9 --- 43
9 ---- 47
10 --- 30
10 --- 38
11 --- 31
11 --- 32
11 --- 33
11 --- 40
11 ---- 48
12 --- 34
12 --- 35
12 --- 36
12 --- 37
12 --- 44
12 ---- 49
13 --- 57
13 x--> 75
13 --- 87
13 --- 110
14 --- 58
14 x--> 75
14 --- 88
14 --- 111
15 --- 56
15 x--> 75
15 --- 89
15 --- 112
16 --- 55
16 x--> 75
16 --- 90
16 --- 113
17 --- 59
17 x--> 75
17 --- 91
17 --- 114
18 --- 61
18 x--> 75
18 --- 92
18 --- 115
19 --- 60
19 x--> 75
19 --- 93
19 --- 116
20 --- 54
20 x--> 75
20 --- 94
20 --- 117
21 --- 66
21 x--> 79
21 --- 101
21 --- 124
22 --- 67
22 x--> 79
22 --- 100
22 --- 123
23 --- 65
23 x--> 79
23 --- 99
23 --- 122
24 --- 68
24 x--> 79
24 --- 98
24 --- 121
26 --- 52
26 x--> 81
26 --- 83
26 --- 106
27 --- 53
27 x--> 81
27 --- 84
27 --- 107
28 --- 50
28 x--> 81
28 --- 85
28 --- 108
29 --- 51
29 x--> 81
29 --- 86
29 --- 109
31 --- 63
31 x--> 73
31 --- 97
31 --- 120
32 --- 62
32 x--> 73
32 --- 96
32 --- 119
33 --- 64
33 x--> 73
33 --- 95
33 --- 118
34 --- 71
34 x--> 77
34 --- 102
34 --- 125
35 --- 70
35 x--> 77
35 --- 103
35 --- 126
36 --- 69
36 x--> 77
36 --- 104
36 --- 127
37 --- 72
37 x--> 77
37 --- 105
37 --- 128
45 --- 54
45 --- 55
45 --- 56
45 --- 57
45 --- 58
45 --- 59
45 --- 60
45 --- 61
45 --- 75
45 --- 80
45 --- 87
45 --- 88
45 --- 89
45 --- 90
45 --- 91
45 --- 92
45 --- 93
45 --- 94
45 --- 110
45 --- 111
45 --- 112
45 --- 113
45 --- 114
45 --- 115
45 --- 116
45 --- 117
46 --- 65
46 --- 66
46 --- 67
46 --- 68
46 --- 74
46 --- 79
46 --- 98
46 --- 99
46 --- 100
46 --- 101
46 --- 121
46 --- 122
46 --- 123
46 --- 124
47 --- 50
47 --- 51
47 --- 52
47 --- 53
47 --- 76
47 --- 81
47 --- 83
47 --- 84
47 --- 85
47 --- 86
47 --- 106
47 --- 107
47 --- 108
47 --- 109
48 --- 62
48 --- 63
48 --- 64
48 --- 73
48 --- 78
48 --- 95
48 --- 96
48 --- 97
48 --- 118
48 --- 119
48 --- 120
49 --- 69
49 --- 70
49 --- 71
49 --- 72
49 --- 77
49 --- 82
49 --- 102
49 --- 103
49 --- 104
49 --- 105
49 --- 125
49 --- 126
49 --- 127
49 --- 128
50 --- 85
107 <--x 50
50 --- 108
51 --- 86
108 <--x 51
51 --- 109
52 --- 83
52 --- 106
109 <--x 52
53 --- 84
106 <--x 53
53 --- 107
54 --- 94
116 <--x 54
54 --- 117
55 --- 90
112 <--x 55
55 --- 113
56 --- 89
111 <--x 56
56 --- 112
57 --- 87
57 --- 110
117 <--x 57
58 --- 88
110 <--x 58
58 --- 111
59 --- 91
113 <--x 59
59 --- 114
60 --- 93
115 <--x 60
60 --- 116
61 --- 92
114 <--x 61
61 --- 115
62 --- 96
62 --- 119
120 <--x 62
63 --- 97
118 <--x 63
63 --- 120
64 --- 95
64 --- 118
119 <--x 64
65 --- 99
65 --- 122
123 <--x 65
66 --- 101
121 <--x 66
66 --- 124
67 --- 100
67 --- 123
124 <--x 67
68 --- 98
68 --- 121
122 <--x 68
69 --- 104
126 <--x 69
69 --- 127
70 --- 103
125 <--x 70
70 --- 126
71 --- 102
71 --- 125
128 <--x 71
72 --- 105
127 <--x 72
72 --- 128
98 <--x 74
99 <--x 74
100 <--x 74
101 <--x 74
83 <--x 76
84 <--x 76
85 <--x 76
86 <--x 76
95 <--x 78
96 <--x 78
97 <--x 78
87 <--x 80
88 <--x 80
89 <--x 80
90 <--x 80
91 <--x 80
92 <--x 80
93 <--x 80
94 <--x 80
102 <--x 82
103 <--x 82
104 <--x 82
105 <--x 82
106 <--x 131
115 <--x 129
124 <--x 130