Plasma postprocessor error - pierce height in wrong place

Hello!

Pierce height for plasma torch is 6 mm, cutting height is 3 mm, pierce delay is 1 sec.
In my postprocessor file I have:

function OnPenDown()
if(dist >= refDistance) then
dist = 0
post.ModalText(" G38.2 Z-6\n");
post.ModalText(" G1 Z#5063\n")
post.ModalText(" G10 L20 Z0\n")
end
if (preheat > 0.001) then
post.ModalText (" G00")
post.ModalNumber (" Z", cutHeight * scale, “0.0000”)
post.Text (“\n G04 P”)
post.Number (preheat,“0.###”)
post.Eol()
end
post.ModalText (" G00")
post.ModalNumber (" Z", pierceHeight * scale, “0.0000”)
post.Text (“\n M03\n”)
if (pierceDelay > 0.001) then
post.Text (" G04 P")
post.Number (pierceDelay,“0.###”)
post.Eol()
end
end

But in the postprocessed g-code I have:
G00 Z10.0000
X47.7415 Y71.7516
Z6.0000
G38.2 Z-6
G1 Z#5063
G10 L20 Z0
G00
M03
G04 P1
G01 Z3.0000 F400
G02 X46.1155 Y70.9559 I-1.2108 J0.4151 F2000.0


The problem is that G0 Z6 is inserted before the probing move and then there is blank G00, which is not valid.
I see 2 possible solutions:

  1. make it not to post Z6.0000 before the probing move;
  2. make it repeat that same number afterwards (I do not know why Sheetcam does not write coordinates again, even if it is not supposed to change - it would make restarting from middle of file easier and it does not make sense, because F word is repeated even though it does not change)

Any suggestions will be appreciated - I would like to avoid editing code by hand

Hi Viesturs,

Sorry for the delay in replying.

  1. make it not to post Z6.0000 before the probing move;

Add this to the beginning of OnRapid():

if(endZ == pierceHeight) then return end



  1. make it repeat that same number afterwards

The post knows nothing about your code so it doesn’t know the physical Z has changed. There are two options:

  1. use
post.NonModalNumber (" Z", pierceHeight * scale, "0.0000")
  1. after your refernece use
post.CancelModalNumbers()

Thank you, the first suggestion works great!

What I meant was: it positioned Z at pierce height before probing moves, then it inserts probing moves and then again should insert Z position of pierce height, but Sheetcam does not post coordinates, which match the last commanded position of the same axis.
For example, if I nest parts so that start/end points of parts are on a straight line, parallel to X or Y, for the rapid move between parts there will be only one coordinate - the one that is changing.
What I would find convenient for situations, when job needs to be restarted in the middle of the file (unfortunately I have to do that pretty often on my router), is to have both X and Y coordinates in all linear moves.
Is that possible in any way?

As I said SheetCam doesn’t understand those probing moves. As far as the post is concerned it is just outputting text. It doesn’t care what that text actually does. Using CancelModalText() as I suggested would tell SheetCam not to make any assumptions about the current machine position.

What I would find convenient for situations, when job needs to be restarted in the middle of the file (unfortunately I have to do that pretty often on my router), is to have both X and Y coordinates in all linear moves.
Is that possible in any way?

Of course. Change the lines that output X and Y coordinates to use NonModalNumber instead of ModalNumber. You’ll probably also want to do that with I and J on arcs.

Ok, got it. Thank you!