Postprocessor questions - sequence of events


I’ve been having a look at a few post processors, and was wondering with regards to plasma and THC what the sequence of function calls was likely to be by sheetcam as it seems some post processors seem to call some events differently and hence the events are within different functions.

Is there a manual / flowchart somewhere?

Its mainly because I see some THC postprocessors are not using the cutHeight variable, despite using the pierceHeight variable, hence I’m unsure if they are dropping to the cutHeight via OnMove() or even possibly OnArc() (as the DHTC postprocessor does).

When is OnPenDown() called, is it everytime the Z axis moves down, or just at the start ?

Hence in a JetOperation using a PlasmaTool, what would be the sequence of events…
OnRapid() – move to start of cut operation
OnPenDown() – reference the Z axis, fire the torch, allow for pierce delay and drop to cut height (at PlungeRate)
OnMove() – cut at feedrate

Or is it
OnRapid() – move to start of cut operation
OnPenDown() – reference the Z axis, , fire the torch, allow for pierce delay and drop to cut height
OnMove() – drop to cut height (at PlungeRate)
OnMove() – cut at feedrate

I am trying to figure out what triggers the “OnPenDown()”, is it called once at the start of the cut, followed by an OnMove() which is the X and Y motion, or is the drop to cutheight also captured in this OnPenDown(), or does it have its own OnMove()

Sorry about the long post, I hope it makes sense, some guidance of the sequence of function calls.



(in case you’re wondering I’m adding in THC voltage + delay settings to store directly with the tool and then send off to the THC on tool change [which I’ve figured out and am happy with], I also have an pneumatic engraver on my machine running off a couple of relays, happy with all of that, just trying to learn something here and understand what others have done in a little more detail, thanks for your time).

The sequence is:
OnRapid() Move to X,Y coordinates of cut
OnRapid() Move down to pierce height
OnPenDown() Reference, Turn torch on etc
OnMove() Move down to cut height at plunge rate
OnMove/OnArc… cut shape.

OnPenDown occurs every time the torch moves down at the start of a cut. For a very minimalist post you only need to turn the torch on in OnPenDown.

Looking back it would have been better for OnPenDown to fire before the move to pierce height. The problem is that if I change it now I could break quite a few post processors that rely on the current behavior.

Les, thanks very much for the insight, it’s great I now understand a little more.

Nope, wouldn’t change a thing, but it now explains why the onmove() functions look the way they do with the z axis motion.

For me it’s a hobby, and I’m happy to tinker and learn post-processors, lua, m3, m4 etc

Thanks for taking the time,


Les - Were you able to come up with a work around for this? I am having the same issue where the machine rapids to pierce height before touching off on the material. If the sheet is warped more than the pierce height then the torch hits the material before the homing is activated. It would be ideal if the post would perform the home from the rapid clearance height. Shown below is the PenDown() post and what it produces. Any advice would be great. Thank you.

function OnPenDown()
post.ModalText ( G28.1) <---- Perform homing routine
post.NonModalNumber ( Z, pierceHeight scale, 0.0000) <---- starting at pierce height so the machine doesn’t have another up/down move
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.ModalText ( G00) <---- Rapid to Pierce height after homing
post.NonModalNumber ( Z, pierceHeight scale, 0.0000) <---- Add in Pierce height number
post.Text (n M07n) <---- Turn on Torch
if (pierceDelay 0.001) then
post.Text ( G04 P) <------Dwell
post.Number (pierceDelay,0.###)

G Code
N0110 G00 Z1.0000 <----Rapid torch up after last cut
N0120 X1.6918 Y0.6050 <----Rapid to pierce location
N0130 Z0.2500 <----Rapid down to pierce height (this is what would be best to remove)
N0140 G28.1 Z0.2500 <----Start homing routine from pierce height (would rather start from Rapid Height)
N0150 G00 Z0.2500 <-------Rapid to Pierce height
N0160 M07 <-------Turn on torch
N0170 G04 P0.1 <-------Dwell
N0180 G01 Z0.0700 F10.0
N0190 G02 X1.3718 Y0.2850 I-0.3200 J0.0000 F55.0
N0200 X1.3718 Y0.2850 I0.0000 J0.8713
N0210 M09

One option is to filter out that Z rapid move. In OnRapid(), change your Z code to look something like this:

   if endZ > currentZ or endZ ~= pierceHeight then
      post.ModalNumber (" Z", endZ * scale, "0.0000")