return "Doodle3D box not found"
if self._printing:
if self._blockIndex < len(self._fileBlocks):
- return "Sending GCode: %.1f" % (float(self._blockIndex) / float(len(self._fileBlocks)))
- return "TODO"
+ return "Sending GCode: %.1f%%" % (float(self._blockIndex) * 100.0 / float(len(self._fileBlocks)))
+ return "Print progress: %.1f%%" % (self.getPrintProgress() * 100.0)
+ return "Printing found, waiting for print."
#Get the temperature of an extruder, returns None is no temperature is known for this extruder
def getTemperature(self, extruder):
if len(self._commandList) > 0:
if self._request('POST', '/d3dapi/printer/print', {'gcode': self._commandList[0], 'start': 'True', 'first': 'True'}):
self._commandList.pop(0)
+ else:
+ time.sleep(1)
else:
time.sleep(5)
elif stateReply['data']['state'] == 'printing':
pos += (objMin + objMax) / 2.0 * 1000
commandList += ['-s', 'posx=%d' % int(pos[0]), '-s', 'posy=%d' % int(pos[1])]
- vertexTotal = 0
+ vertexTotal = [0] * 4
+ meshMax = 1
for obj in scene.objects():
if scene.checkPlatform(obj):
- for mesh in obj._meshList:
- vertexTotal += mesh.vertexCount
+ meshMax = max(meshMax, len(obj._meshList))
+ for n in xrange(0, len(obj._meshList)):
+ vertexTotal[n] += obj._meshList[n].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())
- hash.update(mesh.vertexes.tostring())
+ for n in xrange(0, meshMax):
+ f.write(numpy.array([vertexTotal[n]], numpy.int32).tostring())
+ for obj in scene.objects():
+ if scene.checkPlatform(obj):
+ if n < len(obj._meshList):
+ vertexes = (numpy.matrix(obj._meshList[n].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())
+ hash.update(obj._meshList[n].vertexes.tostring())
- commandList += ['#']
+ commandList += ['#' * meshMax]
self._objCount = 1
else:
for n in order: