From: daid303 Date: Fri, 19 Apr 2013 15:50:37 +0000 (+0200) Subject: Slice all the objects at once if one of them is larger then the gantry height. X-Git-Tag: 13.05~73 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f9fbc9a4d34a3283c47c32f09645fb9aea6bbff3;p=cura.git Slice all the objects at once if one of them is larger then the gantry height. --- diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 66aaf042..f1e92246 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -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') diff --git a/Cura/util/mesh.py b/Cura/util/mesh.py index 63e3185c..f6d83c7a 100644 --- a/Cura/util/mesh.py +++ b/Cura/util/mesh.py @@ -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): diff --git a/Cura/util/objectScene.py b/Cura/util/objectScene.py index 692e0b16..336a309c 100644 --- a/Cura/util/objectScene.py +++ b/Cura/util/objectScene.py @@ -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) diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index ae053656..01b89a80 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -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: