Post-Processor Language¶
Post-Processor Language Files¶
The file that contains all of the post-processor language to define how machine independent NC programs are to be converted to G-Code files for a single machine/control combination is often incorrectly referred to as a "Post". It is the logic embedded in such a file, together with the Vericut Post-Processor program that performs the processing task, but we have no intention of fighting the nomenclature.
A "post" file must contain all the language needed for a machine/control combination. It cannot make reference to other language files, even for subroutines that are common to many machine/control combinations. Each subroutine needed must be present in the single file that will be accessed by the Vericut post-processor. The default file extension for a "post" file is ".VcPost".
A VcPost file is typically encoded with ASCII. The language does not require the use of any non-ASCII characters, but if a user needs to generate comments in the output G-Code, or in the post-processor's log, with accented vowels or Eastern languages, a VcPost file can be encoded with UTF-8 or Unicode. Any suitable text editor can be used to create and maintain VcPost files. A word-processor can be used if you take great care to avoid saving the files with any formatting information. The text editor embedded in Vericut is a viable solution.
It is strongly recommended that you follow good programming practices in terms of indenting blocks of logic to make the code more legible. Recognizing that we haven't yet explained any of the language's syntax, the following snippet may make it clear what is meant by indenting.
Sub GOTO
If (G = 0) Then
If (Z < Z.Previous) Then
Out "<N><G><X><Y>"
Out "<N><G><Z>"
Else
Out "<N><G><Z>"
Out "<N><G><X><Y>"
End If
Else
Out "<N><G><X><Y><Z><F>"
End If
End Sub
Statements, Continuations, and Comments¶
Statements
Elements of the post-processor language are organized in statements to create a VcPost. Very often a statement and a line of the file are the same thing. Using a piece of the same code snippet from the previous page to illustrate this, still without any explanation of the contents of the statements, ...
If (Z < Z.Previous) Then
Out "<N><G><X><Y>"
Out "<N><G><Z>"
Else
Out "<N><G><Z>"
Out "<N><G><X><Y>"
End If
... has seven statements. Many programming languages use a particular character to denote the end of a statement, such as the semi-colon in C and Java. This is not the case in BASIC, or in our post-processor language. The end of a statement is the end of the line, unless the rightmost pair of characters indicates a continuation.
Continuations
The continuation characters are a space followed by an underscore, " _". It is easy to think of the underscore alone as being the continuation character, but an underscore can be used at the end of a variable name, such as "Radius_". We are not recommending this because it would make the code more difficult to read. But if a name like this appeared at the end of a line, the post-processor would treat the next line as the first of another statement. An underscore which is intended to signify a continuation of the current line's statement should be separated from the rest of the characters by at least one space. For example;
Radius = squareRoot((X.Current - X.Previous) ^ 2 _
+ (Y.Current - Y.Previous) ^ 2)
Trying to split a function name or variable name between two lines of a statement is a bad idea. It makes the code hard to read, and won't work. We haven't covered the topic of string constants yet, but they consist of any characters between double-quotation marks. "Any" includes the underscore character, so a single string constant cannot span two lines of a statement. It is necessary to split the string into two or more, and concatenate them as follows;
Sentence = "The quick brown fox jumps" _
& " over the lazy dog."
Strictly it is not necessary to use continuation characters at all. There is no practical limit on the length of a line of code. But it makes sense to restrict lines to the width that can be displayed by your text editor without having to scroll horizontally.
Comments
A comment can be appended to any line of code, simply by adding a single-quotation mark and any characters for the comment.
Radius = 0.5 * Diameter 'This is a comment
It is also possible for a line to contain nothing but a comment, and this may well be the better style to adopt for legibility.
' This line is just a comment
Radius = 0.5 * Diameter
A line with the continuation characters can also end with a comment, but this really gets ugly because it makes it more difficult to see the continuations.
Sentence = "The quick" _ 'This sentence
& " brown fox" _ 'contains all
& " jumps over" _ 'the letters of
& " the lazy dog." 'the alphabet
It would be much better to give the comment its own line.
' This sentence contains all the letters of the alphabet
Sentence = "The quick brown fox jumps over the lazy dog."
While you can append comments to continued lines, it is not possible, nor necessary, to split extensive comments into continuation lines. Since a comment can contain any characters, a space and underscore on the right end will not cause the next line to be treated as a continuation. If you need a multi-line comment, just use several individual comment lines.
' Check for RAPID and perform horizontal or vertical
' Β Β Β Β Β Β moves, or vice versa, to "square" the motion.
No other syntax to denote a comment is supported. In particular the "Rem" style that appears in some flavors of BASIC cannot be used.
Variables¶
There are just three types of variables in the post-processor language; numeric values, text strings and an object analogous to a control's register that has both numeric and text properties. We will refer to these three variable types as simply numbers, strings and registers. There is no Boolean variable type. All Variables defined in the post-processor are "global".
Variable names can be any combination of letters of the alphabet, numerals and the underscore character, but must begin with a letter. There is no practical limit to their length, so you can make them very descriptive. Names are case insensitive, so "radius", "Radius" and "RADIUS" are synonymous and are processed as identical. This relaxed attitude also applies to reserved words in the language such as "If", "Then" and "Else", and also to subroutine and function names. There are two schools of thought when it comes to compound names. One uses uppercase for the first letter of each word, such as "CircleRadius", while the other separates the words with an underscore, such as "circle_radius". We suggest that you pick a style and stick with it. Having both in the same VcPost file would be an invitation to bugs, since "CircleRadius" and "circle_radius" are not synonymous.
Unlike BASIC, the post-processor language has no declaration statements, such as "Dim". We will leave the topic of registers for a while, but if the following statements are the first to be executed that refer to "Radius" and "Tool", then their types will be number and string respectively.
Radius = 0.125
Tool = "Drill"
Once a variable has been defined, its type cannot be altered. So the following statement
Tool = 5
would generate an error if it followed the prior lines.
This may not mean much yet, but also unlike BASIC, all variables are global in scope. If you define a variable in one segment of your VcPost file, it is accessible from all others, without the need to pass it as an argument between subroutines.
Variable names must be unique across all variable types, so you cannot have a number and a string both called "Turret". There are reserved variable names which you must avoid using for anything but their intended purpose.
Numbers
A number variable retains a 64bit precision numeric value. 64bit precision is good for about 15 significant decimal digits. There is no distinction between fixed point values, sometimes called integers, and floating point values, sometimes called floats or doubles. Numeric constants can use integer, decimal or scientific notation. Thus the following are all valid; 2, +3, -4, 1.625, -3.75, 1.E6, 2.25e-3, -4.125E+3. Note that embedded spaces in a numeric constant are a bad idea. Use of a thousands separator, as in "1,000,000" would not produce the desired result.
If you want to format a number variable for output, it should instead be defined as a register. There are numerous functions for performing mathematical operations on number variables.
Strings
A string variable retains a sequence of characters. There is no practical limit on the number of characters. A string constant is a sequence of characters enclosed by double-quotation marks.
Sample = "This is a sample string constant."
If a string constant needs to contain a double-quotation mark, then two such marks should be used. For example;
Exclaim = """Hey!"", he said, ""Get off!"""
There are many functions for manipulating string variables.
Mixing
Number and string variable types cannot be mixed in arithmetic, string concatenation or logical expressions. Thus if "Radius1" and "Radius2" are defined by;
Radius1 = 3.5
Radius2 = "1.25"
then any of the following statements will generate an error;
Sum = Radius1 + Radius2
Range = Radius1 & " to " & Radius2
If (Radius1 > Radius2) Then
Registers¶
A register is analogous to a control or machine register. It contains current and previous floating point numeric values. It also carries information on how its current value is to be formatted in a G-Code file and in the post-processor log. The numeric values are limited to lie in a range, either dictated by the number of digits in the formatting, or specified by tighter constraints. A scale can be applied to the current value prior to formatting.
Syntactically a register is treated like an Object in Visual Basic. It has several properties but no methods. Samples of the properties and syntax used to access them are;
X.Prefix = "X"
MyRegister.Suffix = β] β
X.Format = "s3.3sm"
X.Minimum = -499.999
X.Maximum = 500
If (X.Scale < 0) Then
DeltaX = X.Current - X.Previous
Message = "Set vernier to " & X.Output
A new variable is defined as a register as soon as the variable name is encountered with a trailing period. Many registers are predefined and have reserved names, such as X, Y, and Z for the first 3 machine axes.
To shorten code and perhaps make it more comprehensible, a register variable name can appear without a trailing period. If it appears in an arithmetic expression, an unqualified register name implies its. Current property, thus the following lines of code have the same effect;
Diameter = 2.0 + Z
Diameter = 2.0 + Z.Current
If an unqualified register name appears where a string is expected, such as in concatenation, it is formatted. Output property is assumed. So the following lines of code have the same effect;
Message = "Raise to " & Z & " now."
Message = "Raise to " & Z.Output & " now."
There is one function of note for use with registers;
Zap R
This function will reset the previous value of register R to an undefined state. This is useful for a modal register when it is necessary to force output of the current value even when it may not have changed, perhaps after a tool change.
Properties
| Name | Type | Description | Access |
|---|---|---|---|
| Current | number | Current value of the register. | Read/Write |
| Format | string | {+}{s| }#{.|,}#{s| }{m|i} optional "+" is for plus sign preceding positive value. first optional "s" is to suppress leading zeros, or optional space is to pad the field on the left with spaces. first "#" is maximum number of leading digits, or spaces, sign and digits if padding with spaces. optional "." or "," is decimal point character. Other characters are unusual but permitted. second "#" is maximum number of decimal places, or digits and spaces if padding with spaces. second optional "s" is to suppress trailing zeros, or optional space is to pad the field on the right with spaces. optional "m" is for a modal value, which will only be output when it has changed. optional "i" is for an incremental value, which will always be output when it is non-zero. "m" and "i" are mutually exclusive. Format characters are case insensitive. |
Read/Write |
| Increment | number | Increment to be applied to Current value each time the register is output. Normally only non-zero for the sequence number register, N. Restricted to be a fixed-point value. |
Read/Write |
| isDefined | number | 1 if Current value is defined, 0 otherwise. | Read Only |
| Maximum | number | Maximum value that a register can attain. If not defined explicitly, will be implied by the number of leading and trailing digits in the Format. |
Read/Write |
| Minimum | number | Minimum value that a register can attain. If not defined explicitly, will be implied by the number of leading and trailing digits in the Format. |
Read/Write |
| Output | string | Formatted current value. | Read Only |
| Prefix | string | Prefix is used in formatted output. For example, MyRegister.Prefix = β A[β |
Read/Write |
| Previous | number | Previous value of the register. | Read/Write |
| Scale | number | Scale to be applied to a value before formatting. Scale can be used to adjust units or to reverse an axis. |
Read/Write |
| Suffix | string | Suffix is used in formatted output. For example, MyRegister.Suffix = β] β | Read/Write |
Arrays¶
Variables of all three types; numeric values, text strings and registers, can be grouped into arrays. While it is possible to mix the types of variables in a single array, it would be much more common to have, for example, an array of numeric values or an array of text strings. The same rules that apply to variable names also apply to array names. They can be any combination of letters of the alphabet, numerals and the underscore character, but must begin with a letter.
Unlike BASIC, the post-processor language has no syntax for declaring arrays. The following statements assign values, numeric or textual, to array members.
Tool(1) = "Drill"
Tool(2) = "CounterSink"
Tool(3) = "Tap"
Depth(1) = 3.0
Depth(2) = 0.125
Depth(3) = 2.5
Once an array member has been defined, its type cannot be altered. So
Tool(2) = 5
would generate an error if it followed the prior lines.
Just like variables, array members are global in scope. Once an array member has been assigned a value, it can be used in subsequent statements in the same way that a variable can. So if "ToolNo" has been defined and contains a suitable numeric value, then the following would be a valid statement,
Z = Z - Depth(ToolNo)
Note that the array index or subscript, "ToolNo" in this case, will always be rounded to the nearest integer value.
If you wish to have an array of registers, then to reference one of the member's properties, the syntax would be "Reg_Name(Array_Index).Property", for example;
G(2).Prefix = " G"
It is also possible to define and use arrays with multiple subscripts, but the syntax differs from BASIC's. Instead of using comma-separated subscripts within a single set of parentheses, the post-processor language requires that each subscript be in its own parentheses. For example;
Matrix(0)(0) = 1
Matrix(0)(1) = 0
Matrix(1)(0) = 0
Matrix(1)(1) = 1
Reserved Variable Names¶
Reserved Variable Names, listed by the application for which they are used, are described in the following sections:
Vericut Inspection Probe Cycle Programming
Vericut Drilling and Fastening
Vericut¶
The following variables are reserved for use in Vericut post-processors. These post-processor Variable names must declared in the .vcpost file. Use the command
getString("keyword")
to make all variables attached to the "keyword" accessible in the post.
All of these post-processor Variables are automatically updated by Vericut at the end of each block before executing post-processor subroutines.
3D Cutter Compensation information:
Key Word: 3DCDCInfo
| Variable | Variable Type | Description |
|---|---|---|
| Post3dCdcIVector | Number | I component of a 3D cutter compensation offset direction vector. |
| Post3dCdcJVector | Number | J component of a 3D cutter compensation offset direction vector. |
| Post3dCdcKVector | Number | K component of a 3D cutter compensation offset direction vector. |
Circle information:
Key Word: CircleInfo
| Variable | Variable Type | Description |
|---|---|---|
| PostCircleCenterX | Number | X component of the circle center point. |
| PostCircleCenterY | Number | X component of the circle center point. |
| PostCircleCenterZ | Number | X component of the circle center point. |
| PostCirclePitch | Number | Pitch value (depth per revolution) for helical motion. |
| PostCircleRadius | Number | Radius of the circle. |
| PostCircleStartPointX | Number | X component of the circle start point. |
| PostCircleStartPointY | Number | Y component of the circle start point. |
| PostCircleStartPointZ | Number | Z component of the circle start point. |
Drilling Cycle information: (information comes from the control configuration)
Key Word: CycleInfo
| Variable | Variable Type | Description |
|---|---|---|
| PostCycleDepthType | Number | How the cycle depth value is interpreted. |
| Options are: 0 = Absolute 1 = Incremental from Initial point 2 = Incremental from Rapid Level 3 = Incremental from Part Surface 5 = Incremental from Retract Level 6 = same as Axis position (if used, all 3(XYZ) axis values should be specified on the block) 7 = ZW Tracking β Absolute (With this option, the input value will be converted based on ZW tracking logic, and then the cycle option type will be switched to Absolute.) |
||
| PostCycleDepthValue | Number | Location of the final Depth. |
| PostCycleFeedRate1 | Number | Feedrate from Rapid Level to final Depth |
| PostCycleFeedRate2 | Number | Feedrate from final Depth back to the Rapid Level |
| PostCyclePartSurfaceType | Number | How the cycle Part Surface value is interpreted. |
| Options are: 0 = Absolute 1 = Incremental from Initial point 2 = Incremental from Rapid Level 4 = Incremental from Depth 5 = Incremental from Retract Level 6 = same as Axis position (if used, all 3 (XYZ) axis values should be specified on the block) |
||
| PostCyclePartSurfaceValue | Number | Location of the Part Surface. |
| PostCycleRapidLevelType | Number | How the cycle Rapid Level value is interpreted. |
| Options: 0 = Absolute 1 = Incremental from Initial point 3 = Incremental from Part Surface 4 = Incremental from Depth 5 = Incremental from Retract Level 6 = same as Axis position (if used, all 3(XYZ) axis values should be specified on the block) 7 = ZW Tracking β Absolute (With this option, the input value will be converted based on ZW tracking logic, and then the cycle option type will be switched to Absolute.) |
||
| PostCycleRapidLevelValue | Number | Location of the Rapid Level. |
| PostCycleRetractLevelType | Number | How the cycle retract level value is interpreted. |
| Options are: 0 = Absolute 1 = Incremental from Initial point 2 = Incremental from Rapid Level 3 = Incremental from Part Surface 4 = Incremental from Depth 6 = same as Axis position (if used, all 3(XYZ) axis values should be specified on the block) 7 = ZW Tracking β Absolute (With this option, the input value will be converted based on ZW tracking logic, and then the cycle option type will be switched to Absolute.) |
||
| PostCycleRetractLevelValue | Number | Location of the Retract Level. |
| PostCyclestep_down | Number | The step down distance for drill cycle"Deep". |
| PostCyclestep_up | Number | The step up distance for drill cycle"Deep". |
Dynamic Offset information: (from Info> Machine Offsetsβ¦)
Key Word: MachineOffsetInfo
| Variable | Variable Type | Description |
|---|---|---|
| PostDwoBaseFlag | Number | Status of Dynamic Work Offsets β base offset 0 = Off 1 = On |
| PostDwoContourFlag | Number | Status of Dynamic Work Offsets -Contour 0 = non-contouring mode 1 = contouring mode |
| PostDwoFlag | Number | Status of Dynamic Work Offsets flag. 0 = Off 1 = On |
| PostDwoProgramZeroFlag | Number | Status of Dynamic Work Offsets β program zero 0 = Off 1 = On |
| PostDwoSecondaryFlag | Number | Status of Dynamic Work Offsets β secondary work offset 0 = Off 1 = On |
| PostDwoShiftFlag | Number | Status of Dynamic Work Offsets - shift offset 0 = Off 1 = On |
| PostDwoWithMotionFlag | Number | Status of Dynamic Work Offsets β with motion 0 = offset takes effect immediately 1 = offset takes effect when corresponding axis is specified. |
| PostDwoWorkFlag | Number | Status of Dynamic Work Offsets β base and work offsets 0 = Off 1 = On |
| PostRpcpContourFlag | Number | Status of RPCP contouring 0 = RPCP in non-contouring mode 1 = RPCP in contouring mode |
| PostRpcpFlag | Number | Status of RPCP 0 = Off 1 = On |
| PostRpcpWithMotionFlag | Number | Status of RPCP with motion 0 = XYZ axis will move when the part is rotated in order to keep its relative position the same, even if XYZ is not on the block. 1 = XYZ axis will not be updated until there is motion for that specified axis |
| PostRtcpContourFlag | Number | Status of RTCP contouring 0 = RTCP in non-contouring mode 1 = RTCP in contouring mode |
| PostRtcpFlag | Number | Status of RTCP 0 = Off 1 = On |
| PostRtcpWithMotionFlag | Number | Status of RPCP with motion 0 = offsets take effect immediately 1 = offsets take effect when the corresponding axis is specified |
Mirror information:
Key Word: MirrorInfo
| Variable | Variable Type | Description |
|---|---|---|
| PostMirrorXFlag | Number | Status of Mirroring about the X-axis 0 = Off 1 = On |
| PostMirrorXValue | Number | The value to be mirrored about the X-axis |
| PostMirrorYFlag | Number | Status of Mirroring about the Y-axis 0 = Off 1 = On |
| PostMirrorYValue | Number | The value to be mirrored about the Y-axis |
| PostMirrorZFlag | Number | Status of Mirroring about the Z- axis 0 = Off 1 = On |
| PostMirrorZValue | Number | The value to be mirrored about the Z-axis |
Project and Setup Information:
Key Word: ProjectInfo
| Variable | Variable Type | Description |
|---|---|---|
| PostVcProjectName | String | Current VCProject name. |
| PostSetupName | String | Current (active) setup name. |
| PostSetupSequence | String | Active βSequenceβ name (number). |
| PostPlyGroup | String | Active βPly Groupβ name (number). |
Rotation Plane Matrix information: (from Info> Machine Offsetsβ¦)
Key Word: RPMatrixInfo
| I | J | K | D | |
|---|---|---|---|---|
| X | I1 | J1 | K1 | D1 |
| Y | I2 | J2 | K2 | D2 |
| Z | I3 | J3 | K3 | D3 |
Refer to the above Rotation Plane Matix table.
| Variable | Variable Type | Description |
|---|---|---|
| PostRPMatrixXIVector | Number | The I1component of the Rotation Plane Matrix |
| PostRPMatrixXJVector | Number | The J1component of the Rotation Plane Matrix |
| PostRPMatrixXKVector | Number | The K1component of the Rotation Plane Matrix |
| PostRPMatrixXTrans | Number | The X component of the local CSYS origin (D1) |
| PostRPMatrixYIVector | Number | The I2component of the Rotation Plane Matrix |
| PostRPMatrixYJVector | Number | The J2component of the Rotation Plane Matrix |
| PostRPMatrixYKVector | Number | The K2 component of the Rotation Plane Matrix |
| PostRPMatrixYTrans | Number | The Y component of the local CSYS (D2) |
| PostRPMatrixZIVector | Number | The I3component of the Rotation Plane Matrix |
| PostRPMatrixZJVector | Number | The J3component of the Rotation Plane Matrix |
| PostRPMatrixZKVector | Number | The K3 component of the Rotation Plane Matrix |
| PostRPMatrixZTrans | Number | The z component of the local CSYS (D3) |
Status Window information:
Key Word: StatusInfo
Each of the following variables corresponds to a feature that can be displayed in the Vericut Status window. All values available in Status window are updated in the post-processor when Run Post while simulating, in the Post Setup window is toggled on (checked).
| Variable | Variable Type | Status Feature | Description |
|---|---|---|---|
| PostSubSystem | String | Sub-system | Sub-system that the block applies to. |
| PostNcProgram | String | NC Program | Name of the current NC program. |
| PostNcProgramRecNum | Number | NC Program Rec. # | Line number of the current NC program record. |
| PostNcProgramRec | String | NC Program Record | Current NC Program record being processed. |
| PostChangeRecNum | Number | Change Rec. # | Line number of the last tool change record. |
| PostChangeRec | String | Change Record | Last tool change record processed. |
| PostMachineX | Number | Machine X | Current location of the Machine's X axis. |
| PostMachineY | Number | Machine Y | Current location of the Machine's Y axis. |
| PostMachineZ | Number | Machine Z | Current location of the Machine's Z axis. |
| PostMachineA | Number | Machine A | Current location of the Machine's A axis. |
| PostMachineB | Number | Machine B | Current location of the Machine's B axis. |
| PostMachineC | Number | Machine C | Current location of the Machine's C axis. |
| PostMachineU | Number | Machine U | Current location of the Machine's U axis. |
| PostMachineV | Number | Machine V | Current location of the Machine's V axis. |
| PostMachineW | Number | Machine W | Current location of the Machine's W axis. |
| PostMachineA2 | Number | Machine A2 | Current location of the Machine's A2 axis. |
| PostMachineB2 | Number | Machine B2 | Current location of the Machine's B2 axis. |
| PostMachineC2 | Number | Machine C2 | Current location of the Machine's C2 axis. |
| PostLocalX | Number | Local X | Current location of the X axis within the local coordinates of the current sub-system. |
| PostLocalY | Number | Local Y | Current location of the Y axis within the local coordinates of the current sub-system. |
| PostLocalZ | Number | Local Z | Current location of the Z axis within the local coordinates of the current sub-system. |
| PostLocalA | Number | Local A | Current location of the A axis within the local coordinates of the current sub-system. |
| PostLocalB | Number | Local B | Current location of the B axis within the local coordinates of the current sub-system. |
| PostLocalC | Number | Local C | Current location of the C axis within the local coordinates of the current sub-system. |
| PostLocalU | Number | Local U | Current location of the U axis within the local coordinates of the current sub-system. |
| PostLocalV | Number | Local V | Current location of the V axis within the local coordinates of the current sub-system. |
| PostLocalW | Number | Local W | Current location of the W axis within the local coordinates of the current sub-system. |
| PostLocalA2 | Number | Local A2 | Current location of the A2 axis within the local coordinates of the current sub-system. |
| PostLocalB2 | Number | Local B2 | Current location of the B2 axis within the local coordinates of the current sub-system. |
| PostLocalC2 | Number | Local C2 | Current location of the C2 axis within the local coordinates of the current sub-system. |
| PostToolTipX | Number | Tool Tip X | X coordinate of the current tool tip location. |
| PostToolTipY | Number | Tool Tip Y | Y coordinate of the current tool tip location. |
| PostToolTipZ | Number | Tool Tip Z | Z coordinate of the current tool tip location. |
| PostToolTipI | Number | Tool Tip I | I component of the current tool axis vector. |
| PostToolTipJ | Number | Tool Tip J | J component of the current tool axis vector. |
| PostToolTipK | Number | Tool Tip K | K component of the current tool axis vector. |
| PostToolSeq | Number | Tool Sequence | Sequential number of the last tool change event. |
| PostToolNum | String | Tool Number | Tool number in use. |
| PostToolID | String | Tool ID | ID of a tool retrieved from a Vericut Tool Library. |
| PostToolGeo | String | Tool Geometry | Cutter shape geometry. |
| PostToolDesc | String | Tool Description | Description of a tool retrieved from a Vericut Tool Library. |
| PostToolErrors | Number | Errors | Quantity of errors detected by Vericut. |
| PostToolWarnings | Number | Warnings | Quantity of warnings detected by Vericut. |
| PostToolTime | String | Time | Time anticipated to machine the part. |
| PostToolPerc | Number | Time % | Percentage of time in feed rate mode. |
| PostToolDist | Number | Distance | Tool movement distance. |
| PostToolDistPerc | Number | Distance % | Percentage of tool movement distance in feed rate mode. |
| PostToolFeed | String | Feedrate | Current programmed feed rate. |
| PostToolSpindleSpeed | String | Spindle | Current programmed spindle speed. |
| PostToolCoolant | String | Coolant | Current programmed coolant condition |
| PostToolMotionType | String | Motion Type | Current motion type (Rapid, Linear, CW, etc.). |
| PostAbsInc | String | Abs/Inc | Current motion mode (absolute/incremental). |
| PostMotionPlane | String | Motion Plane | Current motion plane. |
| PostUnitsTo | String | Units | Current units. |
| PostSpindleMode | String | Spindle Mode | Current spindle mode. |
| PostCutterComp | String | Cutter Comp | Current cutter compensation status. |
| PostCycle | String | Cycle | Current cycle type. |
| PostInterpolation | String | Interpolation | Current interpolation mode. |
| PostOptiTime | String | Optimization Time | Time anticipated to machine the part with an optimized NC program. |
| PostOptiFeed | String | Optimization Feed | Current optimized feedrate. |
| PostOptiSpindleSpeed | String | Optimization Spindle Speed | Current optimized spindle speed. |
| PostVolumeRemovalRate | Number | Volume Removal Rate | Current volume removal rate. |
| PostChipThickness | Number | ChipThickness | Current chip thickness. |
| PostCutterCompValue | Number | Cutter Comp Value | Current cutter compensation value. |
| PostAirTimePerc | Number | Air Time % | Percent of time spent cutting air. |
| PostPolarCoord | String | Polar Coordinates | Status of polar coordinate input. |
| PostAxialDepth | Number | Axial Depth | Current depth of the cut. |
| PostRadialWidth | Number | Radial Width | Current width of the cut. |
| PostContactArea | Number | Contact Area | Area of the tool that is in contact with the material. |
| PostSurfaceSpeed | Number | Surface Speed | Current surface speed |
Working Plane Matrix information: (from Info> Machine Offsetsβ¦)
Key Word: WPMatrixInfo
| I | J | K | D
---|---|---|---|---
X | I1 | J1 | K1 | D1
Y | I2 | J2 | K2 | D2
Z | I3 | J3 | K3 | D3
Refer to the above Working Plane Matix table.
| Variable | Variable Type | Description |
|---|---|---|
| PostWPMatrixXIVector | Number | The I1component of the Working Plane Matrix |
| PostWPMatrixXJVector | Number | The J1component of the Working |
| PostWPMatrixXKVector | Number | The K1component of the Working Plane Matrix |
| PostWPMatrixXTrans | Number | The X component of the local CSYS origin (D1) |
| PostWPMatrixYIVector | Number | The I2component of the Working Plane Matrix |
| PostWPMatrixYJVector | Number | The J2component of the Working Plane Matrix |
| PostWPMatrixYKVector | Number | The K2 component of the Working Plane Matrix |
| PostWPMatrixYTrans | Number | The Y component of the local CSYS (D2) |
| PostWPMatrixZIVector | Number | The I3component of the Working Plane Matrix |
| PostWPMatrixZJVector | Number | The J3component of the Working Plane Matrix |
| PostWPMatrixZKVector | Number | The K3 component of the Working Plane Matrix |
| PostWPMatrixZTrans | Number | The Z component of the local CSYS (D3) |
Vericut Inspection Probe Cycle Programming¶
Numbers
| Name | Description |
|---|---|
| ArcRadius | Radius of current arc. |
| ClearRetract | Default clearance plane retract distance. |
| HomeRetract | GOHOME retract distance. Zero if GOHOME without axis minor words should use FROM point. |
| NurbsKnot | Cumulative value of NURBS knot at current point (CATIA style NURBS only). |
NurbsOrder | Order of current NURBS.
NurbsWeight | Weight for current NURBS control point.
PathX | Current X coordinate transformed by NC program matrix.
PathY | Current Y coordinate transformed by NC program matrix.
PathZ | Current Z coordinate transformed by NC program matrix.
PathI | Current I coordinate transformed by NC program matrix.
PathJ | Current J coordinate transformed by NC program matrix.
PathK | Current K coordinate transformed by NC program matrix.
PathCenterX | Current X coordinate of arc center, transformed by NC program matrix.
PathCenterY | Current Y coordinate of arc center, transformed by NC program matrix.
PathCenterZ | Current Z coordinate of arc center, transformed by NC program matrix.
PathCenterI | Current I coordinate of arc axis, transformed by NC program matrix.
PathCenterJ | Current J coordinate of arc axis, transformed by NC program matrix.
PathCenterK | Current K coordinate of arc axis, transformed by NC program matrix.
RawX | Current raw X coordinate from APT source.
RawY | Current raw Y coordinate from APT source.
RawZ | Current raw Z coordinate from APT source.
RawI | Current raw I coordinate from APT source.
RawJ | Current raw J coordinate from APT source.
RawK | Current raw K coordinate from APT source.
RawCenterX | Current raw X coordinate of arc center, from APT source.
RawCenterY | Current raw Y coordinate of arc center, from APT source.
RawCenterZ | Current raw Z coordinate of arc center, from APT source.
RawCenterI | Current raw I coordinate of arc axis, from APT source.
RawCenterJ | Current raw J coordinate of arc axis, from APT source.
RawCenterK | Current raw K coordinate of arc axis, from APT source.
Strings
| Name | Description |
|---|---|
| APTLine | Current APT statement. |
| All of the statement's parameters are concatenated into a single line, even if the source has continuation lines. | |
| APTNext | Next APT statement. |
| All of the statement's parameters are concatenated into a single line, even if the source has continuation lines. | |
| Comment | Current APT statement's comment. |
| If the statement has text following "$$" characters, this variable is that text with any leading and trailing spaces trimmed. For a DISPLY, HEADER, INSERT, PARTNO, PPRINT or REMARK statement, this variable is the text following the major word and its delimiter, with leading and trailing spaces trimmed. | |
| Date | Today's date. |
| In the localized "short" format, so for example in the USA, Christmas day would be "12/25/04". | |
| Time | Current time of day. |
| In the localized "medium" format, so for example in the UK, tea-time would be "16:00:00". | |
| Unit | Linear unit, "in" or "mm". |
Registers
| Name | Description |
|---|---|
| A | Machine A axis. |
| B | Machine B axis. |
| C | Machine C axis. |
| F | Feed rate. |
| G | G-code. |
| H | Head number. |
| I | Machine X of arc axis. |
| J | Machine Y of arc axis. |
| K | Machine Z of arc axis. |
| M | M-code. |
| N | Sequence number. |
| R | Radius. |
| S | Spindle speed. |
| T | Tool number. |
| U | Machine U axis. |
| V | Machine V axis. |
| W | Machine W axis. |
| X | Machine X axis. |
| Y | Machine Y axis. |
| Z | Machine Z axis. |
Language Keywords
(Language Keywords cannot be used as variable names.)
- And
- Case
- Debug
- Do
- Else
- ElseIf
- For
- If
- Log
- Loop
- mod
- Or
- Out
- Select
- Show
- Step
- To
- Until
- Wend
- While
- Xor
- Zap
- zapFrom
Vericut Composite Probing¶
π NOTE: The following Reserved Variable Names tables apply to both Vericut Composites Programming and to Vericut Composites Probing.
Numbers
| Name | Description |
|---|---|
| AccDecDist | Acceleration/deceleration distance. |
| ACCount | Number of cached add or cut points. |
| AddAdjustMax | Tow add location adjustment at maximum roller compression. |
| AddAdjustMin | Tow add location adjustment at minimum roller compression. |
| AddCutI | Number whose binary representation encapsulates the tow on/off state. |
| AddCutJ | Number whose binary representation encapsulates the tow on/off state, in opposite order. |
| AMax | Maximum normal angle about the spin axis, in degrees. |
| AMin | Minimum normal angle about the spin axis, in degrees. |
| AngleSpacing | Maximum rotation between output points, in degrees. |
| AngleTol | The maximum desirable departure of a tow from the ply direction, in degrees. |
| Cached | Cache flag; 1 if point was placed in the cache, and is thus an add or cut point, 0 otherwise. |
| Compression | Maximum roller compression. |
| CourseSpread | Course spread. |
| CutAdjustMax | Tow cut location adjustment at maximum roller compression. |
| CutAdjustMin | Tow cut location adjustment at minimum roller compression. |
| Directions | 1 for uni-directional, 2 for bi-directional. |
| DTwist | Counter-clockwise rotation of (DX,DY,DZ) vector about surface normal, in degrees. |
| DX | X component of unit vector in direction of motion. |
| DY | Y component of unit vector in direction of motion. |
| DZ | Z component of unit vector in direction of motion. |
| EgressLength | Length of egress motion. |
| ETwist | Counter-clockwise rotation of (EX,EY,EZ) vector about surface normal, in degrees. |
| Even1stAdvance | Specific to a robot implementation. |
| EvenAddAdvance | Specific to a robot implementation. |
| EvenCutAdvance | Specific to a robot implementation. |
| EX | X component of unit vector in alternate direction. |
| EY | Y component of unit vector in alternate direction. |
| EZ | Z component of unit vector in alternate direction. |
| FOff | Off-part feed rate. |
| FOn | On-part feed rate. |
| HeadReverse | Head reversal flag; 0 for slow, 1 for fast. |
| I | X component of unit outward surface normal vector. |
| IngressLength | Length of ingress motion. |
| J | Y component of unit outward surface normal vector. |
| K | Z component of unit outward surface normal vector. |
| LandOnShelf | Shelf landing flag; 0 for no, 1 for yes. |
| LeadInLen | Desired lead-in length. |
| LimitedEntry | Limited entry/exit flag; 0 for unlimited, 1 for limited. |
| LinkType | -1 or initial entry, 0 for link, +1 for final exit |
| LParam | Good approximation of the distance of point, along the head path, from an arbitrary start position. May be negative, but increases monotonically in the direction of lay. |
| MandrelRPM | Rotisserie revolutions per minute. |
| MatDense | Density of each tow, in g/cu.cm or oz/cu.in. |
| MatThick | Thickness of each tow. |
| MaxGrader | Maximum grader length. |
| MaxTraverse | Maximum on-form traverse. |
| MinGapLen | Minimum permissible gap in any tow. |
| MinGrader | Minimum grader length. |
| MinSteering | Minimum desirable tow steering radius. |
| MinTowLen | Minimum permissible tow length. |
| Natural | Natural path flag; 0 for steered, 1 for natural. |
| NeedPointInTraverse | Flag to force at least one intermediate point in each off-part traverse. |
| NeedThickness | Flag to request sum of prior layers' thicknesses at each on-part point. |
| NominalPress | Nominal roller compression. |
| Numbering | Tow numbering flag; 0 for left-to-right, 1 for right-to-left. |
| Odd1stAdvance | Specific to a robot implementation. |
| OddAddAdvance | Specific to a robot implementation. |
| OddCutAdvance | Specific to a robot implementation. |
| OffSpacing | Maximum distance between off-part output points. |
| OnSpacing | Maximum distance between on-part output points. |
| OptNumber1 | 1st optional numeric parameter. |
| OptNumber2 | 2nd optional numeric parameter. |
| OptNumber3 | 3rd optional numeric parameter. |
| OptNumber4 | 4th optional numeric parameter. |
| OptSwitch1 | 1st optional Boolean parameter (0 for "Off", 1 for "On"). |
| OptSwitch2 | 2nd optional Boolean parameter (0 for "Off", 1 for "On"). |
| PlyAngle | Ply angle, in degrees. |
| PlyNumber | Ply number. |
| RetractDist | Retract distance. |
| RMax | Maximum radius from the spin axis. |
| RollerAction | Roller action flag; 0 for "press", 1 for "wrap". |
| RollerClear | Roller clearance. |
| RollOffset | Offset of roll center from head path. |
| Rotation | -1 for clockwise, 0 for none, +1 for counter-clockwise. |
| Rotisserie | Rotisserie flag; -1 if none, 0 for stationary, 1 for spinning. |
| RunOutLen | Desired run-out length. |
| ScrewHand | Screw direction; -1 for left-hand, 0 for none, +1 for right-hand. |
| SeqNumber | Sequence number. |
| ShelfAngle | Shelf approach angle, in degrees. |
| ShelfInset | Shelf boundary inset. |
| SpinAxis | Rotisserie axis; 0 for X, 1 for Y, 2 for Z. |
| SpiralAngle | Angular extent of limited entry or exit, in degrees. |
| SpliceLen | Desired tow splice length. |
| SpliceSpace | Minimum permissible distance between tow splices. |
| StartX | X coordinate of ply's start point. |
| StartY | Y coordinate of ply's start point. |
| StartZ | Z coordinate of ply's start point. |
| SumThick | Thickness of material in prior layers. |
| ToLastCut | Distance to last cut. |
| ToLeadIn | Distance to start of lead-in. |
| ToNextAdd | Distance to the next add. |
| ToNextCut | Distance to next cut. |
| ToRunOut | Distance to end of run-out. |
| TowCount | Number of tows on the machine's head. |
| TowEdgeLap | Distance that each tow should overlap the ply boundaries. |
| TowReduction | Number of tows to reduce by when trying to comply with maximum roller compression. |
| TowsInPacket | Number of tows in current tow-packet. |
| TowTowLap | Maximum permissible overlap of adjacent tows. |
| TowWidth | Width of each tow. |
| TraverseSpeed | Maximum traverse velocity. |
| UnitPerMm | Linear output unit per millimeter (1.0 or 1.0/25.4). |
| VirtualAxis | Virtual spin axis flag; 0 for none, 1 for automatically determined virtual axis. |
| VirtDX | X component of offset from spin axis. |
| VirtDY | Y component of offset from spin axis. |
| VirtDZ | Z component of offset from spin axis. |
| XMax | Maximum X coordinate. |
| XMin | Minimum X coordinate. |
| YMax | Maximum Y coordinate. |
| YMin | Minimum Y coordinate. |
| ZMax | Maximum Z coordinate. |
| ZMin | Minimum Z coordinate. |
Strings
| Name | Description |
|---|---|
| AddCutA | Binary string representation of the tow on/off state. |
| AddCutB | Binary string representation of the tow on/off state, in opposite order. |
| Date | Today's date. |
| In the localized "short" format, so for example in the USA, Christmas day would be "12/25/04". | |
| FileName | Name of the G-code file. |
| Header | G-Code header line. |
| OptString1 | 1st optional string parameter. |
| OptString2 | 2nd optional string parameter. |
| Part | Name of the CAD file (CATPart). |
| PlyIdent | Ply identifier. |
| Post | Name of the VcPost file. |
| Product | Software product's name, "VCP". |
| SeqIdent | Sequence identifier. |
| Stamp | Time stamp for the G-code file's creation. |
| Thumb | Name of JPEG thumbnail file. |
| Time | Current time of day. |
| In the localized "medium" format, so for example in the UK, tea-time would be "16:00:00". | |
| User | User's computer account name. |
| Version | Software product's version number. |
Registers
| Name | Description |
|---|---|
| G | G-code. |
| M | M-code. |
| N | Sequence number. |
| TowArea | Tow area. |
| TowLen | Tow length. |
| TowNum | Tow number, or zero for all tows combined. |
| X | Machine X axis. |
| Y | Machine Y axis. |
| Z | Machine Z axis. |
Language Keywords
(Language Keywords cannot be used as variable names.)
- And
- Case
- Debug
- Do
- Else
- ElseIf
- For
- If
- Log
- Loop
- mod
- Or
- Out
- Select
- Show
- Step
- To
- Until
- Wend
- While
- Xor
- Zap
- zapFrom
Vericut Drilling and Fastening¶
Subroutines are defined in the post by VDAF (Reserved Subroutines variables are defined before subroutine is called)
Modals
Modals are called once at the start of post-processing
| Variable | Type | Description |
|---|---|---|
| CSystem | String | NC Program coordinate system name |
| FileName | String | NC Program file name |
| Header1 | String | First NC Program header line |
| Header2 | String | Second NC Program header line |
| Header3 | String | Third NC Program header line |
| Header4 | String | Fourth NC Program header line |
| Header5 | String | Fifth NC Program header line |
| Post | String | Post processor file name (.vcpost) |
| Product | String | VDAF |
| Stamp | String | Time Stamp, long format, in local language (e.g. Saturday, June 21, 2008 9:30:41 PM EDT) |
| Stamp2 | String | Time Stamp, short format (e.g. 6/21/02 9:30 PM EDT) |
| StampEnglish | String | Time Stamp, long format, in English (e.g. Saturday, June 21, 2008 9:30:41 PM EDT) |
| User | String | System log in User name |
DefineRetractPoint
Called after Modals subroutine. Loop through all Way Points, invoked once fore each Way Point.
| Variable | Type | Description |
|---|---|---|
| RetractParent | String | Name of Retract Point's Parent or "" for none |
| RetractPoint | String | Name of Retract Point or "" for none |
| RetractPointI | Register | Retract Point Z axis (i value) |
| RetractPointJ | Register | Retract Point Z axis (j value) |
| RetractPointK | Register | Retract Point Z axis (k value) |
| RetractPointP | Register | Retract Point X axis (p value) |
| RetractPointQ | Register | Retract Point X axis (q value) |
| RetractPointR | Register | Retract Point X axis (r value) |
| RetractPointX | Register | Retract Point X |
| RetractPointY | Register | Retract Point Y |
| RetractPointZ | Register | Retract Point Z |
NewSequence
Called after DefineRetractPoint. Loop through all sequences, invoked once at the beginning of each sequence. All properties associated with the location are set before these subroutines are triggered.
| Variable | Type | Description |
|---|---|---|
| SequenceName | String | Sequence name |
StartCycleProcessing
Start a new location.
| Variable | Type | Description |
|---|---|---|
| ChamferAngle | Number | Chamfer angle for countersunk hole |
| ChamferDepth | Number | Chamfer depth for countersunk hole |
| ClearX | Register | Clearance Point X |
| ClearY | Register | Clearance Point Y |
| ClearZ | Register | Clearance Point Z |
| ClearDist | Register | cd = 0, means no clearance |
| CycleName | String | Cycle name for current location |
| Countersink | Number | 1 = countersunk hold, 0 = non-countersunk hole |
| DatumType | Number | 0 = not datum, 1 = local datum, 2 = global datum, 3 = csys |
| Description | String | Location description |
| Diameter | Number | Hole diameter |
| FastenerID | String | Fastener ID inserted at the location |
| FastenerLength | Number | Fastener length |
| FastenerType | Number | 1 = temp fastener, 2 = permanent fastener, 0 = no fastener |
| GlobalDatumID | String | Global datum ID |
| GlobalDatumI | Number | Global datum I value |
| GlobalDatumJ | Number | Global datum J value |
| GlobalDatumK | Number | Global datum K value |
| GlobalDatumX | Number | Global datum X value |
| GlobalDatumY | Number | Global datum Y value |
| GlobalDatumZ | Number | Global datum Z value |
| HeadAngle | Register | Head angle |
| I | Register | Location normal I |
| J | Register | Location normal J |
| K | Register | Location normal K |
| LocalDatumID | String | Location datum ID |
| LocalDatumI | Number | Location datum I |
| LocalDatumJ | Number | Location datum J |
| LocalDatumK | Number | Location datum K |
| LocalDatumX | Number | Location datum X |
| LocalDatumY | Number | Location datum Y |
| LocalDatumZ | Number | Location datum Z |
| LocationID | String | Location ID |
| MachineX | Register | Location X in Flex track csys or in Machine csys for no flex track machines. |
| MachineY | Register | Location Y in Flex track csys or in Machine csys for no flex track machines. |
| Region | String | Location region |
| StackCount | Number | Total number of stacks |
| StackMaterial[n] | String | Material string of the nth stack, [n] is "1, 2, 3..." |
| StackThicknessString | String | Thickness of each stack, concatenated string of double values separated by whitespace |
| StackThicknessValue[n] | Number | Double value of the nth stack thickness, [n] is "1, 2, 3..." |
| StackTotalThickness | Number | Overall stack thickness. π NOTE: this is not the sum of each stack thickness. It is the X caliper distance of all layers, which counts any model overlap air distance. |
| X | Register | LocationX |
| Y | Register | LocationY |
| Z | Register | LocationZ |
GoToApproachParent
Loop through all parent approach way points for each location for a given sequence. This sub is triggered before GoToApproach sub.
| Variable | Type | Description |
|---|---|---|
| RetractParent | String | Name of Retract Point's parent or "" for null |
| RetractPoint | String | Name of Retract Point or "" for null |
| RetractPointI | Register | Retract Point I |
| RetractPointJ | Register | Retract Point J |
| RetractPointK | Register | Retract Point K |
| RetractPointX | Register | Retract Point X |
| RetractPointY | Register | Retract Point Y |
| RetractPointZ | Register | Retract Point Z |
GoToApproach
Called at each location of a given sequence.
| Variable | Type | Description |
|---|---|---|
| ApproachDist | Register | Distance from location along surface normal. 0 = no clearance defined. |
| ApproachI | Register | Approach location I |
| ApproachJ | Register | Approach location J |
| ApproachK | Register | Approach location K |
| ApproachX | Register | Approach location X |
| ApproachtY | Register | Approach location Y |
| ApproachZ | Register | Approach location Z |
GoToLocation
Called at each location of a given sequence.
UserMachineCycles
Called at each location of a given sequence if locations' cycle name is defined, after the GoToLocation subroutines. A subroutine with the cycle name is triggered. Optional cycle parameters are set before this sub is triggered. If combined cycles are defined, will loop through all subcycles.
| Variable | Type | Description |
|---|---|---|
| CycleName | String | (Sub) Cycle name |
| OptString1 | String | Machine cycle optional string parameter 1 |
| OptString2 | String | Machine cycle optional string parameter 2 |
| OptNumber1 | Number | Machine cycle optional double parameter 1 |
| OptNumber2 | Number | Machine cycle optional double parameter 2 |
| OptNumber3 | Number | Machine cycle optional double parameter 3 |
| OptNumber4 | Number | Machine cycle optional double parameter 4 |
| OptSwitch1 | Number | Machine cycle optional integer parameter 1 |
| OptSwitch2 | Number | Machine cycle optional integer parameter 2 |
GoToRetract
| Variable | Type | Description |
|---|---|---|
| RetractDist | Register | Distance from location along surface normal. 0 = no clearance defined. |
| RetractI | Register | Retract location I |
| RetractJ | Register | Retract location J |
| RetractK | Register | Retract location K |
| RetractX | Register | Retract location X |
| RetractY | Register | Retract location Y |
| RetractZ | Register | Retract location Z |
GoToRetractParent
| Variable | Type | Description |
|---|---|---|
| RetractParent | String | Name of Retract Point's Parent or "" for null. |
| RetractPoint | String | Name of Retract Point or "" for null. |
| RetractPointI | Register | Retract point I |
| RetractPointJ | Register | Retract point J |
| RetractPointK | Register | Retract point K |
| RetractPointX | Register | Retract point X |
| RetractPointtY | Register | Retract point Y |
| RetractPointZ | Register | Retract point Z |
EndCycleProcessing
End of a location.
Terminate
Called once at the end
Functions¶
There is no provision for user-written functions in the post-processor language. You can however write subroutines which are not named to match APT major words, and use them anywhere.
Math Functions
| Signature | Description |
|---|---|
| number = abs(number) | Absolute value. |
| number = acos(number) or number = inverseCosine(number) |
Inverse cosine (result in degrees, between 0 and 180). |
| number = alogE(number) or number = antiLogarithm(number) or number = exp(number) |
Natural anti-logarithm. |
| number = alog10(number) | Base 10 anti-logarithm. |
| number = asin(number) or number = inverseSine(number) |
Inverse sine (result in degrees, between -90 and +90). |
| number = atn(number) or number = atan(number) or number = inverseTangent(number) |
Inverse tangent (result in degrees, between -90 and +90). |
| number = atan2(number, number) | Inverse tangent of first argument divided by second argument (result in degrees, between -180 and +180). |
| number = cos(number) or number = cosine(number) |
Cosine (argument in degrees). |
| number = fix(number) or number = int(number) |
Integer part. |
| number = logE(number) or number = logarithm(number) |
Natural logarithm. |
| number = log10(number) | Base 10 logarithm. |
| number = min(number, number) | Smaller of two arguments. |
| number = max(number, number) | Larger of two arguments. |
| number = root(number) or number = sqr(number) or number = sqrt(number) or number = squareRoot(number) |
Square root. |
| number = round(number) or number = nint(number,) |
Round to nearest integer. |
| number = sgn(number) or number = sign(number) |
Sign (-1, 0, or +1). |
| number = sin(number) or number = sine(number) |
Sine (argument in degrees). |
| number = tan(number) or number = tangent(number) |
Tangent (argument in degrees). |
String Manipulation
(positions are base 1)
| Signature | Description |
|---|---|
| number = Asc(string) or number = Ascii(string) |
Returns ASCII code of first character in argument. |
| number = CDbl(string) | Converts string to floating point value. |
| string = Chr(number) or string = Char(number) |
Returns string containing just the character with the specified ASCII code. |
| number = CInt(string) | Converts string to fixed point value. |
| number = InStr(string, string) or number = inString(string, string) |
Returns position of first occurrence of second argument in first argument. If there is no such occurrence, returns zero. |
| number = isDefined(string) | Returns 1 if named register's current value is defined, named numeric variable is defined, or named string variable is not empty. Otherwise returns 0, including the case when the argument is not the name of an existing register or variable. |
| string = LCase(string) or string = lowercase(string) |
Produces lowercase version of argument. |
| string = Left(string, number) | Returns characters from left of first argument, the number of them being specified by the second argument. |
| number = Len(string) or number = Length(string) |
Returns number of characters in first argument. |
| string = LTrim(string) or string = leftTrim(string) |
Trims whitespace from left of argument. |
| string = Mid(string, number, number) or string = Middle(string, number, number) |
Returns characters from middle of first argument, from position specified by second argument, the number of them being defined by the third argument. |
| string = Right(string, number) | Returns characters from right of first argument, the number of them being specified by the second argument. |
| string = RTrim(string) or string = rightTrim(string) |
Trims whitespace from right of argument. |
| string = Trim(string) | Trims whitespace from left and right of argument. |
| string = UCase(string) or string = uppercase(string) |
Produces uppercase version of argument. |
Register Related
| Signature | Description |
|---|---|
| Zap register | Sets previous value of a register to an undefined state. |
Array Related
| Signature | Description |
|---|---|
| number = LBound(string, number) | Returns lower bound of the array named in the first argument. The second argument is the "rank" of the array subscript of interest; 1 for the first, 2 for the second, et cetera. |
| number = UBound(string, number) | Returns upper bound of the array named in the first argument. The second argument is the "rank" of the array subscript of interest; 1 for the first, 2 for the second, et cetera. |
π NOTE: These functions differ from the equivalents in standard BASIC because their first arguments are a text string containing the name of the array, not the array itself.
Cache Related
(indices are base 0)
π NOTE: This group of functions is applicable only to Vericut Composites Simulation
| Signature | Description |
|---|---|
getNthAddCut(number) | Loads a set of variables detailing the n'th add or cut point in the cache. The list of variables is the same as that for a call to the GoTo subroutine, with the exception of the Cached flag, and the distances to the next add (ToNextAdd), the next cut (ToNextCut), the last cut (ToLastCut) and the end of the run-out (ToRunOut). A number variable, ACCount, provides the count of the points in the cache.
Add/Cut Related
(indices are base 0)
π NOTE: This group of functions is applicable only to Vericut Composites Simulation
| Signature | Description |
|---|---|
| number = getNthLength1(number) | Gets the length of the next tow segment to be cut. Returns zero if there are no more tow segments with the given index in the current tow-packet. A number variable, TowsInPacket, provides the count of the tows in the tow-packet. |
| number = getNthLength2(number) | Gets the distance to the next tow segment add. Returns a negative value if there are no more tow segments with the given index in the current tow-packet, or the last add has been passed. A number variable, TowsInPacket, provides the count of the tows in the tow-packet. |
| number = getNthLength3(number) | Gets the distance to the next tow segment cut. Returns a negative value if there are no more tow segments with the given index in the current tow-packet, or the last cut has been passed. A number variable, TowsInPacket, provides the count of the tows in the tow-packet. |
Input Related
π NOTE: This group of functions is applicable only to Vericut
| Signature | Description |
|---|---|
| number = getKnotValue(number) | Gets the cumulative knot value at the specified NURBS point. |
| Points are numbered from 1. | |
| If there are not enough points, a zero is returned. | |
| string = getNthWord(number) | Gets the n'th non-numeric parameter in the current APT line. |
| If there are not enough non-numeric parameters, an empty string is returned. | |
| number = getNthValue(number) | Gets the n'th numeric parameter in the current APT line. |
| If there are not enough numeric parameters, a zero is returned. | |
| string = getString(variable_name) | Gets the string value of the specified global String, Text or Axis NC Variable in Vericut and passes it to the post-processor. Supports elements of String and Axis arrays. |
| number = getValue(number) | Gets the numeric value at the specified parameter position in the current APT line. |
| Parameters are numbered from 1 for the major word. | |
| If the requested parameter is not numeric, zero is returned. | |
| number = getVariable(variable_name) | Gets the numerical value of the specified global numeric NC Variable in Vericut and passes it to the post-processor. Supports elements of Number Arrays and Frames. |
| string = getWord(number) | Gets the word at the specified parameter position in the current APT line. |
| Parameters are numbered from 1 for the major word. | |
| If the requested parameter is numeric, its text is returned. |
zapFrom | Sets a flag so that the next FROM or GOTO point will become the new HOME position.
Typically used during a tool change or tool axis adjustment.
Output Related
Vericut
| Signature | Description |
|---|---|
| Debug or Debug string |
Displays a dialog box with the current state of all numbers, strings and registers. |
| The string in the statement, if present, is used for the dialog title. | |
| Log string | Sends a string to the log. |
| Out string | Sends a string to both the output G-Code file and the log. |
Vericut Composites Programming
| Signature | Description |
|---|---|
| Debug or Debug string |
Displays a dialog box with the current state of all numbers, strings and registers. |
| The string in the statement, if present, is used for the dialog title. | |
| Log string | Sends a string to the auxiliary output file. |
| Out string | Sends a string to the G-Code output file. |
Show string | Sends a string to the productβs status area.
Subroutines¶
As the post-processor reads each statement from the input NC program, it attempts to invoke a subroutine, or "Sub", from the VcPost file. For example, when the post-processor encounters a RAPID statement, it will try to call the RAPID subroutine. For a subroutine with the name RAPID, the syntax of the start and end of such a subroutine is;
Sub RAPID
....
....
End Sub
Note that a subroutine has no arguments. Because all variables are global in scope, there is no need to pass them as arguments between subroutines. The code between the "Sub" and "End Sub" statements will be executed each time the RAPID subroutine is called.
If at some point within a subroutine you wish to bypass the remaining code, you can use an "Exit" statement.
Sub PPRINT
....
....
If (display = 0) Then
Exit Sub
End If
....
....
End Sub
It is not necessary to write a subroutine for every statement that the post-processor may encounter. If there is no subroutine for a particular statement, the post-processor does nothing, and does not generate an error message.
Do not be surprised to see code statements in a VcPost file that are not in any subroutine. While such lines can appear anywhere in the file, it is good practice to put them up front. They get executed by the post-processor before any statements are read from the input NC program. Typically they are used to establish the output format of registers and specify initial values. For example;
X.Prefix = "X"
X.Format = "s3.4sm"
Y.Prefix = "Y"
Y.Format = "s3.4sm"
Machine = "Horizontal Lathe"
Author = "I. B. Nutz"
MyRegister.Suffix = β] β
Before & After
π NOTE: The following table is only applicable to Vericut Inspection Probe Cycle Probing.
Depending on a statement's major word, the post-processor may perform some activities before invoking the appropriate subroutine, and it may perform more afterwards.
Using a GOTO statement as an example, the post-processor will first convert the statement's X, Y and Z coordinates, and I, J and K if present, to machine axis positions, load these into the reserved machine axis registers, X, Y, Z and others, then invoke the GOTO subroutine. Finally it will set the current value of the G register to 1. Performing this last activity after the subroutine call allows the G register to be tested within the subroutine to check for RAPID motion.
The following table details the "before and after" activities for each major word, in alphabetic order. If a major word is not in this list, there are no associated before or after activities, but a subroutine will still be invoked if one is supplied.
| Before | Sub | After |
|---|---|---|
| If the minor word "CLW" is present, reverses the axis of the current arc. | ARCMOV | |
| For a BEGIN NURBS statement, sets the order and the F register's current value, adjusts the tool axis, updates the NC program coordinates, converts to machine axis positions and sets the machine axis registers' current values. Each subsequent NURBS point, until an END NURBS statement is reached, has no major word but is treated as if it has the major word NURBSTO. | BEGIN | |
| For a $$*CATIA0 statement, sets the G register's current value to 0. | CATIA0 | |
| Sets the G register's current value to 0. | CATMAT | |
| Updates the arc variables, and sets the G register's current value to 2 (CW) or 3 (CCW). For a statement with just 4 numeric parameters (x, y, z, r), the arc axis and the G value cannot be trusted. Direction should be deduced from the following GOTO point. | CIRCLE, | |
| ARCDAT, | ||
| MOVARC, | ||
| ARC or | ||
| SURFACE | For a statement that includes the arc end-point (9 numeric parameters), sets the G register's current value to 1. | |
| Updates the NC program coordinates, and sets the NURBS weight (defaulting to 1.0). | CNTRL | |
| Sets the F register's current value to the first numeric parameter. | FEDRAT | |
| Sets the G register's current value to 0, updates the NC program coordinates, converts to machine axis positions, and sets the machine axis registers' current values. | FROM | |
| Adjusts the NC program coordinates, converts to machine axis positions, and sets the machine axis registers' current values. | GODLTA | Sets the G register's current value to 1. |
| Adjusts the NC program coordinates, converts to machine axis positions, and sets the machine axis registers' current values. If the statement has no axis minor words, motion will be to the FROM position unless the reserved variable, HomeRetract is defined and non-zero. | GOHOME | |
| or HOME | ||
| Updates the NC program coordinates, converts to machine axis positions, and sets the machine axis registers' current values. | GOTO, | |
| CONT or | ||
| VECTOR | Sets the G register's current value to 1. | |
| Builds a list of cumulative NURBS knot values which can be accessed by the getKnotValue function. | KNOT | |
| If the first minor word in the statement is "TOOL" or "WIRE", sets the T register's current value to the first numeric parameter. | LOAD | |
| Sets the T register's current value to the first numeric parameter. | LOADTL or | |
| CHGTOOL | ||
| Sets the G register's current value to 0. | MSYS | |
| Sets the NURBS order (defaulting to 4) and sets the weight to 1.0 for the current point, which is assumed to be the first knot (with a value of 0.0). | NURBS | |
| Each NURBS point between a BEGIN NURBS and END NURBS statement is treated as if it had this major word. Sets the knot and weight values, updates the NC program coordinates, converts to machine axis positions and sets the machine axis registers' current values. | NURBSTO | |
| For a PPRINT/METRIC or PPRINT/INCH statement, sets the reserved string Unit to "mm" or "in". | PPRINT | |
| For a PPRINT/TOOL AXIS or $$TOOL AXIS statement, updates the NC program coordinates, converts to machine axis positions and sets the machine axis registers' current values. | PPRINT | |
| For a PPRINT/Vericut-TOOLID statement, sets the T register's current value to the first numeric parameter. | PPRINT | |
| Sets the G register's current value to 0. | RAPID | |
| Sets the G register's current value to 0, updates the NC program coordinates, converts to machine axis positions, and sets the machine axis registers' current values. | RETRCT | |
| Provided the first minor word in the statement is not ORIENT, sets the S register's current value. If the minor word is OFF, LOCK or NEUTRAL the value will be 0. Otherwise it will be the first numeric parameter, or if there isn't one, the prior non-zero spindle speed. | SPINDL or SPNDL | |
| Adjusts tool axis, updates the NC program coordinates, converts to machine axis positions and sets the machine axis registers' current values. | TLAXIS | |
| Updates the arc variables, and sets the G register's current value to 2 (CW) or 3 (CCW). | TLON or | |
| GOFWD | Sets the G register's current value to 1. | |
| Sets the reserved string Unit to "mm" or "in". | UNIT | |
| If the first minor word in the statement is "TOOL" or "WIRE", sets the T register's current value to 0. | UNLOAD |
Calls
It is not normally necessary for a subroutine named for a major word to invoke one named for another major word. But you can do so.
You can also write a subroutine which is not associated with a major word, which will never be invoked directly by the post-processor. To call such a subroutine, you simply place its name in a statement on its own. There are no arguments because all variables are global in scope. For example you could write a subroutine to calculate rotate the current X and Y machine axis locations through an angle.
Sub RotateXY
ca = cos(Angle)
sa = sin(Angle)
XRotated = X * ca - Y * sa
YRotated = Y * ca + X * sa
End Sub
Then to use this subroutine you would need to set up the "Angle" variable, invoke the Sub and access the results.
Angle = 5
RotateXY
NewX = XRotated
NewY = YRotated
Assignment and Operators¶
Assignment
Assignment of a value to a variable is achieved using the equal sign, "=". The variable's name goes on the left of the equal sign, and an expression that generates the required value goes on the right. This is true for numbers, strings and register properties.
Diameter = R.Current * 2
Message = "Load tool " & T.Current
F.Prefix = " F"
MyRegister.Suffix = β] β
If the variable or register on the left of the equal sign does not already exist, it will be created by the assignment statement. If it does exist, its value or the value of its property, will be adjusted.
Arithmetic Operators
Order of precedence is from top to bottom.
| Operator | Description | Example | Result |
|---|---|---|---|
| ^ | Exponentiation. The first number is raised to the power of the second. |
2 ^ 3 | 8 |
| * | Multiplication. Multiplies two numbers |
2 * 3 | 6 |
| / | Division. Divides first number by second. |
7 / 2 | 3.5 |
| \ | Integer Division. Both numbers are rounded to the nearest integer value, the first is divided by the second, and the result is truncated to its integer part. |
7 2 | 3 |
mod | Modulus.
The remainder after dividing the first number by the second. | 7 mod 3 | 1
+ | Addition.
Adds two numbers. | 2 + 2 | 4
- | Subtraction.
Subtracts second number from first. | 5 - 3 | 2
String Operators
| Operator | Description | Example | Result |
|---|---|---|---|
| & | Concatenation. Second string is appended to first. |
"tool" & "path" | toolpath |
Logical Operators
Order of precedence is from top to bottom.
| Operator | Description | Example |
|---|---|---|
| = | True if both expressions are the same. Can be used with numbers or strings but not a mix. | |
| String comparisons are case insensitive. | X = Y | |
| < > | True if the expressions are different. Can be used with numbers or strings but not a mix. String comparisons are case insensitive. | X < > Y |
| < | True if the first number is smaller than the second, or if the first string collates before the second. String comparisons are case insensitive. | X < Y |
| > | True if the first number is greater than the second, or if the first string collates after the second. String comparisons are case insensitive. | X > Y |
| <= | True if the first number is smaller than or equal to the second, or if the first string collates before or is equal to the second. String comparisons are case insensitive. | X <= Y |
| >= | True if the first number is greater than or equal to the second, or if the first string collates after or is equal to the second. String comparisons are case insensitive. | X >= Y |
Not | Changes true to false, or false to true. | Not (Z > 0)
And | True if both expressions are true. | (X > 2) And (X <10)
Or | True if either or both expressions are true. | (X = 5) Or (X = 6)
Xor | True if one expression is true but not both. | (X = 5) Xor (Y = 5)
Note that the "Like", "Is", "Eqv" and "Imp" operators available in some flavors of BASIC, are not supported by the post-processor language.
Branching¶
There are two types of logic branching available in the post-processor language, the "If ... Then ... Else" technique and the "Select ... Case"" method.
If ... Then ... Else
Using "[" and "]" to bracket optional elements, the syntax is;
If condition Then
statements
[ElseIf condition Then
statements]
[ElseIf condition Then
statements]
[Else
statements]
End If
Note that a statement never appears on the same line following "Then", in an "If" or "ElseIf". This is possible in BASIC but we have chosen not to support it, to encourage more easily maintainable code. An "If" branch can be as simple as;
If (Offset < 0) Then
Offset = -Offset
End If
The parentheses around the condition are not strictly necessary but help improve legibility. Stepping up in complexity, an "If" can represent an either/or condition;
If (word = "Off") Then
M.Current = 11
Else
M.Current = 10
End If
Or it can cover any number of options;
If (word = "Off") Then
display = 0
ElseIf (word = "On" ) Then
display = 1
Else
Out "<N>(" & Comment & ")"
End If
Select ... Case
Using "[" and "]" to bracket optional elements, the syntax is;
Select Case expression
Case condition[,condition][,condition]
statements
[Case condition[,condition][,condition]
statements]
[Case condition[,condition][,condition]
statements]
[Case Else
statements]
End Select
The expression can be a number, string or register property. Each condition should involve the same variable type, with numeric register properties treated as numbers, and text register properties treated as strings. There is a wide choice of condition syntax as defined in the following table, in which variable denotes an expression that evaluates to a number or string.
| Syntax | Actioned if ... |
|---|---|
| variable | expression and variable are equal. |
| \< variable | expression is less than variable. |
| > variable | expression is greater than variable. |
| \<= variable | expression is less than or equal to variable. |
| >= variable | expression is greater than or equal to variable. |
| variable To variable | expression is within the inclusive range. |
Note that the operator "Is", available in some flavors of BASIC, is not supported by the post-processor language. Nor are compound conditions that would require use of the logical operators "Not", "And", "Or" or "Xor". At most one block of statements will be executed during a pass through the "Select" construct, regardless of the value of the expression and the conditions. If the expression matches more than one of the conditions, only the statements following the first such condition will be executed.
Following is an example of the use of "Select ... Case" which parallels the last example for the "If ... Then ... Else" technique.
Select Case word
Case "Off"
display = 0
Case "On"
display = 1
Case Else
Out "<N>(" & Comment & ")"
End Select
And here is an example that uses a number variable and illustrates more of the possible conditions.
Select Case ShankDiameter
Case < 0.25
Chuck = "A"
Case 0.25 To 1
Chuck = "B"
Case 1 To 2.5
Chuck = "C"
Case > 2.5
Chuck = "D"
End Select
Looping¶
There are three types of looping available in the post-processor language, "For ... Next", "Do ... Loop", and "While ... Wend".
For ... Next
Using "[" and "]" to bracket optional elements, the syntax is;
For counter = start To end [Step step]
statements
[Exit For
statements]
[Exit For
statements]
Next [counter]
The counter must be a number, or a register if its current value is to be used. The elements start, end and step, if present, must all be expressions that evaluate to a number. The value of the count and components of any of the expressions can be altered within the loop, but this tends to make debugging much more difficult. If step is missing, a value of -1 is assumed if start is greater than end, otherwise +1 is used.
For a positive or zero step, the contents of the loop are executed provided counter is less than or equal to end, and the counter gets increased by step. For a negative step, the contents of the loop are executed provided counter is greater than or equal to end, and the counter gets decreased by step. It is possible for the content of the loop to never be executed, as would be the case with the following example.
For Count = 1 To 5 Step -2
...
Next
Do ... Loop
Using "[" and "]" to bracket optional elements, and "|" to indicate a choice of keywords, the syntax is;
Do [While|Untilcondition]
statements
[Exit Do
statements]
[Exit Do
statements]
Loop [While|Untilcondition]
It would be very unusual to have While or Until conditions at both ends of the same loop. With a While in the Do statement, the content of the loop will be executed if the condition is true. With an Until in the Do statement, a false condition is required for the loop content to be processed. A While in the Loopstatement needs a true condition for control to return to the Do, and an Until would require a false condition.
You can write a "Do ... Loop" with no conditions at either end, but you had better have an "Exit Do" somewhere within it, or you could wait a while for the post-processor to finish.
While ... Wend
The syntax is;
While condition
statements
Wend
There is no "Exit" statement for a "While ... Wend" so it is vital that condition is changed within the loop, and that it becomes false at some point.