diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index a5dc285df7..969fd4c9ce 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -189,19 +189,9 @@ from draftguitools.gui_wire2spline import WireToBSpline from draftguitools.gui_shape2dview import Shape2DView from draftguitools.gui_draft2sketch import Draft2Sketch from draftguitools.gui_array_simple import Array +from draftguitools.gui_array_simple import LinkArray -class LinkArray(Array): - """GuiCommand for the Draft_LinkArray tool.""" - - def __init__(self): - Array.__init__(self, use_link=True) - - def GetResources(self): - return {'Pixmap' : 'Draft_LinkArray', - 'MenuText': QtCore.QT_TRANSLATE_NOOP("Draft_LinkArray", "LinkArray"), - 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Draft_LinkArray", "Creates a polar or rectangular link array from a selected object")} - class PathArray(Modifier): """The PathArray FreeCAD command definition""" @@ -484,7 +474,6 @@ from draftguitools.gui_snaps import ShowSnapBar # drawing commands # modification commands -FreeCADGui.addCommand('Draft_LinkArray',LinkArray()) FreeCADGui.addCommand('Draft_Clone',Draft_Clone()) FreeCADGui.addCommand('Draft_PathArray',PathArray()) FreeCADGui.addCommand('Draft_PathLinkArray',PathLinkArray()) diff --git a/src/Mod/Draft/draftguitools/gui_array_simple.py b/src/Mod/Draft/draftguitools/gui_array_simple.py index 9d9c40bd57..94cdd58bce 100644 --- a/src/Mod/Draft/draftguitools/gui_array_simple.py +++ b/src/Mod/Draft/draftguitools/gui_array_simple.py @@ -108,3 +108,27 @@ class Array(gui_base_original.Modifier): Gui.addCommand('Draft_Array', Array()) + + +class LinkArray(Array): + """Gui Command for the LinkArray tool based on the simple Array tool.""" + + def __init__(self): + super().__init__(use_link=True) + + def GetResources(self): + """Set icon, menu and tooltip.""" + _tip = ("Like the Array tool, but creates a 'Link array' instead.\n" + "A 'Link array' is more efficient when handling many copies " + "but the 'Fuse' option cannot be used.") + + return {'Pixmap': 'Draft_LinkArray', + 'MenuText': QT_TRANSLATE_NOOP("Draft_LinkArray", "LinkArray"), + 'ToolTip': QT_TRANSLATE_NOOP("Draft_LinkArray", _tip)} + + def Activated(self): + """Execute when the command is called.""" + super().Activated(name=_tr("Link array")) + + +Gui.addCommand('Draft_LinkArray', LinkArray())