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()
def _exportSketchCalepinage(self, sketchList, plateLength, plateWidth, spacing, laserSize):
print(str(plateLength) + " " + str(plateWidth) + " " + str(spacing) + " " + str(laserSize))
outputRacine = App.activeDocument().getFileName().rpartition('.')[0]
copy_sketchList = sketchList[:]
__obj__ = []
@ -50,7 +49,6 @@ class WindowDialog():
while listSize > 0:
while index < listSize:
print(f'{copy_sketchList} --- {listSize}')
__O__ = copy_sketchList[index]
boundingBox = __O__.Shape.BoundBox
if boundingBox.XLength + currentX > plateLength:
@ -93,7 +91,7 @@ class WindowDialog():
if listSize <= 0 or isSVGFull:
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)
for __i__ in __obj__:
App.ActiveDocument.removeObject(__i__.Label)
@ -122,24 +120,21 @@ class WindowDialog():
laserSize = self.form.doubleSpinBoxLaserSize.value()
sketchList = []
for selectedObject in FreeCADGui.Selection.getSelectionEx():
try:
if hasattr(selectedObject.Object, 'Dir'):
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(selectedObject.Object.Dir))
elif hasattr(selectedObject.Object, 'Objects'):
for child in selectedObject.Object.Objects:
if hasattr(child, 'Dir'):
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(child.Dir))
break
if hasattr(selectedObject.Object, 'Dir'):
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(selectedObject.Object.Dir))
elif hasattr(selectedObject.Object, 'Objects'):
for child in selectedObject.Object.Objects:
if hasattr(child, 'Dir'):
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(child.Dir))
break
FreeCAD.ActiveDocument.recompute()
sk = Draft.make_sketch(sv0, autoconstraints=True)
sk.ViewObject.LineColor = (1.0, 0.0, 0.0)
FreeCAD.ActiveDocument.recompute()
sketchList.append(sk)
if hasattr(sv0, 'Name'):
App.ActiveDocument.removeObject(sv0.Name)
except Exception as e:
print(e)
FreeCAD.ActiveDocument.recompute()
sk = Draft.make_sketch(sv0, autoconstraints=True)
sk.ViewObject.LineColor = (1.0, 0.0, 0.0)
FreeCAD.ActiveDocument.recompute()
sketchList.append(sk)
if hasattr(sv0, 'Name'):
App.ActiveDocument.removeObject(sv0.Name)
if isCalepinage:
self._exportSketchCalepinage(sketchList, plateLength, plateWidth, spacing, laserSize)