From 3b1ed65d81ee6cd1005c93969fe5bf97acb78918 Mon Sep 17 00:00:00 2001 From: daid Date: Fri, 3 Aug 2012 11:10:28 +0200 Subject: [PATCH] Add support for heated bed temperature setting. --- Cura/gui/mainWindow.py | 3 +++ Cura/gui/preferencesDialog.py | 1 + Cura/util/profile.py | 11 +++++++++++ 3 files changed, 15 insertions(+) diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 112832c..07bfe86 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -144,6 +144,9 @@ class mainWindow(configBase.configWindowBase): c = configBase.SettingRow(right, "Printing temperature", 'print_temperature', '0', 'Temperature used for printing. Set at 0 to pre-heat yourself') validators.validFloat(c, 0.0, 340.0) validators.warningAbove(c, 260.0, "Temperatures above 260C could damage your machine, be careful!") + if profile.getPreference('has_heated_bed') == 'True': + c = configBase.SettingRow(right, "Bed temperature", 'print_bed_temperature', '0', 'Temperature used for the heated printer bed. Set at 0 to pre-heat yourself') + validators.validFloat(c, 0.0, 340.0) configBase.TitleRow(right, "Support") c = configBase.SettingRow(right, "Support type", 'support', ['None', 'Exterior Only', 'Everywhere', 'Empty Layers Only'], 'Type of support structure build.\n"Exterior only" is the most commonly used support setting.\n\nNone does not do any support.\nExterior only only creates support on the outside.\nEverywhere creates support even on the insides of the model.\nOnly on empty layers is for stacked objects.') diff --git a/Cura/gui/preferencesDialog.py b/Cura/gui/preferencesDialog.py index 036dc70..843460f 100644 --- a/Cura/gui/preferencesDialog.py +++ b/Cura/gui/preferencesDialog.py @@ -29,6 +29,7 @@ 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) c = configBase.SettingRow(left, 'Extruder count', 'extruder_amount', ['1', '2', '3', '4'], 'Amount of extruders in your machine.', type = 'preference') + c = configBase.SettingRow(left, 'Heated bed', 'has_heated_bed', False, 'If you have an heated bed, this enabled heated bed settings', type = 'preference') for i in xrange(1, self.oldExtruderAmount): configBase.TitleRow(left, 'Extruder %d' % (i+1)) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 90d3f74..ab4f030 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -24,6 +24,7 @@ profileDefaultSettings = { 'skirt_gap': '3.0', 'print_speed': '50', 'print_temperature': '230', + 'print_bed_temperature': '70', 'support': 'None', 'filament_diameter': '2.89', 'filament_density': '1.00', @@ -155,6 +156,7 @@ preferencesDefaultSettings = { 'machine_depth': '205', 'machine_height': '200', 'machine_type': 'unknown', + 'has_heated_bed': 'False', 'extruder_amount': '1', 'extruder_offset_x1': '-22.0', 'extruder_offset_y1': '0.0', @@ -486,8 +488,17 @@ def getAlterationFileContents(filename): if eSteps > 0: prefix += 'M92 E%f\n' % (eSteps) temp = getProfileSettingFloat('print_temperature') + bedTemp = 0 + if getPreference('has_heated_bed') == 'True': + bedTemp = getProfileSettingFloat('print_bed_temperature') + + 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 bedTemp > 0 and not '{print_bed_temperature}' in alterationContents: + prefix += 'M190 S%f\n' % (bedTemp) + elif filename == 'end.gcode': #Append the profile string to the end of the GCode, so we can load it from the GCode file later. postfix = ';CURA_PROFILE_STRING:%s\n' % (getGlobalProfileString())