From 54676b04a6c0bdf9d061588cc61db6b8baa66c67 Mon Sep 17 00:00:00 2001 From: Thomas-Alexandre Moreau Date: Thu, 30 Jan 2025 18:14:44 +0100 Subject: [PATCH] add try except --- Calepinage.FCMacro | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Calepinage.FCMacro b/Calepinage.FCMacro index 0c62288..7c6de95 100755 --- a/Calepinage.FCMacro +++ b/Calepinage.FCMacro @@ -44,7 +44,7 @@ class WindowDialog(): isSVGFull = False YBlockCounter = 0 SVGNameCounter = 1 - maxY = 0 + maxY = 0.0 index = 0 listSize = len(copy_sketchList) @@ -68,10 +68,11 @@ class WindowDialog(): __obj__[0].Placement=App.Placement(App.Vector(0,0,0), App.Rotation(App.Vector(1,0,0),0), App.Vector(0,0,0)) if currentX == 0.0: __obj__[0].Placement.Base = FreeCAD.Vector(currentX, currentY, 0.0) + currentX += boundingBox.XLength else: __obj__[0].Placement.Base = FreeCAD.Vector(currentX + spacing, currentY, 0.0) + currentX += boundingBox.XLength + spacing - currentX += boundingBox.XLength copy_sketchList.pop(index) listSize = len(copy_sketchList) App.activeDocument().recompute() @@ -79,6 +80,7 @@ class WindowDialog(): currentY += maxY + spacing + maxY = 0.0 index = 0 listSize = len(copy_sketchList) App.activeDocument().recompute() @@ -122,7 +124,7 @@ class WindowDialog(): if hasattr(child, 'Dir'): sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(child.Dir)) break - print("FAILURE IF") + FreeCAD.ActiveDocument.recompute() sk = Draft.make_sketch(sv0, autoconstraints=True) sk.ViewObject.LineColor = (1.0, 0.0, 0.0) @@ -131,7 +133,7 @@ class WindowDialog(): if hasattr(sv0, 'Name'): App.ActiveDocument.removeObject(sv0.Name) except Exception as e: - print("FAILURE TRY") + print(e) if isCalepinage: self._exportSketchCalepinage(sketchList, plateLength, plateWidth, spacing, laserSize) @@ -142,4 +144,7 @@ class WindowDialog(): if __name__ == '__main__': - d = WindowDialog() \ No newline at end of file + try: + d = WindowDialog() + except Exception as e: + print(e) \ No newline at end of file