From: daid Date: Fri, 29 Nov 2013 11:15:44 +0000 (+0100) Subject: Fix the position for all-at-once prints. X-Git-Tag: 14.01~47 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=df1633853456a30d0d2404a190e0e82390cb210b;p=cura.git Fix the position for all-at-once prints. --- diff --git a/Cura/util/objectScene.py b/Cura/util/objectScene.py index e118a3b3..73df0c0e 100644 --- a/Cura/util/objectScene.py +++ b/Cura/util/objectScene.py @@ -29,7 +29,6 @@ class _objectOrderFinder(object): self.order = [] return - self._hitMap = [None] * (max(initialList)+1) for a in initialList: self._hitMap[a] = [False] * (max(initialList)+1) @@ -38,9 +37,10 @@ class _objectOrderFinder(object): #Check if we have 2 files that overlap so that they can never be printed one at a time. for a in initialList: - if self._hitMap[a][b] and self._hitMap[b][a]: - self.order = None - return + for b in initialList: + if a != b and self._hitMap[a][b] and self._hitMap[b][a]: + self.order = None + return initialList.sort(self._objIdxCmp) diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index 21b79a3d..9cd8fc31 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -131,6 +131,21 @@ class Slicer(object): order = scene.printOrder() if order is None: pos = numpy.array(profile.getMachineCenterCoords()) * 1000 + objMin = None + objMax = None + for obj in scene.objects(): + if scene.checkPlatform(obj): + oMin = obj.getMinimum()[0:2] + obj.getPosition() + oMax = obj.getMaximum()[0:2] + obj.getPosition() + if objMin is None: + objMin = oMin + objMax = oMax + else: + objMin[0] = min(oMin[0], objMin[0]) + objMin[1] = min(oMin[1], objMin[1]) + objMax[0] = max(oMax[0], objMax[0]) + objMax[1] = max(oMax[1], objMax[1]) + pos += (objMin + objMax) / 2.0 * 1000 commandList += ['-s', 'posx=%d' % int(pos[0]), '-s', 'posy=%d' % int(pos[1])] vertexTotal = 0