Description
Hello,
We start here with two topoDS solids as illustrated below. The blue is obtained by rotating the red one.
The two solids are fused using BOPAlgo_FUSE
. The topoDS compound obtained is shown below. The geometry is not as expected at the outer radius of the interface. The question is then how to avoid the edge to collapse during the boolean operation? A short recap of what has been tested is made at the end of this ticket.
A bit more background...
The original code does not produce these simple solids but has a lot more other transformations. The idea was to deactivate as many of these operations as possible to produce simple parts, and narrow down the problem. It is how the two solids were born. And the interesting part here: if these two solids are exported as step (using tools from OCC.Extend.DataExchange
with standard tolerances), read again in pyOCC and fused with exactly the same piece of code then it is WORKING AS EXPECTED! Screenshot below.
A closer look at the interface...
The surfaces building the interface between the two solids do not seem to be mathematically favorable, especially the pink surface as illustrated below which is ending at the outer radius in thin shape. Is it possible that the export of the the solid to step format performs some simplifications that could facilitate the Fuse afterwards?
What has been tested
Below the piece of code used to fuse. Please note that many combinations of options have been tried, with or without glueing, parallel/not parallel, fuse tolerances. Also generating an overlap between the solids. Attempt to heal the solid has been done but with some default settings, without really knowing which tools and options are relevant on this case, so any advice welcome!
from OCC.Display.WebGl.jupyter_renderer import JupyterRenderer
from OCC.Extend.DataExchange import read_step_file,write_step_file
from OCC.Core.TopTools import TopTools_ListOfShape
from OCC.Core.BRepAlgoAPI import BRepAlgoAPI_Fuse
from OCC.Core.BOPAlgo import BOPAlgo_GlueFull,BOPAlgo_BOP,BOPAlgo_FUSE
tools=TopTools_ListOfShape()
args=TopTools_ListOfShape()
for i in range (0,2,1):
filename='../fuse_issue_'+str(i)+'.stp'
print(filename)
a_topods_solid = read_step_file(filename)
if i==0:
args.Append(a_topods_solid)
else:
tools.Append(a_topods_solid)
a_maker=BOPAlgo_BOP()
a_maker.SetOperation(BOPAlgo_FUSE)
a_maker.SetRunParallel(True)
a_maker.SetArguments(args)
a_maker.SetTools(tools)
a_maker.SetGlue(BOPAlgo_GlueFull)
fuzzy=1e-6
a_maker.SetFuzzyValue(fuzzy)
a_maker.Perform()
a_topods_shape=a_maker.Shape()
print(type(a_topods_shape))
my_renderer = JupyterRenderer()
my_renderer.DisplayShape(a_topods_shape, render_edges=True, update=True,quality=0.1)
my_renderer.toggle_grid_visibility(False)
Version:
pythonocc-core=7.7.0
Summary
Fusing the solids in the main code does not work for this specific case. The problem might be related to the thin surface at the interface? A workaround consists in exporting the solids as step, importing them again and fuse , but is not really satisfying from the coding perspective. Understanding what the step export does might help fixing the issue!