From 09465b64c8560158d06b66ba782207aa2849cb42 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 08:12:17 +0100 Subject: [PATCH 1/9] Reword property description to reflect job rather than op --- src/Mod/Path/PathScripts/PathJob.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index f8855d2344..33e3d253b0 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -99,7 +99,7 @@ class ObjectJob: obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Arguments for the Post Processor (specific to the script)")) obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("PathJob","An optional description for this job")) - obj.addProperty("App::PropertyString", "CycleTime", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Operations Cycle Time Estimation")) + obj.addProperty("App::PropertyString", "CycleTime", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Job Cycle Time Estimation")) obj.setEditorMode('CycleTime', 1) # read-only obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("PathJob", "For computing Paths; smaller increases accuracy, but slows down computation")) From b44e21cc6d6af3ab8f7c0541aabcd919bc83af31 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 08:22:26 +0100 Subject: [PATCH 2/9] remove job level warning for cycle time error --- src/Mod/Path/PathScripts/PathJob.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 33e3d253b0..4738d6745f 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -370,7 +370,6 @@ class ObjectJob: ## convert the formatted time from HH:MM:SS to just seconds opCycleTime = sum(x * int(t) for x, t in zip([1, 60, 3600], reversed(formattedCycleTime.split(":")))) except: - FreeCAD.Console.PrintWarning("Error converting the operations cycle time. Job Cycle time may be innacturate\n") continue if opCycleTime > 0: From 14905a17df381a0049ee4be68413f4e24ea20f73 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 08:34:10 +0100 Subject: [PATCH 3/9] Change feedrate error to warning. --- src/Mod/Path/PathScripts/PathOp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 97a8f0fa19..0d06b44f00 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -545,7 +545,7 @@ class ObjectOp(object): vRapidrate = tc.VertRapid.Value if hFeedrate == 0 or vFeedrate == 0: - FreeCAD.Console.PrintError("Tool Controller requires feed rates. Tool feed rates required to calculate the cycle time.\n") + FreeCAD.Console.PrintWarning("Tool Controller feedrate error: Tool feed rates required to calculate the cycle time.\n") return translate('PathGui', 'Feedrate Error') if hRapidrate == 0 or vRapidrate == 0: From 33ad1a3f5feb7537651776a15bc7af0f7fb10b04 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 08:34:55 +0100 Subject: [PATCH 4/9] reword feedrate error when no tool controller is selected --- src/Mod/Path/PathScripts/PathOp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 0d06b44f00..3b2847e8f1 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -536,7 +536,7 @@ class ObjectOp(object): tc = obj.ToolController if tc is None or tc.ToolNumber == 0: - FreeCAD.Console.PrintError("No Tool Controller is selected. Tool feed rates required to calculate the cycle time.\n") + FreeCAD.Console.PrintError("No Tool Controller selected.\n") return translate('PathGui', 'Tool Error') hFeedrate = tc.HorizFeed.Value From 589bd709cb67337a812dbb2df739e5340cb64151 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 08:41:48 +0100 Subject: [PATCH 5/9] Clean up unused code and comments --- src/Mod/Path/PathScripts/PathJob.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 4738d6745f..263d07cf0d 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -41,8 +41,6 @@ from PathScripts.PathPostProcessor import PostProcessor from PySide import QtCore PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -#PathLog.trackModule(PathLog.thisModule()) - # Qt translation handling def translate(context, text, disambig=None): @@ -114,7 +112,6 @@ class ObjectJob: obj.Fixtures = ['G54'] obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile() - #obj.setEditorMode("PostProcessorOutputFile", 0) # set to default mode obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors() defaultPostProcessor = PathPreferences.defaultPostProcessor() # Check to see if default post processor hasn't been 'lost' (This can happen when Macro dir has changed) @@ -367,7 +364,7 @@ class ObjectJob: formattedCycleTime = PathUtil.opProperty(op, 'CycleTime') opCycleTime = 0 try: - ## convert the formatted time from HH:MM:SS to just seconds + # Convert the formatted time from HH:MM:SS to just seconds opCycleTime = sum(x * int(t) for x, t in zip([1, 60, 3600], reversed(formattedCycleTime.split(":")))) except: continue From 73f3585e574043fa432307d2925d6f76d4990282 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 08:51:36 +0100 Subject: [PATCH 6/9] PathJob PEP8 Formatting Fixes --- src/Mod/Path/PathScripts/PathJob.py | 55 +++++++++++++++++------------ 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index 263d07cf0d..4b493caca8 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -30,7 +30,8 @@ import PathScripts.PathSetupSheet as PathSetupSheet import PathScripts.PathStock as PathStock import PathScripts.PathToolController as PathToolController import PathScripts.PathUtil as PathUtil -import json, time +import json +import time # lazily loaded modules from lazy_loader.lazy_loader import LazyLoader @@ -42,10 +43,12 @@ from PySide import QtCore PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) + # Qt translation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) + class JobTemplate: # pylint: disable=no-init '''Attribute and sub element strings for template export/import.''' @@ -60,15 +63,18 @@ class JobTemplate: ToolController = 'ToolController' Version = 'Version' + def isArchPanelSheet(obj): return hasattr(obj, 'Proxy') and isinstance(obj.Proxy, ArchPanel.PanelSheet) + def isResourceClone(obj, propLink, resourceName): # pylint: disable=unused-argument if hasattr(propLink, 'PathResource') and (resourceName is None or resourceName == propLink.PathResource): return True return False + def createResourceClone(obj, orig, name, icon): if isArchPanelSheet(orig): # can't clone panel sheets - they have to be panel sheets @@ -82,21 +88,23 @@ def createResourceClone(obj, orig, name, icon): PathIconViewProvider.Attach(clone.ViewObject, icon) clone.ViewObject.Visibility = False clone.ViewObject.Transparency = 80 - obj.Document.recompute() # necessary to create the clone shape + obj.Document.recompute() # necessary to create the clone shape return clone + def createModelResourceClone(obj, orig): return createResourceClone(obj, orig, 'Model', 'BaseGeometry') + class ObjectJob: - def __init__(self, obj, models, templateFile = None): + def __init__(self, obj, models, templateFile=None): self.obj = obj - obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","The NC output file for this project")) - obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","Select the Post Processor")) + obj.addProperty("App::PropertyFile", "PostProcessorOutputFile", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "The NC output file for this project")) + obj.addProperty("App::PropertyEnumeration", "PostProcessor", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Select the Post Processor")) obj.addProperty("App::PropertyString", "PostProcessorArgs", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Arguments for the Post Processor (specific to the script)")) - obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("PathJob","An optional description for this job")) + obj.addProperty("App::PropertyString", "Description", "Path", QtCore.QT_TRANSLATE_NOOP("PathJob", "An optional description for this job")) obj.addProperty("App::PropertyString", "CycleTime", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Job Cycle Time Estimation")) obj.setEditorMode('CycleTime', 1) # read-only obj.addProperty("App::PropertyDistance", "GeometryTolerance", "Geometry", QtCore.QT_TRANSLATE_NOOP("PathJob", "For computing Paths; smaller increases accuracy, but slows down computation")) @@ -105,12 +113,12 @@ class ObjectJob: obj.addProperty("App::PropertyLink", "Operations", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Compound path of all operations in the order they are processed.")) obj.addProperty("App::PropertyLinkList", "ToolController", "Base", QtCore.QT_TRANSLATE_NOOP("PathJob", "Collection of tool controllers available for this job.")) - obj.addProperty("App::PropertyBool", "SplitOutput", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob","Split output into multiple gcode files")) + obj.addProperty("App::PropertyBool", "SplitOutput", "Output", QtCore.QT_TRANSLATE_NOOP("PathJob", "Split output into multiple gcode files")) obj.addProperty("App::PropertyEnumeration", "OrderOutputBy", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "If multiple WCS, order the output this way")) obj.addProperty("App::PropertyStringList", "Fixtures", "WCS", QtCore.QT_TRANSLATE_NOOP("PathJob", "The Work Coordinate Systems for the Job")) obj.OrderOutputBy = ['Fixture', 'Tool', 'Operation'] obj.Fixtures = ['G54'] - + obj.PostProcessorOutputFile = PathPreferences.defaultOutputFile() obj.PostProcessor = postProcessors = PathPreferences.allEnabledPostProcessors() defaultPostProcessor = PathPreferences.defaultPostProcessor() @@ -128,7 +136,7 @@ class ObjectJob: ops.ViewObject.Visibility = False obj.Operations = ops - obj.setEditorMode('Operations', 2) # hide + obj.setEditorMode('Operations', 2) # hide obj.setEditorMode('Placement', 2) self.setupSetupSheet(obj) @@ -232,7 +240,7 @@ class ObjectJob: if obj.Operations.ViewObject: try: obj.Operations.ViewObject.DisplayMode - except Exception: # pylint: disable=broad-except + except Exception: # pylint: disable=broad-except name = obj.Operations.Name label = obj.Operations.Label ops = FreeCAD.ActiveDocument.addObject("Path::FeatureCompoundPython", "Operations") @@ -243,12 +251,11 @@ class ObjectJob: FreeCAD.ActiveDocument.removeObject(name) ops.Label = label - def onDocumentRestored(self, obj): self.setupBaseModel(obj) self.fixupOperations(obj) self.setupSetupSheet(obj) - obj.setEditorMode('Operations', 2) # hide + obj.setEditorMode('Operations', 2) # hide obj.setEditorMode('Placement', 2) if not hasattr(obj, 'CycleTime'): @@ -324,13 +331,13 @@ class ObjectJob: attrs = {} attrs[JobTemplate.Version] = 1 if obj.PostProcessor: - attrs[JobTemplate.PostProcessor] = obj.PostProcessor - attrs[JobTemplate.PostProcessorArgs] = obj.PostProcessorArgs + attrs[JobTemplate.PostProcessor] = obj.PostProcessor + attrs[JobTemplate.PostProcessorArgs] = obj.PostProcessorArgs if obj.PostProcessorOutputFile: attrs[JobTemplate.PostProcessorOutputFile] = obj.PostProcessorOutputFile - attrs[JobTemplate.GeometryTolerance] = str(obj.GeometryTolerance.Value) + attrs[JobTemplate.GeometryTolerance] = str(obj.GeometryTolerance.Value) if obj.Description: - attrs[JobTemplate.Description] = obj.Description + attrs[JobTemplate.Description] = obj.Description return attrs def __getstate__(self): @@ -372,10 +379,10 @@ class ObjectJob: if opCycleTime > 0: seconds = seconds + opCycleTime - cycleTimeString = time.strftime("%H:%M:%S", time.gmtime(seconds)) - self.obj.CycleTime = cycleTimeString + cycleTimeString = time.strftime("%H:%M:%S", time.gmtime(seconds)) + self.obj.CycleTime = cycleTimeString - def addOperation(self, op, before = None, removeBefore = False): + def addOperation(self, op, before=None, removeBefore=False): group = self.obj.Operations.Group if op not in group: if before: @@ -383,7 +390,7 @@ class ObjectJob: group.insert(group.index(before), op) if removeBefore: group.remove(before) - except Exception as e: # pylint: disable=broad-except + except Exception as e: # pylint: disable=broad-except PathLog.error(e) group.append(op) else: @@ -395,13 +402,14 @@ class ObjectJob: group = self.obj.ToolController PathLog.debug("addToolController(%s): %s" % (tc.Label, [t.Label for t in group])) if tc.Name not in [str(t.Name) for t in group]: - tc.setExpression('VertRapid', "%s.%s" % (self.setupSheet.expressionReference(), PathSetupSheet.Template.VertRapid)) + tc.setExpression('VertRapid', "%s.%s" % (self.setupSheet.expressionReference(), PathSetupSheet.Template.VertRapid)) tc.setExpression('HorizRapid', "%s.%s" % (self.setupSheet.expressionReference(), PathSetupSheet.Template.HorizRapid)) group.append(tc) self.obj.ToolController = group def allOperations(self): ops = [] + def collectBaseOps(op): if hasattr(op, 'TypeId'): if op.TypeId == 'Path::FeaturePython': @@ -433,13 +441,15 @@ class ObjectJob: '''Answer true if the given object can be used as a Base for a job.''' return PathUtil.isValidBaseObject(obj) or isArchPanelSheet(obj) + def Instances(): '''Instances() ... Return all Jobs in the current active document.''' if FreeCAD.ActiveDocument: return [job for job in FreeCAD.ActiveDocument.Objects if hasattr(job, 'Proxy') and isinstance(job.Proxy, ObjectJob)] return [] -def Create(name, base, templateFile = None): + +def Create(name, base, templateFile=None): '''Create(name, base, templateFile=None) ... creates a new job and all it's resources. If a template file is specified the new job is initialized with the values from the template.''' if str == type(base[0]): @@ -451,4 +461,3 @@ def Create(name, base, templateFile = None): obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) obj.Proxy = ObjectJob(obj, models, templateFile) return obj - From 3a65a764e3b88ea2a1d9817e3a70b8bb5cd45313 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 09:02:16 +0100 Subject: [PATCH 7/9] PathOp PEP8 Formatting Fixes --- src/Mod/Path/PathScripts/PathOp.py | 40 ++++++++++++++---------------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 3b2847e8f1..cd10862694 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -43,13 +43,13 @@ __url__ = "http://www.freecadweb.org" __doc__ = "Base class and properties implementation for all Path operations." PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -#PathLog.trackModule() # Qt translation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) + FeatureTool = 0x0001 # ToolController FeatureDepths = 0x0002 # FinalDepth, StartDepth FeatureHeights = 0x0004 # ClearanceHeight, SafeHeight @@ -89,7 +89,7 @@ class ObjectOp(object): FeatureBaseFaces ... Base geometry support for faces FeatureBasePanels ... Base geometry support for Arch.Panels FeatureLocations ... Base location support - FeatureCoolant ... Support for operation coolant + FeatureCoolant ... Support for operation coolant The base class handles all base API and forwards calls to subclasses with an op prefix. For instance, an op is not expected to overwrite onChanged(), @@ -140,7 +140,7 @@ class ObjectOp(object): if FeatureCoolant & features: obj.addProperty("App::PropertyString", "CoolantMode", "Path", QtCore.QT_TRANSLATE_NOOP("PathOp", "Coolant mode for this operation")) - + if FeatureDepths & features: obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Starting Depth of Tool- first cut depth in Z")) obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Final Depth of Tool- lowest value in Z")) @@ -194,7 +194,7 @@ class ObjectOp(object): for op in ['OpStartDepth', 'OpFinalDepth', 'OpToolDiameter', 'CycleTime']: if hasattr(obj, op): - obj.setEditorMode(op, 1) # read-only + obj.setEditorMode(op, 1) # read-only if FeatureDepths & features: if FeatureNoFinalDepth & features: @@ -255,12 +255,12 @@ class ObjectOp(object): def initOperation(self, obj): '''initOperation(obj) ... implement to create additional properties. Should be overwritten by subclasses.''' - pass # pylint: disable=unnecessary-pass + pass # pylint: disable=unnecessary-pass def opOnDocumentRestored(self, obj): '''opOnDocumentRestored(obj) ... implement if an op needs special handling like migrating the data model. Should be overwritten by subclasses.''' - pass # pylint: disable=unnecessary-pass + pass # pylint: disable=unnecessary-pass def opOnChanged(self, obj, prop): '''opOnChanged(obj, prop) ... overwrite to process property changes. @@ -269,24 +269,24 @@ class ObjectOp(object): distinguish between assigning a different value and assigning the same value again. Can safely be overwritten by subclasses.''' - pass # pylint: disable=unnecessary-pass + pass # pylint: disable=unnecessary-pass def opSetDefaultValues(self, obj, job): '''opSetDefaultValues(obj, job) ... overwrite to set initial default values. Called after the receiver has been fully created with all properties. Can safely be overwritten by subclasses.''' - pass # pylint: disable=unnecessary-pass + pass # pylint: disable=unnecessary-pass def opUpdateDepths(self, obj): '''opUpdateDepths(obj) ... overwrite to implement special depths calculation. Can safely be overwritten by subclass.''' - pass # pylint: disable=unnecessary-pass + pass # pylint: disable=unnecessary-pass def opExecute(self, obj): '''opExecute(obj) ... called whenever the receiver needs to be recalculated. See documentation of execute() for a list of base functionality provided. Should be overwritten by subclasses.''' - pass # pylint: disable=unnecessary-pass + pass # pylint: disable=unnecessary-pass def opRejectAddBase(self, obj, base, sub): '''opRejectAddBase(base, sub) ... if op returns True the addition of the feature is prevented. @@ -297,12 +297,11 @@ class ObjectOp(object): def onChanged(self, obj, prop): '''onChanged(obj, prop) ... base implementation of the FC notification framework. Do not overwrite, overwrite opOnChanged() instead.''' - if not 'Restore' in obj.State and prop in ['Base', 'StartDepth', 'FinalDepth']: + if 'Restore' not in obj.State and prop in ['Base', 'StartDepth', 'FinalDepth']: self.updateDepths(obj, True) self.opOnChanged(obj, prop) - def applyExpression(self, obj, prop, expr): '''applyExpression(obj, prop, expr) ... set expression expr on obj.prop if expr is set''' if expr: @@ -483,7 +482,6 @@ class ObjectOp(object): obj.Path = path return - if not self._setBaseAndStock(obj): return @@ -505,7 +503,7 @@ class ObjectOp(object): if not tool or float(tool.Diameter) == 0: FreeCAD.Console.PrintError("No Tool found or diameter is zero. We need a tool to build a Path.") return - self.radius = float(tool.Diameter) /2 + self.radius = float(tool.Diameter) / 2 self.tool = tool obj.OpToolDiameter = tool.Diameter @@ -519,7 +517,7 @@ class ObjectOp(object): if obj.Comment: self.commandlist.append(Path.Command("(%s)" % obj.Comment)) - result = self.opExecute(obj) # pylint: disable=assignment-from-no-return + result = self.opExecute(obj) # pylint: disable=assignment-from-no-return if FeatureHeights & self.opFeatures(obj): # Let's finish by rapid to clearance...just for safety @@ -551,13 +549,13 @@ class ObjectOp(object): if hRapidrate == 0 or vRapidrate == 0: FreeCAD.Console.PrintWarning("Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.\n") - ## get the cycle time in seconds + # Get the cycle time in seconds seconds = obj.Path.getCycleTime(hFeedrate, vFeedrate, hRapidrate, vRapidrate) - + if not seconds: return translate('PathGui', 'Cycletime Error') - - ## convert the cycle time to a HH:MM:SS format + + # Convert the cycle time to a HH:MM:SS format cycleTime = time.strftime("%H:%M:%S", time.gmtime(seconds)) return cycleTime @@ -578,11 +576,11 @@ class ObjectOp(object): for p, el in baselist: if p == base and sub in el: - PathLog.notice((translate("Path", "Base object %s.%s already in the list")+"\n") % (base.Label, sub)) + PathLog.notice((translate("Path", "Base object %s.%s already in the list") + "\n") % (base.Label, sub)) return if not self.opRejectAddBase(obj, base, sub): baselist.append((base, sub)) obj.Base = baselist else: - PathLog.notice((translate("Path", "Base object %s.%s rejected by operation")+"\n") % (base.Label, sub)) + PathLog.notice((translate("Path", "Base object %s.%s rejected by operation") + "\n") % (base.Label, sub)) From d945e3c9fbb988a19d2ecfde6a04588f54764f59 Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 10:35:55 +0100 Subject: [PATCH 8/9] Use PathLog for user notices --- src/Mod/Path/PathScripts/PathOp.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index cd10862694..56861c9d51 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -487,12 +487,12 @@ class ObjectOp(object): if FeatureCoolant & self.opFeatures(obj): if not hasattr(obj, 'CoolantMode'): - FreeCAD.Console.PrintError("No coolant property found. Please recreate operation.") + PathLog.error("No coolant property found. Please recreate operation.") if FeatureTool & self.opFeatures(obj): tc = obj.ToolController if tc is None or tc.ToolNumber == 0: - FreeCAD.Console.PrintError("No Tool Controller is selected. We need a tool to build a Path.") + PathLog.error("No Tool Controller is selected. We need a tool to build a Path.") return else: self.vertFeed = tc.VertFeed.Value @@ -501,7 +501,7 @@ class ObjectOp(object): self.horizRapid = tc.HorizRapid.Value tool = tc.Proxy.getTool(tc) if not tool or float(tool.Diameter) == 0: - FreeCAD.Console.PrintError("No Tool found or diameter is zero. We need a tool to build a Path.") + PathLog.error("No Tool found or diameter is zero. We need a tool to build a Path.") return self.radius = float(tool.Diameter) / 2 self.tool = tool @@ -534,7 +534,7 @@ class ObjectOp(object): tc = obj.ToolController if tc is None or tc.ToolNumber == 0: - FreeCAD.Console.PrintError("No Tool Controller selected.\n") + PathLog.error("No Tool Controller selected.") return translate('PathGui', 'Tool Error') hFeedrate = tc.HorizFeed.Value @@ -543,11 +543,11 @@ class ObjectOp(object): vRapidrate = tc.VertRapid.Value if hFeedrate == 0 or vFeedrate == 0: - FreeCAD.Console.PrintWarning("Tool Controller feedrate error: Tool feed rates required to calculate the cycle time.\n") + PathLog.warning("Tool Controller feedrates required to calculate the cycle time.") return translate('PathGui', 'Feedrate Error') if hRapidrate == 0 or vRapidrate == 0: - FreeCAD.Console.PrintWarning("Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.\n") + PathLog.warning("Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.") # Get the cycle time in seconds seconds = obj.Path.getCycleTime(hFeedrate, vFeedrate, hRapidrate, vRapidrate) From 3fc7fd727b8fcaad810fdc93a0d5cbe711d53d4d Mon Sep 17 00:00:00 2001 From: Daniel Wood Date: Sat, 9 May 2020 10:39:48 +0100 Subject: [PATCH 9/9] Translate user messages --- src/Mod/Path/PathScripts/PathOp.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 56861c9d51..a4d3a7807f 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -487,12 +487,12 @@ class ObjectOp(object): if FeatureCoolant & self.opFeatures(obj): if not hasattr(obj, 'CoolantMode'): - PathLog.error("No coolant property found. Please recreate operation.") + PathLog.error(translate("Path", "No coolant property found. Please recreate operation.")) if FeatureTool & self.opFeatures(obj): tc = obj.ToolController if tc is None or tc.ToolNumber == 0: - PathLog.error("No Tool Controller is selected. We need a tool to build a Path.") + PathLog.error(translate("Path", "No Tool Controller is selected. We need a tool to build a Path.")) return else: self.vertFeed = tc.VertFeed.Value @@ -501,7 +501,7 @@ class ObjectOp(object): self.horizRapid = tc.HorizRapid.Value tool = tc.Proxy.getTool(tc) if not tool or float(tool.Diameter) == 0: - PathLog.error("No Tool found or diameter is zero. We need a tool to build a Path.") + PathLog.error(translate("Path", "No Tool found or diameter is zero. We need a tool to build a Path.")) return self.radius = float(tool.Diameter) / 2 self.tool = tool @@ -534,8 +534,8 @@ class ObjectOp(object): tc = obj.ToolController if tc is None or tc.ToolNumber == 0: - PathLog.error("No Tool Controller selected.") - return translate('PathGui', 'Tool Error') + PathLog.error(translate("Path", "No Tool Controller selected.")) + return translate('Path', 'Tool Error') hFeedrate = tc.HorizFeed.Value vFeedrate = tc.VertFeed.Value @@ -543,17 +543,17 @@ class ObjectOp(object): vRapidrate = tc.VertRapid.Value if hFeedrate == 0 or vFeedrate == 0: - PathLog.warning("Tool Controller feedrates required to calculate the cycle time.") - return translate('PathGui', 'Feedrate Error') + PathLog.warning(translate("Path", "Tool Controller feedrates required to calculate the cycle time.")) + return translate('Path', 'Feedrate Error') if hRapidrate == 0 or vRapidrate == 0: - PathLog.warning("Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.") + PathLog.warning(translate("Path", "Add Tool Controller Rapid Speeds on the SetupSheet for more accurate cycle times.")) # Get the cycle time in seconds seconds = obj.Path.getCycleTime(hFeedrate, vFeedrate, hRapidrate, vRapidrate) if not seconds: - return translate('PathGui', 'Cycletime Error') + return translate('Path', 'Cycletime Error') # Convert the cycle time to a HH:MM:SS format cycleTime = time.strftime("%H:%M:%S", time.gmtime(seconds))