From 9db329907e385554287590ad87c79239a14af70e Mon Sep 17 00:00:00 2001 From: Thomas-Alexandre Moreau Date: Mon, 3 Feb 2025 13:06:40 +0100 Subject: [PATCH] add errors testing --- Calepinage.FCMacro | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Calepinage.FCMacro b/Calepinage.FCMacro index a93f482..49980fd 100755 --- a/Calepinage.FCMacro +++ b/Calepinage.FCMacro @@ -46,11 +46,19 @@ class WindowDialog(): maxY = 0.0 index = 0 listSize = len(copy_sketchList) + errorCount = 0 while listSize > 0: while index < listSize: __O__ = copy_sketchList[index] boundingBox = __O__.Shape.BoundBox + if (boundingBox.XLength > plateLength) or (boundingBox.YLength > plateWidth): + copy_sketchList.pop(index) + listSize = len(copy_sketchList) + errorCount += 1 + App.ActiveDocument.removeObject(__O__.Label) + App.activeDocument().recompute() + continue if boundingBox.XLength + currentX > plateLength: if boundingBox.YLength + currentY > plateWidth: YBlockCounter += 1 @@ -91,12 +99,11 @@ class WindowDialog(): if listSize <= 0 or isSVGFull: fichierSVG = u"" + outputRacine + '--CALEPINAGE-' + str(SVGNameCounter) + '.svg' - print(u'Export SVG de : ' + outputRacine + '--CALEPINAGE-' + str(SVGNameCounter) + '.svg') + print('Export SVG de : ' + u"" + outputRacine + '--CALEPINAGE-' + str(SVGNameCounter) + '.svg') importSVG.export(__obj__, fichierSVG) for __i__ in __obj__: App.ActiveDocument.removeObject(__i__.Label) - App.activeDocument().recompute() __obj__.clear() maxY = 0.0 @@ -105,8 +112,13 @@ class WindowDialog(): currentY = 0.0 isSVGFull = False SVGNameCounter += 1 - SVGBlockCounter = 0 + YBlockCounter = 0 listSize = len(copy_sketchList) + + if errorCount == 1: + print(f"Erreur : {errorCount} sketch ne rentre pas sur le plateau") + elif errorCount > 1: + print(f"Erreur : {errorCount} sketchs ne rentrent pas sur le plateau") # -------- END -------- #