chiark / gitweb /
Fix the position for all-at-once prints.
authordaid <daid303@gmail.com>
Fri, 29 Nov 2013 11:15:44 +0000 (12:15 +0100)
committerdaid <daid303@gmail.com>
Fri, 29 Nov 2013 11:15:44 +0000 (12:15 +0100)
Cura/util/objectScene.py
Cura/util/sliceEngine.py

index e118a3b3613f4b84a932e520179506c4fc0e9da7..73df0c0e39e333c5e096904fdcaeb56905d0623a 100644 (file)
@@ -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)
 
index 21b79a3dce5aafef10b0885a739aedb04ad07998..9cd8fc31a8b3a17ca290080adb2339891bd88a17 100644 (file)
@@ -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