Merge commit '96d014b2c4cef94dbbe4c3adc1c8d7a8ce929ad2'
commit
1755cb8c3f
|
@ -126,6 +126,8 @@ class GcodeSmallSkein:
|
|||
self.output.write(';TYPE:FILL\n');
|
||||
elif line.startswith('(<alteration>'):
|
||||
self.output.write(';TYPE:CUSTOM\n');
|
||||
elif line.startswith('(<supportLayer>'):
|
||||
self.output.write(';TYPE:SUPPORT\n');
|
||||
elif line.startswith('(<layer>'):
|
||||
self.output.write(';LAYER:%d\n' % (self.layerNr));
|
||||
self.layerNr += 1
|
||||
|
|
|
@ -103,6 +103,30 @@ class InstallFirmware(wx.Dialog):
|
|||
def OnClose(self, e):
|
||||
self.Destroy()
|
||||
|
||||
class VirtualPrinter():
|
||||
def __init__(self):
|
||||
self.readList = ['start\n']
|
||||
|
||||
def write(self, data):
|
||||
if self.readList == None:
|
||||
return
|
||||
print "Send: %s" % (data.rstrip())
|
||||
self.readList.append("ok\n")
|
||||
|
||||
def readline(self):
|
||||
if self.readList == None:
|
||||
return ''
|
||||
while len(self.readList) < 1:
|
||||
time.sleep(0.1)
|
||||
if self.readList == None:
|
||||
return ''
|
||||
time.sleep(0.001)
|
||||
print "Recv: %s" % (self.readList[0].rstrip())
|
||||
return self.readList.pop(0)
|
||||
|
||||
def close(self):
|
||||
self.readList = None
|
||||
|
||||
class MachineCom():
|
||||
def __init__(self, port = None, baudrate = None):
|
||||
if port == None:
|
||||
|
@ -124,6 +148,8 @@ class MachineCom():
|
|||
except:
|
||||
print "Unexpected error while connecting to serial port:" + port, sys.exc_info()[0]
|
||||
programmer.close()
|
||||
elif port == 'VIRTUAL':
|
||||
self.serial = VirtualPrinter()
|
||||
else:
|
||||
try:
|
||||
self.serial = Serial(port, baudrate, timeout=5)
|
||||
|
@ -134,8 +160,8 @@ class MachineCom():
|
|||
if self.serial == None:
|
||||
return None
|
||||
ret = self.serial.readline()
|
||||
if ret != '':
|
||||
print "Recv: " + ret.rstrip()
|
||||
#if ret != '':
|
||||
# print "Recv: " + ret.rstrip()
|
||||
return ret
|
||||
|
||||
def close(self):
|
||||
|
@ -146,6 +172,6 @@ class MachineCom():
|
|||
def sendCommand(self, cmd):
|
||||
if self.serial == None:
|
||||
return
|
||||
print 'Send: ' + cmd
|
||||
#print 'Send: ' + cmd
|
||||
self.serial.write(cmd + '\n')
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ class mainWindow(configBase.configWindowBase):
|
|||
super(mainWindow, self).__init__(title='Cura')
|
||||
|
||||
wx.EVT_CLOSE(self, self.OnClose)
|
||||
self.SetIcon(icon.getMainIcon())
|
||||
#self.SetIcon(icon.getMainIcon())
|
||||
|
||||
menubar = wx.MenuBar()
|
||||
fileMenu = wx.Menu()
|
||||
|
|
|
@ -25,6 +25,10 @@ class preferencesDialog(configBase.configWindowBase):
|
|||
c = configBase.SettingRow(left, 'Machine height (mm)', 'machine_height', '200', 'Size of the machine in mm', type = 'preference')
|
||||
validators.validFloat(c, 10.0)
|
||||
|
||||
configBase.TitleRow(left, 'Filament settings')
|
||||
c = configBase.SettingRow(left, 'Filament density (kg/m3)', 'filament_density', '1300', 'Weight of the filament per m3. Around 1300 for PLA. And around 1040 for ABS. This value is used to estimate the weight if the filament used for the print.', type = 'preference')
|
||||
validators.validFloat(c, 500.0, 3000.0)
|
||||
|
||||
configBase.TitleRow(left, 'Communication settings')
|
||||
c = configBase.SettingRow(left, 'Serial port', 'serial_port', ['AUTO'] + machineCom.serialList(), 'Serial port to use for communication with the printer', type = 'preference')
|
||||
c = configBase.SettingRow(left, 'Baudrate', 'serial_baud', '250000', 'Speed of the serial port communication\nNeeds to match your firmware settings\nCommon values are 250000, 115200, 57600', type = 'preference')
|
||||
|
|
|
@ -459,6 +459,10 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
|
|||
glColor3f(c/2,c/2,0)
|
||||
elif path.pathType == 'WALL-INNER':
|
||||
glColor3f(0,c,0)
|
||||
elif path.pathType == 'SUPPORT':
|
||||
glColor3f(0,c,c)
|
||||
elif path.pathType == 'SKIRT':
|
||||
glColor3f(0,c/2,c/2)
|
||||
else:
|
||||
glColor3f(c,0,0)
|
||||
if path.type == 'retract':
|
||||
|
|
|
@ -13,6 +13,7 @@ def printFile(filename):
|
|||
global printWindowHandle
|
||||
if printWindowHandle == None:
|
||||
printWindowHandle = printWindow()
|
||||
printWindowHandle.OnConnect(None)
|
||||
printWindowHandle.Show(True)
|
||||
printWindowHandle.Raise()
|
||||
printWindowHandle.LoadGCodeFile(filename)
|
||||
|
@ -24,12 +25,13 @@ class printWindow(wx.Frame):
|
|||
self.machineCom = None
|
||||
self.machineConnected = False
|
||||
self.thread = None
|
||||
self.gcode = None
|
||||
self.gcodeList = None
|
||||
self.printIdx = None
|
||||
self.bufferLineCount = 4
|
||||
self.sendCnt = 0
|
||||
|
||||
self.SetIcon(icon.getMainIcon())
|
||||
#self.SetIcon(icon.getMainIcon())
|
||||
|
||||
self.SetSizer(wx.BoxSizer())
|
||||
self.panel = wx.Panel(self)
|
||||
|
@ -39,18 +41,18 @@ class printWindow(wx.Frame):
|
|||
|
||||
sb = wx.StaticBox(self.panel, label="Statistics")
|
||||
boxsizer = wx.StaticBoxSizer(sb, wx.VERTICAL)
|
||||
self.statsText = wx.StaticText(self.panel, -1, "Filament: #.##m #.##g\nPrint time: ##:##")
|
||||
self.statsText = wx.StaticText(self.panel, -1, "Filament: ####.##m #.##g\nPrint time: #####:##")
|
||||
boxsizer.Add(self.statsText, flag=wx.LEFT, border=5)
|
||||
|
||||
self.sizer.Add(boxsizer, pos=(0,0), span=(4,1), flag=wx.EXPAND)
|
||||
|
||||
self.connectButton = wx.Button(self.panel, -1, 'Connect')
|
||||
self.loadButton = wx.Button(self.panel, -1, 'Load GCode')
|
||||
#self.loadButton = wx.Button(self.panel, -1, 'Load GCode')
|
||||
self.printButton = wx.Button(self.panel, -1, 'Print GCode')
|
||||
self.cancelButton = wx.Button(self.panel, -1, 'Cancel print')
|
||||
self.progress = wx.Gauge(self.panel, -1)
|
||||
self.sizer.Add(self.connectButton, pos=(0,1))
|
||||
self.sizer.Add(self.loadButton, pos=(1,1))
|
||||
#self.sizer.Add(self.loadButton, pos=(1,1))
|
||||
self.sizer.Add(self.printButton, pos=(2,1))
|
||||
self.sizer.Add(self.cancelButton, pos=(3,1))
|
||||
self.sizer.Add(self.progress, pos=(4,0), span=(1,2), flag=wx.EXPAND)
|
||||
|
@ -59,7 +61,7 @@ class printWindow(wx.Frame):
|
|||
|
||||
self.Bind(wx.EVT_CLOSE, self.OnClose)
|
||||
self.connectButton.Bind(wx.EVT_BUTTON, self.OnConnect)
|
||||
self.loadButton.Bind(wx.EVT_BUTTON, self.OnLoad)
|
||||
#self.loadButton.Bind(wx.EVT_BUTTON, self.OnLoad)
|
||||
self.printButton.Bind(wx.EVT_BUTTON, self.OnPrint)
|
||||
self.cancelButton.Bind(wx.EVT_BUTTON, self.OnCancel)
|
||||
|
||||
|
@ -72,14 +74,19 @@ class printWindow(wx.Frame):
|
|||
|
||||
def UpdateButtonStates(self):
|
||||
self.connectButton.Enable(not self.machineConnected)
|
||||
self.loadButton.Enable(self.printIdx == None)
|
||||
#self.loadButton.Enable(self.printIdx == None)
|
||||
self.printButton.Enable(self.machineConnected and self.gcodeList != None and self.printIdx == None)
|
||||
self.cancelButton.Enable(self.printIdx != None)
|
||||
|
||||
def UpdateProgress(self):
|
||||
status = ""
|
||||
if self.gcode != None:
|
||||
status += "Filament: %.2fm %.2fg\n" % (self.gcode.extrusionAmount / 1000, self.gcode.calculateWeight() * 1000)
|
||||
status += "Print time: %02d:%02d\n" % (int(self.gcode.totalMoveTimeMinute / 60), int(self.gcode.totalMoveTimeMinute % 60))
|
||||
if self.printIdx == None:
|
||||
self.progress.SetValue(0)
|
||||
if self.gcodeList != None:
|
||||
status += 'Line: -/%d\n' % (len(self.gcodeList))
|
||||
else:
|
||||
self.progress.SetValue(self.printIdx)
|
||||
status += 'Line: %d/%d\n' % (self.printIdx, len(self.gcodeList))
|
||||
|
@ -122,6 +129,8 @@ class printWindow(wx.Frame):
|
|||
self.Destroy()
|
||||
|
||||
def LoadGCodeFile(self, filename):
|
||||
if self.printIdx != None:
|
||||
return
|
||||
gcodeList = ["M110"]
|
||||
for line in open(filename, 'r'):
|
||||
if ';' in line:
|
||||
|
@ -131,19 +140,19 @@ class printWindow(wx.Frame):
|
|||
gcodeList.append(line)
|
||||
gcode = gcodeInterpreter.gcode()
|
||||
gcode.loadList(gcodeList)
|
||||
print gcode.extrusionAmount
|
||||
print gcode.totalMoveTimeMinute
|
||||
print "Loaded: %s (%d)" % (filename, len(gcodeList))
|
||||
self.progress.SetRange(len(gcodeList))
|
||||
self.gcode = gcode
|
||||
self.gcodeList = gcodeList
|
||||
self.UpdateButtonStates()
|
||||
self.UpdateProgress()
|
||||
|
||||
def sendLine(self, lineNr):
|
||||
if lineNr >= len(self.gcodeList):
|
||||
return
|
||||
return False
|
||||
checksum = reduce(lambda x,y:x^y, map(ord, "N%d%s" % (lineNr, self.gcodeList[lineNr])))
|
||||
self.machineCom.sendCommand("N%d%s*%d" % (lineNr, self.gcodeList[lineNr], checksum))
|
||||
return True
|
||||
|
||||
def PrinterMonitor(self):
|
||||
skipCount = 0
|
||||
|
@ -151,7 +160,7 @@ class printWindow(wx.Frame):
|
|||
line = self.machineCom.readline()
|
||||
if line == None:
|
||||
self.machineConnected = False
|
||||
wx.CallAfter(self.UpdateButtonState)
|
||||
wx.CallAfter(self.UpdateButtonStates)
|
||||
return
|
||||
if self.machineConnected:
|
||||
while self.sendCnt > 0:
|
||||
|
@ -160,14 +169,17 @@ class printWindow(wx.Frame):
|
|||
self.sendCnt -= 1
|
||||
elif line.startswith("start"):
|
||||
self.machineConnected = True
|
||||
wx.CallAfter(self.UpdateButtonState)
|
||||
wx.CallAfter(self.UpdateButtonStates)
|
||||
if self.printIdx != None:
|
||||
if line.startswith("ok"):
|
||||
if skipCount > 0:
|
||||
skipCount -= 1
|
||||
else:
|
||||
self.sendLine(self.printIdx)
|
||||
self.printIdx += 1
|
||||
if self.sendLine(self.printIdx):
|
||||
self.printIdx += 1
|
||||
else:
|
||||
self.printIdx = None
|
||||
wx.CallAfter(self.UpdateButtonStates)
|
||||
wx.CallAfter(self.UpdateProgress)
|
||||
elif "resend" in line.lower() or "rs" in line:
|
||||
try:
|
||||
|
@ -177,3 +189,4 @@ class printWindow(wx.Frame):
|
|||
lineNr=int(line.split()[1])
|
||||
self.printIdx = lineNr
|
||||
#we should actually resend the line here, but we also get an "ok" for each error from Marlin. And thus we'll resend on the OK.
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class simpleModeWindow(configBase.configWindowBase):
|
|||
super(simpleModeWindow, self).__init__(title='Cura - Simple mode')
|
||||
|
||||
wx.EVT_CLOSE(self, self.OnClose)
|
||||
self.SetIcon(icon.getMainIcon())
|
||||
#self.SetIcon(icon.getMainIcon())
|
||||
|
||||
menubar = wx.MenuBar()
|
||||
fileMenu = wx.Menu()
|
||||
|
|
|
@ -7,6 +7,7 @@ import re
|
|||
import os
|
||||
|
||||
from util import util3d
|
||||
from util import profile
|
||||
|
||||
class gcodePath():
|
||||
def __init__(self, newType, pathType, startPoint):
|
||||
|
@ -31,6 +32,12 @@ class gcode():
|
|||
def loadList(self, l):
|
||||
self._load(l)
|
||||
|
||||
def calculateWeight(self):
|
||||
#Calculates the weight of the filament in kg
|
||||
radius = float(profile.getProfileSetting('filament_diameter')) / 2
|
||||
volumeM3 = (self.extrusionAmount * (math.pi * radius * radius)) / (1000*1000*1000)
|
||||
return volumeM3 * float(profile.getPreference('filament_density'))
|
||||
|
||||
def _load(self, gcodeFile):
|
||||
filePos = 0
|
||||
pos = util3d.Vector3()
|
||||
|
|
|
@ -69,6 +69,7 @@ preferencesDefaultSettings = {
|
|||
'machine_width': '205',
|
||||
'machine_depth': '205',
|
||||
'machine_height': '200',
|
||||
'filament_density': '1300',
|
||||
'steps_per_e': '0',
|
||||
'serial_port': 'AUTO',
|
||||
'serial_baud': '250000',
|
||||
|
|
|
@ -16,7 +16,7 @@ BUILD_TARGET=${1:-win32}
|
|||
##Do we need to create the final archive
|
||||
ARCHIVE_FOR_DISTRIBUTION=1
|
||||
##Which version name are we appending to the final archive
|
||||
BUILD_NAME=NewUI-Beta4
|
||||
BUILD_NAME=RC1
|
||||
TARGET_DIR=${BUILD_TARGET}-Cura-${BUILD_NAME}
|
||||
|
||||
##Which versions of external programs to use
|
||||
|
@ -159,6 +159,12 @@ if (( ${ARCHIVE_FOR_DISTRIBUTION} )); then
|
|||
cd ${TARGET_DIR}
|
||||
7z a ../${TARGET_DIR}.zip *
|
||||
cd ..
|
||||
|
||||
if [ ! -z `which wine` ]; then
|
||||
#if we have wine, try to run our nsis script.
|
||||
ln -sf `pwd`/${TARGET_DIR} scripts/win32/dist
|
||||
wine ~/.wine/drive_c/Program\ Files/NSIS/makensis.exe /DVERSION=${BUILD_NAME} scripts/win32/installer.nsi
|
||||
fi
|
||||
else
|
||||
echo "Archiving to ${TARGET_DIR}.tar.gz"
|
||||
$TAR cfp - ${TARGET_DIR} | gzip --best -c > ${TARGET_DIR}.tar.gz
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
!define VERSION 'RC1'
|
||||
!ifndef VERSION
|
||||
!define VERSION 'DEV'
|
||||
!endif
|
||||
|
||||
; The name of the installer
|
||||
Name "Cura ${VERSION}"
|
||||
|
|
Loading…
Reference in New Issue