Do multiple chamfer/fillet in one API call (#6750)
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.
This commit is contained in:
@ -198,30 +198,16 @@ description: Artifact commands rotate_after_fillet.kcl
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": null,
|
||||
"edge_ids": [
|
||||
"[uuid]",
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 0.02,
|
||||
"tolerance": 0.0000001,
|
||||
"cut_type": "fillet",
|
||||
"strategy": "automatic",
|
||||
"extra_face_ids": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"cmdId": "[uuid]",
|
||||
"range": [],
|
||||
"command": {
|
||||
"type": "solid3d_fillet_edge",
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": null,
|
||||
"edge_ids": [
|
||||
"extra_face_ids": [
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 0.02,
|
||||
"tolerance": 0.0000001,
|
||||
"cut_type": "fillet",
|
||||
"strategy": "automatic",
|
||||
"extra_face_ids": []
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -85,9 +85,7 @@ flowchart LR
|
||||
48["SweepEdge Adjacent"]
|
||||
49["EdgeCut Fillet<br>[456, 522, 0]"]
|
||||
%% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
|
||||
50["EdgeCut Fillet<br>[456, 522, 0]"]
|
||||
%% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 0 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
|
||||
51["EdgeCut Fillet<br>[1381, 1440, 0]"]
|
||||
50["EdgeCut Fillet<br>[1381, 1440, 0]"]
|
||||
%% [ProgramBodyItem { index: 7 }, VariableDeclarationDeclaration, VariableDeclarationInit, FunctionExpressionBody, FunctionExpressionBodyItem { index: 2 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 3 }]
|
||||
1 --- 4
|
||||
29 x--> 2
|
||||
@ -112,7 +110,7 @@ flowchart LR
|
||||
7 x--> 31
|
||||
7 --- 40
|
||||
7 --- 48
|
||||
7 --- 50
|
||||
7 --- 49
|
||||
8 --- 26
|
||||
8 x--> 29
|
||||
8 --- 39
|
||||
@ -199,6 +197,5 @@ flowchart LR
|
||||
38 <--x 30
|
||||
39 <--x 30
|
||||
33 <--x 32
|
||||
33 <--x 51
|
||||
40 <--x 49
|
||||
33 <--x 50
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user