chiark / gitweb /
Update for dual-extrusion. Better start code with multiple temperatures set.
authordaid303 <daid303@gmail.com>
Thu, 14 Mar 2013 14:17:27 +0000 (15:17 +0100)
committerdaid303 <daid303@gmail.com>
Thu, 14 Mar 2013 14:17:27 +0000 (15:17 +0100)
Cura/slice/__main__.py
Cura/util/profile.py

index eecb3f4890d752fa3acd977bb1552c79b18ef421..f5d2d8489f8bc3d715d871bd9f995b3c61b56a65 100644 (file)
@@ -52,7 +52,7 @@ def main():
                profile.setTempOverride('object_center_y', position[1])
                if idx == 0:
                        resultFile.write(';TYPE:CUSTOM\n')
-                       resultFile.write(profile.getAlterationFileContents('start.gcode').replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))
+                       resultFile.write(profile.getAlterationFileContents('start.gcode', len(filenames)).replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))
                else:
                        resultFile.write(';TYPE:CUSTOM\n')
                        n = output[-1].rfind('Z')+1
index 023fae49d865264f952f4acf4e4eb4521cd9c21a..66614bfaaa4bc5eb530c0db8e06beeb3c269684e 100644 (file)
@@ -26,6 +26,9 @@ profileDefaultSettings = {
        'skirt_gap': '3.0',
        'print_speed': '50',
        'print_temperature': '220',
+       'print_temperature2': '0',
+       'print_temperature3': '0',
+       'print_temperature4': '0',
        'print_bed_temperature': '70',
        'support': 'None',
        'filament_diameter': '2.89',
@@ -73,6 +76,9 @@ profileDefaultSettings = {
        'alternative_center': '',
        'clear_z': '0.0',
        'extruder': '0',
+       'new_x': '0',
+       'new_y': '0',
+       'new_z': '0',
 }
 alterationDefault = {
 #######################################################################################
@@ -133,10 +139,11 @@ G92 E0
 #######################################################################################
        'switchExtruder.gcode': """;Switch between the current extruder and the next extruder, when printing with multiple extruders.
 G92 E0
-G1 E-15 F5000
+G1 E-36 F5000
 G92 E0
 T{extruder}
-G1 E15 F5000
+;G1 X{new_x} Y{new_y} Z{new_z} F{travel_speed}
+G1 E36 F5000
 G92 E0
 """,
 }
@@ -535,7 +542,7 @@ def setAlterationFile(filename, value):
        saveGlobalProfile(getDefaultProfilePath())
 
 ### Get the alteration file for output. (Used by Skeinforge)
-def getAlterationFileContents(filename):
+def getAlterationFileContents(filename, extruderCount = 1):
        prefix = ''
        postfix = ''
        alterationContents = getAlterationFile(filename)
@@ -553,7 +560,20 @@ def getAlterationFileContents(filename):
                if bedTemp > 0 and not '{print_bed_temperature}' in alterationContents:
                        prefix += 'M140 S%f\n' % (bedTemp)
                if temp > 0 and not '{print_temperature}' in alterationContents:
-                       prefix += 'M109 S%f\n' % (temp)
+                       if extruderCount > 0:
+                               for n in xrange(1, extruderCount):
+                                       t = temp
+                                       if n > 0 and getProfileSettingFloat('print_temperature%d' % (n+1)) > 0:
+                                               t = getProfileSettingFloat('print_temperature%d' % (n+1))
+                                       prefix += 'M104 T%d S%f\n' % (n, temp)
+                               for n in xrange(0, extruderCount):
+                                       t = temp
+                                       if n > 0 and getProfileSettingFloat('print_temperature%d' % (n+1)) > 0:
+                                               t = getProfileSettingFloat('print_temperature%d' % (n+1))
+                                       prefix += 'M109 T%d S%f\n' % (n, temp)
+                               prefix += 'T0\n'
+                       else:
+                               prefix += 'M109 S%f\n' % (temp)
                if bedTemp > 0 and not '{print_bed_temperature}' in alterationContents:
                        prefix += 'M190 S%f\n' % (bedTemp)
        elif filename == 'end.gcode':