Testing 2 conditions: Using AND and OR with IF
9.1.1.4 Variables set from the Tool or Tool Change information
These variables are typically used in the ToolChange and 1stToolChange sequences. Some of them are used other places as well.
Remenber - variables marked with asterisk (*) are probably not supported by your CAM system, so you should generally avoid using them. (Although you may employ them as “general use” variables by setting their values by using the Set command within the template.)
Variable(s) Category Details Related / similar items
(variables, unless noted) Comp Tool change info Lathe Tool compensation offset #. (Not used for milling posts.) LComp, DComp
Cool Tool change info Coolant M code value (on, off, mist). Typically M8, M9 and M7, respectively
Corner * Tool change info The “corner radius” of the tool. ToolRad, ToolDiam Cycle Tool change info The [Cycle] variable gets set - when there is a holemaking or
threading cycle upcoming - according to the cycle type. Unless noted, the values listed below are for posts running in MILL mode. ADD 100 when post is in TURN (Lathe) mode:
Note that [Cycle] is set to 0 when 'milling' (In other words, NOT doing any drilling cycles), and 100 when in 'turning' mode (e.g.
turning or grooving).
(Please note that there are 'gaps' in the numbering sequence above.)
SO... If you want to differentiate between MILL and DRILL cycles in a mill post you would do something like this...
ToolChange
... and the same for a turning post, except that you would add 100 like this:
...
[Tap], [Rigid] and [Style]
variables
Variable(s) Category Details Related / similar items (variables, unless noted) if [Cycle] = 100
...
DComp CRC Diameter compensation offset #. (mill only) Usually used in the Infeed sequence, but some machines like this value put in the ToolChange sequences.
Lcomp, Tool, Side
Depth * Tool change info Depth of the upcoming cycle (mill only) D
Direct Tool change info M code value of Spindle direction; Cw (3) or Ccw (4) Speed, Range FeedType Tool change info G code value of IPM (usually 95), IPR (94) or “Inverse time” (93)
designator that was set in the FEEDTYPE line (described above).
(mill and lathe only)
SpeedType
Flutes * Tool change info The number of flutes (cutting edges) this tool has (FYI: drills typically have 2).
IncMode Tool change info Will output the numerical value that corresponds to incremental or absolute program output according to the “INC/ABS” line (see above) - typically 90 or 91 (as in 'G90' and 'G91').
INC/ABS command
LastDep * Tool change info Depth of the previous cycle (mill only)
LastTool Tool change info The T# of the last tool used (commonly used in lathe programs to
cancel compensation). NextTool, Tool, Tool1
LComp Tool change info Length compensation offset #. (mill only) Dcomp, Tool NextTool Tool change info The T# of the tool that is to be used AFTER the current tool.
(Usually used to pre-select a tool for machines equipped with arm-type tool changers.)
In the program's final tool change, NextTool will be set to the first tool number used in the program (it will be equal to [Tool1]). (See the ToolChange sequence example at the top of section 7.5 for an example of how to suppress 'pre-selection' of a tool in the program's final tool change.)
LastTool, Tool, Tool1
Plunge Machining info Plunge feed rate value (mill only). Usually used in the Infeed
sequence. FRate
ILevel Positioning Z dimension used for lateral rapid moves (mill only). RLevel Range Tool change info Spindle range number – read from the CL file's SPINDL record
(the number following the RANGE minor word) Speed, Direct SBite * Tool change info “Side bite”: the XY step distance for multi-pass side milling Step SClear * Machining info Side (XY) clearance amount. (Typically the length of the 'Infeed'
move [the move on which a G41 or G42 may appear to apply CRC.)
Dcomp, Side
Side CRC Cutter compensation Left/Right side value (usually 41 or 42).
Usually used in the Infeed sequence. DComp
SLeave * Machining info 'Side Leave': Amount that the current toolpath will “leave” on the side of the contour being cut (amount to leave in X/Y)
(Note: Sleave] and [Vleave] are not available with most CAM systems.)
Vleave
Speed Tool change info Spindle speed (usually an “S” value). Direct, Range SpeedType Tool change info G code value of RPM (97) or CSS (96) designator that was set in
the SPEEDTYPE line (described above). (lathe only) Speed, FeedType Spindle# Tool change info The spindle number. (Only useful on lathes or MillTurns with more
than 1 spindle.) Turret
Variable(s) Category Details Related / similar items (variables, unless noted) Tap Tool change info Use the following IF structure in your ToolChange or
1stToolChange sequences to detect an upcoming TAP or LTAP cycle:
The IF line in the example above is equivalent to...
If [Cycle] = 13 OR [Cycle] = 14
... See the [Cycle] variable for the list of cycle values.
The [Tap] variable should actually be considered as a 'constant' (In other words, it is always set to the same value automatically by the post, and you should NEVER use a 'Set' command to change its value).
[Cycle] variable
Tool Tool change info “T” number LastTool, NextTool, Tool1
Tool1 Tool change info The T number of the 1st tool in the program; this is usually referenced in the EndCode section to put the first tool back in the spindle (mill) or to return the turret back to tool position 1 (lathe) at the end of the program.
LastTool, NextTool, Tool
ToolDiam Tool change info The diameter of the tool. ToolRad, Corner
ToolRad Tool change info RADIUS value (1/2 the ToolDiam) of the current tool. ToolDiam, Corner Turret Tool change info This is the # of the turret now active. (Typically used in lathe or
MillTurn posts only.)
If your CAM system ever sets the [Turret] to 2, then the post will not run unless you add the HCode2, VCode2 and/or DCode2 commands to your template (to tell the post which letters you want assigned to the 2nd turret.). Read about these commands in section 4.1.16
Also available for turret 2 only is the RevTurret2? switch. Read about that in section 4.1.30
[Tool] & [Style] variables, RevTurret2? switch.
UnitMode Tool change info Will output the numerical value that corresponds to inch or MM programming mode according to the “INCH/MM” command. For example, if the following line is used...
Inch/MM 70 71
...then the following code (within a ToolChange sequence, for example) will output G70 when in INCH mode, and a G71 when in MM mode.
G[UnitMode]
IncMode
VLeave * Machining info 'Vertical Leave': Amount that the current toolpath will “leave” in the Z dimension for finishing with a later operation or tool. (Note:
[Sleave] and [Vleave] are not applicable to most CAM systems.)
SLeave
Work Tool change / prompted (See
“Details” column)
Work offset # (usually in the range of 54 to 59). The user will be prompted for the first occurrence of this value if it is not found in the incoming CL data.
WorkDefault and Work commands. (See Appendix C for details on this topic!)
9.1.1.5 Variables used for subroutines or subprograms