[in master] Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

[in master] Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by DeepSOIC »

Hi!
I've been working on these for a few weeks already. The main goal was to port Connect to use generalFuse method, to make it faster. In the process, It became clear it's relatively easy to add a few more tools (which proved to be much more involved than I anticipated, but I did it :D .

Code:
https://github.com/DeepSOIC/FreeCAD-ell ... nFeatures4

I ask for some testing before I make a pull request.

Here's a brief list of what has happened:
* old JoinFeatures was changed to a deprecated state, where it is only capable of recomputing existing objects (using legacy algorithm).

* New JoinFeatures (Connect, Embed, Cutout) were implemented. They use the new generalFuse if OCC6.9.0, or fall back to legacy algorithm (less capable) if OCC is lower.
** Connect now supports multiple arguments
** Connect can take a (single) compound to act as a set of arguments (thus you can now connect self-intersecting Draft Arrays)
** Connect now works with shells/faces, and wires/edges. It might work with compsolids, too (I didn't test, it'll probably treat them as single solids).
** Connect now has Tolerance property (appears to break input shapes, so it probably should be avoided).
** Embed and Cutout are essentially unchanged. But try them on shells/faces and wires, and tell me if they work or not.

* new Split Tools: Boolean Fragments, Slice and XOR. These output compounds, and they need to be exploded to get the actual splitting. They work only if OCC is 6.9.0 and up.
** New tool: Boolean Fragments. This one is essentially generalFuse method exposed to Gui. BUT. It has Mode property, which alters its behavior. The most interesting mode is "CompSolid", which makes compsolids!
** New tool: Slice. It can split solids apart with a plane (for example). It can also "engrave" sketches onto faces of solids/whatever. It should accept a wide variety of inputs, from compsolids to vertices. Just try it, and tell me if it doesn't do what you expected.
It also has Mode property, which has "CompSolid" entry.
** New tool: Boolean XOR. That pretty much says it all. Although I doubt it will be very useful, I made it because it was easy (and it helped reveal a serious problem with the code)

API:
* the new JoinFeatures now have API to work on shapes. This API, as well as all the machinery that makes it work, is exposed as Part.BOPTools,* I hope this machinery will help create more BOP-like tools in the future!
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by NormandC »

DeepSOIC wrote:New tool: Boolean XOR. That pretty much says it all.
Nope. Not for me anyway. :D
DeepSOIC wrote:New tool: Slice. It can split solids apart with a plane (for example). It can also "engrave" sketches onto faces of solids/whatever.
Sounds very interesting. Quite a few people have enquired if FreeCAD had this functionality.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by DeepSOIC »

NormandC wrote:
DeepSOIC wrote:New tool: Boolean XOR. That pretty much says it all.
Nope. Not for me anyway. :D
Part_XOR.png
Part_XOR.png (90.67 KiB) Viewed 2684 times
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by NormandC »

Still don't know what XOR stands for.
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by ezzieyguywuf »

https://en.wikipedia.org/wiki/Exclusive_or

Deepsoic: Is that a valid solid? It seems like some of those edges may violate the rule of number of faces per edge (I can't remember the rule specifically).
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by DeepSOIC »

ezzieyguywuf wrote:Is that a valid solid? It seems like some of those edges may violate the rule of number of faces per edge (I can't remember the rule specifically).
On the screenshot, there is no solid. It's a compound of faces on XY plane. But if you XOR some cylinders, you'll get a compound of solids. It passes BOPCheck, even though the solids/faces in the compound are touching.

It is usually considered invalid (invalid for BOP, to be specific) to have a compound of touching objects. Boolean fragments, Slice and XOR all create such compounds. Nevertheless, they pass BOPCheck, and can be put through further Boolean operations. I believe this is thanks to that things they touch with are shared.
http://www.opencascade.com/doc/occt-7.0 ... ithms_10_1
OCCT Guide wrote:The argument should not be self-interfered, i.e. all sub-shapes of the argument that have geometrical coincidence through any topological entities (vertices, edges, faces) should share these entities.
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by ezzieyguywuf »

Neat, sounds like you've done your homework. I can't say I have an immediate use for it, but I can definitely see why having these features would be helpful. Well done!
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by ickby »

Nicely done DeepSoic! I really love to see that Part Workbench gets all those specialized tools, that makes it ever more powerfull for advanced users! Together with a more streamlined user-friendly PartDesign IMHO this is a very good way for evolving FreeCAD!
triplus
Veteran
Posts: 9471
Joined: Mon Dec 12, 2011 4:45 pm

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by triplus »

ickby wrote:Nicely done DeepSoic! I really love to see that Part Workbench gets all those specialized tools, that makes it ever more powerfull for advanced users! Together with a more streamlined user-friendly PartDesign IMHO this is a very good way for evolving FreeCAD!
I am sure this will be ironed out over time but i feel we must not confuse features nobody really understand when reading the description with powerful features. And the use of substandard terminology doesn't really help here. Somebody said in the past if you can't explain it to a child you probably don't know what you are doing. ;)

Therefore this is definitely something that will need additional attention in the future. That is putting the powerful features behind understandable use-cases and short and understandable description. Terminology should be human readable and workflow intuitive.

I do understand ATM things are explored and under heavy development. Therefore they can't be perfect. But as said in the future i would expect additional effort to be made to explain something to average FreeCAD users without loose ends. That is powerful in the end.
User avatar
tanderson69
Veteran
Posts: 1626
Joined: Thu Feb 18, 2010 1:07 am

Re: Test request: updated JoinFeatures,new tools BoolFragments, Slice, XOR

Post by tanderson69 »

great work DeepSoic! bernd is going to love this for his FEM compsolids.
Post Reply