Merge pull request #4768 from Roy-043/Draft-Gui-addModule-issue

Draft: Fixed 3 gui_*.py files that did not execute Gui.addModule("Draft") if UsePartPrimitives is True
This commit is contained in:
Yorik van Havre
2021-05-05 14:11:33 +02:00
committed by GitHub
3 changed files with 3 additions and 4 deletions

View File

@@ -301,6 +301,7 @@ class Arc(gui_base_original.Creator):
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)
@@ -318,7 +319,6 @@ class Arc(gui_base_original.Creator):
_cmd_list)
else:
# Insert a Draft circle
Gui.addModule("Draft")
_base = DraftVecUtils.toString(self.center)
_cmd = 'Draft.makeCircle'
_cmd += '('

View File

@@ -104,9 +104,9 @@ class Ellipse(gui_base_original.Creator):
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,
@@ -122,7 +122,6 @@ class Ellipse(gui_base_original.Creator):
_cmd_list)
else:
# Insert a Draft ellipse
Gui.addModule("Draft")
_cmd = 'Draft.makeEllipse'
_cmd += '('
_cmd += str(r1) + ', ' + str(r2) + ', '

View File

@@ -119,6 +119,7 @@ class Point(gui_base_original.Creator):
# 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.'
@@ -133,7 +134,6 @@ class Point(gui_base_original.Creator):
_cmd_list))
else:
# Insert a Draft point
Gui.addModule("Draft")
_cmd = 'Draft.makePoint'
_cmd += '('
_cmd += str(self.stack[0][0]) + ', '