SpeedChangeByLayer is a Cura plugin to insert print speed or fan speed changes on a layer by layer basis in the Cura generated GCode
Copyright (c) 2020 Randy Walker, [email protected]
This script was inspired by the ChangeAtZ script by Steven Morlock, [email protected].
I wanted a script that would allow me to only change print & fan speeds per layer, not when the z-axis change happens, starting/ending at the ;LAYER:xx marker comments.
I started with the code from the ChangeAtZ script and have removed & re-written most of it to only handle print/fan speeds per layer.
It runs with the PostProcessingPlugin which is released under the terms of the AGPLv3 or higher.
This script is licensed under the Creative Commons - Attribution - Share Alike (CC BY-SA) terms.
This script accepts four parameters, provided by the user to change Print and/or Fan speeds by layer:
- Layer number from the Cura gui on which to start the speed change Script will subtract 1 from the layer number provided because layers in gcode start at 0 not 1
- How many layers total to apply speed changes to
- Print Speed change percentage Script will automatically reset the Print Speed back to 100% at the end of the last layer
- Fan Speed percentage of 100%, not a % change from current fan speed Script will find the original Fan Speed on the last layer that has been overridden (if it existed) and reset the Fan Speed to that number or 0 at the end of the last layer affected
Since the script ends each layer change by resetting the print speed back to 100% of the Cura speed, adding multiple instances of this script will always calculate the percentage up or down from 100%, the original print speed set in Cura, and not from the last instance of the script ie.If the first instance set print speed to 50% & a 2nd instance set print speed to 20%, that would equal 20% of the original Cura print speed and not 20% of 50%
The script ends each layer change by resetting the fan speed back to the last fan speed found before the last layer affected. Fan speed changes are entered as a percentage of 100% [% of 255], not the original Cura speed or last found layer fan speed. Resetting fan speed: If the current layer originally had a speed of 50% [50% of 255 = 127.5 PWM number for the M106 command], then the fan speed will reset to that number at the end of the speed change
MAC:
- Move SpeedChangeByLayer.py file into the scripts directory inside the Cura application (right-click app -> Show Package Contents: Cura.app/Contents/Resources/plugins/plugins/PostprocessingPlugin/scripts/SpeedChangeByLayer.py
- Restart Cura
- Plugin can be found in Cura: Extensions -> Post Processing -> Modify G-Code Then click, "Add a script" and choose "Speed Change By Layer"
WINDOWS:
- I haven't installed a Cura plugin in Windows before. Will update this once I find out how.