This commit is contained in:
Thomas-Alexandre Moreau 2025-01-31 17:55:35 +01:00
parent 168ea56717
commit 1b60641794

View file

@ -35,7 +35,6 @@ class WindowDialog():
App.activeDocument().recompute() App.activeDocument().recompute()
def _exportSketchCalepinage(self, sketchList, plateLength, plateWidth, spacing, laserSize): def _exportSketchCalepinage(self, sketchList, plateLength, plateWidth, spacing, laserSize):
print(str(plateLength) + " " + str(plateWidth) + " " + str(spacing) + " " + str(laserSize))
outputRacine = App.activeDocument().getFileName().rpartition('.')[0] outputRacine = App.activeDocument().getFileName().rpartition('.')[0]
copy_sketchList = sketchList[:] copy_sketchList = sketchList[:]
__obj__ = [] __obj__ = []
@ -50,7 +49,6 @@ class WindowDialog():
while listSize > 0: while listSize > 0:
while index < listSize: while index < listSize:
print(f'{copy_sketchList} --- {listSize}')
__O__ = copy_sketchList[index] __O__ = copy_sketchList[index]
boundingBox = __O__.Shape.BoundBox boundingBox = __O__.Shape.BoundBox
if boundingBox.XLength + currentX > plateLength: if boundingBox.XLength + currentX > plateLength:
@ -93,7 +91,7 @@ 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('Export SVG de : --CALEPINAGE-' + str(SVGNameCounter) + '.svg') print(u'Export SVG de : ' + 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)
@ -122,7 +120,6 @@ class WindowDialog():
laserSize = self.form.doubleSpinBoxLaserSize.value() laserSize = self.form.doubleSpinBoxLaserSize.value()
sketchList = [] sketchList = []
for selectedObject in FreeCADGui.Selection.getSelectionEx(): for selectedObject in FreeCADGui.Selection.getSelectionEx():
try:
if hasattr(selectedObject.Object, 'Dir'): if hasattr(selectedObject.Object, 'Dir'):
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(selectedObject.Object.Dir)) sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(selectedObject.Object.Dir))
elif hasattr(selectedObject.Object, 'Objects'): elif hasattr(selectedObject.Object, 'Objects'):
@ -138,8 +135,6 @@ class WindowDialog():
sketchList.append(sk) sketchList.append(sk)
if hasattr(sv0, 'Name'): if hasattr(sv0, 'Name'):
App.ActiveDocument.removeObject(sv0.Name) App.ActiveDocument.removeObject(sv0.Name)
except Exception as e:
print(e)
if isCalepinage: if isCalepinage:
self._exportSketchCalepinage(sketchList, plateLength, plateWidth, spacing, laserSize) self._exportSketchCalepinage(sketchList, plateLength, plateWidth, spacing, laserSize)