From 5af90ff7b16e3f403a422efccf46a0a19323a114 Mon Sep 17 00:00:00 2001 From: Gilles DOFFE Date: Tue, 28 Mar 2017 11:24:15 +0200 Subject: [PATCH] path: make dogbone dressup using new tool controller --- src/Mod/Path/PathScripts/PathDressupDogbone.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathDressupDogbone.py b/src/Mod/Path/PathScripts/PathDressupDogbone.py index b165923f7a93..28a54c7147e4 100644 --- a/src/Mod/Path/PathScripts/PathDressupDogbone.py +++ b/src/Mod/Path/PathScripts/PathDressupDogbone.py @@ -347,6 +347,8 @@ def edges(self): class ObjectDressup: def __init__(self, obj): + # Tool Properties + obj.addProperty("App::PropertyLink", "ToolController", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The tool controller that will be used to calculate the path")) obj.addProperty("App::PropertyLink", "Base","Base", QtCore.QT_TRANSLATE_NOOP("PathDressup_Dogbone", "The base path to modify")) obj.addProperty("App::PropertyEnumeration", "Side", "Dressup", QtCore.QT_TRANSLATE_NOOP("PathDressup_Dogbone", "The side of path to insert bones")) obj.Side = [Side.Left, Side.Right] @@ -780,11 +782,11 @@ def setup(self, obj): obj.Side = 'On' self.toolRadius = 5 - toolLoad = PathUtils.getLastToolLoad(obj) + toolLoad = obj.ToolController if toolLoad is None or toolLoad.ToolNumber == 0: self.toolRadius = 5 else: - tool = PathUtils.getTool(obj, toolLoad.ToolNumber) + tool = toolLoad.Proxy.getTool(toolLoad) #PathUtils.getTool(obj, toolLoad.ToolNumber) if not tool or tool.Diameter == 0: self.toolRadius = 5 else: @@ -1018,6 +1020,7 @@ def Activated(self): FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') FreeCADGui.doCommand('obj.Base.ViewObject.Visibility = False') FreeCADGui.doCommand('dbo.setup(obj)') + FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)') FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute()