Skip to content

Commit

Permalink
Merge pull request #4768 from Roy-043/Draft-Gui-addModule-issue
Browse files Browse the repository at this point in the history
Draft: Fixed 3 gui_*.py files that did not execute Gui.addModule("Draft") if UsePartPrimitives is True
  • Loading branch information
yorikvanhavre committed May 5, 2021
2 parents f4f1b0b + 9d8c51c commit ddb6b5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Draft/draftguitools/gui_arcs.py
Expand Up @@ -301,6 +301,7 @@ def drawArc(self):
try:
# The command to run is built as a series of text strings
# to be committed through the `draftutils.todo.ToDo` class.
Gui.addModule("Draft")
if utils.getParam("UsePartPrimitives", False):
# Insert a Part::Primitive object
_base = DraftVecUtils.toString(self.center)
Expand All @@ -318,7 +319,6 @@ def drawArc(self):
_cmd_list)
else:
# Insert a Draft circle
Gui.addModule("Draft")
_base = DraftVecUtils.toString(self.center)
_cmd = 'Draft.makeCircle'
_cmd += '('
Expand Down
3 changes: 1 addition & 2 deletions src/Mod/Draft/draftguitools/gui_ellipses.py
Expand Up @@ -104,9 +104,9 @@ def createObject(self):
rot2 = App.Placement(m)
rot2 = rot2.Rotation
rot = str((rot1.multiply(rot2)).Q)
Gui.addModule("Draft")
if utils.getParam("UsePartPrimitives", False):
# Insert a Part::Primitive object
Gui.addModule("Part")
_cmd = 'FreeCAD.ActiveDocument.'
_cmd += 'addObject("Part::Ellipse", "Ellipse")'
_cmd_list = ['ellipse = ' + _cmd,
Expand All @@ -122,7 +122,6 @@ def createObject(self):
_cmd_list)
else:
# Insert a Draft ellipse
Gui.addModule("Draft")
_cmd = 'Draft.makeEllipse'
_cmd += '('
_cmd += str(r1) + ', ' + str(r2) + ', '
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Draft/draftguitools/gui_points.py
Expand Up @@ -119,6 +119,7 @@ def click(self, event_cb=None):
# The command to run is built as a series of text strings
# to be committed through the `draftutils.todo.ToDo` class.
commitlist = []
Gui.addModule("Draft")
if utils.getParam("UsePartPrimitives", False):
# Insert a Part::Primitive object
_cmd = 'FreeCAD.ActiveDocument.'
Expand All @@ -133,7 +134,6 @@ def click(self, event_cb=None):
_cmd_list))
else:
# Insert a Draft point
Gui.addModule("Draft")
_cmd = 'Draft.makePoint'
_cmd += '('
_cmd += str(self.stack[0][0]) + ', '
Expand Down

0 comments on commit ddb6b5b

Please sign in to comment.