cleaning
This commit is contained in:
parent
168ea56717
commit
1b60641794
|
|
@ -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,24 +120,21 @@ 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'):
|
for child in selectedObject.Object.Objects:
|
||||||
for child in selectedObject.Object.Objects:
|
if hasattr(child, 'Dir'):
|
||||||
if hasattr(child, 'Dir'):
|
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(child.Dir))
|
||||||
sv0 = Draft.make_shape2dview(selectedObject.Object, FreeCAD.Vector(child.Dir))
|
break
|
||||||
break
|
|
||||||
|
|
||||||
FreeCAD.ActiveDocument.recompute()
|
FreeCAD.ActiveDocument.recompute()
|
||||||
sk = Draft.make_sketch(sv0, autoconstraints=True)
|
sk = Draft.make_sketch(sv0, autoconstraints=True)
|
||||||
sk.ViewObject.LineColor = (1.0, 0.0, 0.0)
|
sk.ViewObject.LineColor = (1.0, 0.0, 0.0)
|
||||||
FreeCAD.ActiveDocument.recompute()
|
FreeCAD.ActiveDocument.recompute()
|
||||||
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)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue