Page 1 of 2
post processing variables
Posted: Wed Feb 08, 2023 10:01 pm
by Kissable1089
I know that you guys are working on documentation for the variables, and you've been providing some variables as needed.
I'm looking for some variables to help with file naming (I can pass them to a script and do what I need to do).
Ideally, I'd like "profile name", "quality", "default speed", and "estimated time".
Thanks

Re: post processing variables
Posted: Fri Feb 10, 2023 11:52 am
by S3D-Jason
For total time you can use:
[total_build_time_minutes]
[total_build_time_seconds]
I don't think there's a variable for the currently selected quality level. But if you really wanted you could probably set your scripts to be controlled by the quality auto-configure category, then you could actually write custom comments in the scripts for each quality level.
Re: post processing variables
Posted: Wed May 24, 2023 9:51 pm
by Kissable1089
Any update on a variable list for v5?
Re: post processing variables
Posted: Thu Jun 08, 2023 1:08 pm
by Kissable1089
Bump >:D
Re: post processing variables
Posted: Mon Jun 12, 2023 5:01 pm
by linuxguygary
Hi folks
I'm looking for a way to control my Klipper based chamber fan , looking a the S3D gcode file I see it issues a marlin M106 S89 P2 to set the fan to the correct percentage.
But Klipper needs "SET_FAN_SPEED FAN=fan_name SPEED=x"
So using the REPLACE post processing I have tried the text below, using every permutation of [fan2_speed] that I can think of , with no results, the gcode gets replaced as expected, but apparently I have not yet found the correct variable name for [fan2_speed] .
{REPLACE "M106 S89 P2" "SET_FAN_SPEED FAN=chamber_cooling_fan SPEED="[fan2_speed]}
The gcode in the output file looks like SET_FAN_SPEED FAN=chamber_cooling_fan SPEED= with nothing after the =
Can anyone offer any help for this variable or does it even exist?
A full list of variable name would REALLY be helpful !
Thanks all
Re: post processing variables
Posted: Tue Jun 13, 2023 10:18 am
by S3D-Jason
You can use [fan2_speed_percentage] or [fan2_speed_pwm] depending on if you want the 0-100 or 0-255 value. This assumes your fan is already set to use T2 (otherwise adjust the number in those variables).
Re: post processing variables
Posted: Tue Jun 13, 2023 11:56 am
by linuxguygary
I guess I need a little syntax help , here's what I'm doing
{REPLACE "M106 S89 P2" "SET_FAN_SPEED FAN=chamber_cooling_fan SPEED="[fan2_speed_percentage]}
this does the replace, but still leaves the line without a value like: SET_FAN_SPEED FAN=chamber_cooling_fan SPEED=
the fan is defined as T2 fan type as environmental (not extruder mounted) although I have tested both with the same result. The Marlin M106 SXX P2 does show the correct fan index (P2)
So I have a couple of questions
- Is it possible to do simple math e.g. [fan2_speed_percentage]/100 because Klipper expects 0-1 ie. .35 for 35%
- Syntax for the replace command to replace the M106 SXX P2 command with a literal string and the fan percentage. Depending on what I set the fan to in the software, the replace command will do an S value from 0-255 and I'd like to just search for any value and then provide that value to the Klipper equivalent in [fan2_speed_percentage] REGEX? or ??
- what is the syntax needed to get both the replacement string and the variable value?
This is not correct: {REPLACE "M106 S89 P2" "SET_FAN_SPEED FAN=chamber_cooling_fan SPEED="[fan2_speed_percentage]}
Re: post processing variables
Posted: Tue Jun 13, 2023 1:40 pm
by S3D-Jason
The [fan2_speed_percentage] variable needs to be inside the double quotes.
Basically it should be {REPLACE "find text" "replace text"}. There shouldn't be anything after the 4th double quote besides the closing squiggly brace.
Re: post processing variables
Posted: Tue Jun 13, 2023 4:12 pm
by linuxguygary
Here's my test REPLACE line with only the variable in the replacement {REPLACE "M106 S89 P2" "[fan2_speed_percentage]"}
and here is the result, its interpreted as literal text, (never the variable value). The layer comment included just for context.
; layer 20, Z = 6.0600
[fan2_speed_percentage]
What am I missing?
Re: post processing variables
Posted: Wed Jun 14, 2023 1:14 pm
by S3D-Jason
Are you hoping to have this replace with different values throughout the gcode? I'm not sure that will work. Post-processing usually replaces text with a constant value.
If you want to use a dynamic value, you could try putting the command in the layer change script instead. Just add the following to the post layer change script:
SET_FAN_SPEED FAN=chamber_cooling_fan SPEED=[fan2_speed_percentage]