size = window.GetSize()\r
glViewport(0,0, size.GetWidth(), size.GetHeight())\r
\r
- glLightfv(GL_LIGHT0, GL_POSITION, [1.0, 1.0, 1.0, 0.0])\r
+ glLightfv(GL_LIGHT0, GL_POSITION, [0.2, 0.2, 1.0, 0.0])\r
glLightfv(GL_LIGHT1, GL_POSITION, [1.0, 1.0, 1.0, 0.0])\r
\r
glEnable(GL_RESCALE_NORMAL)\r
if profile.getPreference('machine_type') == 'ultimaker':\r
glPushMatrix()\r
glEnable(GL_LIGHTING)\r
- glTranslate(100,120,-285)\r
+ glTranslate(100,200,-5)\r
glLightfv(GL_LIGHT0, GL_DIFFUSE, [0.8,0.8,0.8])\r
glLightfv(GL_LIGHT0, GL_AMBIENT, [0.5,0.5,0.5])\r
glEnable(GL_BLEND)\r
global platformMesh\r
if platformMesh == None:\r
platformMesh = meshLoader.loadMesh(os.path.normpath(os.path.join(os.path.split(__file__)[0], "../images", 'ultimaker_platform.stl')))\r
- platformMesh.setRotateMirror(0, False, True, False, False, True)\r
+ platformMesh.setRotateMirror(0, False, False, False, False, False)\r
\r
DrawMesh(platformMesh)\r
glPopMatrix()\r
glVertex3f(min(x+10, machineSize.x), min(y+10, machineSize.y), -0.01)\r
glVertex3f(x, min(y+10, machineSize.y), -0.01)\r
glEnd()\r
- glColor4ub(5/2,171/2,231/2,128)\r
+ glColor4ub(5*8/10,171*8/10,231*8/10,128)\r
glBegin(GL_QUADS)\r
for x in xrange(10, int(machineSize.x), 20):\r
for y in xrange(0, int(machineSize.y), 20):\r
glEnd()\r
glEnable(GL_CULL_FACE)\r
\r
- glColor4ub(5,171,231,128)\r
+ glColor4ub(5,171,231,64)\r
glBegin(GL_QUADS)\r
glVertex3f(0, 0, machineSize.z)\r
glVertex3f(0, machineSize.y, machineSize.z)\r
glVertex3f(machineSize.x, 0, machineSize.z)\r
glEnd()\r
\r
- glColor4ub(5,171,231,192)\r
+ glColor4ub(5,171,231,96)\r
glBegin(GL_QUADS)\r
glVertex3f(0, 0, 0)\r
glVertex3f(0, 0, machineSize.z)\r
glVertex3f(machineSize.x, machineSize.y, machineSize.z)\r
glEnd()\r
\r
- glColor4ub(5,171,231,255)\r
+ glColor4ub(5,171,231,128)\r
glBegin(GL_QUADS)\r
glVertex3f(0, 0, machineSize.z)\r
glVertex3f(0, 0, 0)\r
dist = (v0 - v1).vsize()\r
if dist > 0 and path.layerThickness > 0:\r
extrusionMMperDist = (v1.e - v0.e) / dist\r
- lineWidth = extrusionMMperDist * filamentArea / path.layerThickness / 2\r
+ lineWidth = extrusionMMperDist * filamentArea / path.layerThickness / 2 * v1.extrudeAmountMultiply\r
\r
drawLength += (v0 - v1).vsize()\r
normal = (v0 - v1).cross(util3d.Vector3(0,0,1))\r
title = wx.StaticText(pluginPanel, -1, plugin['name'])
title.SetFont(wx.Font(wx.SystemSettings.GetFont(wx.SYS_ANSI_VAR_FONT).GetPointSize(), wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD))
remButton = wx.Button(pluginPanel, -1, 'X', style=wx.BU_EXACTFIT)
- s.Add(title, pos=(0,0), span=(1,2), flag=wx.ALIGN_BOTTOM|wx.TOP|wx.LEFT|wx.RIGHT, border=5)
- s.Add(remButton, pos=(0,2), span=(1,1), flag=wx.TOP|wx.LEFT|wx.RIGHT|wx.ALIGN_RIGHT, border=5)
- s.Add(wx.StaticLine(pluginPanel), pos=(1,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
+ helpButton = wx.Button(pluginPanel, -1, '?', style=wx.BU_EXACTFIT)
+ s.Add(title, pos=(0,1), span=(1,2), flag=wx.ALIGN_BOTTOM|wx.TOP|wx.LEFT|wx.RIGHT, border=5)
+ s.Add(helpButton, pos=(0,0), span=(1,1), flag=wx.TOP|wx.LEFT|wx.ALIGN_RIGHT, border=5)
+ s.Add(remButton, pos=(0,3), span=(1,1), flag=wx.TOP|wx.RIGHT|wx.ALIGN_RIGHT, border=5)
+ s.Add(wx.StaticLine(pluginPanel), pos=(1,0), span=(1,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
info = wx.StaticText(pluginPanel, -1, plugin['info'])
info.Wrap(300)
- s.Add(info, pos=(2,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
+ s.Add(info, pos=(2,0), span=(1,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
pluginPanel.paramCtrls = {}
i = 0
value = pluginConfig['params'][param['name']]
ctrl = wx.TextCtrl(pluginPanel, -1, value)
- s.Add(wx.StaticText(pluginPanel, -1, param['description']), pos=(3+i,0), span=(1,1), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,border=3)
- s.Add(ctrl, pos=(3+i,2), span=(1,1), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
+ s.Add(wx.StaticText(pluginPanel, -1, param['description']), pos=(3+i,0), span=(1,2), flag=wx.LEFT|wx.RIGHT|wx.ALIGN_CENTER_VERTICAL,border=3)
+ s.Add(ctrl, pos=(3+i,2), span=(1,2), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
ctrl.Bind(wx.EVT_TEXT, self.OnSettingChange)
pluginPanel.paramCtrls[param['name']] = ctrl
i += 1
- s.Add(wx.StaticLine(pluginPanel), pos=(3+i,0), span=(1,3), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
+ s.Add(wx.StaticLine(pluginPanel), pos=(3+i,0), span=(1,4), flag=wx.EXPAND|wx.LEFT|wx.RIGHT,border=3)
self.Bind(wx.EVT_BUTTON, self.OnRem, remButton)
- s.AddGrowableCol(2)
+ s.AddGrowableCol(1)
pluginPanel.SetBackgroundColour(self.GetParent().GetBackgroundColour())
self.pluginEnabledPanel.GetSizer().Add(pluginPanel, flag=wx.EXPAND)
self.pluginEnabledPanel.Layout()
c = configBase.SettingRow(right, 'Save profile on slice', 'save_profile', False, 'When slicing save the profile as [stl_file]_profile.ini next to the model.', type = 'preference')\r
\r
configBase.TitleRow(right, 'SD Card settings')\r
- if len(getDrives()) > 1:\r
- c = configBase.SettingRow(right, 'SD card drive', 'sdpath', getDrives(), 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
+ if len(profile.getSDcardDrives()) > 1:\r
+ c = configBase.SettingRow(right, 'SD card drive', 'sdpath', profile.getSDcardDrives(), 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
else:\r
c = configBase.SettingRow(right, 'SD card path', 'sdpath', '', 'Location of your SD card, when using the copy to SD feature.', type = 'preference')\r
c = configBase.SettingRow(right, 'Copy to SD with 8.3 names', 'sdshortnames', False, 'Save the gcode files in short filenames, so they are properly shown on the UltiController', type = 'preference')\r
self.MakeModal(False)\r
self.parent.updateProfileToControls()\r
self.Destroy()\r
-\r
-def getDrives():\r
- drives = ['']\r
- if platform.system() == "Windows":\r
- from ctypes import windll\r
- bitmask = windll.kernel32.GetLogicalDrives()\r
- for letter in string.uppercase:\r
- if bitmask & 1:\r
- drives.append(letter + ':/')\r
- bitmask >>= 1\r
- if platform.system() == "Darwin":\r
- drives = []\r
- for volume in glob.glob('/Volumes/*'):\r
- if stat.S_ISLNK(os.lstat(volume).st_mode):\r
- continue\r
- drives.append(volume)\r
- return drives\r
self.warningPopup.timer = wx.Timer(self)\r
self.Bind(wx.EVT_TIMER, self.OnHideWarning, self.warningPopup.timer)\r
\r
- self.Bind(wx.EVT_BUTTON, self.OnResetAll, self.warningPopup.yesButton)\r
+ self.Bind(wx.EVT_BUTTON, self.OnWarningPopup, self.warningPopup.yesButton)\r
self.Bind(wx.EVT_BUTTON, self.OnHideWarning, self.warningPopup.noButton)\r
parent.Bind(wx.EVT_MOVE, self.OnMove)\r
parent.Bind(wx.EVT_SIZE, self.OnMove)\r
sizer.Add(self.toolbar2, 0, flag=wx.EXPAND|wx.BOTTOM|wx.LEFT|wx.RIGHT, border=1)\r
self.SetSizer(sizer)\r
\r
- def OnMove(self, e):\r
- e.Skip()\r
+ def OnMove(self, e = None):\r
+ if e != None:\r
+ e.Skip()\r
x, y = self.glCanvas.ClientToScreenXY(0, 0)\r
sx, sy = self.glCanvas.GetClientSizeTuple()\r
self.warningPopup.SetPosition((x, y+sy-self.warningPopup.GetSize().height))\r
\r
if showWarning:\r
if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False':\r
- self.warningPopup.Show(True)\r
- self.warningPopup.timer.Start(5000)\r
+ self.ShowWarningPopup('Reset scale, rotation and mirror?', self.OnResetAll)\r
+ \r
+ def ShowWarningPopup(self, text, callback):\r
+ self.warningPopup.text.SetLabel(text)\r
+ self.warningPopup.callback = callback\r
+ self.OnMove()\r
+ self.warningPopup.Show(True)\r
+ self.warningPopup.timer.Start(5000)\r
+\r
\r
def loadReModelFiles(self, filelist):\r
#Only load this again if the filename matches the file we have already loaded (for auto loading GCode after slicing)\r
def loadProgress(self, progress):\r
pass\r
\r
- def OnResetAll(self, e):\r
+ def OnResetAll(self, e = None):\r
profile.putProfileSetting('model_scale', '1.0')\r
profile.putProfileSetting('model_rotate_base', '0')\r
profile.putProfileSetting('flip_x', 'False')\r
profile.putProfileSetting('swap_xz', 'False')\r
profile.putProfileSetting('swap_yz', 'False')\r
self.updateProfileToControls()\r
+ \r
+ def OnWarningPopup(self, e):\r
self.warningPopup.Show(False)\r
self.warningPopup.timer.Stop()\r
+ self.warningPopup.callback()\r
\r
def OnHideWarning(self, e):\r
self.warningPopup.Show(False)\r
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)\r
elif self.viewMode == "Normal":\r
glLightfv(GL_LIGHT0, GL_DIFFUSE, self.objColor[self.parent.objectList.index(obj)])\r
- glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x / 5, self.objColor[self.parent.objectList.index(obj)]))\r
+ glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x * 0.4, self.objColor[self.parent.objectList.index(obj)]))\r
glEnable(GL_LIGHTING)\r
self.drawModel(obj)\r
\r
import wx, sys, os, shutil, math, threading, subprocess, time, re
from gui import taskbar
+from gui import preferencesDialog
from util import profile
from util import sliceRun
from util import exporer
exporer.openExporer(sliceRun.getExportFilename(self.filelist[0]))
def OnCopyToSD(self, e):
+ if profile.getPreference('sdpath') == '':
+ wx.MessageBox("You need to configure your SD card drive first before you can copy files to it.\nOpening the preferences now.", 'No SD card drive.', wx.OK | wx.ICON_INFORMATION)
+ prefDialog = preferencesDialog.preferencesDialog(self.GetParent())
+ prefDialog.Centre()
+ prefDialog.Show(True)
+ if profile.getPreference('sdpath') == '':
+ print "No path set"
+ return
exportFilename = sliceRun.getExportFilename(self.filelist[0])
filename = os.path.basename(exportFilename)
if profile.getPreference('sdshortnames') == 'True':
self.openFileLocationButton = wx.Button(self, -1, "Open file location")
self.Bind(wx.EVT_BUTTON, self.OnOpenFileLocation, self.openFileLocationButton)
self.sizer.Add(self.openFileLocationButton, 0)
- if profile.getPreference('sdpath') != '':
- self.copyToSDButton = wx.Button(self, -1, "To SDCard")
+ if len(profile.getSDcardDrives()) > 0:
+ self.copyToSDButton = wx.Button(self, -1, "Copy to SDCard")
self.Bind(wx.EVT_BUTTON, self.OnCopyToSD, self.copyToSDButton)
self.sizer.Add(self.copyToSDButton, 0)
self.showButton = wx.Button(self, -1, "Show result")
totalExtrusion = 0.0
maxExtrusion = 0.0
currentExtruder = 0
+ extrudeAmountMultiply = 1.0
totalMoveTimeMinute = 0.0
scale = 1.0
posAbs = True
currentLayer = []
currentPath = gcodePath('move', pathType, layerThickness, pos.copy())
currentPath.list[0].e = totalExtrusion
+ currentPath.list[0].extrudeAmountMultiply = extrudeAmountMultiply
currentLayer.append(currentPath)
for line in gcodeFile:
if type(line) is tuple:
moveType = 'extrude'
if e < currentE:
moveType = 'retract'
- totalExtrusion += e - currentE
- currentE = e
else:
if e > 0:
moveType = 'extrude'
if e < 0:
moveType = 'retract'
- totalExtrusion += e
- currentE += e
+ totalExtrusion += e - currentE
+ currentE = e
if totalExtrusion > maxExtrusion:
maxExtrusion = totalExtrusion
if moveType == 'move' and oldPos.z != pos.z:
currentLayer.append(currentPath)
newPos = pos.copy()
newPos.e = totalExtrusion
+ newPos.extrudeAmountMultiply = extrudeAmountMultiply
currentPath.list.append(newPos)
elif G == 4: #Delay
S = self.getCodeFloat(line, 'S')
pass
elif M == 190: #Set bed temperature & wait
pass
+ elif M == 221: #Extrude amount multiplier
+ s = self.getCodeFloat(line, 'S')
+ if s != None:
+ extrudeAmountMultiply = s / 100.0
else:
print "Unknown M code:" + str(M)
self.layerList.append(currentLayer)
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.\r
import __init__\r
\r
-import os, traceback, math, re, zlib, base64, time, sys, platform, glob\r
+import os, traceback, math, re, zlib, base64, time, sys, platform, glob, string\r
import cPickle as pickle\r
if sys.version_info[0] < 3:\r
import ConfigParser\r
locationInfo = traceback.extract_tb(sys.exc_info()[2])[-1]\r
return "%s: '%s' @ %s:%s:%d" % (str(sys.exc_info()[0].__name__), str(sys.exc_info()[1]), os.path.basename(locationInfo[0]), locationInfo[2], locationInfo[1])\r
return None\r
+\r
+def getSDcardDrives():\r
+ drives = ['']\r
+ if platform.system() == "Windows":\r
+ from ctypes import windll\r
+ bitmask = windll.kernel32.GetLogicalDrives()\r
+ for letter in string.uppercase:\r
+ if bitmask & 1:\r
+ drives.append(letter + ':/')\r
+ bitmask >>= 1\r
+ if platform.system() == "Darwin":\r
+ drives = []\r
+ for volume in glob.glob('/Volumes/*'):\r
+ if stat.S_ISLNK(os.lstat(volume).st_mode):\r
+ continue\r
+ drives.append(volume)\r
+ return drives\r