Arch Site as a group object

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
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!
Post Reply
simsiem
Posts: 46
Joined: Tue Feb 02, 2016 7:19 am

Arch Site as a group object

Post by simsiem »

Hi,

when I use the Arch subtract tool to remove a Part box from a wall, this fails because a site object exists in the document. The Python trace says:
Running the Python command 'Arch_Remove' failed:
Traceback (most recent call last):
File "/home/walter/FreeCAD/build/Mod/Arch/ArchCommands.py", line 1083, in Activated
FreeCADGui.doCommand("Arch.removeComponents("+ss+",FreeCAD.ActiveDocument."+host.Name+")")
File "<string>", line 1, in <module>
File "/home/walter/FreeCAD/build/Mod/Arch/ArchCommands.py", line 160, in removeComponents
setAsSubcomponent(o)
File "/home/walter/FreeCAD/build/Mod/Arch/ArchCommands.py", line 232, in setAsSubcomponent
Draft.ungroup(obj)
File "/home/walter/FreeCAD/build/Mod/Draft/Draft.py", line 247, in ungroup
if grp.hasObject(obj):

'FeaturePython' object has no attribute 'hasObject'
I tracked it further down to find, which grp fails. It turns out that the remove command tries to ungroup the removed object from any group object. To do so, it iterates over all group object and asks them, whether they belong the removed object. This iteration fails on the site object in the document.

Thus the code expects that a site behaves like (inherits from) a group object.

I further found out: While a building object is of type App::DocumentObjectGroupPython, a site object is of type Part::FeaturePython. Maybe this is the critical difference. But I did not change it yet, because a site object can be drawn, while a building object is a pure container. Thus the difference could be no bug but a meaningful well chosen difference.

Some more tests brought up the following results. I attached a minimal example so you can easily repeat the tests.
  • A site misses the context menu entry to create a group (German translation label "Gruppe erstellen ...").
  • When I drag an existing group object, I cannot drop it on a site object.
  • I can select the group object and the site object and press the add button of the Arch workbench. Thus adding it basically works.
  • I cannot drag a group object, which is part of a site object away from the site object.
  • As already written above: When I use the Arch subtract tool to remove a Part object from a Wall object, this fails because of the site object existing in the tree.
The online documentation says:
  • "The Arch Site is a special object that combines properties of a standard FreeCAD group object and Arch objects."
  • "After creating a site, you can add more objects to it by drag and dropping them in the Tree View or by using the Arch Add.png Arch Add tool."
  • "You can remove objects from a site by drag and dropping them out of it the Tree View or by using the Arch Remove.png Arch Remove tool."
All in all
  • Is this problem known?
  • What is the right strategy to fix this? Maybe I can do it?
Simon

--

OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10544 (Git)
Build type: Unknown
Branch: master
Hash: 69af452bc3b2b71942c1b92cef9a147feb7d5a43
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 7.1.0
Attachments
errors_with_site_object.fcstd
Minimal example for the tests
(9.8 KiB) Downloaded 48 times
User avatar
yorik
Founder
Posts: 13660
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Arch Site as a group object

Post by yorik »

Thanks for the long analysis! It was a bug in Draft.ungroup, it's fixed in git commit 14041ebe31
Post Reply