def _doPrinterConnectionUpdate(self, connection, extraInfo = None):
wx.CallAfter(self.__doPrinterConnectionUpdate, connection, extraInfo)
+ temp = [connection.getTemperature(0)]
+ self.temperatureGraph.addPoint(temp, [0], connection.getBedTemperature(), 0)
+
def __doPrinterConnectionUpdate(self, connection, extraInfo):
t = time.time()
if self.lastUpdateTime + 0.5 > t:
self._points.pop(0)
def addPoint(self, temp, tempSP, bedTemp, bedTempSP):
+ if time.time() - self._points[-1][4] < 0.5:
+ return
+ for n in xrange(0, len(temp)):
+ if temp[n] is None:
+ temp[n] = 0
+ for n in xrange(0, len(tempSP)):
+ if tempSP[n] is None:
+ tempSP[n] = 0
if bedTemp is None:
bedTemp = 0
if bedTempSP is None:
def _checkHit(self, addIdx, idx):
obj = self._scene._objectList[idx]
addObj = self._scene._objectList[addIdx]
- return polygon.polygonCollision(obj._headAreaHull + obj.getPosition(), addObj._boundaryHull + addObj.getPosition())
+ return polygon.polygonCollision(obj._boundaryHull + obj.getPosition(), addObj._headAreaHull + addObj.getPosition())
class Scene(object):
def __init__(self):
self._isAvailable = False
self._printing = False
self._fileBlocks = []
+ self._commandList = []
self._blockIndex = None
self._lineCount = 0
self._progressLine = 0
def isAvailable(self):
return self._isAvailable
+ #Are we able to send a direct coammand with sendCommand at this moment in time.
+ def isAbleToSendDirectCommand(self):
+ return self._isAvailable and not self._printing
+
+ #Directly send a command to the printer.
+ def sendCommand(self, command):
+ if not self._isAvailable or self._printing:
+ return
+ self._commandList.append(command)
+
# Get the connection status string. This is displayed to the user and can be used to communicate
# various information to the user.
def getStatusString(self):
if not self._isAvailable:
return "Doodle3D box not found"
if self._printing:
- if self._fileIndex < len(self._fileBlocks):
- return "Sending GCode: %.1f" % (float(self._fileIndex) / float(len(self._fileBlocks)))
+ if self._blockIndex < len(self._fileBlocks):
+ return "Sending GCode: %.1f" % (float(self._blockIndex) / float(len(self._fileBlocks)))
return "TODO"
#Get the temperature of an extruder, returns None is no temperature is known for this extruder
else:
self._printing = False
else:
- time.sleep(5)
+ 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(5)
elif stateReply['data']['state'] == 'printing':
if self._printing:
if self._blockIndex < len(self._fileBlocks):
self._progressLine = stateReply['data']['current_line']
else:
#Got a printing state without us having send the print file, set the state to printing, but make sure we never send anything.
- if 'current_line' in stateReply['data'] and 'total_lines' in stateReply['data']:
+ if 'current_line' in stateReply['data'] and 'total_lines' in stateReply['data'] and stateReply['data']['total_lines'] > 2:
self._printing = True
self._blockIndex = len(self._fileBlocks)
self._progressLine = stateReply['data']['current_line']
alterationContents = getAlterationFile(filename)
if getMachineSetting('gcode_flavor') == 'UltiGCode':
if filename == 'end.gcode':
- return 'M25 ;Stop reading from this point on.\n'
+ return 'M25 ;Stop reading from this point on.\n;CURA_PROFILE_STRING:%s\n' % (getProfileString())
return ''
if filename == 'start.gcode':
if extruderCount > 1: