One Object in 2 Layers / Groups / Building Parts

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: One Object in 2 Layers / Groups / Building Parts

Post by Roy_043 »

I am not sure what you mean. Currently objects can be in multiple BuidingParts, provided you edit their Group property. If you use drag-and-drop then the single Group rule is enforced.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: One Object in 2 Layers / Groups / Building Parts

Post by Roy_043 »

Related: Two modified files.

ArchBuildingPart.py
Enforces the single Group rule by checking things in the onChanged method.

view_layer.py
Workaround for the current Layer drag-and-drop behavior (the workaround does not rely on the Ctrl key):
If you drop an object from a Group/BuildingPart on a Layer the object is not removed from the Group/BP and vice versa.
To remove an object from a Layer it must be dropped on another Layer or on the document node.
Attachments
view_layer.py
(23.8 KiB) Downloaded 19 times
ArchBuildingPart.py
(45.51 KiB) Downloaded 19 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: One Object in 2 Layers / Groups / Building Parts

Post by yorik »

Roy_043 wrote: Thu Aug 18, 2022 9:21 pm ArchBuildingPart.py
Enforces the single Group rule by checking things in the onChanged method.

view_layer.py
Workaround for the current Layer drag-and-drop behavior (the workaround does not rely on the Ctrl key):
If you drop an object from a Group/BuildingPart on a Layer the object is not removed from the Group/BP and vice versa.
To remove an object from a Layer it must be dropped on another Layer or on the document node.
That seems perfect to me! Mind to do a PR?
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: One Object in 2 Layers / Groups / Building Parts

Post by Roy_043 »

I have two questions:

Would it not be better to revise the Ctrl+drag behavior for Groups? This behavior is now blocked and my code is sort of a workaround.

What should happen when objects are dragged from and to the construction group? The construction group is very similar to a Draft Layer. If Draft construction mode on, and there is also an active layer, the construction group 'wins': new objects are added to it, and not to the layer. From that behavior you could conclude that an object should not be in both the construction group and a layer.
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: One Object in 2 Layers / Groups / Building Parts

Post by yorik »

Yes, (at the moment, at least) the construction group is just a normal group. I think it still should work that way, that is, a group is basically simply a way to mark some objects so they can be gathered together and turned on/off together. That's still exactly what we want. You could for example want to switch an object to/from the construction group, without it to loose its layer attributes.

So I'd propose to leave it like that for now..

For the ctrl+drop problem, I understand your code allows to drop an object to a layer, without having it removed from its group? I would keep that, it seems exactly what we want (a layer is different from a group, we want an object to be able to coexist in a layer AND a group)
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: One Object in 2 Layers / Groups / Building Parts

Post by Roy_043 »

Post Reply