View Issue Details

IDProjectCategoryView StatusLast Update
0003066PartDesignBugpublic2017-06-05 15:46
ReportersheinzAssigned Toyorik 
Status closedResolutionfixed 
Platformx86_64OSArch LinuxOS Version4.10.10-1
Product Version0.17 
Target VersionFixed in Version0.17 
Summary0003066: Draft clone fails with "name 'Draft' is not defined" if used first time in Draft workbench
DescriptionIt seems like variable [b]Draft[/b] is dynamically created when a tool from Draft workbench is used.
But if the first used tool from Draft workbench is Clone it fails with:
Running the Python command 'Draft_Clone' failed:
Traceback (most recent call last):
  File "$HOME/src/freecad-build/Mod/Draft/", line 4832, in Activated
  File "$HOME/src/freecad-build/Mod/Draft/", line 4841, in proceed
  File "<string>", line 1, in <module>

name 'Draft' is not defined
After using some other tool from Draft workbench (for example move) clone operation starts to work.
Steps To Reproduce1. New document
2. Create a solid cube in Part workbench.
3. Switch to Draft workbench.
4. Select the cube and clone it.
- Error is generated and clone operation fails.
5. Move the cube.
6. Try to clone the cube one more time. This time it works.
Additional InformationOS: Linux
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.11206 (Git)
Build type: Debug
Branch: master
Hash: 749d666099ce5d201e67917d491c9dad2c0ccf32
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 7.1.0


related to 0003036 closed Draft Draft -> Clone feature doesn't work when you open file directly 



2017-06-02 21:41

reporter   ~0009268

I quickly had a look at the code and adding the following line in method [b]DraftClone.proceed[/b] fixes the issue.
I'm not sure if it is the right approach or if it is the right place but might be a hint for the developers.
I also included the patch.

freecad_draft_clone.patch (650 bytes)
diff --git a/src/Mod/Draft/ b/src/Mod/Draft/
index 079b89928..4d4981da7 100644
--- a/src/Mod/Draft/
+++ b/src/Mod/Draft/
@@ -4836,6 +4836,7 @@ class Draft_Clone(Modifier):
         if FreeCADGui.Selection.getSelection():
             l = len(FreeCADGui.Selection.getSelection())
+            FreeCADGui.addModule("Draft")
             for obj in FreeCADGui.Selection.getSelection():


2017-06-03 02:04

manager   ~0009270

Thanks sheinz.
@yorik can you confirm the patch is 'kosher'?


2017-06-03 02:43

administrator   ~0009272

Good catch! Thanks for the patch @sheinz


2017-06-03 02:45

administrator   ~0009273

Fixed in master. Source integration doesn't work anymore...


2017-06-03 15:13

manager   ~0009275

FYI @yorik shell access would be helpful to fix source integration


2017-06-05 15:46

administrator   ~0009288

I know, I know...

Issue History

Date Modified Username Field Change
2017-06-02 14:54 sheinz New Issue
2017-06-02 14:54 sheinz Tag Attached: Draft
2017-06-02 15:36 Kunda1 Description Updated View Revisions
2017-06-02 15:37 Kunda1 Relationship added related to 0003036
2017-06-02 21:41 sheinz File Added: freecad_draft_clone.patch
2017-06-02 21:41 sheinz Note Added: 0009268
2017-06-03 02:04 Kunda1 Note Added: 0009270
2017-06-03 02:43 yorik Note Added: 0009272
2017-06-03 02:45 yorik Note Added: 0009273
2017-06-03 02:46 yorik Assigned To => yorik
2017-06-03 02:46 yorik Status new => closed
2017-06-03 02:46 yorik Resolution open => fixed
2017-06-03 02:46 yorik Fixed in Version => 0.17
2017-06-03 15:13 Kunda1 Note Added: 0009275
2017-06-05 15:46 yorik Note Added: 0009288