# How to Move Z motors

**URL:** <https://klipper.discourse.group/t/how-to-move-z-motors/18148>\
**Category:** Developers\
**Created:** [August 8, 2024, 5:59am UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148 "2024-08-08T05:59:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Geking](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@Geking](https://klipper.discourse.group/u/Geking)\
**Post date:** [August 8, 2024, 5:59am UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148/1 "2024-08-08T05:59:30Z")

</div>

I am making a ‘extra’ and need to move two of the 4 Z motors. I tried to use Z\_tilt to accomplish this, but it will only move the motors Z positive, opting to move the other motors up vs the ones I wish to move down. Unfortionaly my python is a little rusty and I am having issues understanding the variables I need to pass to toolhead.move(pos, speed)

I am aware that the positon is an array, with pos[2] being the Z, but how do I specify Z 0 to z4 independantly? In what structure? I think that there are truples in there of position and stepper motor, but I am at a loss trying to understand how Z\_tilt uses them. If someone could please shed some light on how I can do this, or even what the data structure of the object passed as a position for a mutlti Z motor system would look like I would be very greatful!

Thanks!

---

<div class="post-metadata">

**Author:** ![3dcoded](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/3dcoded/32/20297_2.png) [@3dcoded](https://klipper.discourse.group/u/3dcoded)\
**Post date:** [August 8, 2024, 10:47am UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148/2 "2024-08-08T10:47:08Z")

</div>

If you use the `gcode` object (obtained by `printer.lookup_object("gcode")`, you can run a `FORCE_MOVE` command:

```auto
self.printer = config.get_printer()
self.gcode = self.printer.lookup_object("gcode")

# Force Move
stepper = 'stepper_z1'
distance = 10
velocity = 5
self.gcode.run_script_from_command(f"FORCE_MOVE STEPPER={stepper} DISTANCE={distance} VELOCITY={velocity}")

```

I’m also working on a Klippy extra development tutorial. It’s still under construction, but if you want, it’s [here](https://3dcoded.github.io/DynamicMacros/extras/extras-start/). Also, when writing extras myself, I look at the builtin Klippy extras [here](https://github.com/Klipper3d/klipper/tree/master/klippy/extras).

---

<div class="post-metadata">

**Author:** ![Geking](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@Geking](https://klipper.discourse.group/u/Geking)\
**Post date:** [August 8, 2024, 12:41pm UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148/3 "2024-08-08T12:41:21Z")

</div>

This is perfect. Thank you!

---

<div class="post-metadata">

**Author:** ![Geking](https://avatars.discourse-cdn.com/v4/letter/g/c77e96/32.png) [@Geking](https://klipper.discourse.group/u/Geking)\
**Post date:** [August 8, 2024, 10:36pm UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148/4 "2024-08-08T22:36:45Z")

</div>

Well, I tested this and it would work, but I need the two motors to run in sync. FORCE\_MOVE moves one at a time with a pause.

---

<div class="post-metadata">

**Author:** ![3dcoded](https://yyz2.discourse-cdn.com/free1/user_avatar/klipper.discourse.group/3dcoded/32/20297_2.png) [@3dcoded](https://klipper.discourse.group/u/3dcoded)\
**Post date:** [August 9, 2024, 10:34am UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148/5 "2024-08-09T10:34:12Z")

</div>

You might be able to use `SET_STEPPER_ENABLE` to disable the motors you don’t want to move, then using `G1` to move:

```auto
self.gcode.run_script_from_command("""
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=0
SET_STEPPER_ENABLE STEPPER=stepper_z1 ENABLE=0
G1 Z5 ; should only move stepper_z2 and stepper_z3""")

```

---

<div class="post-metadata">

**Author:** ![huahua](https://avatars.discourse-cdn.com/v4/letter/h/0ea827/32.png) [@huahua](https://klipper.discourse.group/u/huahua)\
**Post date:** [August 9, 2024, 2:09pm UTC](https://klipper.discourse.group/t/how-to-move-z-motors/18148/6 "2024-08-09T14:09:04Z")

</div>

Hello, I have two z’s. But sometimes I want z to work and z1 not to work.  
So I want to create a macro Z0 and Z1,The macro Z0 can make only z work, and the macro Z1 can make only z1 work.

 ![屏幕截图 2024-08-09 215545](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/1/1600900627b5aaef1af55ee61d3dc6d5c95ce612.png)  
[printer（1）.cfg.txt](https://klipper.discourse.group/uploads/short-url/i4jxzRew6cLAA76zT6Z98ktu21w.txt) (5.5 KB)

I have downloaded and replaced your klipper file [here](https://github.com/Klipper3d/klipper)  
And,I have also changed what needs to be modified below:

 ![屏幕截图 2024-08-09 224107](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/f/fd020a0119d1ecb31c2631638b837e86d7a7e44b.png)

My system is just the simplest cartesian, not corexy and others！  
No matter how I adjust, the two z’s always move together in sync, and I have no idea how to disable one of them.  
How should I modify it in printer.cfg?!  
Can you give me some advice,savior!!!
