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:
@ -745,64 +745,20 @@ description: Artifact commands gridfinity-bins.kcl
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": null,
|
||||
"edge_ids": [
|
||||
"[uuid]",
|
||||
"[uuid]",
|
||||
"[uuid]",
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 0.8,
|
||||
"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]",
|
||||
"[uuid]",
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 0.8,
|
||||
"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": [
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 0.8,
|
||||
"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": [
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 0.8,
|
||||
"tolerance": 0.0000001,
|
||||
"cut_type": "fillet",
|
||||
"strategy": "automatic",
|
||||
"extra_face_ids": []
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -2982,64 +2938,20 @@ description: Artifact commands gridfinity-bins.kcl
|
||||
"object_id": "[uuid]",
|
||||
"edge_id": null,
|
||||
"edge_ids": [
|
||||
"[uuid]",
|
||||
"[uuid]",
|
||||
"[uuid]",
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 3.75,
|
||||
"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]",
|
||||
"[uuid]",
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 3.75,
|
||||
"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": [
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 3.75,
|
||||
"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": [
|
||||
"[uuid]"
|
||||
],
|
||||
"radius": 3.75,
|
||||
"tolerance": 0.0000001,
|
||||
"cut_type": "fillet",
|
||||
"strategy": "automatic",
|
||||
"extra_face_ids": []
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -195,19 +195,7 @@ flowchart LR
|
||||
113["SweepEdge Adjacent"]
|
||||
114["EdgeCut Fillet<br>[2606, 2836, 0]"]
|
||||
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
115["EdgeCut Fillet<br>[2606, 2836, 0]"]
|
||||
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
116["EdgeCut Fillet<br>[2606, 2836, 0]"]
|
||||
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
117["EdgeCut Fillet<br>[2606, 2836, 0]"]
|
||||
%% [ProgramBodyItem { index: 22 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
118["EdgeCut Fillet<br>[4704, 4937, 0]"]
|
||||
%% [ProgramBodyItem { index: 27 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
119["EdgeCut Fillet<br>[4704, 4937, 0]"]
|
||||
%% [ProgramBodyItem { index: 27 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
120["EdgeCut Fillet<br>[4704, 4937, 0]"]
|
||||
%% [ProgramBodyItem { index: 27 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
121["EdgeCut Fillet<br>[4704, 4937, 0]"]
|
||||
115["EdgeCut Fillet<br>[4704, 4937, 0]"]
|
||||
%% [ProgramBodyItem { index: 27 }, VariableDeclarationDeclaration, VariableDeclarationInit, PipeBodyItem { index: 7 }]
|
||||
1 <--x 6
|
||||
1 --- 10
|
||||
@ -466,12 +454,6 @@ flowchart LR
|
||||
78 <--x 74
|
||||
79 <--x 74
|
||||
80 <--x 74
|
||||
105 <--x 115
|
||||
106 <--x 117
|
||||
107 <--x 114
|
||||
108 <--x 116
|
||||
110 <--x 119
|
||||
111 <--x 118
|
||||
112 <--x 120
|
||||
113 <--x 121
|
||||
105 <--x 114
|
||||
110 <--x 115
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user