Path: Add Waterline command and PEP8 clean-up
This commit is contained in:
@@ -21,8 +21,9 @@
|
||||
# * *
|
||||
# ***************************************************************************/
|
||||
|
||||
|
||||
class PathCommandGroup:
|
||||
def __init__(self, cmdlist, menu, tooltip = None):
|
||||
def __init__(self, cmdlist, menu, tooltip=None):
|
||||
self.cmdlist = cmdlist
|
||||
self.menu = menu
|
||||
if tooltip is None:
|
||||
@@ -34,7 +35,7 @@ class PathCommandGroup:
|
||||
return tuple(self.cmdlist)
|
||||
|
||||
def GetResources(self):
|
||||
return { 'MenuText': self.menu, 'ToolTip': self.tooltip }
|
||||
return {'MenuText': self.menu, 'ToolTip': self.tooltip}
|
||||
|
||||
def IsActive(self):
|
||||
if FreeCAD.ActiveDocument is not None:
|
||||
@@ -43,6 +44,7 @@ class PathCommandGroup:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class PathWorkbench (Workbench):
|
||||
"Path workbench"
|
||||
|
||||
@@ -88,14 +90,14 @@ class PathWorkbench (Workbench):
|
||||
projcmdlist = ["Path_Job", "Path_Post"]
|
||||
toolcmdlist = ["Path_Inspect", "Path_Simulator", "Path_ToolLibraryEdit", "Path_SelectLoop", "Path_OpActiveToggle"]
|
||||
prepcmdlist = ["Path_Fixture", "Path_Comment", "Path_Stop", "Path_Custom", "Path_Probe"]
|
||||
twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix", "Path_Adaptive" ]
|
||||
twodopcmdlist = ["Path_Contour", "Path_Profile_Faces", "Path_Profile_Edges", "Path_Pocket_Shape", "Path_Drilling", "Path_MillFace", "Path_Helix", "Path_Adaptive"]
|
||||
threedopcmdlist = ["Path_Pocket_3D"]
|
||||
engravecmdlist = ["Path_Engrave", "Path_Deburr"]
|
||||
modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy" ]
|
||||
modcmdlist = ["Path_OperationCopy", "Path_Array", "Path_SimpleCopy"]
|
||||
dressupcmdlist = ["Path_DressupAxisMap", "Path_DressupPathBoundary", "Path_DressupDogbone", "Path_DressupDragKnife", "Path_DressupLeadInOut", "Path_DressupRampEntry", "Path_DressupTag", "Path_DressupZCorrect"]
|
||||
extracmdlist = []
|
||||
#modcmdmore = ["Path_Hop",]
|
||||
#remotecmdlist = ["Path_Remote"]
|
||||
# modcmdmore = ["Path_Hop",]
|
||||
# remotecmdlist = ["Path_Remote"]
|
||||
|
||||
engravecmdgroup = ['Path_EngraveTools']
|
||||
FreeCADGui.addCommand('Path_EngraveTools', PathCommandGroup(engravecmdlist, QtCore.QT_TRANSLATE_NOOP("Path", 'Engraving Operations')))
|
||||
@@ -107,11 +109,12 @@ class PathWorkbench (Workbench):
|
||||
extracmdlist.extend(["Path_Area", "Path_Area_Workplane"])
|
||||
|
||||
try:
|
||||
import ocl # pylint: disable=unused-variable
|
||||
import ocl # pylint: disable=unused-variable
|
||||
from PathScripts import PathSurfaceGui
|
||||
threedopcmdlist.append("Path_Surface")
|
||||
from PathScripts import PathWaterlineGui
|
||||
threedopcmdlist.extend(["Path_Surface", "Path_Waterline"])
|
||||
threedcmdgroup = ['Path_3dTools']
|
||||
FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path",'3D Operations')))
|
||||
FreeCADGui.addCommand('Path_3dTools', PathCommandGroup(threedopcmdlist, QtCore.QT_TRANSLATE_NOOP("Path", '3D Operations')))
|
||||
except ImportError:
|
||||
FreeCAD.Console.PrintError("OpenCamLib is not working!\n")
|
||||
|
||||
@@ -122,7 +125,9 @@ class PathWorkbench (Workbench):
|
||||
if extracmdlist:
|
||||
self.appendToolbar(QtCore.QT_TRANSLATE_NOOP("Path", "Helpful Tools"), extracmdlist)
|
||||
|
||||
self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path")], projcmdlist +["Path_ExportTemplate", "Separator"] + toolbitcmdlist + toolcmdlist +["Separator"] + twodopcmdlist + engravecmdlist +["Separator"] +threedopcmdlist +["Separator"])
|
||||
self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path")], projcmdlist + ["Path_ExportTemplate", "Separator"] +
|
||||
toolbitcmdlist + toolcmdlist + ["Separator"] + twodopcmdlist + engravecmdlist + ["Separator"] +
|
||||
threedopcmdlist + ["Separator"])
|
||||
self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP(
|
||||
"Path", "Path Dressup")], dressupcmdlist)
|
||||
self.appendMenu([QtCore.QT_TRANSLATE_NOOP("Path", "&Path"), QtCore.QT_TRANSLATE_NOOP(
|
||||
@@ -136,7 +141,7 @@ class PathWorkbench (Workbench):
|
||||
|
||||
curveAccuracy = PathPreferences.defaultLibAreaCurveAccuracy()
|
||||
if curveAccuracy:
|
||||
Path.Area.setDefaultParams(Accuracy = curveAccuracy)
|
||||
Path.Area.setDefaultParams(Accuracy=curveAccuracy)
|
||||
|
||||
Log('Loading Path workbench... done\n')
|
||||
|
||||
@@ -171,8 +176,8 @@ class PathWorkbench (Workbench):
|
||||
if obj.isDerivedFrom("Path::Feature"):
|
||||
if "Profile" in selectedName or "Contour" in selectedName or "Dressup" in selectedName:
|
||||
self.appendContextMenu("", "Separator")
|
||||
#self.appendContextMenu("", ["Set_StartPoint"])
|
||||
#self.appendContextMenu("", ["Set_EndPoint"])
|
||||
# self.appendContextMenu("", ["Set_StartPoint"])
|
||||
# self.appendContextMenu("", ["Set_EndPoint"])
|
||||
for cmd in self.dressupcmds:
|
||||
self.appendContextMenu("", [cmd])
|
||||
menuAppended = True
|
||||
@@ -182,10 +187,10 @@ class PathWorkbench (Workbench):
|
||||
if menuAppended:
|
||||
self.appendContextMenu("", "Separator")
|
||||
|
||||
|
||||
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")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user