treeview(viewObject) reduce group with python

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
petit_chat_noir
Posts: 87
Joined: Wed Oct 02, 2019 6:45 pm

treeview(viewObject) reduce group with python

Post by petit_chat_noir »

Hello I've created a group with Python :

Code: Select all

FreeCAD.ActiveDocument.addObject("App::DocumentObjectGroupPython", self.name)
I've added some objects in, and i would like to reduce/minimize my group in the treeview with a python function:
reduced
reduced
Screenshot_20200421_143221.png (2.86 KiB) Viewed 1220 times
not reduced
not reduced
Screenshot_20200421_143205.png (4.05 KiB) Viewed 1220 times
thanks for reply
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: treeview(viewObject) reduce group with python

Post by Kunda1 »

Mod Edit: Moved to python scripting subforum
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
petit_chat_noir
Posts: 87
Joined: Wed Oct 02, 2019 6:45 pm

Re: treeview(viewObject) reduce group with python

Post by petit_chat_noir »

Mod Edit: Moved to python scripting subforum
[/quote]
@Kunda1 please send me a notification or PM when you move my post :D I'm lost
Kunda1 wrote: Tue Apr 21, 2020 4:12 pm
Syres
Veteran
Posts: 2902
Joined: Thu Aug 09, 2018 11:14 am

Re: treeview(viewObject) reduce group with python

Post by Syres »

petit_chat_noir wrote: Tue Apr 21, 2020 12:35 pm would like to reduce/minimize my group in the treeview
Collapse is the term you're looking I believe. If you see the macro in the Wiki https://wiki.freecadweb.org/Macro_ExpandTreeItem you'll notice the line:

Code: Select all

tree.collapseItem(item)
I think this should give you a good pointer.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: treeview(viewObject) reduce group with python

Post by Kunda1 »

petit_chat_noir wrote: Tue Apr 21, 2020 8:18 pm @Kunda1 please send me a notification or PM when you move my post :D I'm lost
You should of received some notification in the forum that I responded to this thread. Was that not enough?
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
Post Reply