# Something similar to Marlin's M92 command

**URL:** <https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112>\
**Category:** General Discussion\
**Created:** [August 5, 2024, 4:05pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112 "2024-08-05T16:05:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 5, 2024, 4:05pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/1 "2024-08-05T16:05:09Z")

</div>

Hello, I am a big fan of Klipper firmware and I am finally expanding my horizons to new ways of 3D-printing. I have read through a lot of discussions as well as the documentation, but no one seems to have the same problem I do. Any help is greatly appreciated!

Information about my printer:  
It uses a cartesian coordinate system, but the x-axis motor is used to turn a cylindrical ‘print bed’ around the Y-axis. It is intended to print tube-like parts with increased strength compared to normal cartesian printers.

My problem:  
As the height of the part increases, so does the circumference. This means that one rotation of the X-axis corresponds to a longer travel distance along the printed part. In the past, I used Marlin’s M92 command to set the “steps per millimeter” to reflect the current circumference, but I could not find a Klipper analogue.

The question:  
Is it at all possible to change the “rotation distance” property with gcode mid-print? If not, is it possible (easy enough) to change something in the code which would allow me to do something similar?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![tore1887](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tore1887](https://klipper.discourse.group/u/tore1887)\
**Post date:** [August 5, 2024, 9:22pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/2 "2024-08-05T21:22:55Z")

</div>

I don’t think that is not found in Klipper, but someone may have added something extra. For extruders there is ‘SET\_E\_ROTATION\_DISTANCE’.  
What is missing for extruders is a variable where in a macro one can read back the value that has been set (‘rotation\_distance’: self.rotation\_distance). If you get help with an addition to the code, be sure to include this as well. This simplifies the macro.

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 6, 2024, 11:10am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/3 "2024-08-06T11:10:08Z")

</div>

Thank you for your reply! I will see if I can find the “SET\_E\_ROTATION\_DISTANCE” implementation in the source code and (if at all possible) try to do the same for other axes. I would still greatly appreciate any help or guidance from someone who’s more experienced with the inner workings of Klipper than me 😄

---

<div class="post-metadata">

**Author:** ![tore1887](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tore1887](https://klipper.discourse.group/u/tore1887)\
**Post date:** [August 6, 2024, 12:07pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/4 "2024-08-06T12:07:13Z")

</div>

> [@Francois](#):
>
> ROTATION

In [GitHub - Klipper3d/klipper: Klipper is a 3d-printer firmware](https://github.com/Klipper3d/klipper)  
Pressing ‘Pull request’  
[Pull requests · Klipper3d/klipper · GitHub](https://github.com/Klipper3d/klipper/pulls)  
In Filters delete ‘is:pr is:open’, use ROTATION as search instead  
On page 2 I found ‘change rotation distance at run time’.

1. I don’t know if it’s for you.
2. There is probably a better way to search.

---

<div class="post-metadata">

**Author:** ![olhev](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@olhev](https://klipper.discourse.group/u/olhev)\
**Post date:** [August 7, 2024, 7:46am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/5 "2024-08-07T07:46:07Z")

</div>

If you need to change the amount of material extruded, why not just change the flow multiplier? M221

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 7, 2024, 8:53am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/6 "2024-08-07T08:53:03Z")

</div>

I think I found what I was looking for. Thank you!

After testing it myself I will add the link to my original message.

---

<div class="post-metadata">

**Author:** ![tore1887](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tore1887](https://klipper.discourse.group/u/tore1887)\
**Post date:** [August 7, 2024, 8:57am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/7 "2024-08-07T08:57:30Z")

</div>

Do you have a picture? I still can’t imagine what the printer looks like.

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 7, 2024, 9:00am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/8 "2024-08-07T09:00:32Z")

</div>

@olhev to be clear: Extrusion is not a problem, the rotation of the x-axis is. If I want to print x-mm in the x-direction, the printer needs to know how much to turn the motor based on the height of the part. If I were to work with degrees instead of mm, the problem is kind of solved, but it creates a speed problem. At larger diameters, a rotation would produce a much higher nozzle speed relative to the printed part than at smaller diameters.

I am making my own slicer so extrusion math and units can be what I need them to be.

---

<div class="post-metadata">

**Author:** ![olhev](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@olhev](https://klipper.discourse.group/u/olhev)\
**Post date:** [August 7, 2024, 9:16am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/9 "2024-08-07T09:16:16Z")

</div>

Sorry I thought the E distance was being discussed.

You can change via gcode also the X axis rotation distance,if you want. That should work.

I’d be interested in seeing the printer and something printed with it, if you have photos.  
Quite unusual project.

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 7, 2024, 9:16am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/10 "2024-08-07T09:16:58Z")

</div>

@tore1887 Unfortunately, I have not designed the rotary part, but here is a picture:

 ![image](https://global.discourse-cdn.com/free1/uploads/klipper/original/2X/c/cbdf5d4838ae2c4dfd4974eb7f08dc88a10fdb7d.jpeg)  
It is a coreXY setup with 3 Z lead screws. The “rotary module” will essentially be a stepper motor attached to the Z lead screw on the back with the shaft facing forward (red arrow)

CoreXY would be disabled, and both motors would be set up as Y-axis motors. That way I can “disable” the X-axis of the coreXY setup and use the new motor as X.

---

<div class="post-metadata">

**Author:** ![olhev](https://avatars.discourse-cdn.com/v4/letter/o/54ee81/32.png) [@olhev](https://klipper.discourse.group/u/olhev)\
**Post date:** [August 7, 2024, 9:19am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/11 "2024-08-07T09:19:49Z")

</div>

My bad, there is no gcode for the XY rotation distance but you can still change inner parameters of the printer via macro, just I’m on the phone and I cannot easily find it right now.

---

<div class="post-metadata">

**Author:** ![tore1887](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tore1887](https://klipper.discourse.group/u/tore1887)\
**Post date:** [August 7, 2024, 9:24am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/12 "2024-08-07T09:24:37Z")

</div>

So then you want to make changes for each layer? @masterxq has created this ‘Volumetric Flow Rate Limit’. Look here:

> <https://github.com/masterxq/klipper/blob/master/klippy/kinematics/extruder.py>

I myself have made some changes to be able to use variables in macros. But I’m not good at python so I haven’t posted this.

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 7, 2024, 9:34am UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/13 "2024-08-07T09:34:31Z")

</div>

For now, this seems to be what I’m looking for:

> <https://github.com/Klipper3d/klipper/pull/4911>
>
> my modification for a personal prototype that has z axis modifyng rotation dista…nce at run time

I will try it out and post my results 😃

---

<div class="post-metadata">

**Author:** ![dmbutyugin](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@dmbutyugin](https://klipper.discourse.group/u/dmbutyugin)\
**Post date:** [August 7, 2024, 7:06pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/14 "2024-08-07T19:06:33Z")

</div>

Indeed this is not something supported by Klipper out of the box. Besides the PR you referenced, you may find it useful to try the new `generic_cartesian` kinematics being [developed](https://klipper.discourse.group/t/new-generic-cartesian-kinematics-incl-corexyu-corexyuv-generic-idex-and-awd/17510). There I added a [support](https://klipper.discourse.group/t/new-generic-cartesian-kinematics-incl-corexyu-corexyuv-generic-idex-and-awd/17510/20) of the `SET_STEPPER_KINEMATICS` command. While originally I had other usecases for it in mind, you could conceivably use it to scale the stepper movements for a given axis in case you have a plain Cartesian kinematics, e.g. if you have in the config

```auto
[stepper x]
kinematics: x
....

```

then during the print you could issue commands like

```auto
SET_STEPPER_KINEMATICS STEPPER='stepper x' KINEMATICS=1.005x

```

which would make stepper move 0.5% more on X axis movements.

Just one thing to keep in mind, regardless of which approach you choose. It is very important where the toolhead is when you change the rotation distance or axis scaling. This is because when you change the scaling, the toolhead won’t move, but all subsequent moves will be scaled relative to the position where the command was issued. So you may need it to be either in the center of the print, or stable on one side of the print, depending on what you want to achieve exactly. Also, I don’t think axis scaling would work well if you are printing in vase mode, as you want to scale the axis with Z, and in vase mode Z changes continuously.

---

<div class="post-metadata">

**Author:** ![Francois](https://avatars.discourse-cdn.com/v4/letter/f/77aa72/32.png) [@Francois](https://klipper.discourse.group/u/Francois)\
**Post date:** [August 7, 2024, 7:42pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/15 "2024-08-07T19:42:12Z")

</div>

@dmbutyugin This is perfect. Will definitely give it a try! Thanks a lot 😃

---

<div class="post-metadata">

**Author:** ![tore1887](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tore1887](https://klipper.discourse.group/u/tore1887)\
**Post date:** [August 7, 2024, 8:26pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/16 "2024-08-07T20:26:38Z")

</div>

> [@dmbutyugin](#):
>
> then during the print you could issue commands like
> 
> ```auto
> SET_STEPPER_KINEMATICS STEPPER='stepper x' KINEMATICS=1.005x
> 
> ```
> 
> which would make stepper move 0.5% more on X axis movements.

Is there any variable that can read back into a macro?

---

<div class="post-metadata">

**Author:** ![dmbutyugin](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@dmbutyugin](https://klipper.discourse.group/u/dmbutyugin)\
**Post date:** [August 7, 2024, 8:29pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/17 "2024-08-07T20:29:58Z")

</div>

You mean, the current kinematics? It is exported as `printer.toolhead.stepper_kinematics` as a map from stepper name to an array of x,y,z coefficients, e.g. you can read X axis scaling as `printer.toolhead.stepper_kinematics['stepper x'][0]` in a macro.

---

<div class="post-metadata">

**Author:** ![tore1887](https://avatars.discourse-cdn.com/v4/letter/t/a87d85/32.png) [@tore1887](https://klipper.discourse.group/u/tore1887)\
**Post date:** [August 7, 2024, 8:53pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/18 "2024-08-07T20:53:12Z")

</div>

Thanks. This is something I hold dear. I think that every time there is SET\_SOMETHING there should be an opportunity to read this back. This avoids creating a variable in a macro. Which may be used by several other macros.  
Should the last [0] be included? Haven’t seen anything like this before.

---

<div class="post-metadata">

**Author:** ![dmbutyugin](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@dmbutyugin](https://klipper.discourse.group/u/dmbutyugin)\
**Post date:** [August 7, 2024, 9:12pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/19 "2024-08-07T21:12:08Z")

</div>

The exported is an array of coordinates, so [0] would be X, [1] would be Y coefficient, and so forth. The code that exports all this stuff is [here](https://github.com/dmbutyugin/klipper/blob/generic-cartesian/klippy/kinematics/generic_cartesian.py#L354-L357). And in general, if you check [Status reference - Klipper documentation](https://www.klipper3d.org/Status_Reference.html), you can find many instances like this, e.g. `printer["neopixel <config_name>"].color_data[1][2]`.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/klipper/original/1X/64419bf2aac6639e6ef5cef200dcd456b0a01ac3.png) [@system](https://klipper.discourse.group/u/system)\
**Post date:** [October 6, 2024, 9:12pm UTC](https://klipper.discourse.group/t/something-similar-to-marlins-m92-command/18112/20 "2024-10-06T21:12:45Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
