So I'm building a corexy printer with a scissor-lift style z axis. The whole idea is the printer folds down flat at z=0 so it can fit in a briefcase. The catch is the scissor mechanism means bed height changes non-linearly compared to the stepper's linear input, so I worked out the math for it: h = sqrt(Lc - (1/4)c^2), where h is the bed height, L is the distance between the end hinges and the center hinge, and c is the distance from the roller hinge to where it sits at z=0. Rearranged for c it comes out as c = 2(L - sqrt(L^2 - h^2)). Since I'm using corexy for x and y, I took Klipper's corexy.py and swapped the '*pos[2]' in the calc_position function at line 35 for 2(length - math.sqrt(length**2 - pos[2]**2)). My understanding is this function takes the bed height you want and figures out the stepper position needed to get there, so that swap should handle the scissor geometry. Now I want to try this on my current prototype. I can edit printer.cfg in Mainsail fine, but I have no clue how to link that config to my modified kinematics script so Klipper actually loads it. Any advice or pointers to an explanation somewhere would be much appreciated. Sorry if this has been asked before, I searched and came up empty. TYIA
How do I make printer.cfg use my custom kinematics python file?
Nov 21, 2026
Last reply: 13 hours ago
4 Replies
First reply
can't point at your script, that's the catch. The kinematics line in the config is just a name, and Klipper looks that name up inside its own klippy/kinematics folder on the host machine. So there's no way to link it from Mainsail alone. You'll need to ssh into the Klipper…
Read the full replyprinter.cfg can't point at your script, that's the catch. The kinematics line in the config is just a name, and Klipper looks that name up inside its own klippy/kinematics folder on the host machine. So there's no way to link it from Mainsail alone. You'll need to ssh into the Klipper host, drop your modified corexy.py over the stock one, or make a new folder with your own kinematics and reference that new name in printer.cfg. Then restart the Klipper service. Depending on how deep you go you may also need to rewrite the C helper code, so don't assume it's a pure python change.
Before you commit to that, though, it might already be doable with the generic cartesian kinematic and a more complex printer.cfg. No custom python or C at all, just config. If that works it's a much easier path to maintain, since your modified file would get wiped every time you update Klipper otherwise.
One thing on the geometry: the c = 2(L - sqrt(L^2 - h^2)) form only holds if h is the vertical travel of the center scissor hinge measured from the flat position. If you're actually after the full height of a symmetric scissor mechanism, the relation comes out differently, so it's worth re-checking which h your bed really needs before you bake it into code. Also, if all you're doing is inverting the whole thing, the original corexy kinematics might work as-is, X and Y would be the same but flipped. The question is whether Z ends up linear, because looking at that scissor in my head the Z rotation distance seems to change depending on how close the joints are to each other. Which lines up exactly with the non-linearity you worked out, so your custom math may well be the right call in the end.
Genuinely cool project either way. I've wanted a printer that packs down small enough to travel with for ages, so I'm rooting for this one.
The ssh part is what stumped me too when I first wanted to change how my own machine moved. Editing things in the web interface feels like it should be enough, but the kinematics live on the host, so it was off to the command line for me. Once I got over that hump it stopped feeling scary. For you, the thing that jumps out most is the geometry check, since if h means something slightly different than you assumed the whole conversion in your calc_position edit would be quietly wrong. Also curious, does your lead screw drive the scissor from the roller hinge directly? That would explain why you treated the stepper input as c.
Yeah, the geometry check is the part that got me too when I worked out a linkage for my own build. I had my h defined one way in my notes and another way in the code, and the bed moved right for a bit then drifted, which was a fun afternoon to debug. So double check what your h actually measures on the scissor before you bake it into the python, it saves a lot of head scratching later.
Update: okay, ssh it is then. One of the replies mentioned the generic cartesian kinematics might already handle a non-linear z just through printer.cfg, which would save me all the python editing. Does that mean Klipper can apply a curved z mapping natively somehow, or would I still be back to ssh for the scissor math? Also taking the note about double checking what h actually measures seriously.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required