Bug: after tool change, coordinates lost, please fix

I use a tool change macro. It issues move commands. The spindle is not where it was before the tool change. Kiri does not send tool back to where it was.

I drill a column of holes with a tool change for some of the holes. All have the same X value. Kiri does not repeat the column (X) coordinate after the M6 tool change macro.

part of the nc file:
G0 X14.0400 F800
G1 Z-1.1 F60
G1 Z1.5000
; ending drill op after 4 seconds
; starting drill op
;M6 T3 ‘end 1/16’ ; start of my macro
M5 ; stop spindle

G0 X20 Y20 ; go to work piece for Z probe

M3 ; restart spindle and go on
; end tool change macro ; end of my macro
M3 S10000
G0 Y18.5325 F800 ; kiri thinks the spindle has not moved, Xvalue is suppressed.
G1 Z-1.1 F60 ; hole is in the wrong place.

Took a while to figure out why the .nc file was broken, Now, I fix each .nc file by hand. Would rather not have to.
Thank you, Mitch

Tool changing is either a complex sequence that your sender/machine handles automatically with a single command, or one you can script yourself in the tool change macro.

I take your response as dismissive. You seem to be saying Kiri has no responsibility to put the tool back were it was before the tool change.

if so, How does my Tool Change Script know the tool position just before the tool change? is there a variable name I can use in the script? Did I miss a variable that contains the tools current position?

Hopeful, Mitch

Hi Mitch,

I didn’t mean to be dismissive. I have experience with only two types of tool changes with cnc machines.

  1. full automated. the tool change command does all the heavy lifting of swapping tools and returning the head to the previous position with new tool length/offset accounted for

  2. fully manual. the tool change command puts the sender into a “paused” state where the human can then take over and perform all necessary work to change and re-calibrate the new tool. once done, the human hits “resume” on the sender.

If your machine isn’t the fully automated type and requires human intervention and because KM just outputs a script, it cannot know where you left the head or tool or new tool offset after changing it. If the next move was just to a saved location, that might work, but it could also cause a collision if not done very carefully.

Happy to hear your thoughts on ways that might work better for you.


Thinking there might be a variable, I searched and found:

It show FDM variables (not CAM) for

  • {pos_x} = last output X position
  • {pos_y} = last output Y position
  • {pos_z} = last output Z position
    I will try them in my CAM Tool Change Macro and report back.

Very fast response. Thank you.
I am type 2. Using a 3018 class mill.
Away from the machine, not where I can post my macro.

I use a pause. Lift and move tool to a safe spot. Manually change the tool (with a wrench). Send the tool back to an offset from the job origin. Probe for new Z offset. Resume job.

I expected Kiri to provide X and Y where it left off.
Easy enough for Kiri, no harm if tool is already there.
I was wrong.
If pos_x and pos_y get me there, I am a happy camper.

Regards, Mitch

the FDM and CNC post processors are separate code paths. I’ll add pos_x, pos_x, pos_z to the CNC vars for your macro and push it later today

super awesome support.
Give us an inch and we will ask for a mile. Silly users…

Your responsiveness makes me visit my WIBNif list. (Would’nt It Be Nice if) #1 Stop air-milling. I cut a pocket using trace, then slots in the bottom of the pocket. Kiri mills the slots from top of stock, through missing pocket (air), into remaining material. gets the job done. I should not complain.

I know Kiri does some tracking of removed material. I had “cut through” set on a trace. The future slots were removed by the cut- thru. Kiri refused to generate the slots. finally noticed the cut-thru and removed it. That’s when the air-milling appeared.

Just a wish. No pressure.
Thank you for the pos_x … fix.
Regards, Mitch

if you set trace down to 0, it will mill the trace only and not the material above. KM does not currently track removed material. that’s a major refactor.