diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc
index 7eeaf9bc56..1cef2e5a8e 100644
--- a/src/Mod/Path/Gui/Resources/Path.qrc
+++ b/src/Mod/Path/Gui/Resources/Path.qrc
@@ -96,6 +96,7 @@
panels/PageOpDeburrEdit.ui
panels/PageOpDrillingEdit.ui
panels/PageOpEngraveEdit.ui
+ panels/PageOpExtensionEdit.ui
panels/PageOpHelixEdit.ui
panels/PageOpPocketFullEdit.ui
panels/PageOpProfileFullEdit.ui
diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpExtensionEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageOpExtensionEdit.ui
new file mode 100644
index 0000000000..65e7a18e7c
--- /dev/null
+++ b/src/Mod/Path/Gui/Resources/panels/PageOpExtensionEdit.ui
@@ -0,0 +1,335 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 324
+ 550
+
+
+
+ Form
+
+
+ -
+
+
+ Negative X
+
+
+
-
+
+
+
+
+
+ :/icons/button_left.svg
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ <html><head/><body><p>Size of extension for each edge.</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p>List of edges to be extended.</p></body></html>
+
+
+
+ -
+
+
+
-
+
+
+ <html><head/><body><p>Add selected edge from 3d view to list.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-add.svg:/icons/list-add.svg
+
+
+
+ -
+
+
+ <html><head/><body><p>Remove selected edge from list above.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-remove.svg:/icons/list-remove.svg
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Positive Y
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+ false
+
+
+
-
+
+
+
+
+
+ :/icons/button_up.svg
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ <html><head/><body><p>Size of extension for each edge.</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p>List of edges to be extended.</p></body></html>
+
+
+
+ -
+
+
+
-
+
+
+ <html><head/><body><p>Add selected edge from 3d view to list.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-add.svg:/icons/list-add.svg
+
+
+
+ -
+
+
+ <html><head/><body><p>Remove selected edge from list above.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-remove.svg:/icons/list-remove.svg
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Positive X
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
-
+
+
+
+
+
+ :/icons/button_right.svg
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ <html><head/><body><p>Size of extension for each edge.</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p>List of edges to be extended.</p></body></html>
+
+
+
+ -
+
+
+
-
+
+
+ <html><head/><body><p>Add selected edge from 3d view to list.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-add.svg:/icons/list-add.svg
+
+
+
+ -
+
+
+ <html><head/><body><p>Remove selected edge from list above.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-remove.svg:/icons/list-remove.svg
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Negative Y
+
+
+
-
+
+
+
+
+
+ :/icons/button_down.svg
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ <html><head/><body><p>Size of extension for each edge.</p></body></html>
+
+
+
+ -
+
+
+ <html><head/><body><p>List of edges to be extended.</p></body></html>
+
+
+
+ -
+
+
+
-
+
+
+ <html><head/><body><p>Add selected edge from 3d view to list.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-add.svg:/icons/list-add.svg
+
+
+
+ -
+
+
+ <html><head/><body><p>Remove selected edge from list above.</p></body></html>
+
+
+
+
+
+
+ :/icons/list-remove.svg:/icons/list-remove.svg
+
+
+
+
+
+
+
+
+
+ -
+
+
+ QFrame::Panel
+
+
+ QFrame::Raised
+
+
+ Requires "Use Outline"!
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+ Gui::QuantitySpinBox
+ QDoubleSpinBox
+
+
+
+
+
+
+
+
diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py
index 27458ac767..be1d09d0cc 100644
--- a/src/Mod/Path/InitGui.py
+++ b/src/Mod/Path/InitGui.py
@@ -47,7 +47,7 @@ class PathWorkbench (Workbench):
"Path workbench"
def __init__(self):
- self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Path/Resources/icons/PathWorkbench.svg"
+ self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/Path/Gui/Resources/icons/PathWorkbench.svg"
self.__class__.MenuText = "Path"
self.__class__.ToolTip = "Path workbench"
diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py
index 047fcbe0a6..f2564480b1 100644
--- a/src/Mod/Path/PathScripts/PathOpGui.py
+++ b/src/Mod/Path/PathScripts/PathOpGui.py
@@ -399,36 +399,41 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
return 'edges'
return 'nothing'
- def addBaseGeometrySelection(self, sel):
+ def selectionSupportedAsBaseGeometry(self, selection, ignoreErrors):
+ if len(selection) != 1:
+ if not ignoreErrors:
+ PathLog.error(translate("PathProject", "Please select %s from a single solid" % self.featureName()))
+ return False
+ sel = selection[0]
if sel.HasSubObjects:
- if not self.supportsVertexes() and sel.SubObjects[0].ShapeType == "Vertex":
- PathLog.error(translate("PathProject", "Vertexes are not supported"))
+ if not self.supportsVertexes() and selection[0].SubObjects[0].ShapeType == "Vertex":
+ if not ignoreErrors:
+ PathLog.error(translate("PathProject", "Vertexes are not supported"))
return False
- if not self.supportsEdges() and sel.SubObjects[0].ShapeType == "Edge":
- PathLog.error(translate("PathProject", "Edges are not supported"))
+ if not self.supportsEdges() and selection[0].SubObjects[0].ShapeType == "Edge":
+ if not ignoreErrors:
+ PathLog.error(translate("PathProject", "Edges are not supported"))
return False
- if not self.supportsFaces() and sel.SubObjects[0].ShapeType == "Face":
- PathLog.error(translate("PathProject", "Faces are not supported"))
+ if not self.supportsFaces() and selection[0].SubObjects[0].ShapeType == "Face":
+ if not ignoreErrors:
+ PathLog.error(translate("PathProject", "Faces are not supported"))
return False
else:
if not self.supportsPanels() or not 'Panel' in sel.Object.Name:
- PathLog.error(translate("PathProject", "Please select %s of a solid" % self.featureName()))
+ if not ignoreErrors:
+ PathLog.error(translate("PathProject", "Please select %s of a solid" % self.featureName()))
return False
-
- for sub in sel.SubElementNames:
- self.obj.Proxy.addBase(self.obj, sel.Object, sub)
return True
+
def addBaseGeometry(self, selection):
PathLog.track(selection)
- #if len(selection) != 1:
- # PathLog.error(translate("PathProject", "Please select %s from a single solid" % self.featureName()))
- # return False
- changed = False
- for sel in selection:
- if self.addBaseGeometrySelection(sel):
- changed = True
- return changed
+ if self.selectionSupportedAsBaseGeometry(selection, False):
+ sel = selection[0]
+ for sub in sel.SubElementNames:
+ self.obj.Proxy.addBase(self.obj, sel.Object, sub)
+ return True
+ return False
def addBase(self):
if self.addBaseGeometry(FreeCADGui.Selection.getSelectionEx()):
@@ -475,6 +480,11 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
if prop in ['Base']:
self.setFields(obj)
+ def updateSelection(self, obj, sel):
+ if self.selectionSupportedAsBaseGeometry(sel, True):
+ self.form.addBase.setEnabled(True)
+ else:
+ self.form.addBase.setEnabled(False)
class TaskPanelBaseLocationPage(TaskPanelPage):
'''Page controller for base locations. Uses PathGetPoint.'''
diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py
index e06b878451..44f3d30173 100644
--- a/src/Mod/Path/PathScripts/PathPocketShape.py
+++ b/src/Mod/Path/PathScripts/PathPocketShape.py
@@ -53,6 +53,9 @@ def translate(context, text, disambig=None):
class ObjectPocket(PathPocketBase.ObjectPocket):
'''Proxy object for Pocket operation.'''
+ def areaOpFeatures(self, obj):
+ return super(self.__class__, self).areaOpFeatures(obj) | PathOp.FeatureLocations
+
def initPocketOp(self, obj):
'''initPocketOp(obj) ... setup receiver'''
obj.addProperty("App::PropertyBool", "UseOutline", "Pocket", QtCore.QT_TRANSLATE_NOOP("App::Property", "Uses the outline of the base geometry."))
diff --git a/src/Mod/Path/PathScripts/PathPocketShapeGui.py b/src/Mod/Path/PathScripts/PathPocketShapeGui.py
index cd0876261e..e1a17a5a81 100644
--- a/src/Mod/Path/PathScripts/PathPocketShapeGui.py
+++ b/src/Mod/Path/PathScripts/PathPocketShapeGui.py
@@ -23,17 +23,43 @@
# ***************************************************************************
import FreeCAD
+import FreeCADGui
+import PathScripts.PathOp as PathOp
import PathScripts.PathOpGui as PathOpGui
import PathScripts.PathPocketShape as PathPocketShape
import PathScripts.PathPocketBaseGui as PathPocketBaseGui
-from PySide import QtCore
+from PySide import QtCore, QtGui
__title__ = "Path Pocket Shape Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__doc__ = "Pocket Shape operation page controller and command implementation."
+class TaskPanelExtensionPage(PathOpGui.TaskPanelPage):
+
+ def initPage(self, obj):
+ self.extensions = [self.form.negXInput, self.form.posXInput, self.form.negYInput, self.form.posYInput]
+ self.setTitle("Pocket Extensions")
+ self.enabled = True
+ self.enable(False)
+
+ def enable(self, ena):
+ if ena != self.enabled:
+ self.enabled = ena
+ if ena:
+ self.form.info.hide()
+ for ext in self.extensions:
+ ext.setEnabled(True)
+ else:
+ self.form.info.show()
+ for ext in self.extensions:
+ ext.setEnabled(False)
+
+ def getForm(self):
+ return FreeCADGui.PySideUic.loadUi(":/panels/PageOpExtensionEdit.ui")
+
+
class TaskPanelOpPage(PathPocketBaseGui.TaskPanelOpPage):
'''Page controller class for Pocket operation'''
@@ -41,6 +67,16 @@ class TaskPanelOpPage(PathPocketBaseGui.TaskPanelOpPage):
'''pocketFeatures() ... return FeaturePocket (see PathPocketBaseGui)'''
return PathPocketBaseGui.FeaturePocket | PathPocketBaseGui.FeatureOutline
+ def taskPanelBaseLocationPage(self, obj, features):
+ self.extensionsPanel = TaskPanelExtensionPage(obj, features)
+ return self.extensionsPanel
+
+ def enableExtensions(self):
+ self.extensionsPanel.enable(self.form.useOutline.isChecked())
+
+ def pageRegisterSignalHandlers(self):
+ self.form.useOutline.clicked.connect(self.enableExtensions)
+
Command = PathOpGui.SetupOperation('Pocket Shape',
PathPocketShape.Create,
TaskPanelOpPage,
diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py
index 6688d9ad96..092a3719f6 100644
--- a/src/Mod/Path/PathScripts/PathSelection.py
+++ b/src/Mod/Path/PathScripts/PathSelection.py
@@ -168,6 +168,30 @@ class ADAPTIVEGate:
return adaptive
+class POCKETSHAPEGate:
+ def allow(self, doc, obj, sub):
+
+ try:
+ obj = obj.Shape
+ except:
+ return False
+
+ if obj.ShapeType == 'Edge':
+ return True
+
+ elif obj.ShapeType == 'Face':
+ return True
+
+ elif obj.ShapeType == 'Solid':
+ if sub and (sub[0:4] == 'Face' or sub[0:4] == 'Edge'):
+ return True
+
+ elif obj.ShapeType == 'Compound':
+ if sub and (sub[0:4] == 'Face' or sub[0:4] == 'Edge'):
+ return True
+
+ return False
+
class CONTOURGate:
def allow(self, doc, obj, sub):
pass
@@ -204,6 +228,10 @@ def adaptiveselect():
FreeCADGui.Selection.addSelectionGate(ADAPTIVEGate())
FreeCAD.Console.PrintWarning("Adaptive Select Mode\n")
+def pocketshapeselect():
+ FreeCADGui.Selection.addSelectionGate(POCKETSHAPEGate())
+ FreeCAD.Console.PrintWarning("Pocketing Select Mode (shape)\n")
+
def surfaceselect():
FreeCADGui.Selection.addSelectionGate(MESHGate())
FreeCAD.Console.PrintWarning("Surfacing Select Mode\n")
@@ -218,7 +246,7 @@ def select(op):
opsel['MillFace'] = pocketselect
opsel['Pocket'] = pocketselect
opsel['Pocket 3D'] = pocketselect
- opsel['Pocket Shape'] = pocketselect
+ opsel['Pocket Shape'] = pocketshapeselect
opsel['Profile Edges'] = eselect
opsel['Profile Faces'] = profileselect
opsel['Surface'] = surfaceselect