Open
Description
I want to automatically fillet the new edges produced by fusing 2 shapes. Something like this: https://upload.wikimedia.org/wikipedia/commons/f/fd/Fillet.jpg
BRepFilletAPI_MakeFillet wants the edges returned TopTools_ListOfShape BRepAlgoAPI_Fuse::SectionEdges()
to be added one by one. And I don't see any way to non-destructively iterate over TopTools_ListOfShape
. If I try to copy it and iterate using First(); RemoveFirst()
I get a segfault.
Here is what I have now, it only fillets 2 edges. How do I get the rest?
from OCC.Core.BRepFilletAPI import BRepFilletAPI_MakeFillet
from OCC.Core import gp
import OCC.Core.BRepPrimAPI as occprim
import OCC.Core.BRepAlgoAPI as occalgo
from OCC.Display.SimpleGui import init_display
from OCC.Display.backend import load_backend
load_backend()
cyl = occprim.BRepPrimAPI_MakeCylinder(10, 10).Shape()
cpos = gp.gp_Pnt(9, 0, -2)
cube = occprim.BRepPrimAPI_MakeBox(cpos, 6, 6, 6).Shape()
display, start_display, add_menu, add_function_to_menu = init_display()
fus = occalgo.BRepAlgoAPI_Fuse(cyl, cube)
se = fus.SectionEdges()
new_edges = []
fil = BRepFilletAPI_MakeFillet(fus.Shape())
print("%d edges" % (se.Size()))
# Here ideally it should be like "for edge in se: fil.Add(0.1, edge)"
fil.Add(0.1, se.First())
fil.Add(0.1, se.Last())
fil.Build()
assert fil.IsDone()
ret = fil.Shape()
display.DisplayShape(ret, update=True)
start_display()
As an additional note, if you replace cube position to cpos = gp.gp_Pnt(9, 0, -2)
it crashes. Not sure if it's related.