@@ -118,14 +118,22 @@ def _findRelativePath(path, typ):
|
||||
return relative
|
||||
|
||||
|
||||
# Unused due to bug fix related to relative paths
|
||||
"""
|
||||
def findRelativePathShape(path):
|
||||
return _findRelativePath(path, 'Shape')
|
||||
|
||||
|
||||
def findRelativePathTool(path):
|
||||
return _findRelativePath(path, 'Bit')
|
||||
"""
|
||||
|
||||
|
||||
def findRelativePathLibrary(path):
|
||||
return _findRelativePath(path, "Library")
|
||||
|
||||
|
||||
class ToolBit(object):
|
||||
|
||||
TOOL_TYPES = [ "EndMill", "BallEndMill", "BullNoseMill", "Drill", "VBit", "Probe", "Laser", "Other"]
|
||||
|
||||
def __init__(self, obj, shapeFile, path=None):
|
||||
Path.Log.track(obj.Label, shapeFile, path)
|
||||
self.obj = obj
|
||||
@@ -147,14 +155,6 @@ class ToolBit(object):
|
||||
"Base",
|
||||
QT_TRANSLATE_NOOP("App::Property", "The file of the tool"),
|
||||
)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"ToolType",
|
||||
"Base",
|
||||
QT_TRANSLATE_NOOP("App::Property", "The type of the tool"),
|
||||
)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyString",
|
||||
"ShapeName",
|
||||
@@ -168,13 +168,10 @@ class ToolBit(object):
|
||||
QT_TRANSLATE_NOOP("App::Property", "List of all properties inherited from the bit"),
|
||||
)
|
||||
|
||||
# set enum types by assigning array
|
||||
obj.ToolType = self.TOOL_TYPES
|
||||
if path:
|
||||
obj.File = path
|
||||
if shapeFile is None:
|
||||
obj.BitShape = "endmill.fcstd"
|
||||
obj.ToolType = "EndMill"
|
||||
self._setupBitShape(obj)
|
||||
self.unloadBitBody(obj)
|
||||
else:
|
||||
@@ -199,16 +196,6 @@ class ToolBit(object):
|
||||
obj.setEditorMode("BitBody", 2)
|
||||
obj.setEditorMode("File", 1)
|
||||
obj.setEditorMode("Shape", 2)
|
||||
|
||||
if not hasattr(obj, "ToolType"):
|
||||
obj.addProperty(
|
||||
"App::PropertyString",
|
||||
"ToolType",
|
||||
"Base",
|
||||
QT_TRANSLATE_NOOP("App::Property", "The type of the tool"),
|
||||
)
|
||||
obj.ToolType = self.TOOL_TYPES
|
||||
|
||||
if not hasattr(obj, "BitPropertyNames"):
|
||||
obj.addProperty(
|
||||
"App::PropertyStringList",
|
||||
@@ -451,10 +438,6 @@ class ToolBit(object):
|
||||
attrs = {}
|
||||
attrs["version"] = 2
|
||||
attrs["name"] = obj.Label
|
||||
|
||||
if obj.ToolType:
|
||||
attrs["type"] = obj.ToolType
|
||||
|
||||
if Path.Preferences.toolsStoreAbsolutePaths():
|
||||
attrs["shape"] = obj.BitShape
|
||||
else:
|
||||
@@ -468,7 +451,8 @@ class ToolBit(object):
|
||||
for name in obj.BitPropertyNames:
|
||||
params[name] = PathUtil.getPropertyValueString(obj, name)
|
||||
attrs["parameter"] = params
|
||||
attrs["attribute"] = {}
|
||||
params = {}
|
||||
attrs["attribute"] = params
|
||||
return attrs
|
||||
|
||||
|
||||
@@ -483,10 +467,6 @@ class ToolBitFactory(object):
|
||||
Path.Log.track(attrs, path)
|
||||
obj = Factory.Create(name, attrs["shape"], path)
|
||||
obj.Label = attrs["name"]
|
||||
|
||||
if "type" in attrs:
|
||||
obj.ToolType = attrs["type"]
|
||||
|
||||
params = attrs["parameter"]
|
||||
for prop in params:
|
||||
PathUtil.setProperty(obj, prop, params[prop])
|
||||
|
||||
Reference in New Issue
Block a user