From 35b44967cd0c92d842539a3b166d91278faed3ad Mon Sep 17 00:00:00 2001 From: Thomas-Alexandre Moreau Date: Tue, 13 May 2025 17:30:44 +0200 Subject: [PATCH] fix recursive function, but not working as expected, will need to change algo for vectors --- MultiExport.FCMacro | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/MultiExport.FCMacro b/MultiExport.FCMacro index 7e8afe8..e404991 100755 --- a/MultiExport.FCMacro +++ b/MultiExport.FCMacro @@ -210,21 +210,30 @@ class WindowDialog(): # -------- END -------- # - def searchDir(self, obj, x = 0.0, y = 0.0, z = 0.0): - x1, y1, z1 = x, y, z + def searchDir(self, obj, xres, yres, zres): + x, y, z = xres, yres, zres - if hasattr(obj, 'Dir'): + if hasattr(obj, "Dir"): if obj.Dir.x != 0.0: - x1 = obj.Dir.x + x = obj.Dir.x if obj.Dir.y != 0.0: - y1 = obj.Dir.y + y = obj.Dir.y if obj.Dir.z != 0.0: - z1 = obj.Dir.z - if hasattr(obj, 'Objects'): + z = obj.Dir.z + + if not hasattr(obj, "Objects"): + return FreeCAD.Vector(x, y, z) + else: + res = FreeCAD.Vector(x, y, z) + for i in obj.Objects: + res = self.searchDir(i, x, y, z) + return res + + elif hasattr(obj, "Objects"): + res = FreeCAD.Vector(x, y, z) for i in obj.Objects: - self.searchDir(i, x1, y1, z1) - - return FreeCAD.Vector(x1, y1, z1) + res = self.searchDir(i, x, y, z) + return res def exportSVG(self, isCalepinage): plateLength = self.form.doubleSpinBoxLength.value() @@ -246,7 +255,7 @@ class WindowDialog(): break for _ in range(count): - vector = self.searchDir(obj) + vector = self.searchDir(obj, 0, 0, 0) sv0 = Draft.make_shape2dview(obj, vector) FreeCAD.ActiveDocument.recompute()