Feature idea: blended fusion

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
jnxd
Posts: 952
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Feature idea: blended fusion

Post by jnxd »

So, DeepSOIC and I have been exploring the possibilities with blended fusion, and it appears that there are bugs in OCC at multiple levels that prevent us from actually implementing this feature right away. Blended fusion consists of three problems:
  1. Finding the fusion.
  2. Finding the (non-redundant) section edges, i.e. the edges at the interface between the objects, within the fusion.
  3. Performing the fillet itself on the section edges.
Finding the fusion is straight forward, but the other two problems are the bigger hurdles. I'll try to elaborate them here, but the text will be too geeky.

While section exists as a boolean operation, the edges that it returns have at their core different TShapes than those that are part of the fusion, and are necessary to make the fillet. To obtain those, we tried two methods: using BRepAlgoAPI_BooleanOperation::SectionEdges() within the C++ framework; and using generalFuse in Python. SectionEdges sometimes misses a few edges, especially the ones that were already there, or are parts of edges that were already there. Using generalFuse and then finding common edges between the "children" seems to be the way to go, but in one case I had a single vertex being returned as an edge, which might or might not affect the results.

Making the fillet itself also has its own bugs, ranging from the fillet creation simply failing to FreeCAD crashing. We suspect the redundant edges are again at play here.

DeepSOIC believes, and I agree, that due to these bugs, it is best to not incorporate them directly into the Part workbench, but to make a macro. By tonight or tomorrow I will create a simple macro for BlendedFusion for the rest of the community to play with and then we can decide whether or not to refine it, and maybe add other boolean operations too.
User avatar
jnxd
Posts: 952
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: Feature idea: blended fusion

Post by jnxd »

Here's the promised macro (updated circa 20:40 IST). Select two solids and run:

Code: Select all

import MacroBlendedFusion
MacroBlendedFusion.run()
Edit: Added optionally arguments fillet_radius, base_obj and tool_obj.
Attachments
MacroBlendedFusion.py
(6.59 KiB) Downloaded 40 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Feature idea: blended fusion

Post by DeepSOIC »

Gallery of successes.
blf good 1.png
blf good 1.png (332.11 KiB) Viewed 797 times

Gallery of fails.
blf bad 1.png
blf bad 1.png (110.74 KiB) Viewed 797 times
looks good, but fails BOPCheck
looks good, but fails BOPCheck
blf good 2.png (280.19 KiB) Viewed 795 times
Post Reply