FreeCAD new tree functionality for drag elements to sub-tree
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
FreeCAD new tree functionality for drag elements to sub-tree
Hello,
I would like to create a new FreeCAD functinality wich is similar to Catia's tree manipulation. It functionality will pop a new window with a sub-tree from selected element and allows drag an element from main tree to the created sub-tree.
I am showing an image with the Catia's funtionality for better understanding.
If someone knows if it funtionality already exists in FreeCAD or someone has programed, please let me know.
cheers,
Dani.
I would like to create a new FreeCAD functinality wich is similar to Catia's tree manipulation. It functionality will pop a new window with a sub-tree from selected element and allows drag an element from main tree to the created sub-tree.
I am showing an image with the Catia's funtionality for better understanding.
If someone knows if it funtionality already exists in FreeCAD or someone has programed, please let me know.
cheers,
Dani.
Re: FreeCAD new tree functionality for drag elements to sub-tree
Please elaborate on the semantics of such actions
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: FreeCAD new tree functionality for drag elements to sub-tree
My proposed vehavior:
Raight click to element, menú select move, appear a second Window with tree, Clik on destination container on the new Window. T'he element Moves to new destination, you can select destination on new Window and elements to move on t'he Otger Window.
Raight click to element, menú select move, appear a second Window with tree, Clik on destination container on the new Window. T'he element Moves to new destination, you can select destination on new Window and elements to move on t'he Otger Window.
Re: FreeCAD new tree functionality for drag elements to sub-tree
Thank you for answer.
The functionality aims to solve the problem of moving objects in tree when it is very large. It will be very useful if yo have several windows with diferent portions of tree and can move objets in order to have all in the correct place.
The proposed behavior is a valid one. For my Python skills the question will be if there are enough code out there for reuse in this question.
I am analyzing some macros like this: https://gist.github.com/mario52a/67517e ... dcfd8c9190 writed by mario52a for reuse some ideas.
Best regards,
Dani
The functionality aims to solve the problem of moving objects in tree when it is very large. It will be very useful if yo have several windows with diferent portions of tree and can move objets in order to have all in the correct place.
The proposed behavior is a valid one. For my Python skills the question will be if there are enough code out there for reuse in this question.
I am analyzing some macros like this: https://gist.github.com/mario52a/67517e ... dcfd8c9190 writed by mario52a for reuse some ideas.
Best regards,
Dani
Re: FreeCAD new tree functionality for drag elements to sub-tree
That would indeed be helpful. There is already the possibility to open a TreeView in addition to the ComboView; alas, it is not possible to drag objects from one view to the other.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: FreeCAD new tree functionality for drag elements to sub-tree
I don't want to pile on but;
It would cool if we could open a library view in a new window, where we could drag items in/out into the main tree view. I wouldn't really care about sub-features, I would like to use it as a model object item holder.
Also want to thing about the logic of saving changes on a close.
It would cool if we could open a library view in a new window, where we could drag items in/out into the main tree view. I wouldn't really care about sub-features, I would like to use it as a model object item holder.
Also want to thing about the logic of saving changes on a close.
Re: FreeCAD new tree functionality for drag elements to sub-tree
Hello, I have a very preliminary version of the macro.
It works with some files but fails on others. The problem is that I can`t get an ordered list of objects with FreeCAD Name as same order as FreeCAD's tree.
I tried this diferent ways:
1. Using qtreewidget:
I can get the FreeCAD's qtreewidget used in treeview by:
The object self.FVtreeitems contains a list of qtreewidgetitems which property .text() is the FreeCAD Label. In this way the objects are listed in the correct order but I have no the Name property.
2. I can use the property OutList of a FreeCAD object like so:
This returns a list of objects that are below 'ObjectName' in the FreeCAD's tree but not always in the correct order.
I can not find a piece of code for achieve the solution. I put my very preliminary code on github: https://github.com/iinjdpa/TreeHelper
Thanks,
Dani.
It works with some files but fails on others. The problem is that I can`t get an ordered list of objects with FreeCAD Name as same order as FreeCAD's tree.
I tried this diferent ways:
1. Using qtreewidget:
I can get the FreeCAD's qtreewidget used in treeview by:
Code: Select all
mw = Gui.getMainWindow()
self.tw = mw.findChildren(QtGui.QTreeWidget)
self.tw0 = self.tw[0]
self.FCtreeitems = self.tw0.findItems('*', Qt.MatchWrap | Qt.MatchWildcard | Qt.MatchRecursive)[0]
2. I can use the property OutList of a FreeCAD object like so:
Code: Select all
App.ActiveDocument.getObject('ObjectName').OutList
I can not find a piece of code for achieve the solution. I put my very preliminary code on github: https://github.com/iinjdpa/TreeHelper
Thanks,
Dani.
- Pauvres_honteux
- Posts: 728
- Joined: Sun Feb 16, 2014 12:05 am
- Location: Far side of the moon
Re: FreeCAD new tree functionality for drag elements to sub-tree
Any chance of getting this into master? Or at least into AddonManager?
Re: FreeCAD new tree functionality for drag elements to sub-tree
Hello,
I found the functionality for getting the macro working. I used the method object.ViewObject.claimChildren() for get the true children of an object in the FreeCAD's tree.
I am working in some litle errors and new funcionalities for pass objects between different sub-trees.
I created a youtube video with an easy example about macro working.
https://www.youtube.com/watch?v=f32JEWJefAE
I found the functionality for getting the macro working. I used the method object.ViewObject.claimChildren() for get the true children of an object in the FreeCAD's tree.
I am working in some litle errors and new funcionalities for pass objects between different sub-trees.
I created a youtube video with an easy example about macro working.
https://www.youtube.com/watch?v=f32JEWJefAE
Re: FreeCAD new tree functionality for drag elements to sub-tree
Hello,
I finish some bugs fixed and now I can move objects between sub-trees.
Youtube vídeo: https://www.youtube.com/watch?v=mzuLPpF64tY&t=2s
I finish some bugs fixed and now I can move objects between sub-trees.
Youtube vídeo: https://www.youtube.com/watch?v=mzuLPpF64tY&t=2s