fix recursive function, but not working as expected, will need to change algo for vectors

This commit is contained in:
Thomas-Alexandre Moreau 2025-05-13 17:30:44 +02:00
parent 0396dd5f58
commit 35b44967cd

View file

@ -210,21 +210,30 @@ class WindowDialog():
# -------- END -------- # # -------- END -------- #
def searchDir(self, obj, x = 0.0, y = 0.0, z = 0.0): def searchDir(self, obj, xres, yres, zres):
x1, y1, z1 = x, y, z x, y, z = xres, yres, zres
if hasattr(obj, 'Dir'): if hasattr(obj, "Dir"):
if obj.Dir.x != 0.0: if obj.Dir.x != 0.0:
x1 = obj.Dir.x x = obj.Dir.x
if obj.Dir.y != 0.0: if obj.Dir.y != 0.0:
y1 = obj.Dir.y y = obj.Dir.y
if obj.Dir.z != 0.0: if obj.Dir.z != 0.0:
z1 = obj.Dir.z z = obj.Dir.z
if hasattr(obj, 'Objects'):
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: for i in obj.Objects:
self.searchDir(i, x1, y1, z1) res = self.searchDir(i, x, y, z)
return res
return FreeCAD.Vector(x1, y1, z1)
def exportSVG(self, isCalepinage): def exportSVG(self, isCalepinage):
plateLength = self.form.doubleSpinBoxLength.value() plateLength = self.form.doubleSpinBoxLength.value()
@ -246,7 +255,7 @@ class WindowDialog():
break break
for _ in range(count): for _ in range(count):
vector = self.searchDir(obj) vector = self.searchDir(obj, 0, 0, 0)
sv0 = Draft.make_shape2dview(obj, vector) sv0 = Draft.make_shape2dview(obj, vector)
FreeCAD.ActiveDocument.recompute() FreeCAD.ActiveDocument.recompute()