From a8a76deb87dfbe8d0451edcb9ab25b039051999a Mon Sep 17 00:00:00 2001 From: sliptonic Date: Wed, 26 Aug 2020 14:45:31 -0500 Subject: [PATCH] Allow adding a material to the stock object. Select the stock object and use the Arch Material button to add and assign the material to the stock. The only thing affected is the path-sanity report --- src/Mod/Path/PathScripts/PathSanity.py | 7 ++++++- src/Mod/Path/PathScripts/PathStock.py | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/Path/PathScripts/PathSanity.py b/src/Mod/Path/PathScripts/PathSanity.py index 4df987fec5..fdb27ec105 100644 --- a/src/Mod/Path/PathScripts/PathSanity.py +++ b/src/Mod/Path/PathScripts/PathSanity.py @@ -571,7 +571,11 @@ class CommandPathSanity: data['xLen'] = FreeCAD.Units.Quantity(bb.XLength, FreeCAD.Units.Length).UserString data['yLen'] = FreeCAD.Units.Quantity(bb.YLength, FreeCAD.Units.Length).UserString data['zLen'] = FreeCAD.Units.Quantity(bb.ZLength, FreeCAD.Units.Length).UserString - data['material'] = "Not Specified" # fix this + + data['material'] = "Not Specified" + if hasattr(obj.Stock, 'Material'): + if obj.Stock.Material is not None: + data['material'] = obj.Stock.Material.Material['Name'] if data['material'] == "Not Specified": self.squawk("PathSanity", "Consider Specifying the Stock Material", squawkType="TIP") @@ -579,6 +583,7 @@ class CommandPathSanity: data['stockImage'] = self.__makePicture(obj.Stock, "stockImage") except Exception as e: data['errors'] = e + print(e) return data diff --git a/src/Mod/Path/PathScripts/PathStock.py b/src/Mod/Path/PathScripts/PathStock.py index e1ab825627..aa59109eb2 100644 --- a/src/Mod/Path/PathScripts/PathStock.py +++ b/src/Mod/Path/PathScripts/PathStock.py @@ -103,6 +103,7 @@ class StockFromBase(Stock): obj.addProperty("App::PropertyDistance", "ExtYpos", "Stock", QtCore.QT_TRANSLATE_NOOP("PathStock", "Extra allowance from part bound box in positive Y direction")) obj.addProperty("App::PropertyDistance", "ExtZneg", "Stock", QtCore.QT_TRANSLATE_NOOP("PathStock", "Extra allowance from part bound box in negative Z direction")) obj.addProperty("App::PropertyDistance", "ExtZpos", "Stock", QtCore.QT_TRANSLATE_NOOP("PathStock", "Extra allowance from part bound box in positive Z direction")) + obj.addProperty("App::PropertyLink","Material","Component", QtCore.QT_TRANSLATE_NOOP("App::Property","A material for this object")) obj.Base = base obj.ExtXneg= 1.0