diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 88aa5881f..2b03e7acd 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -48,23 +48,23 @@ except AttributeError: class ObjectDrilling: def __init__(self, obj): - obj.addProperty("App::PropertyLinkSubList", "Base","Path", translate("PathProject", "The base geometry of this toolpath")) - obj.addProperty("App::PropertyBool", "Active", "Path", translate("PathProject", "Make False, to prevent operation from generating code")) - obj.addProperty("App::PropertyString", "Comment", "Path", translate("PathProject", "An optional comment for this profile")) - obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label")) + obj.addProperty("App::PropertyLinkSubList", "Base","Path", "The base geometry of this toolpath") + obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code") + obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile") + obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label") - obj.addProperty("App::PropertyLength", "PeckDepth", "Depth", translate("PathProject", "Incremental Drill depth before retracting to clear chips")) - obj.addProperty("App::PropertyLength", "StartDepth", "Depth", translate("PathProject", "Starting Depth of Tool- first cut depth in Z")) - obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate("PathProject", "The height needed to clear clamps and obstructions")) - obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate("PathProject", "Final Depth of Tool- lowest value in Z")) - obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate("PathProject", "Height to clear top of materil")) - obj.addProperty("App::PropertyDistance", "RetractHeight", "Depth", translate("PathProject", "The height where feed starts and height during retract tool when path is finished")) + obj.addProperty("App::PropertyLength", "PeckDepth", "Depth", "Incremental Drill depth before retracting to clear chips") + obj.addProperty("App::PropertyLength", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z") + obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions") + obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z") + obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Height to clear top of materil") + obj.addProperty("App::PropertyDistance", "RetractHeight", "Depth", "The height where feed starts and height during retract tool when path is finished") # Tool Properties - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("PathProfile", "The tool number in use")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use") obj.ToolNumber = (0, 0, 1000, 1) obj.setEditorMode('ToolNumber', 1) # make this read only - obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool ")) + obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ") obj.setEditorMode('ToolDescription', 1) # make this read onlyt diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 8cddee746..002721233 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -47,25 +47,25 @@ class ObjectPathEngrave: def __init__(self, obj): obj.addProperty("App::PropertyLinkSubList", "Base", "Path", "The base geometry of this object") - obj.addProperty("App::PropertyBool", "Active", "Path", translate("Path", "Make False, to prevent operation from generating code")) - obj.addProperty("App::PropertyString", "Comment", "Path", translate("Path", "An optional comment for this profile")) - obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label")) + obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code") + obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile") + obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label") - obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", translate("Path", "The library or Algorithm used to generate the path")) + obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", "The library or Algorithm used to generate the path") obj.Algorithm = ['OCC Native'] # Tool Properties - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("Path", "The tool number in use")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use") obj.ToolNumber = (0, 0, 1000, 1) obj.setEditorMode('ToolNumber', 1) # make this read only - obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool ")) - obj.setEditorMode('ToolDescription', 1) # make this read onlyt + obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ") + obj.setEditorMode('ToolDescription', 1) # make this read onlyt # Depth Properties - obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate("Path", "The height needed to clear clamps and obstructions")) - obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate("Path", "Rapid Safety Height between locations.")) - obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", translate("Path", "Starting Depth of Tool- first cut depth in Z")) - obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate("Path", "Final Depth of Tool- lowest value in Z")) + obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions") + obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Rapid Safety Height between locations.") + obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z") + obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z") obj.addProperty("App::PropertyInteger", "StartVertex", "Path", "The vertex index to start the path from") if FreeCAD.GuiUp: @@ -81,7 +81,7 @@ class ObjectPathEngrave: def onChanged(self, obj, prop): if prop == "UserLabel": - obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")" + obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")" def execute(self, obj): output = "" diff --git a/src/Mod/Path/PathScripts/PathHop.py b/src/Mod/Path/PathScripts/PathHop.py index e8848bc36..a54053309 100644 --- a/src/Mod/Path/PathScripts/PathHop.py +++ b/src/Mod/Path/PathScripts/PathHop.py @@ -1,35 +1,38 @@ # -*- coding: utf-8 -*- -#*************************************************************************** -#* * -#* Copyright (c) 2014 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 * -#* * -#*************************************************************************** +# *************************************************************************** +# * * +# * Copyright (c) 2014 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 +import FreeCAD +import FreeCADGui +import Path +from PySide import QtCore, QtGui """Path Hop 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: @@ -38,50 +41,50 @@ except AttributeError: class ObjectHop: - - def __init__(self,obj): - obj.addProperty("App::PropertyLink","NextObject","Path","The object to be reached by this hop") - obj.addProperty("App::PropertyDistance","HopHeight","Path","The Z height of the hop") + def __init__(self, obj): + obj.addProperty("App::PropertyLink", "NextObject", + "Path", "The object to be reached by this hop") + obj.addProperty("App::PropertyDistance", "HopHeight", + "Path", "The Z height of the hop") obj.Proxy = self def __getstate__(self): return None - def __setstate__(self,state): + def __setstate__(self, state): return None - - def execute(self,obj): + + def execute(self, obj): nextpoint = FreeCAD.Vector() if obj.NextObject: if obj.NextObject.isDerivedFrom("Path::Feature"): # look for the first position of the next path for c in obj.NextObject.Path.Commands: - if c.Name in ["G0","G00","G1","G01","G2","G02","G3","G03"]: + if c.Name in ["G0", "G00", "G1", "G01", "G2", "G02", "G3", "G03"]: nextpoint = c.Placement.Base break - + # absolute coords, millimeters, cancel offsets output = "G90\nG21\nG40\n" - + # go up to the given height output += "G0 Z" + str(obj.HopHeight.Value) + "\n" - + # go horizontally to the position of nextpoint output += "G0 X" + str(nextpoint.x) + " Y" + str(nextpoint.y) + "\n" - - #print output + + # print output path = Path.Path(output) obj.Path = path - class ViewProviderPathHop: - def __init__(self,vobj): + def __init__(self, vobj): vobj.Proxy = self - def attach(self,vobj): + def attach(self, vobj): self.Object = vobj.Object return @@ -91,48 +94,52 @@ class ViewProviderPathHop: def __getstate__(self): return None - def __setstate__(self,state): + def __setstate__(self, state): return None - class CommandPathHop: - def GetResources(self): - return {'Pixmap' : 'Path-Hop', - 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Hop"), + return {'Pixmap': 'Path-Hop', + 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Hop", "Hop"), 'Accel': "P, H", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Hop","Creates a Path Hop object")} + 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Hop", "Creates a Path Hop object")} def IsActive(self): - return not FreeCAD.ActiveDocument is None - + return FreeCAD.ActiveDocument is not None + def Activated(self): - + # check that the selection contains exactly what we want selection = FreeCADGui.Selection.getSelection() if len(selection) != 1: - FreeCAD.Console.PrintError(translate("Path_Hop","Please select one path object\n")) + FreeCAD.Console.PrintError( + translate("Path_Hop", "Please select one path object\n")) return if not selection[0].isDerivedFrom("Path::Feature"): - FreeCAD.Console.PrintError(translate("Path_Hop","The selected object is not a path\n")) + FreeCAD.Console.PrintError( + translate("Path_Hop", "The selected object is not a path\n")) return - - FreeCAD.ActiveDocument.openTransaction(translate("Pat_hHop","Create Hop")) + + FreeCAD.ActiveDocument.openTransaction( + translate("Pat_hHop", "Create Hop")) FreeCADGui.addModule("PathScripts.PathHop") FreeCADGui.addModule("PathScripts.PathUtils") - FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")') + FreeCADGui.doCommand( + 'obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython","Hop")') FreeCADGui.doCommand('PathScripts.PathHop.ObjectHop(obj)') - FreeCADGui.doCommand('PathScripts.PathHop.ViewProviderPathHop(obj.ViewObject)') - FreeCADGui.doCommand('obj.NextObject = FreeCAD.ActiveDocument.' + selection[0].Name) + FreeCADGui.doCommand( + 'PathScripts.PathHop.ViewProviderPathHop(obj.ViewObject)') + FreeCADGui.doCommand( + 'obj.NextObject = FreeCAD.ActiveDocument.' + selection[0].Name) FreeCADGui.doCommand('PathScripts.PathUtils.addToProject(obj)') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() -if FreeCAD.GuiUp: +if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand('Path_Hop',CommandPathHop()) + FreeCADGui.addCommand('Path_Hop', CommandPathHop()) FreeCAD.Console.PrintLog("Loading PathHop... done\n") diff --git a/src/Mod/Path/PathScripts/PathLoadTool.py b/src/Mod/Path/PathScripts/PathLoadTool.py index 70a4977b3..7f31ddf36 100644 --- a/src/Mod/Path/PathScripts/PathLoadTool.py +++ b/src/Mod/Path/PathScripts/PathLoadTool.py @@ -45,13 +45,13 @@ except AttributeError: class LoadTool: def __init__(self, obj): - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("Tool Number", "The active tool")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The active tool") obj.ToolNumber = (0, 0, 10000, 1) - obj.addProperty("App::PropertyFloat", "SpindleSpeed", "Tool", translate("Spindle Speed", "The speed of the cutting spindle in RPM")) - obj.addProperty("App::PropertyEnumeration", "SpindleDir", "Tool", translate("Spindle Dir", "Direction of spindle rotation")) + obj.addProperty("App::PropertyFloat", "SpindleSpeed", "Tool", "The speed of the cutting spindle in RPM") + obj.addProperty("App::PropertyEnumeration", "SpindleDir", "Tool", "Direction of spindle rotation") obj.SpindleDir = ['Forward', 'Reverse'] - obj.addProperty("App::PropertySpeed", "VertFeed", "Feed", translate("Path", "Feed rate for vertical moves in Z")) - obj.addProperty("App::PropertySpeed", "HorizFeed", "Feed", translate("Path", "Feed rate for horizontal moves")) + obj.addProperty("App::PropertySpeed", "VertFeed", "Feed", "Feed rate for vertical moves in Z") + obj.addProperty("App::PropertySpeed", "HorizFeed", "Feed", "Feed rate for horizontal moves") obj.Proxy = self mode = 2 @@ -228,12 +228,18 @@ class TaskPanel: self.form.cboSpindleDirection.setCurrentIndex(index) # Populate the tool list mach = PathUtils.findMachine() - tool = mach.Tooltable.Tools[self.obj.ToolNumber] + try: + tool = mach.Tooltable.Tools[self.obj.ToolNumber] + self.form.txtToolName.setText(tool.Name) + self.form.txtToolType.setText(tool.ToolType) + self.form.txtToolMaterial.setText(tool.Material) + self.form.txtToolDiameter.setText(str(tool.Diameter)) + except: + self.form.txtToolName.setText("UNDEFINED") + self.form.txtToolType.setText("UNDEFINED") + self.form.txtToolMaterial.setText("UNDEFINED") + self.form.txtToolDiameter.setText("UNDEFINED") - self.form.txtToolName.setText(tool.Name) - self.form.txtToolType.setText(tool.ToolType) - self.form.txtToolMaterial.setText(tool.Material) - self.form.txtToolDiameter.setText(str(tool.Diameter)) # self.form.cboToolSelect.addItem(tool.Name) diff --git a/src/Mod/Path/PathScripts/PathMachine.py b/src/Mod/Path/PathScripts/PathMachine.py index 11523fec1..563c91438 100644 --- a/src/Mod/Path/PathScripts/PathMachine.py +++ b/src/Mod/Path/PathScripts/PathMachine.py @@ -46,39 +46,25 @@ class Machine: def __init__(self, obj): - obj.addProperty("App::PropertyString", "MachineName", "Base", translate( - "Machine Name", "Name of the Machine that will use the CNC program")) + obj.addProperty("App::PropertyString", "MachineName", "Base", "Name of the Machine that will use the CNC program") - obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", translate( - "Post Processor", "Select the Post Processor file for this machine")) - # obj.setEditorMode("PostProcessor",1) #set to read only - obj.addProperty("App::PropertyEnumeration", "MachineUnits", "CodeOutput", translate( - "Machine Units", "Units that the machine works in, ie Metric or Inch")) + obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this machine") + obj.addProperty("App::PropertyEnumeration", "MachineUnits", "CodeOutput", "Units that the machine works in, ie Metric or Inch") obj.MachineUnits = ['Metric', 'Inch'] - obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", translate( - "Tool Table", "The tooltable used for this CNC program")) + obj.addProperty("Path::PropertyTooltable", "Tooltable", "Base", "The tooltable used for this CNC program") - obj.addProperty("App::PropertyDistance", "X_Max", "Limits", translate( - "X Maximum Limit", "The Maximum distance in X the machine can travel")) - obj.addProperty("App::PropertyDistance", "Y_Max", "Limits", translate( - "Y Maximum Limit", "The Maximum distance in X the machine can travel")) - obj.addProperty("App::PropertyDistance", "Z_Max", "Limits", translate( - "Y Maximum Limit", "The Maximum distance in X the machine can travel")) + obj.addProperty("App::PropertyDistance", "X_Max", "Limits", "The Maximum distance in X the machine can travel") + obj.addProperty("App::PropertyDistance", "Y_Max", "Limits", "The Maximum distance in X the machine can travel") + obj.addProperty("App::PropertyDistance", "Z_Max", "Limits", "The Maximum distance in X the machine can travel") - obj.addProperty("App::PropertyDistance", "X_Min", "Limits", translate( - "X Minimum Limit", "The Minimum distance in X the machine can travel")) - obj.addProperty("App::PropertyDistance", "Y_Min", "Limits", translate( - "Y Minimum Limit", "The Minimum distance in X the machine can travel")) - obj.addProperty("App::PropertyDistance", "Z_Min", "Limits", translate( - "Y Minimum Limit", "The Minimum distance in X the machine can travel")) + obj.addProperty("App::PropertyDistance", "X_Min", "Limits", "The Minimum distance in X the machine can travel") + obj.addProperty("App::PropertyDistance", "Y_Min", "Limits", "The Minimum distance in X the machine can travel") + obj.addProperty("App::PropertyDistance", "Z_Min", "Limits", "The Minimum distance in X the machine can travel") - obj.addProperty("App::PropertyDistance", "X", "HomePosition", translate( - "X Home Position", "Home position of machine, in X (mainly for visualization)")) - obj.addProperty("App::PropertyDistance", "Y", "HomePosition", translate( - "Y Home Position", "Home position of machine, in Y (mainly for visualization)")) - obj.addProperty("App::PropertyDistance", "Z", "HomePosition", translate( - "Z Home Position", "Home position of machine, in Z (mainly for visualization)")) + obj.addProperty("App::PropertyDistance", "X", "HomePosition", "Home position of machine, in X (mainly for visualization)") + obj.addProperty("App::PropertyDistance", "Y", "HomePosition", "Home position of machine, in Y (mainly for visualization)") + obj.addProperty("App::PropertyDistance", "Z", "HomePosition", "Home position of machine, in Z (mainly for visualization)") obj.Proxy = self mode = 2 diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index 3e5d0ede8..88b51259e 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -47,55 +47,55 @@ except AttributeError: class ObjectPocket: def __init__(self, obj): - obj.addProperty("App::PropertyLinkSubList", "Base", "Path", translate("PathProject", "The base geometry of this object")) - obj.addProperty("App::PropertyBool", "Active", "Path", translate("PathProject", "Make False, to prevent operation from generating code")) - obj.addProperty("App::PropertyString", "Comment", "Path", translate("PathProject", "An optional comment for this profile")) - obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label")) + obj.addProperty("App::PropertyLinkSubList", "Base", "Path", "The base geometry of this object") + obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code") + obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile") + obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label") - obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", translate("PathProject", "The library to use to generate the path")) + obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", "The library to use to generate the path") obj.Algorithm = ['OCC Native', 'libarea'] # Tool Properties - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("PathProfile", "The tool number in use")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use") obj.ToolNumber = (0, 0, 1000, 0) obj.setEditorMode('ToolNumber', 1) # make this read only - obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool ")) + obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ") obj.setEditorMode('ToolDescription', 1) # make this read onlyt # Depth Properties - obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate("PathProject", "The height needed to clear clamps and obstructions")) - obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate("PathProject", "Rapid Safety Height between locations.")) - obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Depth", translate("PathProject", "Incremental Step Down of Tool")) + obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions") + obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Rapid Safety Height between locations.") + obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Depth", "Incremental Step Down of Tool") obj.StepDown = (0.0, 0.01, 100.0, 0.5) - obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", translate("PathProject", "Starting Depth of Tool- first cut depth in Z")) - obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate("PathProject", "Final Depth of Tool- lowest value in Z")) - obj.addProperty("App::PropertyDistance", "FinishDepth", "Depth", translate("PathProject", "Maximum material removed on final pass.")) + obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z") + obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z") + obj.addProperty("App::PropertyDistance", "FinishDepth", "Depth", "Maximum material removed on final pass.") # Pocket Properties - obj.addProperty("App::PropertyEnumeration", "CutMode", "Pocket", translate("PathProject", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW")) + obj.addProperty("App::PropertyEnumeration", "CutMode", "Pocket", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW") obj.CutMode = ['Climb', 'Conventional'] - obj.addProperty("App::PropertyDistance", "MaterialAllowance", "Pocket", translate("PathProject", "Amount of material to leave")) - obj.addProperty("App::PropertyEnumeration", "StartAt", "Pocket", translate("PathProject", "Start pocketing at center or boundary")) + obj.addProperty("App::PropertyDistance", "MaterialAllowance", "Pocket", "Amount of material to leave") + obj.addProperty("App::PropertyEnumeration", "StartAt", "Pocket", "Start pocketing at center or boundary") obj.StartAt = ['Center', 'Edge'] - obj.addProperty("App::PropertyPercent", "StepOver", "Pocket", translate("PathProject", "Percent of cutter diameter to step over on each pass")) + obj.addProperty("App::PropertyPercent", "StepOver", "Pocket", "Percent of cutter diameter to step over on each pass") #obj.StepOver = (0.0, 0.01, 100.0, 0.5) - obj.addProperty("App::PropertyBool", "KeepToolDown", "Pocket", translate("PathProject", "Attempts to avoid unnecessary retractions.")) - obj.addProperty("App::PropertyBool", "ZigUnidirectional", "Pocket", translate("PathProject", "Lifts tool at the end of each pass to respect cut mode.")) - obj.addProperty("App::PropertyBool", "UseZigZag", "Pocket", translate("PathProject", "Use Zig Zag pattern to clear area.")) - obj.addProperty("App::PropertyFloat", "ZigZagAngle", "Pocket", translate("PathProject", "Angle of the zigzag pattern")) + obj.addProperty("App::PropertyBool", "KeepToolDown", "Pocket", "Attempts to avoid unnecessary retractions.") + obj.addProperty("App::PropertyBool", "ZigUnidirectional", "Pocket", "Lifts tool at the end of each pass to respect cut mode.") + obj.addProperty("App::PropertyBool", "UseZigZag", "Pocket", "Use Zig Zag pattern to clear area.") + obj.addProperty("App::PropertyFloat", "ZigZagAngle", "Pocket", "Angle of the zigzag pattern") # Entry Properties - obj.addProperty("App::PropertyBool", "UseEntry", "Entry", translate("PathProject", "Allow Cutter enter material with a straight plunge.")) - obj.addProperty("App::PropertyFloatConstraint", "RampSize", "Entry", translate("PathProject", "The minimum fraction of tool diameter to use for ramp length")) + obj.addProperty("App::PropertyBool", "UseEntry", "Entry", "Allow Cutter enter material with a straight plunge.") + obj.addProperty("App::PropertyFloatConstraint", "RampSize", "Entry", "The minimum fraction of tool diameter to use for ramp length") obj.RampSize = (0.0, 0.01, 100.0, 0.5) - obj.addProperty("App::PropertyFloatConstraint", "HelixSize", "Entry", translate("PathProject", "The fraction of tool diameter to use for calculating helix size.")) + obj.addProperty("App::PropertyFloatConstraint", "HelixSize", "Entry", "The fraction of tool diameter to use for calculating helix size.") obj.HelixSize = (0.0, 0.01, 100.0, 0.5) - obj.addProperty("App::PropertyFloatConstraint", "RampAngle", "Entry", translate("PathProject", "The Angle of the ramp entry.")) + obj.addProperty("App::PropertyFloatConstraint", "RampAngle", "Entry", "The Angle of the ramp entry.") obj.RampAngle = (0.0, 0.01, 100.0, 0.5) # Start Point Properties - obj.addProperty("App::PropertyVector", "StartPoint", "Start Point", translate("PathProject", "The start point of this path")) - obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", translate("PathProject", "make True, if specifying a Start Point")) + obj.addProperty("App::PropertyVector", "StartPoint", "Start Point", "The start point of this path") + obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", "make True, if specifying a Start Point") obj.Proxy = self @@ -366,7 +366,10 @@ class ObjectPocket: self.vertFeed = toolLoad.VertFeed.Value self.horizFeed = toolLoad.HorizFeed.Value tool = PathUtils.getTool(obj, toolLoad.ToolNumber) - self.radius = tool.Diameter/2 + if tool.Diameter == 0: + self.radius = 0.25 + else: + self.radius = tool.Diameter/2 obj.ToolNumber = toolLoad.ToolNumber obj.ToolDescription = toolLoad.Name diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 58656d1e1..bcffc4382 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -55,56 +55,56 @@ except AttributeError: class ObjectProfile: def __init__(self, obj): - obj.addProperty("App::PropertyLinkSubList", "Base", "Path", translate("Parent Object", "The base geometry of this toolpath")) - obj.addProperty("App::PropertyBool", "Active", "Path", translate("Path", "Make False, to prevent operation from generating code")) - obj.addProperty("App::PropertyString", "Comment", "Path", translate("Path", "An optional comment for this profile")) - obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label")) + obj.addProperty("App::PropertyLinkSubList", "Base", "Path", "The base geometry of this toolpath") + obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code") + obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile") + obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label") - obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", translate("Path", "The library or algorithm used to generate the path")) + obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", "The library or algorithm used to generate the path") obj.Algorithm = ['OCC Native', 'libarea'] - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("Path", "The tool number in use")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use") obj.ToolNumber = (0, 0, 1000, 1) obj.setEditorMode('ToolNumber', 1) # make this read only - obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool ")) + obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ") obj.setEditorMode('ToolDescription', 1) # make this read onlyt # Depth Properties - obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate("Path", "The height needed to clear clamps and obstructions")) - obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate("Path", "Rapid Safety Height between locations.")) - obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Depth", translate("Path", "Incremental Step Down of Tool")) + obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions") + obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Rapid Safety Height between locations.") + obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Depth", "Incremental Step Down of Tool") obj.StepDown = (1, 0.01, 1000, 0.5) - obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", translate("Path", "Starting Depth of Tool- first cut depth in Z")) - obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate("Path", "Final Depth of Tool- lowest value in Z")) + obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z") + obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z") # Start Point Properties - obj.addProperty("App::PropertyVector", "StartPoint", "Start Point", translate("Path_Profile", "The start point of this path")) - obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", translate("Path_Profile", "make True, if specifying a Start Point")) - obj.addProperty("App::PropertyLength", "ExtendAtStart", "Start Point", translate("Path_Profile", "extra length of tool path before start of part edge")) - obj.addProperty("App::PropertyLength", "LeadInLineLen", "Start Point", translate("Path_Profile", "length of straight segment of toolpath that comes in at angle to first part edge")) + obj.addProperty("App::PropertyVector", "StartPoint", "Start Point", "The start point of this path") + obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", "make True, if specifying a Start Point") + obj.addProperty("App::PropertyLength", "ExtendAtStart", "Start Point", "extra length of tool path before start of part edge") + obj.addProperty("App::PropertyLength", "LeadInLineLen", "Start Point", "length of straight segment of toolpath that comes in at angle to first part edge") # End Point Properties - obj.addProperty("App::PropertyBool", "UseEndPoint", "End Point", translate("Path_Profile", "make True, if specifying an End Point")) - obj.addProperty("App::PropertyLength", "ExtendAtEnd", "End Point", translate("Path_Profile", "extra length of tool path after end of part edge")) - obj.addProperty("App::PropertyLength", "LeadOutLineLen", "End Point", translate("Path_Profile", "length of straight segment of toolpath that comes in at angle to last part edge")) - obj.addProperty("App::PropertyVector", "EndPoint", "End Point", translate("Path_Profile", "The end point of this path")) + obj.addProperty("App::PropertyBool", "UseEndPoint", "End Point", "make True, if specifying an End Point") + obj.addProperty("App::PropertyLength", "ExtendAtEnd", "End Point", "extra length of tool path after end of part edge") + obj.addProperty("App::PropertyLength", "LeadOutLineLen", "End Point", "length of straight segment of toolpath that comes in at angle to last part edge") + obj.addProperty("App::PropertyVector", "EndPoint", "End Point", "The end point of this path") # Profile Properties - obj.addProperty("App::PropertyEnumeration", "Side", "Profile", translate("Path_Profile", "Side of edge that tool should cut")) + obj.addProperty("App::PropertyEnumeration", "Side", "Profile", "Side of edge that tool should cut") obj.Side = ['Left', 'Right', 'On'] # side of profile that cutter is on in relation to direction of profile - obj.addProperty("App::PropertyEnumeration", "Direction", "Profile", translate("Path_Profile", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW")) + obj.addProperty("App::PropertyEnumeration", "Direction", "Profile", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW") obj.Direction = ['CW', 'CCW'] # this is the direction that the profile runs - obj.addProperty("App::PropertyBool", "UseComp", "Profile", translate("Path_Profile", "make True, if using Cutter Radius Compensation")) + obj.addProperty("App::PropertyBool", "UseComp", "Profile", "make True, if using Cutter Radius Compensation") - obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", translate("Path_Profile", "Radius at start and end")) - obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", translate("Path_Profile", "Extra value to stay away from final profile- good for roughing toolpath")) - obj.addProperty("App::PropertyLength", "SegLen", "Profile", translate("Path_Profile", "Tesselation value for tool paths made from beziers, bsplines, and ellipses")) + obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", "Radius at start and end") + obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", "Extra value to stay away from final profile- good for roughing toolpath") + obj.addProperty("App::PropertyLength", "SegLen", "Profile", "Tesselation value for tool paths made from beziers, bsplines, and ellipses") - obj.addProperty("App::PropertyVectorList", "locs", "Tags", translate("Path_Profile", "List of holding tag locations")) + obj.addProperty("App::PropertyVectorList", "locs", "Tags", "List of holding tag locations") - obj.addProperty("App::PropertyFloatList", "angles", "Tags", translate("Path_Profile", "List of angles for the holding tags")) - obj.addProperty("App::PropertyFloatList", "heights", "Tags", translate("Path_Profile", "List of angles for the holding tags")) - obj.addProperty("App::PropertyFloatList", "lengths", "Tags", translate("Path_Profile", "List of angles for the holding tags")) + obj.addProperty("App::PropertyFloatList", "angles", "Tags", "List of angles for the holding tags") + obj.addProperty("App::PropertyFloatList", "heights", "Tags", "List of angles for the holding tags") + obj.addProperty("App::PropertyFloatList", "lengths", "Tags", "List of angles for the holding tags") locations = [] angles = [] lengths = [] @@ -271,7 +271,10 @@ print "y - " + str(point.y) self.vertFeed = toolLoad.VertFeed.Value self.horizFeed = toolLoad.HorizFeed.Value tool = PathUtils.getTool(obj, toolLoad.ToolNumber) - self.radius = tool.Diameter/2 + if tool.Diameter == 0: + self.radius = 0.25 + else: + self.radius = tool.Diameter/2 obj.ToolNumber = toolLoad.ToolNumber obj.ToolDescription = toolLoad.Name diff --git a/src/Mod/Path/PathScripts/PathProject.py b/src/Mod/Path/PathScripts/PathProject.py index 743a66a21..a73e5ca4b 100644 --- a/src/Mod/Path/PathScripts/PathProject.py +++ b/src/Mod/Path/PathScripts/PathProject.py @@ -1,29 +1,30 @@ # -*- coding: utf-8 -*- -#*************************************************************************** -#* * -#* Copyright (c) 2014 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 * -#* * -#*************************************************************************** +# *************************************************************************** +# * * +# * Copyright (c) 2014 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,Path -from PySide import QtCore,QtGui +import FreeCAD +import Path +from PySide import QtCore, QtGui FreeCADGui = None if FreeCAD.GuiUp: @@ -34,6 +35,7 @@ if FreeCAD.GuiUp: # Qt tanslation handling try: _encoding = QtGui.QApplication.UnicodeUTF8 + def translate(context, text, disambig=None): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: @@ -42,27 +44,26 @@ except AttributeError: class ObjectPathProject: - - def __init__(self,obj): -# obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project") - obj.addProperty("App::PropertyFile", "OutputFile", "CodeOutput", "The NC output file for this project") - obj.setEditorMode("OutputFile",0) #set to default mode -# obj.addProperty("App::PropertyBool","Editor","CodeOutput","Show G-Code in simple editor after posting code") -# obj.addProperty("Path::PropertyTooltable","Tooltable", "Path","The tooltable of this feature") - obj.addProperty("App::PropertyString", "Description","Path","An optional description for this project") + def __init__(self, obj): + # obj.addProperty("App::PropertyFile", "PostProcessor", "CodeOutput", "Select the Post Processor file for this project") + obj.addProperty("App::PropertyFile", "OutputFile", + "CodeOutput", "The NC output file for this project") + obj.setEditorMode("OutputFile", 0) # set to default mode + obj.addProperty("App::PropertyString", "Description", + "Path", "An optional description for this project") obj.Proxy = self def __getstate__(self): return None - def __setstate__(self,state): + def __setstate__(self, state): return None - def onChanged(self,obj,prop): + def onChanged(self, obj, prop): pass - def execute(self,obj): + def execute(self, obj): cmds = [] for child in obj.Group: if child.isDerivedFrom("Path::Feature"): @@ -75,78 +76,71 @@ class ObjectPathProject: path = Path.Path(cmds) obj.Path = path + class ViewProviderProject: - def __init__(self,vobj): + def __init__(self, vobj): vobj.Proxy = self mode = 2 -# vobj.setEditorMode('LineWidth',mode) -# vobj.setEditorMode('MarkerColor',mode) -# vobj.setEditorMode('NormalColor',mode) -# vobj.setEditorMode('ShowFirstRapid',mode) - vobj.setEditorMode('BoundingBox',mode) - vobj.setEditorMode('DisplayMode',mode) - vobj.setEditorMode('Selectable',mode) - vobj.setEditorMode('ShapeColor',mode) - vobj.setEditorMode('Transparency',mode) -# vobj.setEditorMode('Visibility',mode) + vobj.setEditorMode('BoundingBox', mode) + vobj.setEditorMode('DisplayMode', mode) + vobj.setEditorMode('Selectable', mode) + vobj.setEditorMode('ShapeColor', mode) + vobj.setEditorMode('Transparency', mode) - def __getstate__(self): #mandatory + def __getstate__(self): # mandatory return None - def __setstate__(self,state): #mandatory + def __setstate__(self, state): # mandatory return None def getIcon(self): return ":/icons/Path-Project.svg" - def onChanged(self,vobj,prop): + def onChanged(self, vobj, prop): mode = 2 -# vobj.setEditorMode('LineWidth',mode) -# vobj.setEditorMode('MarkerColor',mode) -# vobj.setEditorMode('NormalColor',mode) -# vobj.setEditorMode('ShowFirstRapid',mode) - vobj.setEditorMode('BoundingBox',mode) - vobj.setEditorMode('DisplayMode',mode) - vobj.setEditorMode('Selectable',mode) - vobj.setEditorMode('ShapeColor',mode) - vobj.setEditorMode('Transparency',mode) -# vobj.setEditorMode('Visibility',mode) + vobj.setEditorMode('BoundingBox', mode) + vobj.setEditorMode('DisplayMode', mode) + vobj.setEditorMode('Selectable', mode) + vobj.setEditorMode('ShapeColor', mode) + vobj.setEditorMode('Transparency', mode) class CommandProject: - def GetResources(self): - return {'Pixmap' : 'Path-Project', - 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Project","Project"), + return {'Pixmap': 'Path-Project', + 'MenuText': QtCore.QT_TRANSLATE_NOOP("Path_Project", "Project"), 'Accel': "P, P", - 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Project","Creates a Path Project object")} + 'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Project", "Creates a Path Project object")} def IsActive(self): - return not FreeCAD.ActiveDocument is None - + return FreeCAD.ActiveDocument is not None + def Activated(self): incl = [] sel = FreeCADGui.Selection.getSelection() for obj in sel: if obj.isDerivedFrom("Path::Feature"): incl.append(obj) - FreeCAD.ActiveDocument.openTransaction(translate("Path_Project","Create Project")) + FreeCAD.ActiveDocument.openTransaction( + translate("Path_Project", "Create Project")) CommandProject.Create(incl) FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() @staticmethod - def Create(pathChildren = []): + def Create(pathChildren=[]): """Code to create a project""" - #FreeCADGui.addModule("PathScripts.PathProject") + # FreeCADGui.addModule("PathScripts.PathProject") import PathScripts.PathUtils as PU - if not PU.findProj() == None: - FreeCAD.Console.PrintError("A Path project already exists in this document\n") + if not PU.findProj() is None: + FreeCAD.Console.PrintError( + "A Path project already exists in this document\n") return - obj = FreeCAD.ActiveDocument.addObject("Path::FeatureCompoundPython","Project") + obj = FreeCAD.ActiveDocument.addObject( + "Path::FeatureCompoundPython", "Project") ObjectPathProject(obj) if pathChildren: for child in pathChildren: @@ -154,7 +148,7 @@ class CommandProject: obj.Group = pathChildren ViewProviderProject(obj.ViewObject) - #create a machine obj + # create a machine obj import PathScripts PathScripts.PathMachine.CommandPathMachine.Create() PathScripts.PathLoadTool.CommandPathLoadTool.Create() @@ -162,8 +156,8 @@ class CommandProject: return obj -if FreeCAD.GuiUp: +if FreeCAD.GuiUp: # register the FreeCAD command - FreeCADGui.addCommand('Path_Project',CommandProject()) + FreeCADGui.addCommand('Path_Project', CommandProject()) FreeCAD.Console.PrintLog("Loading PathProject... done\n") diff --git a/src/Mod/Path/PathScripts/PathRemote.py b/src/Mod/Path/PathScripts/PathRemote.py index 6030b2c23..9bbe1dbc1 100644 --- a/src/Mod/Path/PathScripts/PathRemote.py +++ b/src/Mod/Path/PathScripts/PathRemote.py @@ -57,30 +57,30 @@ class ObjectRemote: def __init__(self, obj): - obj.addProperty("App::PropertyLinkSubList", "Base", "Path", translate("Parent Object(s)", "The base geometry of this toolpath")) - obj.addProperty("App::PropertyBool", "Active", "Path", translate("Active", "Make False, to prevent operation from generating code")) - obj.addProperty("App::PropertyString", "Comment", "Path", translate("PathProject", "An optional comment for this profile")) - obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label")) + obj.addProperty("App::PropertyLinkSubList", "Base", "Path", "The base geometry of this toolpath") + obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code") + obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile") + obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label") - obj.addProperty("App::PropertyString", "URL", "API", translate("RemotePath", "The Base URL of the remote path service")) - obj.addProperty("App::PropertyStringList", "proplist", "Path", translate("Path", "list of remote properties")) + obj.addProperty("App::PropertyString", "URL", "API", "The Base URL of the remote path service") + obj.addProperty("App::PropertyStringList", "proplist", "Path", "list of remote properties") obj.setEditorMode('proplist', 2) # make this hidden # Tool Properties - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", translate("PathProfile", "The tool number in use")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use") obj.ToolNumber = (0, 0, 1000, 0) obj.setEditorMode('ToolNumber', 1) # make this read only - obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool ")) - obj.setEditorMode('ToolDescription', 1) # make this read onlyt + obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ") + obj.setEditorMode('ToolDescription', 1) # make this read onlyt # Depth Properties - obj.addProperty("App::PropertyFloat", "ClearanceHeight", "Depth", translate("PathProject", "The height needed to clear clamps and obstructions")) - obj.addProperty("App::PropertyFloat", "SafeHeight", "Depth", translate("PathProject", "Rapid Safety Height between locations.")) - obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Step", translate("PathProject", "Incremental Step Down of Tool")) + obj.addProperty("App::PropertyFloat", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions") + obj.addProperty("App::PropertyFloat", "SafeHeight", "Depth", "Rapid Safety Height between locations.") + obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Step", "Incremental Step Down of Tool") obj.StepDown = (0.0, 0.01, 100.0, 0.5) - obj.addProperty("App::PropertyFloat", "StartDepth", "Depth", translate("PathProject", "Starting Depth of Tool- first cut depth in Z")) - obj.addProperty("App::PropertyFloat", "FinalDepth", "Depth", translate("PathProject", "Final Depth of Tool- lowest value in Z")) - obj.addProperty("App::PropertyFloat", "FinishDepth", "Depth", translate("PathProject", "Maximum material removed on final pass.")) + obj.addProperty("App::PropertyFloat", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z") + obj.addProperty("App::PropertyFloat", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z") + obj.addProperty("App::PropertyFloat", "FinishDepth", "Depth", "Maximum material removed on final pass.") obj.Proxy = self @@ -157,7 +157,7 @@ class ObjectRemote: obj.proplist = pl if prop == "UserLabel": - obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")" + obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")" def execute(self, obj): output = "" diff --git a/src/Mod/Path/PathScripts/PathSurface.py b/src/Mod/Path/PathScripts/PathSurface.py index 787ef541e..0c298783c 100644 --- a/src/Mod/Path/PathScripts/PathSurface.py +++ b/src/Mod/Path/PathScripts/PathSurface.py @@ -54,45 +54,33 @@ except AttributeError: class ObjectSurface: def __init__(self, obj): - obj.addProperty("App::PropertyLinkSubList", "Base", "Path", translate( - "Parent Object(s)", "The base geometry of this toolpath")) - obj.addProperty("App::PropertyBool", "Active", "Path", translate( - "Active", "Make False, to prevent operation from generating code")) - obj.addProperty("App::PropertyString", "Comment", "Path", translate( - "PathProject", "An optional comment for this profile")) - obj.addProperty("App::PropertyString", "UserLabel", "Path", translate("Path", "User Assigned Label")) + obj.addProperty("App::PropertyLinkSubList", "Base", "Path", "The base geometry of this toolpath") + obj.addProperty("App::PropertyBool", "Active", "Path", "Make False, to prevent operation from generating code") + obj.addProperty("App::PropertyString", "Comment", "Path", "An optional comment for this profile") + obj.addProperty("App::PropertyString", "UserLabel", "Path", "User Assigned Label") - obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", translate( - "PathProject", "The library to use to generate the path")) + obj.addProperty("App::PropertyEnumeration", "Algorithm", "Algorithm", "The library to use to generate the path") obj.Algorithm = ['OCL Dropcutter', 'OCL Waterline'] # Tool Properties - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", - "Tool", translate("PathProfile", "The tool number in use")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", "The tool number in use") obj.ToolNumber = (0, 0, 1000, 0) obj.setEditorMode('ToolNumber', 1) # make this read only - obj.addProperty("App::PropertyString", "ToolDescription", "Tool", translate("Path", "The description of the tool ")) - obj.setEditorMode('ToolDescription', 1) # make this read onlyt + obj.addProperty("App::PropertyString", "ToolDescription", "Tool", "The description of the tool ") + obj.setEditorMode('ToolDescription', 1) # make this read onlyt # Surface Properties - obj.addProperty("App::PropertyFloatConstraint", "SampleInterval", "Surface", translate( - "PathSurface", "The Sample Interval. Small values cause long wait")) + obj.addProperty("App::PropertyFloatConstraint", "SampleInterval", "Surface", "The Sample Interval. Small values cause long wait") obj.SampleInterval = (0, 0, 1, 0) # Depth Properties - obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", translate( - "PathProject", "The height needed to clear clamps and obstructions")) - obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", translate( - "PathProject", "Rapid Safety Height between locations.")) - obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Depth", translate( - "PathProject", "Incremental Step Down of Tool")) + obj.addProperty("App::PropertyDistance", "ClearanceHeight", "Depth", "The height needed to clear clamps and obstructions") + obj.addProperty("App::PropertyDistance", "SafeHeight", "Depth", "Rapid Safety Height between locations.") + obj.addProperty("App::PropertyFloatConstraint", "StepDown", "Depth", "Incremental Step Down of Tool") obj.StepDown = (0.0, 0.01, 100.0, 0.5) - obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", translate( - "PathProject", "Starting Depth of Tool- first cut depth in Z")) - obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", translate( - "PathProject", "Final Depth of Tool- lowest value in Z")) - obj.addProperty("App::PropertyDistance", "FinishDepth", "Depth", translate( - "PathProject", "Maximum material removed on final pass.")) + obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", "Starting Depth of Tool- first cut depth in Z") + obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", "Final Depth of Tool- lowest value in Z") + obj.addProperty("App::PropertyDistance", "FinishDepth", "Depth", "Maximum material removed on final pass.") obj.Proxy = self @@ -133,7 +121,7 @@ class ObjectSurface: def onChanged(self, obj, prop): if prop == "UserLabel": - obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")" + obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")" def _waterline(self, obj, s, bb): import ocl @@ -411,7 +399,6 @@ class TaskPanel: self.form = FreeCADGui.PySideUic.loadUi(":/panels/SurfaceEdit.ui") FreeCAD.Console.PrintWarning("Surface calculations can be slow. Don't Panic.\n") - def accept(self): self.getFields()