Klipper CNC Feature (G38.2 gcode help)

Hello everyone,

I’ve been using klipper running my 2 printer and loved it. As i’m starting a CNC project that was supposedly run on Marlin, i want to use klipper instead.

It has successfully setup on all the XYZ motors and spindle control. The only problem is to probably have G38.2 command for probing XYZ axis.

I’m using the config macros i found from vladbabii/klippy-cnc github. The only problem is that it seems that it has been coded long time ago and seems like is no longer maintained. (Especially the G38.2 gcode)

I dont understand how to code these except for changing config files / creating macros. Is it possible to add these feature or can anyone help with the G38.2.cfg to be workable? I have attached the config file that i may find related from vladbabii/klippy-cnc github.

I hope i can work this out before i give up and opt to Marlin instead. Will be great if Klipper is usable for CNC, as a lot are using Marlin for now and its hard to find info on how to use klipper for CNC but i see quite a few people who has done that. Thanks a lot in advance.

g38.2.cfg (1.4 KB)
kcnc_probe.cfg (3.4 KB)

Also attached another file that may be related

kcnc_probee.cfg (5.6 KB)

Try GitHub - enarges/klippy-cnc: KCNC - Klipper CNC Macro Package

Thanks Sineos. I tried that and does not seem to work. Many of the codes shows error. Actually i just need G38.2 to work on the device, however there seems to be many dependencies on these klippy cnc configs.

If there is a way to just have G38.2 single config that allows me to home X, Y and Z, that will be great.

I had a look at this CNC package and:

  • the macros are fully interlinked
  • commands cannot be cherry-picked individually (at least not easily)
  • needs best be installed via its installer script
git pull https://github.com/enarges/klippy-cnc.git
cd klippy-cnc
./install.sh

If you want to try it you should roll back any previous attempts to install such commands manually.

I don’t think that probing can be implemented with just macros. I have implemented some XYZ probing feature in Klipper time ago which won’t be usable for you unfortunately, because it uses a load-cell based sensor, which you likely do not have. I decided to move away from that sensor type (for CNC milling - still using it for 3D printing bed probing) and instead use a normal 3D probe head, which will require me to implement this properly :slight_smile: It will be some weeks until it is ready for testing, also the probe head has yet to arrive (and then needs to be assembled by me).

What you might already try or at least look at is this code:

It allows to computed the coordinate system after probing the X and Y axes and apply a transform to all movements such that you always move along the probed coordinate system. It corrects not only for offsets (which is trivial) but also rotations. I have used this code already successfully for some milling projects. In theory it can be used together with some manual probe - you will just need to call the EDGE_TOUCH command with the right DIRECTION argument when the toolhead is in contact with the edge. If you repeat this for at least 3 points (so both axes are fully defined), you can run the COMPUTE_WORKPART command to get the transform computed and applied.

I have never used any firmware really made for CNC machines, so it would be good to get some feedback whether my approach and workflow makes sense or is somehow weird.

Also it would be good to get some feedback if the target audience of this feature would be big enough to get this merged into the Klipper main repository eventually.

Ah thank you for the advice and response guys. I think these are more complicated than i expected. May try to go for simpler route and not use XYZ probing for now. Appreciate your help thankss.