Keith
My approach to this was to add a text box which to define a custom tool parameter and then use that as an optional switch to turn off THC before whatever the process was that you did not want it to operate against.
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)
Define a variable name for use in the ‘set variable’ dialog.
varName = variable name
units. One of the following: sc.unitTEXT, sc.unitLINEAR, sc.unitANGULAR, sc.unitFEED, sc.unitRPM, sc.unitTIME, sc.unitPERCENT, sc.unitPITCH,
sc.unit0DECPLACE, sc.unit1DECPLACE, sc.unit2DECPLACE, ,sc.unit3DECPLACE, sc.unit4DECPLACE note the unitxDECPLACE units display
a number without units with a precision of the given number of decimal places
min minimum value (ignored for text)
max maximum value (ignored for text)
DefineCustomOption(caption,varName,units,min,max, default)
Adds an option to the post options.
caption is a label that is displayed next to the input box.
The rest of the syntax is as DefineVariable above.
ShowCustomOptions(caption)
Show an options dialog containing the options defined using DefineOption.
Caption is displayed in the dialog box title.
If no options have been defined this function has no effect.
DefineCustomToolParam(toolClass,caption,varName,units,default,min,max)
Adds an extra parameter to a tool definition.
toolClass is the tool class name. See the toolClass variable for a description of tool classes
default is the default value. Note that values are always in METRIC for linear units, RADIANS for angular units and a decimal fraction for percentage e.g 0.1 = 10%
The rest of the syntax is as DefineVariable above.
An example would have been (as I like to have a look and what CandCNC do in their post processors [no harm in looking + learning]) to use an if statement such that if Toolxxxx||Toolxxx then provide the parameter
https://www.candcnc.net/downloads/
that way it is optional (you could associate it with another inside / outside offset etc).
With small circles or arcs, I have this within one of my post processors I created:
function OnArc()
if (endX == CurrentX and endY == CurrentY) then return end
if(endX < materialX1 and endY < materialX1) or (endX > materialX2 and endY > materialX2) then return end
local radius = math.hypot(currentX - arcCentreX, currentY - arcCentreY)
len = radius * math.abs(arcAngle)
dist = dist + len
if (radius < slowRadius) then
feed = slowPercent * feedRate
ThcLockOn()
else
feed = feedRate
minTHCdist = feed / 180 -- 0.333 second of motion
if (minTHCdist > len) then
ThcLockOff()
else
ThcLockOn()
end
end
if(arcAngle < 0) then
post.Text (" G3")
else
post.Text (" G2")
end
post.NonModalNumber (" X", (endX + offX) * scale, "0.0000")
post.NonModalNumber (" Y", (endY + offY) * scale, "0.0000")
post.ModalNumber (" Z", (endZ + offZ) * scale, "0.0000")
post.Text (" I")
post.Number (((arcCentreX + offX) - currentX) * scale, "0.0000")
post.Text (" J")
post.Number (((arcCentreY + offY) - currentY) * scale, "0.0000")
post.ModalNumber (" " .. rotaryAxis, endA, "0.0000")
post.NonModalNumber (" F", feed * scale, "0.0###")
post.Eol()
end
the if (radius < slowRadius) then is the important bit for the circles.
but its a snippet without a leadin… that is all it really is… as it only operates based upon what arc radius it is sent.
So the code snippet is more advanced.