testing
This commit is contained in:
parent
cb4870666b
commit
e6d9eae3a1
33
Calepinage.FCMacro
Normal file → Executable file
33
Calepinage.FCMacro
Normal file → Executable file
|
|
@ -44,25 +44,27 @@ class WindowDialog():
|
||||||
isSVGFull = False
|
isSVGFull = False
|
||||||
YBlockCounter = 0
|
YBlockCounter = 0
|
||||||
SVGNameCounter = 1
|
SVGNameCounter = 1
|
||||||
|
maxY = 0
|
||||||
|
index = 0
|
||||||
|
listSize = len(copy_sketchList)
|
||||||
|
|
||||||
while len(copy_sketchList) > 0:
|
while listSize > 0:
|
||||||
maxY = 0.0
|
while index < (listSize - 1):
|
||||||
counter = 0
|
print(f'{copy_sketchList} --- {listSize}')
|
||||||
for __O__ in copy_sketchList:
|
__O__ = copy_sketchList[index]
|
||||||
boundingBox = __O__.Shape.BoundBox
|
boundingBox = __O__.Shape.BoundBox
|
||||||
if boundingBox.XLength + currentX > plateLength:
|
if boundingBox.XLength + currentX > plateLength:
|
||||||
counter += 1
|
index += 1
|
||||||
continue
|
continue
|
||||||
if boundingBox.YLength + currentY > plateWidth:
|
if boundingBox.YLength + currentY > plateWidth:
|
||||||
YBlockCounter += 1
|
YBlockCounter += 1
|
||||||
if YBlockCounter >= len(copy_sketchList):
|
if YBlockCounter >= listSize:
|
||||||
isSVGFull = True
|
isSVGFull = True
|
||||||
break
|
break
|
||||||
|
index += 1
|
||||||
continue
|
continue
|
||||||
__obj__.insert(0, __O__)
|
__obj__.insert(0, __O__)
|
||||||
maxY = boundingBox.YLength if boundingBox.YLength > maxY else maxY
|
maxY = boundingBox.YLength if boundingBox.YLength > maxY else maxY
|
||||||
|
|
||||||
oldPlace = __obj__[0].Placement
|
|
||||||
__obj__[0].Placement=App.Placement(App.Vector(0,0,0), App.Rotation(App.Vector(1,0,0),0), App.Vector(0,0,0))
|
__obj__[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:
|
if currentX == 0.0:
|
||||||
__obj__[0].Placement.Base = FreeCAD.Vector(currentX, currentY, 0.0)
|
__obj__[0].Placement.Base = FreeCAD.Vector(currentX, currentY, 0.0)
|
||||||
|
|
@ -70,28 +72,35 @@ class WindowDialog():
|
||||||
__obj__[0].Placement.Base = FreeCAD.Vector(currentX + spacing, currentY, 0.0)
|
__obj__[0].Placement.Base = FreeCAD.Vector(currentX + spacing, currentY, 0.0)
|
||||||
|
|
||||||
currentX += boundingBox.XLength
|
currentX += boundingBox.XLength
|
||||||
copy_sketchList.pop(counter)
|
copy_sketchList.pop(index)
|
||||||
counter += 1
|
listSize = len(copy_sketchList)
|
||||||
App.activeDocument().recompute()
|
App.activeDocument().recompute()
|
||||||
|
index = 0
|
||||||
|
|
||||||
|
|
||||||
currentY += maxY + spacing
|
currentY += maxY + spacing
|
||||||
|
index = 0
|
||||||
|
listSize = len(copy_sketchList)
|
||||||
App.activeDocument().recompute()
|
App.activeDocument().recompute()
|
||||||
|
|
||||||
if len(copy_sketchList) == 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('Export SVG de : --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
|
||||||
|
index = 0
|
||||||
currentX = 0.0
|
currentX = 0.0
|
||||||
currentY = 0.0
|
currentY = 0.0
|
||||||
isSVGFull = False
|
isSVGFull = False
|
||||||
SVGNameCounter += 1
|
SVGNameCounter += 1
|
||||||
SVGBlockCounter = 0
|
SVGBlockCounter = 0
|
||||||
|
listSize = len(copy_sketchList)
|
||||||
|
|
||||||
# -------- END -------- #
|
# -------- END -------- #
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue