From c7946e5c78872d7ab51188195d349e430ade8efb Mon Sep 17 00:00:00 2001 From: Anson Liu Date: Sat, 6 Aug 2022 16:54:37 -0400 Subject: [PATCH] Added Cooling Rate setting --- .../scripts/AnnealAfterPrint.py | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/AnnealAfterPrint.py b/plugins/PostProcessingPlugin/scripts/AnnealAfterPrint.py index 7ca8fac79d..1e47f2d9af 100644 --- a/plugins/PostProcessingPlugin/scripts/AnnealAfterPrint.py +++ b/plugins/PostProcessingPlugin/scripts/AnnealAfterPrint.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Anson Liu +# Copyright (c) 2022 Anson Liu # The PostProcessingPlugin is released under the terms of the AGPLv3 or higher. from ..Script import Script @@ -6,10 +6,11 @@ from ..Script import Script class AnnealAfterPrint(Script): """Adds timed annealing GCODE after objects finish printing. - Bed annealing works best with a glass bed and a plastic container placed on top of the object during annealing. + Bed annealing works best with a glass bed and a container placed on top of the object during annealing. """ def getSettingDataString(self): + return """{ "name": "Anneal After Print", "key": "AnnealAfterPrint", @@ -20,7 +21,7 @@ class AnnealAfterPrint(Script): "heatingElement": { "label": "Heating Element", - "description": "Printer heating element to use for annealing.", + "description": "Printer heating element to use for annealing. Glass bed and 4-8 mm brim is recommended if XY dimensional stability is desired.", "type": "enum", "options": { @@ -33,7 +34,7 @@ class AnnealAfterPrint(Script): "annealBedTemp": { "label": "Bed Temperature", - "description": "Bed temperature annealing. Recommended bed temperature is greater of build plate printing or vendor specified annealing temperature for material. E.g. PC 90-110 C, PLA 60-90 C", + "description": "Bed temperature annealing. Recommended bed temperature is greater of build plate printing or vendor specified annealing temperature for material. Temperature should be between material glass transition temperature and melting point. E.g. PC 90-110 C, PLA 60-90 C", "unit": "C", "type": "float", "default_value": 0, @@ -43,7 +44,7 @@ class AnnealAfterPrint(Script): "annealChamberTemp": { "label": "Chamber Temperature", - "description": "Chamber temperature for annealing.", + "description": "Chamber temperature for annealing. Temperature should be between material glass transition temperature and melting point.", "unit": "C", "type": "float", "default_value": 0, @@ -57,7 +58,7 @@ class AnnealAfterPrint(Script): "unit": "min", "type": "int", "default_value": 120, - "minimum_value": 0 + "minimum_value": 1 }, "reminderBeep": { @@ -69,24 +70,37 @@ class AnnealAfterPrint(Script): "endCoolingTemp": { "label": "End Cooling Temperature", - "description": "Temperature to end gradual cooling at. After annealing at target temperature for specified duration temperature decreases by 1 degree after 1 minute at each step.", + "description": "Temperature to end gradual cooling at after annealing at target temperature for specified duration.", "unit": "C", "type": "float", "default_value": 50, "minimum_value": 0 + }, + "coolingRate": + { + "label": "Cooling Rate", + "description": "Gradual cooling rate. Temperature decreases by 1 C after specified seconds at each degree", + "unit": "sec/C", + "type": "int", + "default_value": 60, + "minimum_value": 0 } } }""" - def generateAnnealCode(self, annealBedTemp, annealChamberTemp, annealMinutes, initialBeep, endCoolingTemp): + settingData = settingData.format(anneal_temp_guideline) + print(settingData) + return settingData + + def generateAnnealCode(self, annealBedTemp, annealChamberTemp, annealMinutes, initialBeep, endCoolingTemp, coolingRate): anneal_code = ';Generated Annealing GCODE by Anson Liu' if initialBeep: - anneal_code += '\nM300 ;play beep for plastic container placement reminder' + anneal_code += '\nM300 ;play beep for container placement reminder' anneal_code += '\nM117 ' if annealBedTemp: - anneal_code += 'Place plastic container over objects on bed now! ' + anneal_code += 'Place container over objects on bed. ' anneal_code += 'Waiting until annealing temp reached...' anneal_code += '\nM73 P00 ;reset progress bar to 0' @@ -121,7 +135,7 @@ class AnnealAfterPrint(Script): anneal_code += '\nM190 S{}'.format(x) # Wait for buildplate only if heating if annealChamberTemp and annealChamberTemp > x: anneal_code += '\nM191 S{}'.format(x) - anneal_code += '\nG4 S60' # Wait 60 seconds after reaching each cooldown temperature + anneal_code += '\nG4 S{}'.format(int(coolingRate)) # Wait user specified seconds after reaching each cooldown temperature if annealBedTemp: anneal_code += '\nM140 S0' @@ -143,12 +157,13 @@ class AnnealAfterPrint(Script): anneal_chamber_temp = self.getSettingValueByKey("annealChamberTemp") anneal_minutes = self.getSettingValueByKey("annealMinutes") - initial_beep = self.getSettingValueByKey("firmware_config") + initial_beep = self.getSettingValueByKey("reminderBeep") final_cooling_temp = self.getSettingValueByKey("endCoolingTemp") + cooling_rate = self.getSettingValueByKey("coolingRate") # Test printing the generated anneal code #print(self.generateAnnealCode(110, 120, False, 50)) - anneal_code = self.generateAnnealCode(anneal_bed_temp, anneal_chamber_temp, anneal_minutes, initial_beep, final_cooling_temp) + anneal_code = self.generateAnnealCode(anneal_bed_temp, anneal_chamber_temp, anneal_minutes, initial_beep, final_cooling_temp, cooling_rate) try: end_of_gcode_index = data[-1].index(';End of Gcode')