From: daid Date: Mon, 7 May 2012 15:42:46 +0000 (+0200) Subject: Move extruder switching GCode to profile instead of hardcoded. X-Git-Tag: RC3~12^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7f576692809f229f204006ef79dfd6dfd4cc55f0;p=cura.git Move extruder switching GCode to profile instead of hardcoded. --- diff --git a/Cura/gui/alterationPanel.py b/Cura/gui/alterationPanel.py index 5f5098d6..144f3d94 100644 --- a/Cura/gui/alterationPanel.py +++ b/Cura/gui/alterationPanel.py @@ -9,6 +9,8 @@ class alterationPanel(wx.Panel): wx.Panel.__init__(self, parent,-1) self.alterationFileList = ['start.gcode', 'end.gcode', 'support_start.gcode', 'support_end.gcode', 'nextobject.gcode', 'replace.csv'] + if int(profile.getPreference('extruder_amount')) > 1: + self.alterationFileList.append('switchExtruder.gcode') self.currentFile = None #self.textArea = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_DONTWRAP|wx.TE_PROCESS_TAB) diff --git a/Cura/gui/sliceProgessPanel.py b/Cura/gui/sliceProgessPanel.py index 9e49e5b3..d2240a56 100644 --- a/Cura/gui/sliceProgessPanel.py +++ b/Cura/gui/sliceProgessPanel.py @@ -190,11 +190,10 @@ class WorkerThread(threading.Thread): resultFile.write(';LAYER:%d\n' % (layerNr)) resultFile.write(';EXTRUDER:%d\n' % (nextExtruder)) if nextExtruder != currentExtruder: - resultFile.write("G1 E-5 F5000\n") - resultFile.write("G92 E0\n") - resultFile.write("T%d\n" % (nextExtruder)) - resultFile.write("G1 E5 F5000\n") - resultFile.write("G92 E0\n") + resultFile.write(';TYPE:CUSTOM\n') + profile.setTempOverride('extruder', nextExtruder) + resultFile.write(profile.getAlterationFileContents('switchExtruder.gcode')) + profile.resetTempOverride() currentExtruder = nextExtruder layerHasLine = True resultFile.write(line) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 5e6f67ef..22d30fb0 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -122,6 +122,13 @@ G92 E0 G1 Z0 F{max_z_speed} """, ####################################################################################### + 'switchExtruder.gcode': """;Switch between the current extruder and the next extruder, when printing with multiple extruders. +G1 E-5 F5000 +G92 E0 +T{extruder} +G1 E5 F5000 +G92 E0 +""", } preferencesDefaultSettings = { 'wizardDone': 'False',