Page 1 of 1

Substitutions in post processing

Posted: Fri Jan 06, 2017 2:27 am
by ssackett
In the advanced settings for processes the Scripts section has an area for the G-Code starting script. There are entries in the starting script for the LulzBot Mini (and I assume other printers) where values are substituted for symbolic parameters. For example the line
M140 S[bed0_temperature]
This obviously substitutes the value for the parameter "bed0_temperature" into the code before it is written out.

I would like to see this extended to the "Additional terminal commands for post processing". This would be helpful with complicated post processing instructions such as the one I wrote to do a filament change (see below). In it I was forced to hardcode both the bed and extruder temperatures. Of course this will not get updated if I decide to change one of these temperatures and I will need to edit the script to make changes.

The script I wrote:
------------
{REPLACE "layer 5" "\n; Pause for filament change\n;\n;SES Mods to change filament\nG0 Z80 ; Raise extruder\nM109 S140 ; Cool extruder\nM107 ; Fan Off\nM0 ; Wait for filament change\nM140 S70 ; Set bed temperature\nM109 S200 ; Set extruder temperature and wait\n;SES End Mods\n;\n; layer 5"}
------------

The script I would have preferred:
-----------
{REPLACE "layer 5" "\n; Pause for filament change\n;\n;SES Mods to change filament\nG0 Z80 ; Raise extruder\nM109 S140 ; Cool extruder\nM107 ; Fan Off\nM0 ; Wait for filament change\nM140 S[bed0_temperature] ; Set bed temperature\nM109 S[extruder0_temperature] ; Set extruder temperature and wait\n;SES End Mods\n;\n; layer 5"}
---------

Re: Substitutions in post processing

Posted: Fri Jan 06, 2017 3:20 am
by brian442
It seems what you would really need is [extruder0_temperature_at_layer5], since you are using that post-processing script to insert code at a specific layer. I think a better way to do this would be to have an option on the layer change script where you can add code and have it only add that code at layer 5. That makes it more intuitive IMHO

I'm not sure how they would currently support the current [extruder0_temperature] variable in the post-processing script, since you can have lots of different temperatures at different layers

Re: Substitutions in post processing

Posted: Fri Jan 06, 2017 4:56 am
by ssackett
Yes, coupling it with the layer would be ideal. Perhaps it could be done with a conditional such as:

if(layer==5) my_script

Where my_script is a file processed with the same substitution rules as the start script.

An alternative would be to use a switch statement such as:

switch(layer)
case 1 : break;
case 2 : my_script_1; break;
case 5 : my_script_2; break;
default: