Skip to content

Commit

Permalink
OCC pocket handles large curves better now. Needs testing
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
sliptonic authored and yorikvanhavre committed May 23, 2016
1 parent be03c2a commit a0f332f
Show file tree
Hide file tree
Showing 10 changed files with 339 additions and 206 deletions.
127 changes: 71 additions & 56 deletions src/Mod/Path/InitGui.py
@@ -1,31 +1,32 @@
#***************************************************************************
#* (c) Yorik van Havre (yorik@uncreated.net) 2014 *
#* *
#* This file is part of the FreeCAD CAx development system. *
#* *
#* 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. *
#* *
#* FreeCAD 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 Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with FreeCAD; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* *
#***************************************************************************/
# ***************************************************************************
# * (c) Yorik van Havre (yorik@uncreated.net) 2014 *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * 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. *
# * *
# * FreeCAD 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 Lesser General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with FreeCAD; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************/


class PathWorkbench ( Workbench ):
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/Resources/icons/PathWorkbench.svg"
self.__class__.MenuText = "Path"
self.__class__.ToolTip = "Path workbench"

Expand Down Expand Up @@ -65,59 +66,73 @@ def Initialize(self):
from PathScripts import PathEngrave
from PathScripts import PathSurface
from PathScripts import PathRemote
from PathScripts import PathSanity

# 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","Path_FaceProfile","Path_FacePocket","Path_Custom","Path_FromShape"]
opcmdlist = ["Path_Profile","Path_Pocket","Path_Drilling","Path_Engrave","Path_Surfacing"]
modcmdlist = ["Path_Copy","Path_CompoundExtended","Path_Dressup","Path_Hop","Path_Array","Path_SimpleCopy"]
projcmdlist = ["Path_Project", "Path_ToolTableEdit",
"Path_Post", "Path_Inspect", "Path_Sanity"]
prepcmdlist = ["Path_Plane", "Path_Fixture", "Path_LoadTool", "Path_ToolLenOffset", "Path_Comment",
"Path_Stop", "Path_FaceProfile", "Path_FacePocket", "Path_Custom", "Path_FromShape"]
opcmdlist = ["Path_Profile", "Path_Pocket",
"Path_Drilling", "Path_Engrave", "Path_Surfacing"]
modcmdlist = ["Path_Copy", "Path_CompoundExtended",
"Path_Dressup", "Path_Hop", "Path_Array", "Path_SimpleCopy"]
remotecmdlist = ["Path_Remote"]

# Add commands to menu and toolbar
def QT_TRANSLATE_NOOP(scope, text):
def QT_TRANSLATE_NOOP(scope, text):
return text
def translate(context,text):

def translate(context, text):
return QtGui.QApplication.translate(context, text, None, QtGui.QApplication.UnicodeUTF8).encode("utf8")
self.appendToolbar(translate("Path","Project Setup"),projcmdlist)
self.appendToolbar(translate("Path","Partial Commands"),prepcmdlist)
self.appendToolbar(translate("Path","New Operations"),opcmdlist)
self.appendToolbar(translate("Path","Path Modification"),modcmdlist)
self.appendToolbar(translate("Path", "Project Setup"), projcmdlist)
self.appendToolbar(translate("Path", "Partial Commands"), prepcmdlist)
self.appendToolbar(translate("Path", "New Operations"), opcmdlist)
self.appendToolbar(translate("Path", "Path Modification"), modcmdlist)

self.appendMenu([translate("Path", "Path"), translate(
"Path", "Project Setup")], projcmdlist)
self.appendMenu([translate("Path", "Path"), translate(
"Path", "Partial Commands")], prepcmdlist)
self.appendMenu([translate("Path", "Path"), translate(
"Path", "New Operations")], opcmdlist)
self.appendMenu([translate("Path", "Path"), translate(
"Path", "Path Modification")], modcmdlist)
self.appendMenu([translate("Path", "Path"), translate(
"Path", "Remote Operations")], remotecmdlist)

self.appendMenu([translate("Path","Path"),translate("Path","Project Setup")],projcmdlist)
self.appendMenu([translate("Path","Path"),translate("Path","Partial Commands")],prepcmdlist)
self.appendMenu([translate("Path","Path"),translate("Path","New Operations")],opcmdlist)
self.appendMenu([translate("Path","Path"),translate("Path","Path Modification")],modcmdlist)
self.appendMenu([translate("Path","Path"),translate("Path","Remote Operations")],remotecmdlist)

# Add preferences pages
import os
FreeCADGui.addPreferencePage(FreeCAD.getHomePath()+os.sep+"Mod"+os.sep+"Path"+os.sep+"PathScripts"+os.sep+"DlgSettingsPath.ui","Path")

Log ('Loading Path workbench... done\n')
FreeCADGui.addPreferencePage(FreeCAD.getHomePath(
) + os.sep + "Mod" + os.sep + "Path" + os.sep + "PathScripts" + os.sep + "DlgSettingsPath.ui", "Path")

Log('Loading Path workbench... done\n')

def GetClassName(self):
return "Gui::PythonWorkbench"

def Activated(self):
# update the translation engine
FreeCADGui.updateLocale()
Msg("Path workbench activated\n")

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"])
if "Profile" in FreeCADGui.Selection.getSelection()[0].Name:
self.appendContextMenu("",["Add_Tag"])
self.appendContextMenu("",["Set_StartPoint"])
self.appendContextMenu("",["Set_EndPoint"])
if "Remote" in FreeCADGui.Selection.getSelection()[0].Name:
self.appendContextMenu("",["Refresh_Path"])
self.appendContextMenu("", ["Path_Inspect"])
if "Profile" in FreeCADGui.Selection.getSelection()[0].Name:
self.appendContextMenu("", ["Add_Tag"])
self.appendContextMenu("", ["Set_StartPoint"])
self.appendContextMenu("", ["Set_EndPoint"])
if "Remote" in FreeCADGui.Selection.getSelection()[0].Name:
self.appendContextMenu("", ["Refresh_Path"])

Gui.addWorkbench(PathWorkbench())

FreeCAD.addImportType("GCode (*.nc *.gc *.ncc *.ngc *.cnc *.tap *.gcode)","PathGui")
FreeCAD.addExportType("GCode (*.nc *.gc *.ncc *.ngc *.cnc *.tap *.gcode)","PathGui")
FreeCAD.addImportType(
"GCode (*.nc *.gc *.ncc *.ngc *.cnc *.tap *.gcode)", "PathGui")
FreeCAD.addExportType(
"GCode (*.nc *.gc *.ncc *.ngc *.cnc *.tap *.gcode)", "PathGui")
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathDrilling.py
Expand Up @@ -74,7 +74,7 @@ def __setstate__(self, state):
def execute(self, obj):
output = ""
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None:
if toolLoad is None or toolLoad.ToolNumber == 0:
self.vertFeed = 100
self.horizFeed = 100
self.radius = 0.25
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathEngrave.py
Expand Up @@ -80,7 +80,7 @@ def execute(self, obj):
output = ""

toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None:
if toolLoad is None or toolLoad.ToolNumber == 0:
self.vertFeed = 100
self.horizFeed = 100
self.radius = 0.25
Expand Down

0 comments on commit a0f332f

Please sign in to comment.