Path: Add ShapeName property to ToolBit objects

The new `ShapeName` is the name of the FreeCAD shape file containing the 3D body of the cutter.
We might want to change the source of the `ShapeName` to the name of the first Body object in the shape file, rather than the name of the file itself.
This commit is contained in:
Russell Johnson
2020-06-06 14:01:32 -05:00
parent 76aac3a221
commit 31ae323e73

View File

@@ -151,6 +151,7 @@ class ToolBit(object):
obj.addProperty('App::PropertyFile', 'BitShape', 'Base', translate('PathToolBit', 'Shape for bit shape'))
obj.addProperty('App::PropertyLink', 'BitBody', 'Base', translate('PathToolBit', 'The parametrized body representing the tool bit'))
obj.addProperty('App::PropertyFile', 'File', 'Base', translate('PathToolBit', 'The file of the tool'))
obj.addProperty('App::PropertyString', 'ShapeName', 'Base', translate('PathToolBit', 'The name of the shape file'))
if shapeFile is None:
obj.BitShape = 'endmill.fcstd'
self._setupBitShape(obj)
@@ -230,6 +231,7 @@ class ToolBit(object):
if not path and p != obj.BitShape:
obj.BitShape = p
doc = FreeCAD.open(p)
obj.ShapeName = doc.Name
docOpened = True
return (doc, docOpened)