[Implemented] Ticket #3923 - change order in tree view

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!
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

[Implemented] Ticket #3923 - change order in tree view

Post by bernd »

If new groups or objects are added to the document they will be at the end of the tree view. Is it somehow possible to change the order of the tree view elements (I am interested in the first level only) manually? Attached a screen. I would like to move the "Aufhaenger-extrahiert" to the top above "hilfskoerper-zwischenstufen" and "FB Stahltreppe alle teile" between "Fusion001" and "Analysis"

bernd

screen.jpg
screen.jpg (25.36 KiB) Viewed 7504 times
Last edited by Kunda1 on Fri Nov 12, 2021 12:24 pm, edited 2 times in total.
Reason: This feature has been implemented in v0.20dev
User avatar
Chris_G
Veteran
Posts: 2596
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: change order in tree view

Post by Chris_G »

There a "hack" way :
- create a group
- put all the objects in it, in the desired order
- delete the group
chrisb
Veteran
Posts: 54168
Joined: Tue Mar 17, 2015 9:14 am

Re: change order in tree view

Post by chrisb »

I used this technique until I realised, that it does not survive save/reload :( .
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
yorik
Founder
Posts: 13659
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: change order in tree view

Post by yorik »

I'd like to discuss this question too at some point... Obviously we'll need Werner's opinion.

The list of objects in a FreeCAD document is apparently just a simple array https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L2638 so in theory, it seems possible to remove an item from it and reinsert it at another place. AFAICS the tree is simply reflecting directly the array order

I tried this in the Path WB in the past, you can reorder objects inside a group (Path Compound): https://github.com/FreeCAD/FreeCAD/blob ... .cpp#L2638 and it seems pretty stable...

Maybe we could try? Add a couple of methods to the FreeCAD document to move an object in the stack, and see what happens :?:
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: change order in tree view

Post by bernd »

since we have hundreds of messages each day especially in help, I sent him a message with a link to this topic.

cheers bernd
wmayer
Founder
Posts: 20301
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: change order in tree view

Post by wmayer »

IMO the easiest way would be to only change the tree view directly and do not touch the order of objects inside the document. To make the order of items in the tree view persistent the GuiDocument.xml can be extended to also store this order.
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: change order in tree view

Post by bernd »

wmayer wrote: Fri Mar 29, 2019 3:35 pm IMO the easiest way would be to only change the tree view directly and do not touch the order of objects inside the document. To make the order of items in the tree view persistent the GuiDocument.xml can be extended to also store this order.
seams reosnable to me too, issue #3923
freecad-heini-1
Veteran
Posts: 7790
Joined: Tue Jan 07, 2014 11:10 am
Contact:

Re: change order in tree view

Post by freecad-heini-1 »

bernd wrote: Tue Apr 02, 2019 11:07 am
wmayer wrote: Fri Mar 29, 2019 3:35 pm IMO the easiest way would be to only change the tree view directly and do not touch the order of objects inside the document. To make the order of items in the tree view persistent the GuiDocument.xml can be extended to also store this order.
seams reosnable to me too, issue #3923
I asked more or less the same question in August 2013:
https://forum.freecadweb.org/viewtopic. ... 220#p34220
With some strange answers.
wmayer
Founder
Posts: 20301
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: change order in tree view

Post by wmayer »

freecad-heini-1 wrote: Tue Apr 02, 2019 12:57 pm https://forum.freecadweb.org/viewtopic. ... 220#p34220
With some strange answers.
What you asked there is something different because it has an impact on the result when you change the order of operations. Something similar exists in PD (since v0.17) where for a body you can change the position of a feature. It is not yet very robust but it's a start.

What has been asked here -- unless I have understood something wrong -- is a pure GUI thing without any impact on any operations.
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: change order in tree view

Post by kisolre »

I dont know how DragDrop is realized but now it forbids dragging from one container(Document, Part, Group) to itself. If just this was possible it would be easy to rearange objects in reverse order - move object to end of container tree.
Post Reply