If I delete a group in the gui, I need to delete sometimes up to 5 times before all objects are really deleted. Is there a possibility to delete all group objects recursively?
bernd
deleting a group with all its contents recursively
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
Re: deleting a group with all its contents recursively
Are you referring to a "group" object or a feature in the tree that has multiple features/operation under it?
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: deleting a group with all its contents recursively
a FreeCAD group object, especially the Arch spatial groups. They have groups in groups and Features in this groups and the python features are based on parts. sometimes a thousand or two thousand.
Re: deleting a group with all its contents recursively
an example attached
- Attachments
-
- group_to_delete.FCStd
- (315.59 KiB) Downloaded 43 times
Re: deleting a group with all its contents recursively
OPenSCAD->Remove objects and their children.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: deleting a group with all its contents recursively
Sorry, I had wrongly assumed it worked universally.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: deleting a group with all its contents recursively
In the regard of openscad tool it is just a matter of implemented command activation. If a part object is added the command is not greyed and can be applied. It works than, but this is somehow cumbersome ...
Re: deleting a group with all its contents recursively
Good find! I had tried to move things into a normal group, but that didn't work either.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
-
- Veteran
- Posts: 2764
- Joined: Mon Feb 27, 2012 5:31 pm
Re: deleting a group with all its contents recursively
I had a look at the code in the OpenSCAD workbench.
The relevant Feature is RemoveSubtree
Code: Select all
class RemoveSubtree:
def IsActive(self):
return FreeCADGui.Selection.countObjectsOfType('Part::Feature') > 0
def Activated(self):
print('Activated')
import OpenSCADUtils,FreeCADGui
OpenSCADUtils.removesubtree(FreeCADGui.Selection.getSelection())
I tried adding a call to FreeCADGui.getSelection to the IsActive function, but clicking on the group does not cause this to return anything
and I did not see anything in the Selection View panel.