Draft clone gives an error for Group objects

A forum dedicated to the Draft, Arch and BIM workbenches development.
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Draft clone gives an error for Group objects

Postby bernd » Wed Jul 10, 2019 9:32 am

- start FreeCAD, make a new Document
- change to FEM, make a new analysis (the button A)
- change to Draft
- select the FEM analysis
- click on Draft --> Clone

Code: Select all

Select an object to clone
Running the Python command 'Draft_Clone' failed:
Traceback (most recent call last):
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Draft/DraftTools.py", line 5010, in Activated
    self.proceed()
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Draft/DraftTools.py", line 5022, in proceed
    FreeCADGui.doCommand("Draft.clone(FreeCAD.ActiveDocument."+obj.Name+")")
  File "<string>", line 1, in <module>
  File "/home/hugo/Documents/dev/freecad/freecadbhb_dev/build/Mod/Draft/Draft.py", line 2684, in clone
    cl.Placement = obj[0].Placement

'App.DocumentObjectGroup' object has no attribute 'Placement'
if it is not possible to make a clone from a Group object this should be cached and at least an error or even better a popup should be printed IMHO.

OS: Debian GNU/Linux 10 (buster) (KDE/plasma)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17331 (Git)
Build type: Unknown
Branch: master
Hash: cf18161dc26267c259ac21675cb9637263bf4152
Python version: 3.7.3
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Switzerland (de_CH)
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Draft clone gives an error for Group objects

Postby bernd » Wed Jul 10, 2019 9:37 am

Furthermore I developed an own object which is based on ArchComponent. If I try to clone this the following error comes up:

Code: Select all

Running the Python command 'Draft_Clone' failed:
Traceback (most recent call last):
  File "/usr/local/Mod/Draft/DraftTools.py", line 5010, in Activated
    self.proceed()
  File "/usr/local/Mod/Draft/DraftTools.py", line 5022, in proceed
    FreeCADGui.doCommand("Draft.clone(FreeCAD.ActiveDocument."+obj.Name+")")
  File "<string>", line 1, in <module>
  File "/usr/local/Mod/Draft/Draft.py", line 2651, in clone
    cl = getattr(Arch,"make"+obj[0].Proxy.Type)()

module 'Arch' has no attribute 'makeRebar2'
See https://github.com/FreeCAD/FreeCAD/blob ... 2648-L2651
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Draft clone gives an error for Group objects

Postby bernd » Wed Jul 10, 2019 11:06 am

bernd wrote:
Wed Jul 10, 2019 9:37 am
Furthermore I developed an own object which is based on ArchComponent. If I try to clone this the following error comes up:
It works on Python if forcedraft is set to True. But this should be catched too. There hopefully will be more ArchComponents in the future which are not part of Core Arch FreeCAD ... :mrgreen:
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Draft clone gives an error for Group objects

Postby bernd » Wed Jul 10, 2019 11:16 am

Furthermore if the solver object of an FEM is cloned the same error as for a Group object comes up, because these kind or objects neither have shape nor a placement.
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Draft clone gives an error for Group objects

Postby bernd » Wed Jul 10, 2019 11:17 am

trying to clone an Arch Material results in :

Code: Select all

Running the Python command 'Draft_Clone' failed:
Traceback (most recent call last):
  File "C:\0_BHA_privat\progr\FreeCAD_0.19.xxxxx_Py3Qt5\Mod\Draft\DraftTools.py", line 4993, in Activated
    self.proceed()
  File "C:\0_BHA_privat\progr\FreeCAD_0.19.xxxxx_Py3Qt5\Mod\Draft\DraftTools.py", line 5005, in proceed
    FreeCADGui.doCommand("Draft.clone(FreeCAD.ActiveDocument."+obj.Name+")")
  File "<string>", line 1, in <module>
  File "C:\0_BHA_privat\progr\FreeCAD_0.19.xxxxx_Py3Qt5\Mod\Draft\Draft.py", line 2641, in clone
    if (len(obj) == 1) and obj[0].isDerivedFrom("Part::Part2DObject"):

'dict' object has no attribute 'isDerivedFrom'
User avatar
yorik
Site Admin
Posts: 11577
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Draft clone gives an error for Group objects

Postby yorik » Thu Jul 11, 2019 3:45 pm

Ok all these issues should now be solved in git commit 0d4106541. But cloning an object with no shape (groups excepted, which are supported) has not much sense, since the clone essentially duplicates the shape...
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Draft clone gives an error for Group objects

Postby bernd » Thu Jul 11, 2019 7:27 pm

yorik wrote:
Thu Jul 11, 2019 3:45 pm
But cloning an object with no shape (groups excepted, which are supported) has not much sense, since the clone essentially duplicates the shape...
FullACK no sense at all, but catching them makes sense anyway. I got the error on the own ArchComponent and just was playing around a bit ...
User avatar
bernd
Posts: 8472
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Draft clone gives an error for Group objects

Postby bernd » Thu Jul 11, 2019 7:29 pm

works great :D