How to Move Z motors

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!

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

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. Also, when writing extras myself, I look at the builtin Klippy extras here.

This is perfect. Thank you!

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.

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

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""")

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.


printer(1).cfg.txt (5.5 KB)

I have downloaded and replaced your klipper file here
And,I have also changed what needs to be modified below:

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!!!