add errors testing

This commit is contained in:
Thomas-Alexandre Moreau 2025-02-03 13:06:40 +01:00
parent 1b60641794
commit 9db329907e

View file

@ -46,11 +46,19 @@ class WindowDialog():
maxY = 0.0 maxY = 0.0
index = 0 index = 0
listSize = len(copy_sketchList) listSize = len(copy_sketchList)
errorCount = 0
while listSize > 0: while listSize > 0:
while index < listSize: while index < listSize:
__O__ = copy_sketchList[index] __O__ = copy_sketchList[index]
boundingBox = __O__.Shape.BoundBox 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.XLength + currentX > plateLength:
if boundingBox.YLength + currentY > plateWidth: if boundingBox.YLength + currentY > plateWidth:
YBlockCounter += 1 YBlockCounter += 1
@ -91,12 +99,11 @@ class WindowDialog():
if listSize <= 0 or isSVGFull: if listSize <= 0 or isSVGFull:
fichierSVG = u"" + outputRacine + '--CALEPINAGE-' + str(SVGNameCounter) + '.svg' 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) importSVG.export(__obj__, fichierSVG)
for __i__ in __obj__: for __i__ in __obj__:
App.ActiveDocument.removeObject(__i__.Label) App.ActiveDocument.removeObject(__i__.Label)
App.activeDocument().recompute() App.activeDocument().recompute()
__obj__.clear() __obj__.clear()
maxY = 0.0 maxY = 0.0
@ -105,8 +112,13 @@ class WindowDialog():
currentY = 0.0 currentY = 0.0
isSVGFull = False isSVGFull = False
SVGNameCounter += 1 SVGNameCounter += 1
SVGBlockCounter = 0 YBlockCounter = 0
listSize = len(copy_sketchList) 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 -------- # # -------- END -------- #