Generate Bounding Box as a Subprogramm

Since the controller of our China CNC does not have a function to generate the bounding box from the loaded gcode, I wrote a small web application that does exactly that: Bounding Box

Today I had the idea that Kiri could easily generate it and embed it into the nc-file. Have you already done such a function or can you point me in this direction?

CNC.js offers such a function:

G90
G0 Z10 ; go to z-safe
G0 X[xmin] Y[ymin]
G0 X[xmax]
G0 Y[ymax]
G0 X[xmin]
G0 Y[ymin]

Kiri has these vars internally. I could surface them in the gcode macro vars and then you could add that to your device header.

1 Like

Thank you for your reply. I’ll check how the machine handles macros and subroutines. I’ll let you know when I have some news. :slight_smile:

to be clear, this will require some changes on my part. I’m in the middle of some refactoring, so it could be a couple of weeks.

That’s fine for me. As I mentioned, I have a workaround with my webapp. So there is no hurry. :wink: