Basic Information:
Printer Model: RatRig V-Core 3.1
MCU / Printerboard: BTT Octopus V1.1 (F446)
Host / SBC: Raspberry Pi 4B
klippy.log:
klippy.log (58.1 KB)
Fill out above information and in all cases attach your klippy.log
file (use zip to compress it, if too big). Pasting your printer.cfg
is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there
Describe your issue:
I’m trying to write a macro that receives the filament material and nozzle size from the START_PRINT macro and use that select a Beacon Model using the BEACON_MODEL_SELECT NAME={Model Name} command. The model names are defined as Material+nozzle size (for example: PETG0.6, PLA0.4, etc).
I don’t know how to concatenate two strings in Klipper macro language. I’ve tried “+”, “||”, and “&” to no avail. Any help would be greatly appreciated.
The macro in question is shown below and throws an exception:
[gcode_macro SET_MATERIAL]
description: Define Material based beacon model settings
variable_Profile: "XXXXXX"
gcode:
{% set Profile = params.MATERIAL|string & params.NOZZLE|string }
BEACON_MODEL_SELECT NAME={Profile}
M117 Selecting Beacon Model {Profile}
The START_PRINT macro receives these parameters when the G-Code file is generated and calls the SET_MATERIAL macro as shown below:
[gcode_macro START_PRINT]
description: Start print procedure, use this in your Slicer.
gcode:
CLEAR_PAUSE
{% if printer["gcode_macro RatOS"].force_absolute_position|lower == 'true' %}
G90
{% endif %}
SAVE_GCODE_STATE NAME=start_print_state
# Metric values
G21
# Absolute positioning
G90
# Set extruder to absolute mode
M82
_USER_START_PRINT_BEFORE_HOMING
[gcode_macro _USER_START_PRINT_BEFORE_HOMING]
gcode:
{% if printer["gcode_macro RatOS"].led|lower == "true" %}
LIGHTS_ON
{% endif %}
{% set MATERIAL = params.MATERIAL|default('PLA')|string %}
{% set NOZZLE = params.NOZZLE|default('0.4')|string %}
SET_MATERIAL MATERIAL={MATERIAL} NOZZLE={NOZZLE}