pls
This commit is contained in:
parent
86ed6a19c1
commit
cb4870666b
|
|
@ -35,6 +35,7 @@ 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__ = []
|
||||
|
|
@ -69,9 +70,6 @@ class WindowDialog():
|
|||
__obj__[0].Placement.Base = FreeCAD.Vector(currentX + spacing, currentY, 0.0)
|
||||
|
||||
currentX += boundingBox.XLength
|
||||
|
||||
# __obj__[0].Placement = oldPlace
|
||||
# App.ActiveDocument.removeObject(__O__.Label)
|
||||
copy_sketchList.pop(counter)
|
||||
counter += 1
|
||||
App.activeDocument().recompute()
|
||||
|
|
@ -79,72 +77,21 @@ class WindowDialog():
|
|||
currentY += maxY + spacing
|
||||
App.activeDocument().recompute()
|
||||
|
||||
if isSVGFull or len(copy_sketchList) == 0:
|
||||
if len(copy_sketchList) == 0 or isSVGFull:
|
||||
fichierSVG = u"" + outputRacine + '--CALEPINAGE-' + str(SVGNameCounter) + '.svg'
|
||||
print('Export SVG de : --CALEPINAGE-' + str(SVGNameCounter) + '.svg')
|
||||
importSVG.export(__obj__, fichierSVG)
|
||||
for __i__ in __obj__:
|
||||
App.ActiveDocument.removeObject(__i__.Label)
|
||||
|
||||
__obj__ = []
|
||||
|
||||
App.activeDocument().recompute()
|
||||
__obj__.clear()
|
||||
currentX = 0.0
|
||||
currentY = 0.0
|
||||
isSVGFull = False
|
||||
SVGNameCounter += 1
|
||||
SVGBlockCounter = 0
|
||||
'''def _exportSketchCalepinage(self, sketchList, plateLength, plateWidth, spacing, laserSize):
|
||||
outputRacine = App.activeDocument().getFileName().rpartition('.')[0]
|
||||
copy_sketchList = sketchList[:]
|
||||
objects_to_export = []
|
||||
currentX = 0.0
|
||||
currentY = 0.0
|
||||
isSVGFull = False
|
||||
YBlockCounter = 0
|
||||
SVGNameCounter = 1
|
||||
|
||||
while len(copy_sketchList) != 0:
|
||||
maxY = 0.0
|
||||
counter = 0
|
||||
for obj in copy_sketchList:
|
||||
boundingBox = obj.Shape.BoundBox
|
||||
if boundingBox.XLength + currentX > plateLength:
|
||||
counter += 1
|
||||
continue
|
||||
if boundingBox.YLength + currentY > plateWidth:
|
||||
YBlockCounter += 1
|
||||
if YBlockCounter >= len(copy_sketchList):
|
||||
isSVGFull = True
|
||||
break
|
||||
continue
|
||||
objects_to_export.insert(0, obj)
|
||||
maxY = boundingBox.YLength if boundingBox.YLength > maxY else maxY
|
||||
|
||||
oldPlace = objects_to_export[0].Placement
|
||||
objects_to_export[0].Placement = App.Placement(App.Vector(0, 0, 0), App.Rotation(App.Vector(1, 0, 0), 0), App.Vector(0, 0, 0))
|
||||
if currentX == 0.0:
|
||||
objects_to_export[0].Placement.Base = FreeCAD.Vector(currentX, currentY, 0.0)
|
||||
else:
|
||||
objects_to_export[0].Placement.Base = FreeCAD.Vector(currentX + spacing, currentY, 0.0)
|
||||
|
||||
currentX += boundingBox.XLength
|
||||
counter_to_remove = copy_sketchList.index(obj)
|
||||
copy_sketchList.pop(counter_to_remove)
|
||||
counter += 1
|
||||
App.activeDocument().recompute()
|
||||
|
||||
currentY += maxY + spacing
|
||||
App.activeDocument().recompute()
|
||||
|
||||
if isSVGFull or len(copy_sketchList) == 0:
|
||||
fichierSVG = outputRacine + '--CALEPINAGE-' + str(SVGNameCounter) + '.svg'
|
||||
print('Export SVG de : --CALEPINAGE-' + str(SVGNameCounter) + '.svg')
|
||||
importSVG.export(objects_to_export, fichierSVG)
|
||||
for i in objects_to_export:
|
||||
App.ActiveDocument.removeObject(i.Label)
|
||||
App.activeDocument().recompute()
|
||||
objects_to_export = []'''
|
||||
|
||||
|
||||
# -------- END -------- #
|
||||
|
||||
|
|
@ -174,7 +121,7 @@ class WindowDialog():
|
|||
sketchList.append(sk)
|
||||
if hasattr(sv0, 'Name'):
|
||||
App.ActiveDocument.removeObject(sv0.Name)
|
||||
except:
|
||||
except Exception as e:
|
||||
print("FAILURE TRY")
|
||||
|
||||
if isCalepinage:
|
||||
|
|
|
|||
Loading…
Reference in a new issue