Page 1 of 1

Does not handle G82

Posted: Sun Aug 29, 2021 1:36 pm
by tomeletctronics
I have just noted that the autoleveller does not handle the Linuxcnc G82 command (Drilling Cycle, Dwell) correctly. This command will retract the tool after the drilling operation to the Z level before the execution of the command.

The following is an extract from the original G-code file:
G00 Z1.0000
G82 X33.0200 Y78.7400 Z-0.2540 F144.00 R1.0000 P1.000000
G00 X33.0200 Y7.6200
G01 Z-0.2540 F144.00

and results in:
G00 Z1.0000
#102=[#522+0.24983*#519-0.24983*#522]
#101=[#523+0.24983*#520-0.24983*#523]
#100=[#102+0.33282*#101-0.33282*#102]
G82 X33.0200 Y78.7400 Z[#100+-0.2540] F144.00 R1.0000 P1.000000
#102=[#522+0.70683*#519-0.70683*#522]
#101=[#523+0.70683*#520-0.70683*#523]
#100=[#102+0.33282*#101-0.33282*#102]
G00 X33.02000 Y73.74000Z[#100+-0.2540] ;segmented line. Max segment length set to 5

which will mill the surface rather than move above it. This is also shown in the attached picture, indicated by the red arrow.
Capture.PNG

Re: Does not handle G82

Posted: Sun Aug 29, 2021 3:57 pm
by Country_Bubba
The way I read this is the first part of the command adjusts for the height of the surface (#100) and then it will drill down the 0.2540 depth and then dwell the required time and return to the proper height.

Re: Does not handle G82

Posted: Mon Aug 30, 2021 7:20 pm
by tomeletctronics
The problem is the G0 move on the last line of the code extract that is done at #100+-0.254:
G00 X33.02000 Y73.74000Z[#100+-0.2540] ;segmented line. Max segment length set to 5

It should be:
G00 X33.02000 Y73.74000Z[#100+1.000] ;segmented line. Max segment length set to 5

since the retract (R) in the G82 line is set to 1.0:
G82 X33.0200 Y78.7400 Z-0.2540 F144.00 R1.0000 P1.000000

Re: Does not handle G82

Posted: Mon Aug 30, 2021 10:35 pm
by daedelus
Hi yes I think I can see the cause of the problem. Autoleveller does its levelling business on any line that it thinks Z is negative. On the G82 line it drills down to a negative value but actually will pop back up to a positive value at the end, but this line doesnt explicitly state this. Therefore in the next G0 line, Autoleveller still thinks Z is negative and will attempt to level Z, whereas Z is not really negative and should be left alone.

Thanks for pointing this out and I will try to publish a fix for this. In the meantime though, I suppose the easiest workaround is to ensure your drill holes are "deep enough" and not run Autoleveller on this drill file, only on the milling files.

EDIT: So what I mean is that even though the R / retract value is set to 1.000000, Autoleveller ignores the R value and just looks at Z. So when it gets to the next G0 line it thinks Z is still a negative value and Z will need to be levelled and set explicitly, which of course is not the case.

Re: Does not handle G82

Posted: Tue Aug 31, 2021 2:02 pm
by tomeletctronics
Thanks for your attention to this issue.

Actually it's not a drill file, it's an etch file created with Eagle and the pcb-gcode ulp. There is an option to spot all hole positions with the engraving tool so a tiny drill won't wander off and break when the drill operation is executed.

I think the easy, short term fix, in my case is to omit the spot drilling option and hope for the best :-) when I run the drill file.

Re: Does not handle G82

Posted: Wed Sep 01, 2021 9:07 am
by daedelus
Ah yes, I forgot about the spot drilling option. Its been a while since I used eagle to be honest.

Heres another option then, you could insert a quick G0 line immediatly after G82 lines. i.e.

G00 Z1.0000
G82 X33.0200 Y78.7400 Z-0.2540 F144.00 R1.0000 P1.000000
G00 Z1.0000
G00 X33.0200 Y7.6200
G01 Z-0.2540 F144.00

Your tool wont move as it should be at 1.0000 anyway, but it should stop Autoleveller thinking Z is negative and so the following line wont be touched by Autoleveller and you wont mill into the surface.

You could use a text editor to search for all the G82 lines in your original gcode and insert the highlighted line after each one, then run it through Autoleveller as normal. I think that will work. Just an option.