Toolchange_Custom

Issue #419 resolved
Stefan Lechner created an issue

Hi, me again.

Milling CNC 1610 Grbl 1.1f
OS: Ubuntu 20.04
Flatcam Version: Beta branch

I tried to add the following toolchange gcode:

G00 Z%z_toolchange%
G00 X0,0
T%tool%
(MSG, Change to Tool Dia = %tooldia% )
M0
G21G91G38.2Z-30F30
G0Z1
G38.2Z-2F10
G92Z0
G0Z%z_move%

tool & tooldia always point to the last tool int the list.

(TOOLS DIAMETER: )
(Tool: 1 -> Dia: 0.762)
(Tool: 2 -> Dia: 0.8)
(Tool: 3 -> Dia: 0.9)
(Tool: 4 -> Dia: 0.95)
(Tool: 5 -> Dia: 1.52)

Generated G-Code for all toolchanges:

G00 Z25.0
G00 X0,0
T5
(MSG, Change to Tool Dia = 1.52 )
M0
G21G91G38.2Z-30F30
G0Z1
G38.2Z-2F10
G92Z0
G0Z2

btw. the variables: x_toochange,y_toochange and no_drills form the dropdown are leading to a error

[ERROR] There is no such parameter: %x_toolchange%
[ERROR] There is no such parameter: %t_drills%

That’s not a problem, it’s cosmetic but the wrong tool number leads to handling errors

Comments (4)

  1. Marius Stanciu

    Ok the problem is that the custom toolchange macro is applied after the GCode is generated, by replacing the M6 keyword with the inserted text block. Which yield the results you mention because the variables indeed hold the latest values.

    This needs to be reworked, and the custom toolchange need to be called and applied while the Gcode is created which means that the CNCJob methods that generate Gcode need to be modified.

  2. Stefan Lechner reporter

    Thank for looking at it. I managed it to get a PyCharm instance working, to debug the issue. (On a Linux VM on OSX it’s a nightmare).
    However I copied the Toolchange custom, and adapted it to my needs. It’s untested by now. But I’ll put it to a pull request, if it’s working.

    I can also have a look, if we could change the behavior of the macro version. There are some other “specialities” I want to have a look at.

    “Why does a Isolation routing with a V tool, generate an initial tool change, but the cut out does not..”

  3. Log in to comment