Editing gcode from Fusion 360 and the Inventables post processor

as I documented yesterday in https://discuss.inventables.com/t/periodic-calibration-loss-z-axis-randomly-lost-steps-in-middle-of-a-loooong-cut/23538
I was in the middle of a long cut (~2 hours 15 minutes) when my z lost some steps on the way down and I started air cutting instead of engaging the tool with the material.

I spent all day frustrated as I really did not want to have to go back and start over and watch the machine retrace those steps while holding my breath in case it started to lose steps again. What to do?

Eventually it dawned on me that the Gcode file the XC inputs from easel is JUST A TEXT FILE meaning that if I could decode it, I could edit it. It is currently impossible to know which line I was on when I lost steps, but if I could edit it so I started at a point closer than starting completely over, it is a win.

When I opened the file this is what I saw:

G90G94
G17
G21

(TOOL/MILL,6.35,0,19.05,0)
(STOCK/BLOCK,155.014,277.124,414.295,0, 0, 0)
M9
T1M6
S16200M3
G54
M9
G0X59.321Y48.725
Z16.968
Z-6.798
G1X59.335Y48.731Z-6.936F333.3
X59.377Y48.746Z-7.067
X59.445Y48.772Z-7.186
X59.534Y48.81Z-7.286

I went to google and found this page with a handy list of Gcodes and their meanings which I used to decode what it all meant:

G90G94 G90 = absolute distance mode G94 = units per minute mode
G17 = plane select xy default
G21 = units in mm

(TOOL/MILL,6.35,0,19.05,0) = appears to be cutting diameter, corner radius, flute length which is interesting as it is adding .05 to the flute length versus the tool definition in Fusion…
(STOCK/BLOCK,155.014,277.124,414.295,0, 0, 0) = appears to be stock geometry from setup…
M9 = turn all coolant off
T1M6 = Tool 1 tool change
S16200M3 = spindle speed 16200 rpm start spindle clockwise
G54 = select coordinate system 1
M9 = turn all coolant off
G0X59.321Y48.725 rapid move to absolute coordinate x59.321y48.725
Z16.968 tool up
Z-6.798 tool down
G1X59.335Y48.731Z-6.936F333.3 feed tool into cut…

seemed simple enough.
the challenge then appeared to be how to identify when the tool was starting a new cut,
so I would know where I could edit the file to create a new starting point that would work.
Eventually, after some more eyeballing, I noticed a pattern that looked like this:

G0Z6.968 = fast move, appears 104 times, raises the z to 6.968, which is the safe retraction height
X80.358Y218.36 followed by an x nn y nn to move the spindle over the next entry position
G1Z-7.607F333.3 bring the spindle down to where you want to start the ramp into the cut and set the feedrate to the ramp feedrate…

Once I figured this out, it became pretty simple to create a ‘resume’ version of the file I have been working from.
I picked a new in point about 50% of the way down the file (I failed out at ~65% in)
and deleted everything between the header and the new in point.

when I finished the start of the file now looked like this:

G90G94
G17
G21

(TOOL/MILL,6.35,0,19.05,0)
(STOCK/BLOCK,155.014,277.124,414.295,0, 0, 0)
M9
T1M6
S16200M3
G54
M9

G0 Z6.968
G0X74.637Y208.024
Z-6.798
G1Z-7.607F333.3
X74.666Y208.05Z-7.828
X74.751Y208.125Z-8.021
X74.88Y208.241Z-8.162

I then saved this file and imported it into Easel: it appears to load ok.
eyeballing the toolpath, it appears to pick up close to where I previously failed.
It is too late to run it now, the neighbours would be disturbed,
but this will be my starting point on my next run.
I’ll let you know how it goes.

2 Likes