View Issue Details

IDProjectCategoryView StatusLast Update
0000755FreeCADFeaturepublic2013-10-30 08:37
Reportershoogen Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version0.12 
Target VersionFixed in Version0.14 
Summary0000755: Add a Feature to delete a whole subtree of the FeatureTree
DescriptionAdd a new 'delete' Feature that delete the selected Object and all (indirect) Children that are only referenced in in the selected Objects and its (indirect) Children.
Keyboard shortcut could be SHIFT-DEL
Additional InformationThis would be helpful to prepare a file for project merging.
TagsNo tags attached.
FreeCAD Information

Activities

shoogen

2012-06-24 18:08

developer   ~0002238

Last edited: 2012-06-24 18:21

python implementation:

import FreeCAD
def removesubtree(objs):
    def addsubobjs(obj,toremoveset):
        toremove.add(obj)
        for subobj in obj.OutList:
            addsubobjs(subobj,toremoveset)

    toremove=set()
    for obj in objs:
        addsubobjs(obj,toremove)
    checkinlistcomplete =False
    while not checkinlistcomplete:
        for obj in toremove:
            if (obj not in objs) and (frozenset(obj.InList) - toremove):
                toremove.remove(obj)
                break
        else:
            checkinlistcomplete = True
    for obj in toremove:
        obj.Document.removeObject(obj.Name)

import FreeCADGui
removesubtree(FreeCADGui.Selection.getSelection())

jmaustpc

2012-07-01 05:16

manager   ~0002253

As you said in the description, it is possible that an item in the tree is used elsewhere in an other item's tree, so the code would have to check for this before deleting.

shoogen

2013-10-29 16:51

developer   ~0003830

the function is available in the OpenSCAD workbench. Unless there is a demand for a global key binding, we can close the ticket.

wmayer

2013-10-30 08:37

administrator   ~0003832

OK.

Issue History

Date Modified Username Field Change
2012-06-16 08:50 shoogen New Issue
2012-06-24 18:08 shoogen Note Added: 0002238
2012-06-24 18:21 shoogen Note Edited: 0002238
2012-07-01 05:16 jmaustpc Note Added: 0002253
2013-10-29 16:51 shoogen Note Added: 0003830
2013-10-30 08:37 wmayer Note Added: 0003832
2013-10-30 08:37 wmayer Status new => closed
2013-10-30 08:37 wmayer Resolution open => fixed
2013-10-30 08:37 wmayer Fixed in Version => 0.14