Merge pull request #11419 from Roy-043/Draft-Draft_Join-should-call-join_wires

Draft: Draft_Join should call join_wires
This commit is contained in:
Roy-043
2023-11-17 09:30:01 +01:00
committed by GitHub

View File

@@ -22,19 +22,7 @@
# * USA *
# * *
# ***************************************************************************
"""Provides GUI tools to join lines and wires.
It occasionally fails to join lines even if the lines
visually share a point. This is due to the underlying `joinWires` method
not handling the points correctly.
This is a rounding error in the comparison of the shared point;
a small difference will result in the points being considered different
and thus the lines not joining.
Test properly using `DraftVecUtils.equals` because then it will consider
the precision set in the Draft preferences.
"""
"""Provides GUI tools to join lines and wires."""
## @package gui_join
# \ingroup draftguitools
# \brief Provides GUI tools to join lines and wires.
@@ -61,14 +49,14 @@ class Join(gui_base_original.Modifier):
def GetResources(self):
"""Set icon, menu and tooltip."""
return {'Pixmap': 'Draft_Join',
'Accel': "J, O",
'MenuText': QT_TRANSLATE_NOOP("Draft_Join", "Join"),
'ToolTip': QT_TRANSLATE_NOOP("Draft_Join", "Joins the selected lines or polylines into a single object.\nThe lines must share a common point at the start or at the end for the operation to succeed.")}
return {"Pixmap": "Draft_Join",
"Accel": "J, O",
"MenuText": QT_TRANSLATE_NOOP("Draft_Join", "Join"),
"ToolTip": QT_TRANSLATE_NOOP("Draft_Join", "Joins the selected lines or polylines into a single object.\nThe lines must share a common point at the start or at the end for the operation to succeed.")}
def Activated(self):
"""Execute when the command is called."""
super(Join, self).Activated(name="Join")
super().Activated(name="Join")
if not self.ui:
return
if not Gui.Selection.getSelection():
@@ -90,7 +78,7 @@ class Join(gui_base_original.Modifier):
if Gui.Selection.getSelection():
self.print_selection()
Gui.addModule("Draft")
_cmd = "Draft.joinWires"
_cmd = "Draft.join_wires"
_cmd += "("
_cmd += "FreeCADGui.Selection.getSelection()"
_cmd += ")"