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
This commit is contained in:
sliptonic
2020-08-26 14:45:31 -05:00
parent dfc4e53f67
commit a8a76deb87
2 changed files with 7 additions and 1 deletions

View File

@@ -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

View File

@@ -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