One Object in 2 Layers / Groups / Building Parts
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: One Object in 2 Layers / Groups / Building Parts
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.
Re: One Object in 2 Layers / Groups / Building Parts
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.
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
Re: One Object in 2 Layers / Groups / Building Parts
That seems perfect to me! Mind to do a PR?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.
Re: One Object in 2 Layers / Groups / Building Parts
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.
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.
Re: One Object in 2 Layers / Groups / Building Parts
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)
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)
Re: One Object in 2 Layers / Groups / Building Parts
OK thanks. PR submitted:
https://github.com/FreeCAD/FreeCAD/pull/7462
https://github.com/FreeCAD/FreeCAD/pull/7462