#macro parameter
36 messages · Page 1 of 1 (latest)
You normally can get that via printer.configfile.settings.z_tilt.z_position. Now we need to find out how that parameter is shown
Add ```# Use:
- DUMP_PARAMETER print all parameter expect configfile
- DUMP_PARAMETER P='gcode_macro _TEST' print the defined parameter group
- DUMP_PARAMETER C='printer' print the defined config values
- DUMP_PARAMETER S='printer' print the defined settings values
[gcode_macro DUMP_PARAMETER]
description: Debug: Print entries of the printer object
gcode:
{% set config = True if params.C or params.S else False %}
{% set path = 'config' if params.C
else 'settings' if params.S %}
{% set search = params.C if params.C
else params.S if params.S
else params.P if params.P %}
{% set out = [] %}
{% for name1 in printer|sort %}
{% if config %} ; print the searched printer.configfile[path] parameter
{% if name1 is in ['configfile'] %}
{% for name2 in printer[name1][path]|sort %}
{% if name2 is in [search] %}
{% for name3, value in printer[name1][path][name2].items()|sort %}
{% set _dummy = out.append("printer.configfile.%s['%s'].%s = %s" %
(path, name2, name3, value)) %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{% for name2, value in printer[name1].items()|sort %} ; search for anything expext printer.configfile
{% if search is not defined and name1 is not in ['configfile'] %} ; print all printer. parameter
{% set _dummy = out.append("printer['%s'].%s = %s" % (name1, name2, value)) %}
{% elif search is defined and name1 is in [search] %} ; print the searched printer. parameter
{% set _dummy = out.append("printer['%s'].%s = %s" % (name1, name2, value)) %}
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% if out|length > 0 %}
{action_respond_info(out|join("\n"))}
{% else %}
{action_respond_info("Nothing found for "DUMP_PARAMETER %s"" % rawparams)}
{% endif %}``` to your printer.cig and restart klipper
Than type DUMP_PARAMETER S=z_tilt in the console to see how Klipper returns the parameter
Make me a screenshot so that I see how it is returned than I will explain you how to reach it
hi here again, wow, thanks a lot !!! @spare dew
I need the output otherwise I would need to configure z_tilt
The problem is that Klipper has not a uniform output so my answer will be output depending
ok, 2min to take a non fucked up version of my WIP config, put this macro, and update you
That’s the main reason for that Macro to see what Klipper outputs for a special question
The ideas you get in Klipper will be all wrong I expect a list or dictionary as output but never a string where you would use splitt
an emergency came out, I have to go, I came back in around 30min to update @spare dew
All fine I will be here from time to time
@spare dew I'm back, was shorter than expected.
So :
So it is a list of a list, give me a few moments should be printer.configfile.settings.z_tilt.z_positions[1][0] but I need to check
thx
OK I am correct
to get the 184 you need the element 1 (184.0,472) and from there the element 0
Thanks a lot !
try ```[gcode_macro TEST]
gcode:
{action_respond_info("%s" % printer.configfile.settings.z_tilt.z_positions[1][0]|string)}
that should print the 184.0
to use it in a other macro remove the |string that is only needed for the console output (it converts it in a string)
ok, I'll use |float in another one, gonna try it
try the TEST first than you know you use the right number
mist the s try it again, I corrected it
k
its z_positions I used z_position 🙈
perfect
so close the post as I guess we are done
yy, I learned a lot, and especially the dump parameter : that's so useful !
Yes I need that all the time a small description how to use the 3 parameters is at top