From 8d839b81ad3f53879a6fdb8a7105e1525128df6d Mon Sep 17 00:00:00 2001 From: Itai Nahshon Date: Mon, 9 Oct 2017 02:47:55 +0300 Subject: [PATCH] Use unit conversion when changing feedrates in the tools table of the job edit panel. if the user enters a valid velocity quantity it will be used, Otherwize if the user enters a unitless value the default velocity unit will be used, Otherwise error. --- src/Mod/Path/PathScripts/PathJobGui.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index 721de2aaa2..8260641511 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -752,6 +752,18 @@ class TaskPanel: except: pass item.setText("%s%g" % ('+' if tc.SpindleDir == 'Forward' else '-', tc.SpindleSpeed)) + elif 'HorizFeed' == prop or 'VertFeed' == prop: + vUnit = FreeCAD.Units.Quantity(1, FreeCAD.Units.Velocity).getUserPreferred()[2] + try: + val = FreeCAD.Units.Quantity(item.text()) + if FreeCAD.Units.Velocity == val.Unit: + setattr(tc, prop, val) + elif FreeCAD.Units.Unit() == val.Unit: + val = FreeCAD.Units.Quantity(item.text()+vUnit); + setattr(tc, prop, val) + except: + pass + item.setText("%g" % getattr(tc, prop).getValueAs(vUnit)) else: try: val = FreeCAD.Units.Quantity(item.text())