diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt
index 61573865e..ef93de68c 100644
--- a/src/Mod/Path/CMakeLists.txt
+++ b/src/Mod/Path/CMakeLists.txt
@@ -55,6 +55,7 @@ SET(PathScripts_SRCS
PathScripts/PathArray.py
PathScripts/PathCustom.py
PathScripts/PathInspect.py
+ PathScripts/PathToolChange.py
)
ADD_CUSTOM_TARGET(PathScripts ALL
diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc
index 464348911..9140b35b9 100644
--- a/src/Mod/Path/Gui/Resources/Path.qrc
+++ b/src/Mod/Path/Gui/Resources/Path.qrc
@@ -28,5 +28,6 @@
icons/Path-Array.svg
icons/Path-Custom.svg
icons/Path-Inspect.svg
+ icons/Path-ToolChange.svg
diff --git a/src/Mod/Path/Gui/Resources/icons/Path-Custom.svg b/src/Mod/Path/Gui/Resources/icons/Path-Custom.svg
index a1347f19e..e1c6fdb44 100644
--- a/src/Mod/Path/Gui/Resources/icons/Path-Custom.svg
+++ b/src/Mod/Path/Gui/Resources/icons/Path-Custom.svg
@@ -468,17 +468,6 @@
id="radialGradient3102"
xlink:href="#linearGradient4513-1-2"
inkscape:collect="always" />
-
image/svg+xml
-
+
@@ -523,23 +512,52 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer">
- <>
+ sodipodi:nodetypes="cccccc" />
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/Mod/Path/Gui/Resources/icons/Path-ToolChange.svg b/src/Mod/Path/Gui/Resources/icons/Path-ToolChange.svg
new file mode 100644
index 000000000..5adc6e8c2
--- /dev/null
+++ b/src/Mod/Path/Gui/Resources/icons/Path-ToolChange.svg
@@ -0,0 +1,604 @@
+
+
+
+
diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py
index 7f94a087c..645f31ce3 100644
--- a/src/Mod/Path/InitGui.py
+++ b/src/Mod/Path/InitGui.py
@@ -87,13 +87,14 @@ class PathWorkbench ( Workbench ):
from PathScripts import PathFacePocket
from PathScripts import PathCustom
from PathScripts import PathInspect
+ from PathScripts import PathToolChange
# build commands list
projcmdlist = ["Path_Project", "Path_ToolTableEdit","Path_Post","Path_Inspect"]
prepcmdlist = ["Path_Plane","Path_Fixture","Path_LoadTool","Path_ToolLenOffset","Path_Comment","Path_Stop"]
opcmdlist = ["Path_Profile","Path_Kurve","Path_Pocket","Path_Drilling","Path_FromShape"]
modcmdlist = ["Path_Copy","Path_CompoundExtended","Path_Dressup","Path_Hop","Path_Array"]
- partialcmdlist = ["Path_FaceProfile","Path_FacePocket","Path_Custom"]
+ partialcmdlist = ["Path_FaceProfile","Path_FacePocket","Path_Custom","Path_ToolChange"]
# Add commands to menu and toolbar
@@ -124,6 +125,12 @@ class PathWorkbench ( Workbench ):
def Deactivated(self):
Msg("Path workbench deactivated\n")
+
+ def ContextMenu(self, recipient):
+ if len(FreeCADGui.Selection.getSelection()) == 1:
+ if FreeCADGui.Selection.getSelection()[0].isDerivedFrom("Path::Feature"):
+ self.appendContextMenu("",["Path_Inspect"])
+
Gui.addWorkbench(PathWorkbench())
diff --git a/src/Mod/Path/PathScripts/PathInspect.py b/src/Mod/Path/PathScripts/PathInspect.py
index a807e6fbf..ddc749cd7 100644
--- a/src/Mod/Path/PathScripts/PathInspect.py
+++ b/src/Mod/Path/PathScripts/PathInspect.py
@@ -135,7 +135,7 @@ class CommandPathInspect:
def GetResources(self):
return {'Pixmap' : 'Path-Inspect',
- 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Inspect","Inspect"),
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Inspect","Inspect G-code"),
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Inspect","Inspects the G-code contents of a path")}
def IsActive(self):
diff --git a/src/Mod/Path/PathScripts/PathToolChange.py b/src/Mod/Path/PathScripts/PathToolChange.py
new file mode 100644
index 000000000..a7c14f33a
--- /dev/null
+++ b/src/Mod/Path/PathScripts/PathToolChange.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+
+#***************************************************************************
+#* *
+#* Copyright (c) 2015 Yorik van Havre *
+#* *
+#* This program is free software; you can redistribute it and/or modify *
+#* it under the terms of the GNU Lesser General Public License (LGPL) *
+#* as published by the Free Software Foundation; either version 2 of *
+#* the License, or (at your option) any later version. *
+#* for detail see the LICENCE text file. *
+#* *
+#* This program is distributed in the hope that it will be useful, *
+#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
+#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+#* GNU Library General Public License for more details. *
+#* *
+#* You should have received a copy of the GNU Library General Public *
+#* License along with this program; if not, write to the Free Software *
+#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
+#* USA *
+#* *
+#***************************************************************************
+
+import FreeCAD,FreeCADGui,Path,PathGui
+from PySide import QtCore,QtGui
+
+"""Path ToolChange object and FreeCAD command"""
+
+# Qt tanslation handling
+try:
+ _encoding = QtGui.QApplication.UnicodeUTF8
+ def translate(context, text, disambig=None):
+ return QtGui.QApplication.translate(context, text, disambig, _encoding)
+except AttributeError:
+ def translate(context, text, disambig=None):
+ return QtGui.QApplication.translate(context, text, disambig)
+
+
+class ObjectToolChange:
+
+
+ def __init__(self,obj):
+ obj.addProperty("App::PropertyInteger","ToolNumber","Path","The tool number to be used")
+ obj.Proxy = self
+
+ def __getstate__(self):
+ return None
+
+ def __setstate__(self,state):
+ return None
+
+ def execute(self,obj):
+ path = Path.Path("M6T"+str(obj.ToolNumber))
+ obj.Path = path
+
+
+class CommandPathToolChange:
+
+
+ def GetResources(self):
+ return {'Pixmap' : 'Path-ToolChange',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_ToolChange","Tool Change"),
+ 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_ToolChange","Changes the current tool")}
+
+ def IsActive(self):
+ return not FreeCAD.ActiveDocument is None
+
+ def Activated(self):
+ FreeCAD.ActiveDocument.openTransaction("Create Tool Change")
+ FreeCADGui.addModule("PathScripts.PathToolChange")
+ FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","ToolChange")')
+ FreeCADGui.doCommand('PathScripts.PathToolChange.ObjectToolChange(obj)')
+ FreeCADGui.doCommand('obj.ViewObject.Proxy = 0')
+ FreeCAD.ActiveDocument.commitTransaction()
+ FreeCAD.ActiveDocument.recompute()
+
+
+if FreeCAD.GuiUp:
+ # register the FreeCAD command
+ FreeCADGui.addCommand('Path_ToolChange',CommandPathToolChange())