"Unpack"/"Ungroup"/"Flatten" object hierarchy?

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
sdaau_ml
Posts: 35
Joined: Fri Dec 07, 2018 12:18 am

"Unpack"/"Ungroup"/"Flatten" object hierarchy?

Post by sdaau_ml »

Using:

Code: Select all

OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15379 (Git)
Build type: Release
Branch: master
Hash: 3290c36d28551875f02333c2e01af80e38b8ad02
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.9.1.oce-0.18
Locale: English/UnitedStates (en_US)
I'm guessing I just don't know how these things are called, else I could just look it up. Let's say I import sph_tor_rect_cyl.step in Freecad; I get something like this:
freecad-tree.png
freecad-tree.png (186.79 KiB) Viewed 2448 times
⠀⠀⠀⠀

Note that in the Model tree view, I have a hierarchy of some yellow nodes (how are these called, groups?), which have children of "Origin" nodes (how are these called?), and then blue nodes, which I gather are "actual" object nodes (how are these called properly?)

Now, what I want is a flat hierarchy of only blue nodes, but such that there positions, sizes etc are the same as on the original. All I've figured out so far is to Ctrl-multiselect the blue nodes, do Ctrl-C (Copy) since I cannot do Ctrl-X (Cut, is greyed out), then do Select All from the menu, Delete, say yes at Delete Group Content, then paste - I get my flat hierarchy, but the positions/sizes are all over the place:
freecad-tree2.png
freecad-tree2.png (172.29 KiB) Viewed 2448 times
⠀⠀⠀⠀

So, how is this process called here - unpack group, or flatten hierarchy, or ungroup? And how can I do it right, so all transformation attributes (sizes, positions) are taken into account when creating the flat hierarchy, so the scene remains the same?
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: "Unpack"/"Ungroup"/"Flatten" object hierarchy?

Post by DeepSOIC »

You'll need two add-ons: Part-o-magic and Lattice2
0. (if you don't want PoM to change the way FreeCAD behaves, press Stop button on the workbench)
1. in Part-o-magic, apply "Mux Assembly".
This creates a compound, with same internal nesting as all your parts and bodies.
2. Lattice2: apply "Downgrade to leaves".
This flattens the internal structure of the compound.
Also, you can change "Flatten Compound" property of Mux object to "true", instead.
3. Lattice2: "Explode Compound".
This extracts all the objects from the compound.
(Draft Downgrade may also do it, but I had mixed success. Hopefully, we'll have Explode tool in Part workbench too, so one less add-on to install)


These requests are getting common. Looks like we need a FC tool to accomplish this.
EDIT: I think, realthunder has it in Assembly3
sdaau_ml
Posts: 35
Joined: Fri Dec 07, 2018 12:18 am

Re: "Unpack"/"Ungroup"/"Flatten" object hierarchy?

Post by sdaau_ml »

Many thanks, @DeepSOIC:
DeepSOIC wrote: Tue Dec 11, 2018 3:57 pm You'll need two add-ons: Part-o-magic and Lattice2
Great information, good to know - thanks again!
Post Reply