chiark / gitweb /
Slice all the objects at once if one of them is larger then the gantry height.
authordaid303 <daid303@gmail.com>
Fri, 19 Apr 2013 15:50:37 +0000 (17:50 +0200)
committerdaid303 <daid303@gmail.com>
Fri, 19 Apr 2013 15:50:37 +0000 (17:50 +0200)
Cura/gui/preferencesDialog.py
Cura/util/mesh.py
Cura/util/objectScene.py
Cura/util/sliceEngine.py

index 66aaf042a51fc622d3849ed6bde9c1358a097f9a..f1e922463b868228b2888100b130f44793891528 100644 (file)
@@ -46,11 +46,11 @@ class preferencesDialog(wx.Frame):
                configBase.SettingRow(right, 'serial_port', ['AUTO'] + machineCom.serialList())
                configBase.SettingRow(right, 'serial_baud', ['AUTO'] + map(str, machineCom.baudrateList()))
 
-               configBase.TitleRow(right, 'Slicer settings')
-               configBase.SettingRow(right, 'save_profile')
+               #configBase.TitleRow(right, 'Slicer settings')
+               #configBase.SettingRow(right, 'save_profile')
 
-               configBase.TitleRow(right, 'SD Card settings')
-               configBase.SettingRow(right, 'sdpath', removableStorage.getPossibleSDcardDrives())
+               #configBase.TitleRow(right, 'SD Card settings')
+               #configBase.SettingRow(right, 'sdpath', removableStorage.getPossibleSDcardDrives())
 
                configBase.TitleRow(right, 'Cura settings')
                configBase.SettingRow(right, 'check_for_updates')
index 63e3185c5ee9c10b53020fe65543dc89b4d32cef..f6d83c7a726d822270cee5879fb86344dcc6df26 100644 (file)
@@ -51,7 +51,7 @@ class printableObject(object):
                self._boundaryCircleSize = 0
 
                for m in self._meshList:
-                       transformedVertexes = (numpy.matrix(m.vertexes, copy = False) * self._matrix).getA()
+                       transformedVertexes = (numpy.matrix(m.vertexes, copy = False) * numpy.matrix(self._matrix, numpy.float32)).getA()
                        transformedMin = transformedVertexes.min(0)
                        transformedMax = transformedVertexes.max(0)
                        for n in xrange(0, 3):
index 692e0b16697e87e70748a3cc8322b6b8b64117a5..336a309cffed3ddf75f07508ccc0bd2dff4baa2f 100644 (file)
@@ -17,10 +17,15 @@ class _objectOrderFinder(object):
                for n in xrange(0, len(self._objs)):
                        if scene.checkPlatform(self._objs[n]):
                                initialList.append(n)
+               for n in initialList:
+                       if self._objs[n].getSize()[2] > gantryHeight and len(initialList) > 1:
+                               self.order = None
+                               return
                if len(initialList) == 0:
                        self.order = []
                        return
 
+
                self._hitMap = [None] * (max(initialList)+1)
                for a in initialList:
                        self._hitMap[a] = [False] * (max(initialList)+1)
index ae0536562be080ce0d0b9b0b8f95b5544e17f053..01b89a80c463a79fc3fb5d126ba6677cccd0e98b 100644 (file)
@@ -68,18 +68,40 @@ class Slicer(object):
                commandList += ['-b', self._binaryStorageFilename]
                self._objCount = 0
                with open(self._binaryStorageFilename, "wb") as f:
-                       for n in scene.printOrder():
-                               obj = scene.objects()[n]
-                               for mesh in obj._meshList:
-                                       n = numpy.array([mesh.vertexCount], numpy.int32)
-                                       f.write(n.tostring())
-                                       f.write(mesh.vertexes.tostring())
-                               pos = obj.getPosition() * 1000
-                               pos += numpy.array([profile.getPreferenceFloat('machine_width') * 1000 / 2, profile.getPreferenceFloat('machine_depth') * 1000 / 2])
-                               commandList += ['-m', ','.join(map(str, obj._matrix.getA().flatten()))]
+                       order = scene.printOrder()
+                       if order is None:
+                               pos = numpy.array([profile.getPreferenceFloat('machine_width') * 1000 / 2, profile.getPreferenceFloat('machine_depth') * 1000 / 2])
                                commandList += ['-s', 'posx=%d' % int(pos[0]), '-s', 'posy=%d' % int(pos[1])]
-                               commandList += ['#' * len(obj._meshList)]
-                               self._objCount += 1
+
+                               vertexTotal = 0
+                               for obj in scene.objects():
+                                       if scene.checkPlatform(obj):
+                                               for mesh in obj._meshList:
+                                                       vertexTotal += mesh.vertexCount
+
+                               f.write(numpy.array([vertexTotal], numpy.int32).tostring())
+                               for obj in scene.objects():
+                                       if scene.checkPlatform(obj):
+                                               for mesh in obj._meshList:
+                                                       vertexes = (numpy.matrix(mesh.vertexes, copy = False) * numpy.matrix(obj._matrix, numpy.float32)).getA()
+                                                       vertexes -= obj._drawOffset
+                                                       vertexes += numpy.array([obj.getPosition()[0], obj.getPosition()[1], 0.0])
+                                                       f.write(vertexes.tostring())
+
+                               commandList += ['#']
+                               self._objCount = 1
+                       else:
+                               for n in order:
+                                       obj = scene.objects()[n]
+                                       for mesh in obj._meshList:
+                                               f.write(numpy.array([mesh.vertexCount], numpy.int32).tostring())
+                                               f.write(mesh.vertexes.tostring())
+                                       pos = obj.getPosition() * 1000
+                                       pos += numpy.array([profile.getPreferenceFloat('machine_width') * 1000 / 2, profile.getPreferenceFloat('machine_depth') * 1000 / 2])
+                                       commandList += ['-m', ','.join(map(str, obj._matrix.getA().flatten()))]
+                                       commandList += ['-s', 'posx=%d' % int(pos[0]), '-s', 'posy=%d' % int(pos[1])]
+                                       commandList += ['#' * len(obj._meshList)]
+                                       self._objCount += 1
                if self._objCount > 0:
                        print ' '.join(commandList)
                        try:
@@ -112,7 +134,7 @@ class Slicer(object):
                                        except:
                                                pass
                        else:
-                               #print '#', line.strip()
+                               print '#', line.strip()
                                pass
                        line = self._process.stdout.readline()
                for line in self._process.stderr: