Tool Changing - Storing and retrieving z-offsets



  • Hey there!

    So I have an issue with the tool changing capability of my printer as I cant seem to make heads and tails of the tool offset function in conjunction with the coordinate system.

    I planned to use one coordinate system for machine commands that shall not be altered by the tool offset., however the tool offsets persisted and so a tool drop of, after homing G30 S-2 was not possible.

    Now, to pick up tools, I knock all relevant commands into G53 (unaltered machine coordinate system). This works kind of.

    My tools are of slightly different sizes and I cycle trough the tools and use the G30 S-2 command on each to properly set Z=0 for each of them. Now the funky stuff happens. I have not found a function/gcode to print the current offset of the tool. However I can switch off the tool (T-1 P0). As I have not moved the tool yet, it should report back the position the tool has relative to the position without the tool offset.

    This is an approximation of what I ran:

    T0                         ; call tool 0
    G1 X0 Y0 Z10 F9000         ; Move to center ready for probe
    G30 S-2                    ; probe bed and set tool offset
    G1 X0 Y0 Z10 F9000         ; Move to safe position
    

    Now my position is X0 Y0 Z10 with the tool. Next step is to switch into a non-tool-offset

    T-1 P0                       ; deactivate tool
    

    Nw the funny thing happens: My position is X0 Y0 Z10. However this should be the actual position plus (or minus) the tool offset. Now when I activate the tool again.

    T0 P0                       ; activate tool
    

    I get X0 Y0 Z10.88.

    T-1 P0                       ; deactivate tool
    

    I get X0 Y0 Z10. Even though it should now show me the position with the tool offset.
    So when the tool is activated the first time its at Z10, when I deactivate it stays at Z10 which I think it shouldn't . When I reactivate the tool it adds the offset. And voila, I got nearly one mm offset where there was not supposed to be one.

    This shows me a couple of things:

    1. The tool offset is in there somewhere, which is good.
    2. The tool offset is associated with the tool, which is good too.
    3. The tool offset is only added after I deactivate the tool and reactivate it, which is not good.
    4. I cannot find out the tool offset this way as it is unreliable and not reasonable.

    My probing is in the heated bed at the bottom and provides reasonably accurate results (< 30mue @ 100 reps ), so I can rule this out.

    As of now I solved this problem with hard coding the z-offsets of the tools into G10. However this is not an longterm option as I intend to switch around the tools frequently.

    If you know your way around this issue, please help me!


  • administrators

    @Deltasquare said in Tool Changing - Storing and retrieving z-offsets:

    I have not found a function/gcode to print the current offset of the tool

    Two ways:

    1. G10 P# (where # is the tool number) will print the temperatures and offsets of tool #
    2. In RRF 3.1 the tool offsets are available from the object model, for example "echo tools[0].offsets[2]" will return the Z offset of tool 0.


  • Thank you!

    This helps with displaying the offset, but should the offset displayed not switch around depending on the chosen tool?

    Is the bug "tool offset honored but not displayed correctly" not fixed yet?

    Regards



  • @Deltasquare said in Tool Changing - Storing and retrieving z-offsets:

    Thank you!

    This helps with displaying the offset, but should the offset displayed not switch around depending on the chosen tool?

    Both methods require a tool# be issued
    You can probably get what you want with something like (assuming you want Z offset)

    if state.currentTool != -1
    	M117 {"Z offset of  " ^ tools[(state.currentTool)].name ^ " is  " ^ tools[state.currentTool].offsets[2]}
    else
    	M117 {"No tool selected"}