Klipper/Jinja2 syntax

Basic Information:

Printer Model: Sovol SV08

Can someone tell me what this line exactly does?
{% set start_vars = printer[“gcode_macro _START_VARIABLES”] %}

I know it sets a variable. But I’m confused on the printer[“gcode_macro _START_VARIABLES”] part. Is that the same as doing this: printer._START_VARIABLES? To acces an object in the printer object?

  • This line assumes you have a “hidden” (starting with _) macro called _START_VARIABLES, i.e. it will not appear in the web interfaces
  • For the current macro you set the variable start_vars to this scope
  • Now you can access values from _START_VARIABLES within your current macro, e.g. by doing
    start_vars.my_needed_variable
    
    instead of
    printer['gcode_macro _START_VARIABLES'].my_needed_variable
    

ah I see. Thanks.

So if I have this:

[gcode_macro _global_var]
variable_pause_park:{'x': 0, 'y': 0, 'z': 10, 'e': 1}
variable_cancel_park:{'x': 0, 'y': 350, 'z': 10, 'e': 1}
variable_z_maximum_lifting_distance: 345
variable_pause_resume_travel_speed: 150
variable_bed_mesh_calibrate_target_temp: 65
variable_load_filament_extruder_temp: 250

[gcode_macro QUAD_GANTRY_LEVEL]
rename_existing:QUAD_GANTRY_LEVEL_BASE
gcode:
    {% set mesh_name = "default" %}
    {% set mesh_calibrate_temp = printer['gcode_macro _global_var'].bed_mesh_calibrate_target_temp|int %}

Then mesh_calibrate_temp is just set to 65. Is that correct?

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.