| Name | Type | Definition | Instance |
| total_layer_count | int | Total layer counting |
Showing the number of total layers |
| previous_extruder | int 0-16 | Previous type of filament extruded |
Getting information about the previous type of filament extruded when changing |
| next_extruder | int 0-16 | Next type of filament extruded |
Getting information about the next type of filament extruded when changing |
| layer_num | int | Current layer number |
Showing the number of current layer |
| layer_z | float | Current layer height | |
| max_layer_z | float | The maximum layer height | |
| x_after_toolchange | float | Coordinates after changing filaments | |
| y_after_toolchange | float | ||
| z_after_toolchange | float | ||
| filament_extruder_id | int | Current type of filament ID |
Conditional statement |
| toolchange_z | float | Current total layer height |
Moving the filament extruder |
The variable "layer_z" can be accessed directly by using its name.
To obtain its value, use {layer_z}.
[index]"cool_plate_temp_initial_layer[0]" accesses the first element of "cool_plate_temp_initial_layer".
To obtain its value, use {cool_plate_temp_initial_layer[0]}.
{if scan_first_layer}
;=========register first layer scan=====
M977 S1 P60
{endif}
(<condition> ? <cond_true>:<cond_false>)
S[next_extruder]
S{cool_plate_temp_initial_layer[0]}
Strings:
"Bambu PLA Basic @BBL X1C"
/regex/
toolchange_count > 1
{if old_filament_temp > 142 && next_extruder < 255};dosomething{endif}
Arithmetic Operators:
{layer_num+1}
Float operations return float type, while integer operations return integer type.
If you want the result to be a decimal value, you need to include a float type argument in the operation.
For example, 3/2 will return 1 (an integer), while 3.0/2 will return 1.5 (a float).
=~ matching and !~ not matching:
=~ and !~ are comparison operators used in programming to check if a string matches a pattern or not. The =~ operator checks if a string matches a pattern, while the !~ operator checks if a string does not match a pattern.
Functions are a set of instructions that are executed when called upon to do so. In programming, a function may accept arguments and return a result. Here are some common function operations in programming:
min(a, b): returns the minimum value between a and b.max(a, b): returns the maximum value between a and b.int(a): converts a to an integer type.round(a): rounds a to the nearest integer.digits(a, num_digits, num_decimals=0): rounds the decimal portion of a to an integer and displays num_digits digits using space padding, where num_decimals defaults to 0 and can be left empty.zdigits(a, num_digits, num_decimals=0): same as above, except it uses 0 padding instead of space padding.