diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index 6c8890b9c6..9de8c32def 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -23,6 +23,8 @@ SET(PathScripts_SRCS PathScripts/PathArray.py PathScripts/PathCircularHoleBase.py PathScripts/PathCircularHoleBaseGui.py + PathScripts/PathChamfer.py + PathScripts/PathChamferGui.py PathScripts/PathComment.py PathScripts/PathCopy.py PathScripts/PathCustom.py @@ -133,6 +135,7 @@ SET(PathTests_SRCS ) SET(Path_Images + Images/Ops/chamfer.svg Images/Tools/drill.svg Images/Tools/endmill.svg Images/Tools/v-bit.svg diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index 0c16b73f9e..c0bde1315e 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -5,6 +5,7 @@ icons/Path-Array.svg icons/Path-Axis.svg icons/Path-BaseGeometry.svg + icons/Path-Chamfer.svg icons/Path-Comment.svg icons/Path-Compound.svg icons/Path-Contour.svg @@ -76,6 +77,7 @@ panels/PageBaseLocationEdit.ui panels/PageDepthsEdit.ui panels/PageHeightsEdit.ui + panels/PageOpChamferEdit.ui panels/PageOpDrillingEdit.ui panels/PageOpEngraveEdit.ui panels/PageOpHelixEdit.ui diff --git a/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg b/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg new file mode 100644 index 0000000000..93099b9f55 --- /dev/null +++ b/src/Mod/Path/Gui/Resources/icons/Path-Chamfer.svg @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + Path-Drilling + 2015-07-04 + http://www.freecadweb.org/wiki/index.php?title=Artwork + + + FreeCAD + + + FreeCAD/src/Mod/Path/Gui/Resources/icons/Path-Drilling.svg + + + FreeCAD LGPL2+ + + + https://www.gnu.org/copyleft/lesser.html + + + [agryson] Alexander Gryson + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui b/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui new file mode 100644 index 0000000000..83d7397e01 --- /dev/null +++ b/src/Mod/Path/Gui/Resources/panels/PageOpChamferEdit.ui @@ -0,0 +1,113 @@ + + + Form + + + + 0 + 0 + 538 + 256 + + + + Form + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Tool Controller + + + + + + + <html><head/><body><p>The tool and its settings to be used for this operation.</p></body></html> + + + + + + + + + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + W = + + + + + + + mm + + + + + + + h = + + + + + + + mm + + + + + + + + + + + 0 + 0 + + + + TextLabel + + + Qt::AlignCenter + + + + + + + + + + + Gui::InputField + QLineEdit +
Gui/InputField.h
+
+
+ + +
diff --git a/src/Mod/Path/Images/Ops/chamfer.svg b/src/Mod/Path/Images/Ops/chamfer.svg new file mode 100644 index 0000000000..675ffb59df --- /dev/null +++ b/src/Mod/Path/Images/Ops/chamfer.svg @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + W + h + + diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 94a40b190c..7ec7539926 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -47,6 +47,7 @@ class PathWorkbench (Workbench): FreeCADGui.addIconPath(":/icons") # load python modules from PathScripts import PathArray + from PathScripts import PathChamferGui from PathScripts import PathComment from PathScripts import PathCustom from PathScripts import PathDressupAxisMap @@ -82,7 +83,7 @@ class PathWorkbench (Workbench): projcmdlist = ["Path_Job", "Path_Post"] toolcmdlist = ["Path_Inspect", "Path_Simulator", "Path_ToolLibraryEdit", "Path_SelectLoop"] prepcmdlist = ["Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom"] - twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_Engrave", "Path_MillFace", "Path_Helix"] + twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_Engrave", "Path_Chamfer", "Path_MillFace", "Path_Helix"] threedopcmdlist = ["Path_Pocket_3D"] modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy" ] dressupcmdlist = ["Path_DressupAxisMap", "Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag"] diff --git a/src/Mod/Path/PathScripts/PathChamfer.py b/src/Mod/Path/PathScripts/PathChamfer.py new file mode 100644 index 0000000000..40c3c41d47 --- /dev/null +++ b/src/Mod/Path/PathScripts/PathChamfer.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- + +# *************************************************************************** +# * * +# * Copyright (c) 2018 sliptonic * +# * * +# * 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 +import Part +import Path +import PathScripts.PathLog as PathLog +import PathScripts.PathOp as PathOp + +from PySide import QtCore + +if False: + PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) + PathLog.trackModule(PathLog.thisModule()) +else: + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) + +# Qt tanslation handling +def translate(context, text, disambig=None): + return QtCore.QCoreApplication.translate(context, text, disambig) + +class ObjectChamfer(PathOp.ObjectOp): + '''Proxy class for Chamfer operation.''' + + def opFeatures(self, obj): + return PathOp.FeatureTool | PathOp.FeatureDepths | PathOp.FeatureHeights | PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces; + + def initOperation(self, obj): + obj.addProperty("App::PropertyDistance", "Width", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The desired width of the chamfer")) + obj.addProperty("App::PropertyDistance", "ExtraDepth", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The additional depth of the tool path")) + + def opExecute(self, obj): + pass + + def opSetDefaultValues(self, obj): + obj.Width = '1 mm' + obj.ExtraDepth = '0.1 mm' + +def Create(name): + '''Create(name) ... Creates and returns a Chamfer operation.''' + obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) + proxy = ObjectChamfer(obj) + return obj + diff --git a/src/Mod/Path/PathScripts/PathChamferGui.py b/src/Mod/Path/PathScripts/PathChamferGui.py new file mode 100644 index 0000000000..8bf36b7dcb --- /dev/null +++ b/src/Mod/Path/PathScripts/PathChamferGui.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- + +# *************************************************************************** +# * * +# * Copyright (c) 2018 sliptonic * +# * * +# * 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 +import FreeCADGui +import PathScripts.PathChamfer as PathChamfer +import PathScripts.PathGui as PathGui +import PathScripts.PathLog as PathLog +import PathScripts.PathOpGui as PathOpGui +import PathScripts.PathSelection as PathSelection + +from PySide import QtCore, QtGui + +__title__ = "Path Chamfer Operation UI" +__author__ = "sliptonic (Brad Collette)" +__url__ = "http://www.freecadweb.org" +__doc__ = "Chamfer operation page controller and command implementation." + +if False: + PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) + PathLog.trackModule(PathLog.thisModule()) +else: + PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) + +def translate(context, text, disambig=None): + return QtCore.QCoreApplication.translate(context, text, disambig) + + +class TaskPanelOpPage(PathOpGui.TaskPanelPage): + '''Page controller class for the Chamfer operation.''' + + def getForm(self): + return FreeCADGui.PySideUic.loadUi(":/panels/PageOpChamferEdit.ui") + + def initPage(self, obj): + self.opImagePath = "{}Mod/Path/Images/Ops/{}".format(FreeCAD.getHomePath(), 'chamfer.svg') + self.opImage = QtGui.QPixmap(self.opImagePath) + self.form.opImage.setPixmap(self.opImage) + + def getFields(self, obj): + PathGui.updateInputField(obj, 'Width', self.form.value_W) + PathGui.updateInputField(obj, 'ExtraDepth', self.form.value_h) + + self.updateToolController(obj, self.form.toolController) + + def setFields(self, obj): + self.form.value_W.setText(FreeCAD.Units.Quantity(obj.Width.Value, FreeCAD.Units.Length).UserString) + self.form.value_h.setText(FreeCAD.Units.Quantity(obj.ExtraDepth.Value, FreeCAD.Units.Length).UserString) + self.setupToolController(obj, self.form.toolController) + + def updateWidth(self): + PathGui.updateInputField(self.obj, 'Width', self.form.value_W) + + def updateExtraDepth(self): + PathGui.updateInputField(self.obj, 'ExtraDepth', self.form.value_h) + + def registerSignalHandlers(self, obj): + self.form.value_W.editingFinished.connect(self.updateWidth) + self.form.value_h.editingFinished.connect(self.updateExtraDepth) + + +Command = PathOpGui.SetupOperation('Chamfer', + PathChamfer.Create, + TaskPanelOpPage, + 'Path-Chamfer', + QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Chamfer"), + QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Creates an Engraving Path around a Draft ShapeString")) + +FreeCAD.Console.PrintLog("Loading PathChamferGui... done\n") + diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index d7dc79aa54..eb78985441 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -251,7 +251,7 @@ class ObjectEngrave(PathOp.ObjectOp): self.opSetDefaultValues(obj) def Create(name): - '''Create(name) ... Creates and returns a Engrave operation.''' + '''Create(name) ... Creates and returns an Engrave operation.''' obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectEngrave(obj) return obj diff --git a/src/Mod/Path/PathScripts/PathSelection.py b/src/Mod/Path/PathScripts/PathSelection.py index a9f99ca75c..6d164a1deb 100644 --- a/src/Mod/Path/PathScripts/PathSelection.py +++ b/src/Mod/Path/PathScripts/PathSelection.py @@ -170,6 +170,7 @@ def surfaceselect(): def select(op): opsel = {} + opsel['Chamfer'] = engraveselect opsel['Contour'] = contourselect opsel['Drilling'] = drillselect opsel['Engrave'] = engraveselect