Post processor files are written in the Lua macro language. See http://www.lua.org and  http://lua-users.org/wiki/LuaDirectory
The post is event based. Each event has a function associated with it.

The available events are:

function OnAbout(event)

function OnInit()

function OnNewLine()

function OnFinish()

function OnRapid()

function OnMove()

function OnArc()

function OnDrill()

function OnDrillStart()

function OnDrillEnd()

function OnAutoTap()

function OnRigidTap()

function OnTapStart()

function OnTapEnd()

function OnPenUp()

function OnPenDown()

function OnSetFeed()

function OnToolChange()

function OnNewOperation()

function OnNewPart()

function OnSpindleCW()

function OnSpindleCCW()

function OnSpindleOff()

function OnSpindleChanged()

function OnFloodOn()

function OnMistOn()

function OnCoolantOff()

function OnComment()

function OnNewEntity()

function OnFileOpen()

function OnFileClosed()

Message(text,[text],...)

Warning(text,[text],...)

Error(text,[text],...)

Text(text,[text],...)

TextDirect(text,[text],...)

ModalText(text)

CancelModaltext()

Number(number, format)

FormatNumber(number, format)

ModalNumber(text, number, format)

NonModalNumber(text, number, format)

CancelModalNumbers()

Eol()

SetCommentChars(source chars, replace chars)

ArcAsMoves(Tolerance)

SetEncoding(Encoding)

The following functions should only be called at post load time.

This means that they should be outside any other function definition.

DefineVariable(varName,units,min,max)

DefineCustomOption(caption,varName,units,min,max, default)

ShowCustomOptions(caption)

DefineCustomToolParam(toolClass,caption,varName,units,default,min,max)

ForceExtension(extension)

SetOptions(option)

The following predefined variables are available:

currentX,currentY,currentZ

endX,endY,endZ

arcAngle

arcCentreX,arcCentreY

plungeSafety

drillStart

drillZ

drillPeck

drillRetract

safeZ

materialTop

feedRate

plungeRate

inch

metric

scale

tool

nextTool

line

spindleSpeed

fileName

fileNameOnly

filePath

partName

toolName

operationName

date

time

postName

preheat

pierceDelay

pierceHeight

cutHeight

endDelay

power

materialX1, materialY1

materialX2, materialY2

materialThick

materialHeight

toolDia

toolLength

toolFluteLength

toolOffset

toolAngle

toolType DEPRECATED - use toolClass instead

toolClass

operationClass

tapPitch

underFeed

tapTravel

reverseMult

commentText

entityLength

entityClosed

leadinType

spindleDir

partIndex

operationIndex

cutDepth

Variables

All of SheetCam's internal variables are available in the var namespace. For instance :

var.ClampClearanceHeight would give the material thickness. You can see all of the available variables using the variable monitor (View->variable monitor)

The following Lua libraries are included:

math. See http://lua-users.org/wiki/MathLibraryTutorial for more details. This library has been extended to add the following functions:

math.hypot(x,y). This is equivalent to math.sqrt((x*x) + (y*y))
math.toint(n). Returns the integer value of n.

string. See http://lua-users.org/wiki/StringsTutorial for more details.

os Seehttp://lua-users.org/wiki/OsLibraryTutorial for more details

Also all of the wxLua plugin functions are available. See the plugin documentation.