Problem when deleting an empty group: objects seem linked

A forum dedicated to the Draft, Arch and BIM workbenches development.
JLB85FR
Posts: 76
Joined: Fri Jan 15, 2016 7:08 pm
Location: Vendée - France

Problem when deleting an empty group: objects seem linked

Postby JLB85FR » Tue Mar 22, 2016 5:00 pm

Hi,
I have certainly something wrong in the design file, but I cannot repair it.
I have added many windows and doors to a building, and since this time, several things do not work properly.
If you try to delete the empty group 'Piscine', other components are deleted, when toggling visibility of group it toggles visibility of the other objects as well.

Is this a bug ? :(

OS: Windows XP
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.16.6647 (Git)
Build type: Release
Branch: master
Hash: 9299a73cf1482db4120b94543b33c2f9ec758319
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
delete_group_piscine.FCStd
(45.58 KiB) Downloaded 28 times
User avatar
DeepSOIC
Posts: 6574
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Problem when deleting an empty group: objects seem linked

Postby DeepSOIC » Tue Mar 22, 2016 5:17 pm

Hi!
It is a fundamental bug of tree view. It never displays an object in two places, but it may be wanted to be in two places.
That is, the objects that behave like they are in the group actually ARE in the group. Use Tools->Dependency graph to verify.

So far, I haven't found a way to delete a group without deleting the objects that belong to it, except via Py console.
User avatar
microelly2
Posts: 4271
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Problem when deleting an empty group: objects seem linked

Postby microelly2 » Tue Mar 22, 2016 5:20 pm

Its not a bug but a pitfall.
If you delete a group the elements of it are deleted too.
This is useful for fast cleanup operations.

The problem is that you don't see that an object belongs to a group when it's used somewhere else (example in a Part fuse)

You can check your document structure with Menu Tools -> Dependency Graph
before you delete something.
User avatar
DeepSOIC
Posts: 6574
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Problem when deleting an empty group: objects seem linked

Postby DeepSOIC » Tue Mar 22, 2016 5:22 pm

To delete a group without deleting objects:
1. select the group
2. run:

Code: Select all

g=Gui.Selection.getSelection()[0]
g.Group = []
This will remove all objects from the group, without deleting them.
3. Delete the group, as normal
JLB85FR
Posts: 76
Joined: Fri Jan 15, 2016 7:08 pm
Location: Vendée - France

Re: Problem when deleting an empty group: objects seem linked

Postby JLB85FR » Tue Mar 22, 2016 5:31 pm

Hi DeepSOIC, microelly2,
thanks for your replies.
I must install graphviz I think, I haven't done it yet.

Thanks for the delete tip. I keep it in mind and in my documentation.
is there a function to remove only one object from a group by its name ?

Wouldn't it be a idea to show in the treeview (if it is posible) the objects linked but with another light color and no way of editing them (unless a dblclik could send you to the original object in the tree) ?? this could help to keep only some of them...
User avatar
DeepSOIC
Posts: 6574
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Problem when deleting an empty group: objects seem linked

Postby DeepSOIC » Tue Mar 22, 2016 5:39 pm

JLB85FR wrote:Wouldn't it be a idea to show in the treeview (if it is posible) the objects linked but with another light color and no way of editing them (unless a dblclik could send you to the original object in the tree) ?? this could help to keep only some of them...
There is no 'original' object. Document structure, internally, is flat. 'Container' objects, like Grpoups, Fusions, etc., tell FreeCAD which objects belong to them (claimChildren), and FreeCAD lays out the tree view based on that. So displaying object in two places is very much possible. Just ... not done yet.
JLB85FR
Posts: 76
Joined: Fri Jan 15, 2016 7:08 pm
Location: Vendée - France

Re: Problem when deleting an empty group: objects seem linked

Postby JLB85FR » Tue Mar 22, 2016 5:43 pm

ok.
is there a place to suggest such evolutions for future versions ? or is it enough to post here, in Arch ?
User avatar
DeepSOIC
Posts: 6574
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: Problem when deleting an empty group: objects seem linked

Postby DeepSOIC » Tue Mar 22, 2016 5:46 pm

JLB85FR wrote:is there a function to remove only one object from a group by its name ?

Code: Select all

g.Group = [o for o in g.Group if o.Label != u"Rect_door_localtech"]
JLB85FR
Posts: 76
Joined: Fri Jan 15, 2016 7:08 pm
Location: Vendée - France

Re: Problem when deleting an empty group: objects seem linked

Postby JLB85FR » Tue Mar 22, 2016 6:12 pm

nice, thanks
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Problem when deleting an empty group: objects seem linked

Postby NormandC » Sat Apr 02, 2016 3:47 pm

DeepSOIC wrote:
JLB85FR wrote:Wouldn't it be a idea to show in the treeview (if it is posible) the objects linked but with another light color and no way of editing them (unless a dblclik could send you to the original object in the tree) ?? this could help to keep only some of them...
There is no 'original' object. Document structure, internally, is flat. 'Container' objects, like Grpoups, Fusions, etc., tell FreeCAD which objects belong to them (claimChildren), and FreeCAD lays out the tree view based on that. So displaying object in two places is very much possible. Just ... not done yet.
I'm not sure it would be a good idea to fill up the Model tree with duplicates. IMHO the tree needs to be clean, we already have the dependency graph to show all relationships.

But here's one way it could be dealt with in the tree, that's what the commercial CAD software I use at work does: in the contextual menu for an object in the tree, there are two options "show parents" and "show children". Selecting either will highlight the parent or children objects in the tree, in red for children or in blue for parents. One click anywhere suffices to revert the labels to their original color.

If there is interest, I could create some mockups to better visualize it, possibly create a feature request on Mantis.