Skip to content

Commit

Permalink
Merge pull request FreeCAD#12234 from Roy-043/Draft-Draft_Arc_3Points…
Browse files Browse the repository at this point in the history
…-minor-consistency-update

Draft: Draft_Arc_3Points minor consistency update
  • Loading branch information
Roy-043 authored Feb 2, 2024
2 parents ee3e1cd + 834aff0 commit 90c90f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
33 changes: 17 additions & 16 deletions src/Mod/Draft/draftguitools/gui_arcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def finish(self, cont=False):
if self.ui:
self.linetrack.finalize()
self.arctrack.finalize()
self.doc.recompute()
if cont or (cont is None and self.ui and self.ui.continueMode):
self.Activated()

Expand Down Expand Up @@ -468,12 +467,9 @@ def numericRadius(self, rad):
Gui.addCommand('Draft_Arc', Arc())


class Arc_3Points(gui_base.GuiCommandSimplest):
class Arc_3Points(gui_base.GuiCommandBase):
"""GuiCommand for the Draft_Arc_3Points tool."""

def __init__(self):
super().__init__(name="Arc by 3 points")

def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': "Draft_Arc_3Points",
Expand All @@ -483,7 +479,10 @@ def GetResources(self):

def Activated(self):
"""Execute when the command is called."""
super().Activated()
if App.activeDraftCommand:
App.activeDraftCommand.finish()
App.activeDraftCommand = self
self.featureName = "Arc_3Points"

# Reset the values
self.points = []
Expand Down Expand Up @@ -550,15 +549,16 @@ def getPoint(self, point, info):
# If three points were already picked in the 3D view
# proceed with creating the final object.
# Draw a simple `Part::Feature` if the parameter is `True`.
if params.get_param("UsePartPrimitives"):
Draft.make_arc_3points([self.points[0],
self.points[1],
self.points[2]], primitive=True)
else:
Draft.make_arc_3points([self.points[0],
self.points[1],
self.points[2]], primitive=False)

Gui.addModule("Draft")
_cmd = "Draft.make_arc_3points(["
_cmd += "FreeCAD." + str(self.points[0])
_cmd += ", FreeCAD." + str(self.points[1])
_cmd += ", FreeCAD." + str(self.points[2])
_cmd += "], primitive=" + str(params.get_param("UsePartPrimitives")) + ")"
_cmd_list = ["circle = " + _cmd,
"Draft.autogroup(circle)",
"FreeCAD.ActiveDocument.recompute()"]
self.commit(translate("draft", "Create Arc by 3 points"), _cmd_list)
self.finish(cont=None)

def drawArc(self, point, info):
Expand Down Expand Up @@ -590,8 +590,9 @@ def finish(self, cont=False):
Restart (continue) the command if `True`, or if `None` and
`ui.continueMode` is `True`.
"""
App.activeDraftCommand = None
super().finish()
self.tracker.finalize()
self.doc.recompute()
if cont or (cont is None and Gui.Snapper.ui and Gui.Snapper.ui.continueMode):
self.Activated()

Expand Down
3 changes: 0 additions & 3 deletions src/Mod/Draft/draftmake/make_arc_3points.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ def make_arc_3points(points, placement=None, face=False,
startangle=start, endangle=end,
support=support)

if App.GuiUp:
gui_utils.autogroup(obj)

original_placement = obj.Placement

if placement and not support:
Expand Down

0 comments on commit 90c90f7

Please sign in to comment.