Why does the Part --> booleans returns Compounds
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
Why does the Part --> booleans returns Compounds
Hi,
Does someone know why the part --> booleans (cut, union, intersection) on solids returns compound containing the resulting solid?
Is there a possiblility to return solids instead of compounds, or is there a parametric way to get the solid out of the compound?
Bernd
Does someone know why the part --> booleans (cut, union, intersection) on solids returns compound containing the resulting solid?
Is there a possiblility to return solids instead of compounds, or is there a parametric way to get the solid out of the compound?
Bernd
Re: Why does the Part --> booleans returns Compounds
I'm not sure why it does that, but one of the devs (maybe Werner?) told me that if the compound contains a single solid, you are fine. I stopped caring after that advice.
The Fillet operation also quite often produces a compound.
The Fillet operation also quite often produces a compound.
Re: Why does the Part --> booleans returns Compounds
Up to my knowledge boolean operations always returned a compound independent of whether it's a single solid or a million. Thus it's up to the caller of the function to unpack a single solid if this is what he expects.
In Python it's very easy:
In Python it's very easy:
Code: Select all
result = ...
solid = result.Solids[0]
Re: Why does the Part --> booleans returns Compounds
wmayer wrote:Up to my knowledge boolean operations always returned a compound independent of whether it's a single solid or a million. Thus it's up to the caller of the function to unpack a single solid if this is what he expects.
Code: Select all
result = ...
solid = result.Solids[0]
Does it make sense to create a mantis for a new preference for part. A small wrapper around the part booleans. If a boolean returns one solid in a compound the solid is returned instead of the compound. The resulting object in FreeCAD tree would than be a solid.
Re: Why does the Part --> booleans returns Compounds
At one time in FreeCAD, a Part Fuse output would be invalid if the Fuse did not create a single solid. My understanding was that the creation of a Compound from a fuse is so that a fuse of more than one non-intersecting solids would be able to give a valid output.bernd wrote:wmayer wrote:Up to my knowledge boolean operations always returned a compound independent of whether it's a single solid or a million. Thus it's up to the caller of the function to unpack a single solid if this is what he expects.This python snippets is exactly what I would like to get rid off because it is not parametric and it is not in user GUI.Code: Select all
result = ... solid = result.Solids[0]
Does it make sense to create a mantis for a new preference for part. A small wrapper around the part booleans. If a boolean returns one solid in a compound the solid is returned instead of the compound. The resulting object in FreeCAD tree would than be a solid.
If you are going to do something with the solid from a Fuse, you would need to first check that there is only one solid in the Fuse output compound.
Re: Why does the Part --> booleans returns Compounds
Sure I'm only talking about the cases when the result is valid and only one solid. Ahh thats exactly the problem how to distinguish. I see ...jmaustpc wrote:At one time in FreeCAD, a Part Fuse output would be invalid if the Fuse did not create a single solid. My understanding was that the creation of a Compound from a fuse is so that a fuse of more than one non-intersecting solids would be able to give a valid output.
If you are going to do something with the solid from a Fuse, you would need to first check that there is only one solid in the Fuse output compound.
Re: Why does the Part --> booleans returns Compounds
Found it !!! Lattice2 has exact the tool I need, hopefully! It is called "CompoundFilter remove some childs from a Compound!
- Attachments
-
- parametric_get_solid_from_boolean.fcstd
- (8.32 KiB) Downloaded 60 times
Re: Why does the Part --> booleans returns Compounds
For the last two month I have been using the tool CompoundFilter from lattice2 really really a lot. I would vote for integrating this tool in FreeCAD master? How about others?
@DeepSOIC:
What do you think about this?
bernd
@DeepSOIC:
What do you think about this?
bernd
- DeepSOIC
- Veteran
- Posts: 7896
- Joined: Fri Aug 29, 2014 12:45 am
- Location: used to be Saint-Petersburg, Russia
Re: Why does the Part --> booleans returns Compounds
Actually, that was the second tool added to Lattice, and I was considering to merge this tool into FreeCAD from the very beginning.bernd wrote:For the last two month I have been using the tool CompoundFilter from lattice2 really really a lot. I would vote for integrating this tool in FreeCAD master? How about others?
@DeepSOIC:What do you think about this?
Do you have a good suggestion as to where the tool should be? What workbench?
Re: Why does the Part --> booleans returns Compounds
As workbench is more or less organizational structure and the basic unit is the tool itself i guess choose one of the Python based workbenches or just add Lattice to FreeCAD by default.