Part-o-magic [New: Selection tools, container duplication]

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Part-o-magic [New tool: MUX Assembly]

Post by easyw-fc »

DeepSOIC wrote: Tue May 29, 2018 9:05 pm Ugh, I know you love colors :P but I still haven't looked into if it is possible to copy face colors with python.
Ahahah I know ... :D

Code: Select all

Gui.ActiveDocument.YourObj.DiffuseColor
will give you the diffuse color for all faces or for each single face depending on the object properties...
If

Code: Select all

len(Gui.ActiveDocument.YourObj.DiffuseColor) != len (App.ActiveDocument.YourObj.Shape.Faces)
then your obj has a single color for all the faces, else it has different color for faces
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Part-o-magic [New tool: X-ray]

Post by easyw-fc »

DeepSOIC wrote: Tue May 29, 2018 4:56 pm New feature:
* MUX assembly
Copies all shapes from Part hierarchy into a compound of same hierarchy. Supports exculsion list (names), compound flattening (for fusion), and is ghost-like (takes container placements into account).
first report ...
1) When I make a Cut of the attached file, the Mux thing behaves differently from a Cut made with a Union-ed object
Mux-cutting.png
Mux-cutting.png (195.42 KiB) Viewed 1680 times
2) if I make a Mux of a Part, then I cannot do any more a DeepCopy without deleting the Mux thing... is that related to an observer?

here the file
Part-in-Part-Cut.FCStd
(21.22 KiB) Downloaded 42 times
Thx again
Maurice
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Part-o-magic [New tool: X-ray]

Post by DeepSOIC »

easyw-fc wrote: Wed May 30, 2018 9:29 am first report ...
1) When I make a Cut of the attached file, the Mux thing behaves differently from a Cut made with a Union-ed object
Mux-cutting.png
MUX is a self-intersecting compound. You should not use these for boolean operations directly.

To achieve the result you did with fusion, you should:
1. Set MUX.FlattenCompound = True
This un-nests the compound. Necessary, because fusion only takes children of the topmost compound.
2. Part Union the MUX. This will merge all solids
3. Part Cut Fusion with Cone.


As for deep copy -- no idea... MUX should not interfere with Observer in any special manner.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Part-o-magic [New tool: MUX Assembly]

Post by DeepSOIC »

I feel like making a dedicated "Fuse Part" tool is worth it. Because the thing I suggested is hard to come up with.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Part-o-magic [New tool: MUX Assembly]

Post by easyw-fc »

DeepSOIC wrote: Wed May 30, 2018 9:55 am I feel like making a dedicated "Fuse Part" tool is worth it. Because the thing I suggested is hard to come up with.
that sounds good!
DeepSOIC wrote: Wed May 30, 2018 9:50 am As for deep copy -- no idea... MUX should not interfere with Observer in any special manner.
I will have a look at.. thx for clarification
EDIT: it was related to my way to exclude some InListRecursive objects, and MUX is going into this list for the muxed obj :)
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Part-o-magic [New tool: X-ray]

Post by easyw-fc »

some more test of this new feature:
DeepSOIC wrote: Wed May 30, 2018 9:50 am To achieve the result you did with fusion, you should:
1. Set MUX.FlattenCompound = True
This un-nests the compound. Necessary, because fusion only takes children of the topmost compound.
2. Part Union the MUX. This will merge all solids
I noticed this is not working when a Part Extrusion of a Sketch is inside a MUX... Part Union will give a MultiFusion failure
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Part-o-magic [New tool: MUX Assembly]

Post by DeepSOIC »

easyw-fc wrote: Thu May 31, 2018 9:17 pm I noticed this is not working when a Part Extrusion of a Sketch is inside a MUX... Part Union will give a MultiFusion failure
That is because Sketch is a child of Part too, and thus is included in compound. Fusion then fails, because it refuses to merge shapes of different dimensional kinds (solids + wires in this case).

Your options are:
1. put the extrude and the sketch into a Module container
OR
2. add the sketch to exclusion list of the MUX
OR
3. filter the MUX with Lattice Downgrade to solids.
IMO 1 is best, in combo with 2 for master sketches. I plan adding a filter property for MUX to deal with 2 in automated manner.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Part-o-magic [New tool: MUX Assembly]

Post by easyw-fc »

DeepSOIC wrote: Fri Jun 01, 2018 1:24 am Your options are:
1. put the extrude and the sketch into a Module container
OR
2. add the sketch to exclusion list of the MUX
OR
3. filter the MUX with Lattice Downgrade to solids.
IMO 1 is best, in combo with 2 for master sketches. I plan adding a filter property for MUX to deal with 2 in automated manner.
I didn't know about the Exclusion List... very useful
...
In some user case an automatic exclusion may not be useful (i.e. when you export the MUX the sketch/wire may be useful)... may be an option as a python parameter...
Thx again ... this MUX container is getting very interesting... :)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Part-o-magic [New tool: MUX Assembly]

Post by Kunda1 »

This workbench is awesome, we need to really get it documented!
https://github.com/DeepSOIC/Part-o-magic/issues/25
There is a lot in this thread that help get that started. Any volunteers to help make that happen?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: Part-o-magic [New tool: MUX Assembly]

Post by easyw-fc »

Kunda1 wrote: Tue Oct 02, 2018 11:50 am This workbench is awesome ...
fixing py3 compatibility
https://github.com/DeepSOIC/Part-o-magic/pull/26
Locked