# Macro evaluation help

**URL:** <https://klipper.discourse.group/t/macro-evaluation-help/942>\
**Category:** General Discussion\
**Created:** [September 17, 2021, 4:41am UTC](https://klipper.discourse.group/t/macro-evaluation-help/942 "2021-09-17T04:41:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![charlespick](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/charlespick/32/610_2.png) [@charlespick](https://klipper.discourse.group/u/charlespick)\
**Post date:** [September 17, 2021, 4:41am UTC](https://klipper.discourse.group/t/macro-evaluation-help/942/1 "2021-09-17T04:41:24Z")

</div>

I have a start\_print macro that is causing a move out of range error when executed in the beginning of a print but not when it’s executed on it’s own. I also preheated the printer manually, ran the macro, and then started the print with the macro commented out. that worked fine.

here is the macro:

```auto
[gcode_macro start_print]
gcode: 
    conf_runout
    SAVE_GCODE_STATE NAME=start_print_state
    {% set initialExtruder = printer.toolhead.extruder %}
    G28 ; home all axes
    G90
    {% if printer.extruder.target >= 170 %}
        T0
        G1 X15 Y145 Z0.2 F15000 ; move to prime
        M83
        G92 E0 ; reset extrusion distance
        G1 X110 E15 F1000 ; prime nozzle
        G1 X200 F300000 ; quick wipe
        G92 E0 ; reset extrusion distance
        PARK_extruder
    {% endif %}
    {% if printer.extruder1.target >= 170 %}
        T1
        G1 X15 Y146 Z0.2 F15000 ; move to prime
        M83
        G92 E0 ; reset extrusion distance
        G1 X110 E15 F1000 ; prime nozzle
        G1 X200 F300000 ; quick wipe
        G92 E0 ; reset extrusion distance
        PARK_extruder1
    {% endif %}
    {% if initialExtruder == "extruder1" %}
        T1
    {% else %}
        T0
    {% endif %}
    RESTORE_GCODE_STATE NAME=start_print_state
description: Home and Prime

```

here is the gcode I’m trying to print:

> **[CFFFP\_IDEX\_Calibration\_-\_Part\_1.gcode](https://drive.google.com/file/d/1DzIukcchZ8cGLeN38ZLAIQ8Tw0dcq4hw/view?usp=sharing)**
>
> Google Drive file.

here is my klippy.log:

> **[klippy-3.log](https://drive.google.com/file/d/19ALCQwvIPN-41qaecBQnGumlfcoIh0q9/view?usp=sharing)**
>
> Google Drive file.

here is the error message I’m getting (and the surrounding terminal echos for reference):

```auto

// shaper_type_x:ei shaper_type_y:mzv shaper_freq_x:48.200 shaper_freq_y:32.200 damping_ratio_x:0.100000 damping_ratio_y:0.100000
21:22:07 
// Activating extruder extruder1
21:22:07 
// shaper_type_x:mzv shaper_type_y:mzv shaper_freq_x:55.600 shaper_freq_y:31.000 damping_ratio_x:0.100000 damping_ratio_y:0.100000
21:22:07 
!! Move out of range: 10.000 146.000 0.200 [29.996]
21:22:07 
!! Move out of range: 10.000 146.000 0.200 [29.996]

```

can someone tell me how to get this to work the way I want it to?

---

<div class="post-metadata">

**Author:** ![charlespick](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/charlespick/32/610_2.png) [@charlespick](https://klipper.discourse.group/u/charlespick)\
**Post date:** [September 17, 2021, 4:42am UTC](https://klipper.discourse.group/t/macro-evaluation-help/942/2 "2021-09-17T04:42:03Z")

</div>

new users can only put 2 links in their post…

here is the rest of my config if you need it:

> **[KlipperConf/Octo Creator Pro at master · charlespick/KlipperConf](https://github.com/charlespick/KlipperConf/tree/master/Octo%20Creator%20Pro)**
>
> master/Octo%20Creator%20Pro

---

<div class="post-metadata">

**Author:** ![koconnor](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@koconnor](https://klipper.discourse.group/u/koconnor)\
**Post date:** [September 18, 2021, 2:49pm UTC](https://klipper.discourse.group/t/macro-evaluation-help/942/3 "2021-09-18T14:49:21Z")

</div>

With all the macros, it’s hard to say which move isn’t valid. You can add a bunch of GET\_POSITION calls in your macros and also add `{action_respond_info("some macro name")}` to the top of each macro call as well. That might help track down which move went awry.

-Kevin

---

<div class="post-metadata">

**Author:** ![charlespick](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/charlespick/32/610_2.png) [@charlespick](https://klipper.discourse.group/u/charlespick)\
**Post date:** [September 23, 2021, 9:11pm UTC](https://klipper.discourse.group/t/macro-evaluation-help/942/4 "2021-09-23T21:11:30Z")

</div>

ok, I was trying to do that but I was getting confused because of how the macros are evaluated

so if one macro calls another macro that calls another macro, what happens?

[macro1]  
thing1  
macro2  
thing2

[macro2]  
thing3  
macro3  
thing4

[macro4]  
thing5

---

<div class="post-metadata">

**Author:** ![EddyMI3D](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/eddymi3d/32/1981_2.png) [@EddyMI3D](https://klipper.discourse.group/u/EddyMI3D)\
**Post date:** [April 16, 2025, 10:00am UTC](https://klipper.discourse.group/t/macro-evaluation-help/942/5 "2025-04-16T10:00:17Z")

</div>

Closed on April 16, 2025, 10:00am UTC


