Postprocessor
Postprocessor
Postprocessor
A CAM system generates NC programs that are largely independent of the machines that
will be used to manufacture a design. The syntax, or language, of these NC programs is
typically a variant of APT CL. The machine controllers require files with a different
syntax, often referred to as machine code or G-Code. The purpose of an NC post-
processor is to convert the machine independent NC programs to G-Code files.
An early strategy for creating post-processors was to have a tailored program for each
machine/control combination needed. Such a program required no input from the user
other than the machine independent NC program files. But development of these post-
processors was time consuming and maintenance of a full suite of them quickly became a
nightmare in large organizations.
The next step in the evolution of post-processors was the "generalized post". With this
approach a single program would access a file of parameters for a given machine/control
combination, then process machine independent NC programs according to the values
and settings of the parameters. As machines became more complex and controllers
correspondingly more capable, the parameter files grew rapidly from a few flags and
limit values to a very complex set of inter-related choices. Effectively the parameter files
were required to express some logic handling abilities.
So the next required evolutionary step became clear. The machine/control parameter files
were enhanced with the syntax of their own language, so that they could express the
complex logic required for modern machines and controls. The post-processor program
became simpler as the language got more powerful, so that now the principal role of the
post-processor is to interpret the language.
Unfortunately post-processor technology has not matured to the point that there is just
one language for describing how to convert machine independent NC programs to G-
Code. Each post-processor vendor requires a different syntax and language. The language
of the CGTech Post-Processor borrows heavily from the syntax of BASIC (Beginner's
All-purpose Symbolic Instruction Code).
Why BASIC? The CAD/CAM world doesn't need another new language, so why not
BASIC? There is an inherent danger in borrowing the syntax of an established general-
purpose language for a specific task. Users who are familiar with the language can be
irritated by minor departures from the "standard". On the other hand, the fact that there
are users who don't have to learn the language from scratch is a big plus. We have
attempted to minimize departures from BASIC syntax as much as possible. Where there
are extensions, we have borrowed from Visual-Basic's syntax.
The post-processor reads a machine independent NC program, usually in some flavor of
APT CL, and processes one statement at a time. A statement can span several lines of the
input file. For each statement it invokes a "Sub" or subroutine which is a section of a
nominated machine/control dependent language file. Which "Sub" gets called depends on
the statement's major word. If there is no "Sub" for a particular major word, nothing
1
CGTech Post-Processor Help
happens and no error message is generated. More typically the "Sub" will format a G-
Code line or lines, for output to a machine dependent NC program and a log.
If you are new to the CGTech Post-Processor, it is suggested that you browse the Post-
Processor Language topics in the order they are presented. If you are already familiar
with the Post-Processor Language and only need to apply it to one of VERICUT's
applications, you could jump directly to one of the following application specific
sections.
Inspection Programming capabilities:
Probe Cycle Programming
2
CGTech Post-Processor Help
Post-Processor Language
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 CGTech 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 CGTech 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
3
CGTech Post-Processor Help
... 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;
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.
4
CGTech Post-Processor Help
"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;
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.
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.
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.
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
5
CGTech Post-Processor Help
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.
No other syntax to denote a comment is supported. In particular the "Rem" style that
appears in some flavors of BASIC cannot be used.
6
CGTech Post-Processor Help
Variables
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". There are no arrays. 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
7
CGTech Post-Processor Help
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.
If a string constant needs to contain a double-quotation mark, then two such marks should
be used. For example;
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"
8
CGTech Post-Processor Help
9
CGTech Post-Processor Help
Registers
X.Prefix = "X"
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
Zap R
10
CGTech Post-Processor Help
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
11
CGTech Post-Processor Help
12
CGTech Post-Processor Help
VERICUT
VERICUT Inspection Probe Cycle Programming
VERICUT Composite Programming
VERICUT Composite Probing
13
CGTech Post-Processor Help
VERICUT
The following variables are reserved for use in VERICUT post-processors. Each of these
variables correspond 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). These post-
processor Variable names must declared in .vcpost file. All of these post-processor
Variables are automatically updated by VERICUT at the end of each block before
executing post-processor subroutines.
14
CGTech Post-Processor Help
15
CGTech Post-Processor Help
16
CGTech Post-Processor Help
17
CGTech Post-Processor Help
18
CGTech Post-Processor Help
Name Description
ArcRadius Radius of current arc.
ClearRetract Default clearance plane retract distance.
GOHOME retract distance. Zero if GOHOME without axis minor
HomeRetract
words should use FROM point.
Cumulative value of NURBS knot at current point (CATIA style
NurbsKnot
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.
Current X coordinate of arc center, transformed by NC program
PathCenterX
matrix.
Current Y coordinate of arc center, transformed by NC program
PathCenterY
matrix.
Current Z coordinate of arc center, transformed by NC program
PathCenterZ
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.
19
CGTech Post-Processor Help
Strings
Name Description
Current APT statement.
APTLine All of the statement's parameters are concatenated into a single line,
even if the source has continuation lines.
Next APT statement.
APTNext All of the statement's parameters are concatenated into a single line,
even if the source has continuation lines.
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,
Comment
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.
Today's date.
Date In the localized "short" format, so for example in the USA, Christmas
day would be "12/25/04".
Current time of day.
Time In the localized "medium" format, so for example in the UK, tea-time
would be "16:00:00".
Unit Linear unit, "in" or "mm".
20
CGTech Post-Processor Help
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.
21
CGTech Post-Processor Help
Language Keywords
(Language Keywords cannot be used as variable names.)
22
CGTech Post-Processor Help
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.
Number whose binary representation encapsulates the tow on/off
AddCutI
state.
Number whose binary representation encapsulates the tow on/off
AddCutJ
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.
The maximum desirable departure of a tow from the ply
AngleTol
direction, in degrees.
Cache flag; 1 if point was placed in the cache, and is thus an add
Cached
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
23
CGTech Post-Processor Help
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.
Counter-clockwise rotation of (EX,EY,EZ) vector about surface
ETwist
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
Good approximation of the distance of point, along the head
LParam 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.
24
CGTech Post-Processor Help
25
CGTech Post-Processor Help
26
CGTech Post-Processor Help
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.
Today's date.
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 or SAT).
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.
Current time of day.
Time In the localized "medium" format, so for example in the UK, tea-time
would be "16:00:00".
27
CGTech Post-Processor Help
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
28
CGTech Post-Processor Help
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
Inverse cosine (result in degrees, between 0 and 180).
number =
inverseCosine(number)
number = alogE(number)
or
number =
Natural anti-logarithm.
antiLogarithm(number)
or
number = exp(number)
number = alog10(number) Base 10 anti-logarithm.
number = asin(number)
or
Inverse sine (result in degrees, between -90 and +90).
number =
inverseSine(number)
number = atn(number)
or
number = atan(number)
Inverse tangent (result in degrees, between -90 and +90).
or
number =
inverseTangent(number)
number = atan2(number, Inverse tangent of first argument divided by second
number) argument (result in degrees, between -180 and +180).
number = cos(number)
or Cosine (argument in degrees).
number = cosine(number)
number = fix(number)
Integer part.
or
29
CGTech Post-Processor Help
number = int(number)
number = logE(number)
or Natural logarithm.
number = logarithm(number)
number = log10(number) Base 10 logarithm.
number = min(number,
Smaller of two arguments.
number)
number = max(number,
Larger of two arguments.
number)
number = root(number)
or
number = sqr(number)
or
Square root.
number = sqrt(number)
or
number =
squareRoot(number)
number = round(number)
or Round to nearest integer.
number = nint(number,)
number = sgn(number)
or Sign (-1, 0, or +1).
number = sign(number)
number = sin(number)
or Sine (argument in degrees).
number = sine(number)
number = tan(number)
or Tangent (argument in degrees).
number = tangent(number)
String Manipulation
(positions are base 1)
Signature Description
number = Asc(string)
or Returns ASCII code of first character in argument.
number = Ascii(string)
number = CDbl(string) Converts string to floating point value.
30
CGTech Post-Processor Help
string = Chr(number)
Returns string containing just the character with the
or
specified ASCII code.
string = Char(number)
number = CInt(string) Converts string to fixed point value.
number = InStr(string, string)
Returns position of first occurrence of second argument
or
in first argument. If there is no such occurrence, returns
number = inString(string,
zero.
string)
Returns 1 if named register's current value is defined,
named numeric variable is defined, or named string
number = isDefined(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 Produces lowercase version of argument.
string = lowercase(string)
Returns characters from left of first argument, the
string = Left(string, number)
number of them being specified by the second argument.
number = Len(string)
or Returns number of characters in first argument.
number = Length(string)
string = LTrim(string)
or Trims whitespace from left of argument.
string = leftTrim(string)
string = Mid(string, number,
number) Returns characters from middle of first argument, from
or position specified by second argument, the number of
string = Middle(string, them being defined by the third argument.
number, number)
string = Right(string, Returns characters from right of first argument, the
number) number of them being specified by the second argument.
string = RTrim(string)
or Trims whitespace from right of argument.
string = rightTrim(string)
string = Trim(string) Trims whitespace from left and right of argument.
string = UCase(string)
or Produces uppercase version of argument.
string = uppercase(string)
31
CGTech Post-Processor Help
Register Related
Signature Description
Zap register Sets previous value of a register to an undefined state.
Cache Related
(indices are base 0)
Signature Description
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
getNthAddCut(number)
(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)
Signature Description
Gets the length of the next tow segment to be cut.
Returns zero if there are no more tow segments
number = getNthLength1(number) with the given index in the current tow-packet. A
number variable, TowsInPacket, provides the
count of the tows in the tow-packet.
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-
number = getNthLength2(number)
packet, or the last add has been passed. A number
variable, TowsInPacket, provides the count of the
tows in the tow-packet.
32
CGTech Post-Processor Help
Input Related
Signature Description
Gets the cumulative knot value at the specified
NURBS point.
number = getKnotValue(number) Points are numbered from 1.
If there are not enough points, a zero is
returned.
Gets the n'th non-numeric parameter in the
current APT line.
string = getNthWord(number)
If there are not enough non-numeric
parameters, an empty string is returned.
Gets the n'th numeric parameter in the current
APT line.
number = getNthValue(number)
If there are not enough numeric parameters, a
zero is returned.
Gets the string value of the specified global
String, Text or Axis NC Variable in VERICUT
string = getString(variable_name)
and passes it to the post-processor. Supports
elements of String and Axis arrays.
Gets the numeric value at the specified
parameter position in the current APT line.
Parameters are numbered from 1 for the major
number = getValue(number)
word.
If the requested parameter is not numeric, zero
is returned.
33
CGTech Post-Processor Help
Output Related
VERICUT
Signature Description
Displays a dialog box with the current state of all
Debug
numbers, strings and registers.
or
The string in the statement, if present, is used for the
Debug string
dialog title.
Log string Sends a string to the log.
Sends a string to both the output G-Code file and the
Out string
log.
Signature Description
Displays a dialog box with the current state of all
Debug
numbers, strings and registers.
or
The string in the statement, if present, is used for the
Debug string
dialog title.
Log string Sends a string to the auxiliary output file.
34
CGTech Post-Processor Help
35
CGTech Post-Processor Help
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"
36
CGTech Post-Processor Help
Y.Format = "s3.4sm"
Machine = "Horizontal Lathe"
Author = "I. B. Nutz"
37
CGTech Post-Processor Help
38
CGTech Post-Processor Help
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
39
CGTech Post-Processor Help
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
40
CGTech Post-Processor Help
Diameter = R.Current * 2
Message = "Load tool " & T.Current
F.Prefix = " F"
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.
41
CGTech Post-Processor Help
Subtraction.
- 5-3 2
Subtracts second number from first.
String Operators
Logical Operators
Order of precedence is from top to bottom.
42
CGTech Post-Processor Help
Note that the "Like", "Is", "Eqv" and "Imp" operators available in some flavors of
BASIC, are not supported by the post-processor language.
43
CGTech Post-Processor Help
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 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;
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;
44
CGTech Post-Processor Help
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.
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
45
CGTech Post-Processor Help
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.
And here is an example that uses a number variable and illustrates more of the possible
conditions.
46
CGTech Post-Processor Help
Looping
There are three types of looping available in the post-processor language, "For ... Next",
"Do ... Loop" and "While ... Wend.
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.
Do ... Loop
Using "[" and "]" to bracket optional elements, and "|" to indicate a choice of keywords,
the syntax is;
Do [While|Until condition]
statements
47
CGTech Post-Processor Help
[Exit Do
statements]
[Exit Do
statements]
Loop [While|Until condition]
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 Loop statement 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 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.
48
CGTech Post-Processor Help
Post-Processor Output
VERICUT
VERICUT Inspection Probe Cycle Programming
VERICUT Composite Programming
VERICUT Composite Probing
49
CGTech Post-Processor Help
VERICUT
There are two types of post-processor language statements that generate output to files,
"Out" and "Log". "Out" writes to a G-Code file and "Log" writes to an auxiliary file. A
third language statement, "Show", sends messages to the product’s status area. The
syntax for all three statements is the same;
Out string_expression
Log string_expression
Show string_expression
It is important to note that the order that Out, Log, and Show command appear in the
post-processor is important. This is because the Out command causes the variable to be
incremented, while the Log and Show commands do not. Log and Show commands
should be placed before an Out command when used together in the post-processor.
The string_expression can take advantage of some extra features of the language. In its
simplest form, an expression could be a string constant;
Out "(Load Palette)"
or it could involve concatenation of constants, string variables and textual register
properties.
Out "Job " & jobName & ", Spindle Speed " & S.Output
Remember that a string expression cannot contain a number variable, because there is no
way to specify the format required. If you need to output a number, you should probably
be using a register instead. If necessary, you could use a register just for this purpose;
Temp.Format = "s4.2"
Temp.Current = toolDia
Out "Tool Diameter = " & Temp.Output & "mm"
A reference to a register variable that does not have a property qualifier will use the
Current property if a number is expected, and the Output property when a string would
make sense. Thus this last example could be simplified to;
Temp.Format = "s4.2"
Temp = toolDia
Out "Tool Diameter = " & Temp & "mm"
To explore this topic further, let's use a sample that will be much more common. The
GOTO subroutine for a 3-axis machine needs to output lines similar to the following;
50
CGTech Post-Processor Help
Probably the G, X, Y, Z and F registers will be modal, so that their values will only be
output when they have changed. The N register will always change so it doesn't matter
whether we think of this as being modal or not. Let's assume that the Prefix property for
each register except N includes a leading space. With the rules that we have introduced so
far, you could write a statement to generate the required G-code lines as follows;
Out N.Output & G.Output & X.Output & Y.Output & Z.Output & F.Output
Or more concisely;
Out N & G & X & Y & Z & F
Here is another way that may not initially seem to have any advantage over the prior
implementation.
Out "<N><G><X><Y><Z><F>"
The key here is that the register references are now embedded in a string constant, using
the "<" and ">" characters. So if the output line has some constant elements and some
register values, it can be specified without using concatenation. The last line of our earlier
example could be written;
Zap F
somewhere in one of the subroutines involved in a head change. The other technique is a
variant of the "<register>" syntax. By placing an exclamation point in front of the
register name, "<!register>", you will force output of that register's value.
The Increment property of the N register should always be set to a positive value, in the
segment of your VcPost file that is outside all subroutines.
N.Increment = 1
Each time an "Out" statement includes the N register, its value will automatically be
incremented. If the balance of the output line is modal registers, and none of them have
changed, then no output is generated and the N register will not be changed. A "Log"
statement does not cause any register values to be incremented.
51
CGTech Post-Processor Help
There are two types of post-processor language statements that generate output to files,
"Log" and "Out". "Log" only writes to a log file of the post-processor's activities, but
"Out" directs output both to the log file and to the G-Code file. Input lines from the APT
source are also sent to the log file, but this does not require any language statements in
the VcPost. The syntax for the output statements is;
Log string_expression
Out string_expression
But in each case the string_expression can take advantage of some extra features of the
language. In its simplest form, an expression could be a string constant;
Log "Job " & jobName & ", Spindle Speed " & S.Output
Remember that a string expression cannot contain a number variable, because there is no
way to specify the format required. If you need to output a number, you should probably
be using a register instead. If necessary, you could use a register just for this purpose;
Temp.Format = "s4.2"
Temp.Current = toolDia
Log "Tool Diameter = " & Temp.Output & "mm"
A reference to a register variable that does not have a property qualifier will use the
.Current property if a number is expected, and the .Output property when a string
would make sense. Thus this last example could be simplified to;
Temp.Format = "s4.2"
Temp = toolDia
Log "Tool Diameter = " & Temp & "mm"
52
CGTech Post-Processor Help
To explore this topic further, let's use a sample that will be much more common. The
GOTO subroutine for a 3-axis machine needs to output lines similar to the following;
Probably the G, X, Y, Z and F registers will be modal, so that their values will only be
output when they have changed. The N register will always change so it doesn't matter
whether we think of this as being modal or not. Let's assume that the .Prefix property for
each register except N includes a leading space. With the rules that we have introduced so
far, you could write a statement to generate the required G-Code lines as follows;
Out N.Output & G.Output & X.Output & Y.Output & Z.Output & F.Output
Or more concisely;
Here is another way, which may not initially seem to have any advantage over the prior
implementation.
Out "<N><G><X><Y><Z><F>"
The key here is that the register references are now embedded in a string constant, using
the "<" and ">" characters. So if the output line has some constant elements and some
register values, it can be specified without using concatenation. The last line of our earlier
example could be written;
Zap F
somewhere in one of the subroutines involved in a tool change. The other technique is a
variant of the "<register>" syntax. By placing an exclamation point in front of the
register name, "<!register>", you will force output of that register's value.
53
CGTech Post-Processor Help
The .Increment property of the N register should always be set to a positive value, in the
segment of your VcPost file that is outside all subroutines.
N.Increment = 1
Each time an "Out" statement includes the N register, its value will automatically be
incremented. If the balance of the output line is modal registers, and none of them have
changed, then no output is generated and the N register will not be changed. To illustrate
this, we will go back to our early sample GOTO subroutine.
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
RAPID
GOTO/1,2,6
RAPID
GOTO/1,2,2
N21G00X1.Y2.
N22Z6.
N23Z2.
Note that there is only one output line corresponding to the second GOTO, when both X
and Y are unchanged.
54
CGTech Post-Processor Help
NOTE: The following post-processor language statements that generate output to files
apply to both VERICUT Composites Programming and to VERICUT Composites
Probing.
There are two types of post-processor language statements that generate output to files,
"Out" and "Log". "Out" writes to a G-Code file and "Log" writes to an auxiliary file. A
third language statement, "Show", sends messages to the product’s status area. The
syntax for all three statements is the same;
Out string_expression
Log string_expression
Show string_expression
The string_expression can take advantage of some extra features of the language. In its
simplest form, an expression could be a string constant;
Out "(Load Palette)"
or it could involve concatenation of constants, string variables and textual register
properties.
Out "Job " & jobName & ", Spindle Speed " & S.Output
Remember that a string expression cannot contain a number variable, because there is no
way to specify the format required. If you need to output a number, you should probably
be using a register instead. If necessary, you could use a register just for this purpose;
Temp.Format = "s4.2"
Temp.Current = toolDia
Out "Tool Diameter = " & Temp.Output & "mm"
A reference to a register variable that does not have a property qualifier will use the
Current property if a number is expected, and the Output property when a string would
make sense. Thus this last example could be simplified to;
Temp.Format = "s4.2"
Temp = toolDia
Out "Tool Diameter = " & Temp & "mm"
55
CGTech Post-Processor Help
To explore this topic further, let's use a sample that will be much more common. The
GOTO subroutine for a 3-axis machine needs to output lines similar to the following;
Probably the G, X, Y, Z and F registers will be modal, so that their values will only be
output when they have changed. The N register will always change so it doesn't matter
whether we think of this as being modal or not. Let's assume that the Prefix property for
each register except N includes a leading space. With the rules that we have introduced so
far, you could write a statement to generate the required G-code lines as follows;
Out N.Output & G.Output & X.Output & Y.Output & Z.Output & F.Output
Or more concisely;
Out N & G & X & Y & Z & F
Here is another way that may not initially seem to have any advantage over the prior
implementation.
Out "<N><G><X><Y><Z><F>"
The key here is that the register references are now embedded in a string constant, using
the "<" and ">" characters. So if the output line has some constant elements and some
register values, it can be specified without using concatenation. The last line of our earlier
example could be written;
Zap F
somewhere in one of the subroutines involved in a head change. The other technique is a
variant of the "<register>" syntax. By placing an exclamation point in front of the
register name, "<!register>", you will force output of that register's value.
The Increment property of the N register should always be set to a positive value, in the
segment of your VcPost file that is outside all subroutines.
N.Increment = 1
56
CGTech Post-Processor Help
Each time an "Out" statement includes the N register, its value will automatically be
incremented. If the balance of the output line is modal registers, and none of them have
changed, then no output is generated and the N register will not be changed. A "Log" or
"Show" statement does not cause any register values to be incremented.
57
CGTech Post-Processor Help
Post-Processor Debugging
Debug title_string
The title_string is optional, and if present will be used in the title bar of the window.
You could have just one "Debug" statement outside all the subroutines in the VcPost file.
Then the window would appear as soon you start processing the input NC program. As
you step through the NC program, you can refresh the content of the Debug window at
any time, just by clicking on its icon.
58
CGTech Post-Processor Help
Alternatively you can place "Debug" statements in several places, with different titles,
and a window will be added to the display each time the post-processor reaches such a
statement. Putting a "Debug" statement inside a loop would not be a good idea. You can
close any of the Debug windows by clicking on its icon.
A icon within the register table indicates that a particular property has no defined
value.
59
CGTech Post-Processor Help
60
CGTech Post-Processor Help
Introduction
VERICUT can be used to generate G-Code files that drive an NC machine through the
steps required to inspect a workpiece with one or more probes. You will find this
capability in the menus at Analysis menu > Inspection. Once you have picked the
features that are to be inspected, you can use the (Use probe for all features) icon to
specify that each of them will be probed. Then the (Program probe cycles) icon will
present the Inspection Programming window, and prompt you to select a post-processor
language file. By convention such a file should have the extension ".VcPost".
Probe cycle programming uses the post-processor language file to determine how to
format the output G-Code files. In addition, comments within the file are used to define
the names of the probe cycles available on the target machine, and the names of each
cycle's parameters. Both types of names get displayed in the programming dialog's table,
and the user is expected to pick a cycle which is appropriate for measuring each feature,
and to provide numeric values for at least some of its parameters. This document is
primarily concerned with defining the syntax of the comments.
There are eight keywords used in the probe cycle comments, each of which starts with the
character "#". The keywords are;
A subroutine or "Sub" within the post-processor language file can employ at most just
one of these keywords. It may have more than one comment line with the same keyword.
Such comment lines must be between the "Sub" and "End Sub" statements.
In addition to the keyword, any of the comment lines can also contain parameter names,
which should be separated by spaces. Each parameter name will be used as the name of a
register in the post-processor, so the name must conform to the rules for variable names.
They must start with a letter and can only contain letters, numerals and the underscore
character, "_". Note that there are language keywords that cannot be used as parameter
names. Parameters can be essential to the interpretation of a probe cycle, or optional. An
exclamation mark, "!", preceding a parameter's name in the comment line declares it as
mandatory. The syntax should become much clearer in the following examples.
61
CGTech Post-Processor Help
#Init
There should only be one subroutine containing a comment line with the #Init keyword,
and it will be invoked once, before any other subroutines, when the post-processor is run.
For example, if the following is defined in the post-processor language file,
Sub Initialize()
' #Init Offset Clearance FeedRate
Out "<N> G17"
End Sub
then the first row in the inspection programming table will initially look like this.
Note that it is the name of the subroutine, "Initialize", that appears in the "Cycle" column
of the table. So you can alter the prompt in the table to match the user's language and
preferences. The parameter names that follow the #Init keyword on the comment line will
appear in the numbered columns, in the order they are listed. If you need more
parameters than can comfortably fit on one comment line, simply add more lines, each
with the #Init keyword. There is a maximum of 16 parameters per subroutine. As with the
subroutine name, the parameter names can be localized for language and user taste.
In this example the three parameters are optional, so none of their names are preceded by
an exclamation mark. Note too that none of the parameters are used in the subroutine. If
the user provides a value for one of them in the table, that value will be established as the
current value of the register of the same name, before the subroutine is invoked.
#End
There should only be one subroutine containing a comment line with the #End keyword,
and it will be invoked once, after all other subroutines. For example,
Sub Terminate()
' #End
End Sub
62
CGTech Post-Processor Help
This subroutine has no parameters, and more unusually, no executable statements, but its
name will appear in the last row of the table.
#Rapid
One or more rows for rapid motion can be inserted in the programming table before the
approach to any feature that is to be measured. There should only be one subroutine
containing a comment line with the #Rapid keyword, and it will be invoked for each of
the corresponding rows in the table. This example will "square" the rapid motion. Note
that all three parameters are mandatory, so their names are preceded by exclamation
marks.
Sub Rapid()
' #Rapid !X !Y !Z
If (Z < Z.Previous) Then
Out "<N> G0<X><Y>"
Out "<N><Z>"
Else
Out "<N> G0<Z>"
Out "<N><X><Y>"
End If
End Sub
The background of table cells for mandatory parameters is pink. As the user replaces the
parameter names with numeric values, the pink will be removed. He or she should aim to
eliminate all the pink before running the post-processor.
63
CGTech Post-Processor Help
#Move
Like rapid motions, one or more feedrate motions can be inserted in the programming
table before the approach to a feature that is to be measured. There should only be one
subroutine containing a comment line with the #Move keyword, and it will be invoked
for each of the corresponding rows in the table. This example has a mix of mandatory and
optional parameters.
Sub Move()
' #Move !X !Y !Z FeedRate
Out "<N> G1<X><Y><Z><FeedRate>"
End Sub
If the user leaves the word "FeedRate" in the last parameter's cell, the register with the
same name will not be altered from its prior state.
#Approach
There should only be one subroutine containing a comment line with the #Approach
keyword, and it will be invoked immediately before each of the cycle routines that
measure a feature. For example,
Sub Approach()
' #Approach !X !Y !Z Clearance FeedRate
Z = Z + Clearance
If (Z < Z.Previous) Then
Out "<N> G1<X><Y><FeedRate>"
Out "<N><Z>"
Else
Out "<N> G1<Z><FeedRate>"
Out "<N><X><Y>"
End If
Z = Z - Clearance
GoFeel
End Sub
If you find that there are several parameters that are common to almost all of your cycle
subroutines, you may wish to move them to the approach subroutine. Since this is always
64
CGTech Post-Processor Help
called before the cycle, you can reduce the number of columns used in the table and
provide a more consistent user interface across different cycle types.
#Retract
There should only be one subroutine containing a comment line with the #Retract
keyword, and it will be invoked after each of the cycle routines that measure a feature.
For example,
Sub Retract()
' #Retract Clearance FeedRate
Z = Z + Clearance
Out "<N> G1<Z><FeedRate>"
End Sub
#Cycle
There should as many subroutines containing a comment line with the #Cycle keyword as
there are probe cycles available on the target machine. Typically each such subroutine
will have numerous parameters, and we suggest listing the mandatory ones before the
optional ones. In this example the parameter list is spread across two comment lines, both
beginning with the #Cycle keyword.
Sub WallThick()
' #Cycle !X !Y !Width !Depth !Angle
' #Cycle !Correction Offset MaxSafe
MVAR =4
CPA =X
CPO =Y
SETVAL = Width
ID = Depth
STA1 = Angle
Out "<N><MVAR><CPA><CPO><SETVAL><ID><STA1>"
Out "<N><Correction><Offset><MaxSafe>"
Out "<N> CYCLE979"
End Sub
The alphabetically sorted set of all cycle subroutines is offered in a drop-down list in the
fourth column of each feature row of the table.
65
CGTech Post-Processor Help
Once a cycle type has been selected, the parameters of the corresponding subroutine will
be inserted into the table. Not all of them are included in this illustration.
#Save
Some suites of probe cycles have the ability to save the result of one measurement and
compare it with other measurements in a later cycle. For example, if you wanted to check
that the Z dimension of one surface matched that of another, you could save the result of
probing the first surface, then on the second one use a cycle that compared the new
probed Z with the stored value. If your target machine has this capability, you need a
single subroutine containing the #Save keyword. For example,
Sub Store()
' #Save
Out "<N> G65 P9834"
End Sub
The user will then be able to insert a "save" row prior to any retract.
66
CGTech Post-Processor Help
As with any of the keyword identified subroutines, the #Save subroutine can have
parameters if needed.
67
CGTech Post-Processor Help
When the Write button on VCP's Post card is triggered, statements and subroutines
written in the post-processor language are invoked in a specific sequence. Knowing this
sequence is essential to writing or modifying a post. First, all statements that are not in
any subroutine are executed, in the order that they appear in the VcPost file. It makes
sense to have all these statements at the front of the file. Having them interspersed
between subroutines is possible, but would create a maintenance headache. Typically
these statements are used to establish the names and types of variables and the properties,
such as the output formatting, of registers. The "tree" below shows the sequence in which
post subroutines will be invoked. Click on a subroutine name to obtain an alphabetic list
of the variables that are defined just prior to that subroutine's call. Once a variable is
defined, it remains available for use by all subsequent calls, although its value may be
updated.
68
CGTech Post-Processor Help
69
CGTech Post-Processor Help
Point is appended to a cache which is accessible when needed with
the getNthAddCut function, and the numeric variable ACCount is
incremented.
o PacketHeader
o For each point or option on the head path ...
GoTo or Option
o For each mid-packet safe restart point ...
RestartHeader
If a virtual spin axis is in use ...
CamHeader
For each point on the virtual spin axis ...
CamPoint
CamTrailer
For each point in the restart ...
MoveTo
RestartBuffer
For each point on the restart's lead-in ...
GoTo
RestartTrailer
o PacketTrailer
• For the final link ...
o LinkHeader
o If link has a spinning egress ...
For each point or option in the egress ...
MoveTo or Option
o For each point or option in the traverse ...
MoveTo or Option
After first point in the traverse ...
OffForm
o LinkTrailer
• PlyTrailer
70
CGTech Post-Processor Help
Post-Processor Subroutines/Variables
Primer
Called once before all other subroutines if requested on VCP's Post card. No
additional variables defined. Typically a primer subroutine will establish a few variables
in the post-processor which will be used subsequently to affect the content of the G-Code
file. The following example sets a single variable to adjust the machine's coordinate
system;
The comment line immediately following the "Sub" statement is not essential, but very
desirable. The "#Primer" line identifies the subroutine as an initialization routine, so that
its name can be offered in a drop-down choice list on VCP's Post card.
Modals
Called once at the start of post-processing.
71
CGTech Post-Processor Help
72
CGTech Post-Processor Help
73
CGTech Post-Processor Help
to spin axis.
UnitPerMm Number Linear output unit per millimeter (1.0 or 1.0/25.4).
User String User's computer account name.
Version String Software product's version number.
Virtual spin axis flag; 0 for none, 1 for automatically
VirtualAxis Number
determined virtual axis.
Extent
Called once after the Modals subroutine to define the physical extent of all linked tow-
packets in the ply, it will subsequently be invoked for each individual packet. If there is a
stationary or spinning rotisserie, the variables are all defined in the axis system specified
on VCP's Links card. If there is no rotisserie, the variables are all defined in the same
axis system as the other coordinates in the G-Code file.
Length
Invoked after the initial Extent call, first in a loop for each tow number present in the
linked tow-packets, then again for the total amount of material required. This same
pattern of a loop and a single call is used subsequently as each tow-packet is processed.
Tow areas can be combined with the material thickness (MatThick) and material density
(MatDense) values already established, to present volumes and weights.
74
CGTech Post-Processor Help
CamHeader
Invoked once after the initial Length call if there is a virtual spin axis involved. No
additional variables defined.
CamPoint
Invoked once for each point on the virtual spin axis.
CamTrailer
Invoked once after all the CamPoint calls. No additional variables defined.
PlyHeader
Invoked once after the initial Length calls, or the CamTrailer call. No additional
variables defined.
LinkHeader
Called to start processing of the ply's initial entry, for each link between tow-packets, and
for the final retract.
75
CGTech Post-Processor Help
PulloutHeader
Called to start the processing of an optional safe pullout block. No additional variables
defined. This function should be omitted from any post that is not intended to handle safe
pullouts.
PulloutTrailer
Called after the processing of an optional safe pullout block. No additional variables
defined.
MoveTo
Called for each point on a link's head path. The coordinate system for the variables is the
one specified on VCP's Post card.
76
CGTech Post-Processor Help
OffForm
Invoked when the roller moves out of range of the form. No additional variables defined.
Can be used to turn on collision checking between the roller and the form, and to turn off
roller direction checking in verification software, such as VCS.
OnForm
Invoked when the roller moves within range of the form. No additional variables defined.
Can be used to relax collision checking between the roller and the form, allowing for
roller compression and to turn on roller direction checking in verification software, such
as VCS.
TraverseHeader
Called to start processing of the off-part traverse portion of a link. This function should
be omitted from any post that does not need to handle "wind-up" problems in a head's
"wrist action".
TraverseTo
Called for each point in the traverse portion of a link's head path, provided
TraverseHeader routine is present. This data should not be output directly to the G-Code
file, as it will be repeated in MoveTo calls. Instead it can be used to determine whether
77
CGTech Post-Processor Help
78
CGTech Post-Processor Help
TraverseTrailer
Called after processing the off-part traverse portion of a link. No additional variables
defined.
LinkTrailer
Called after processing each link, including the ply's initial entry and final retract. No
additional variables defined.
PacketHeader
Called to start processing of a tow-packet. No additional variables defined.
RestartHeader
Called to start processing of an optional safe restart block. No additional variables
defined. This function should be omitted from any post that is not intended to handle safe
restarts.
RestartBuffer
Called to permit buffering of the safe restart's extra add point and any of the original add
and cut points that occur after the safe restart location. The original add and cut points are
still accessible using the getNthAddCut function. The details of the new add point is pre-
loaded into the following variables. The coordinate system for the variables is the one
specified on VCP's Post card.
79
CGTech Post-Processor Help
RestartTrailer
Called after processing of an optional safe restart block. No additional variables defined.
GoTo
Called for each point on a tow-packet's head path. The coordinate system for the
variables is the one specified on VCP's Post card.
80
CGTech Post-Processor Help
81
CGTech Post-Processor Help
Option
A post-processor option's subroutine is invoked when the option is encountered on a link
or tow-packet. Only those parameters which were specified as being relevant to the
option are set prior to the subroutine call. Prior values of other parameters are not altered.
82
CGTech Post-Processor Help
An example may help clarify the relationship between a post-processor option, the
subroutine it needs in the VcPost file, and the parameters in the table above. Suppose we
need to insert messages to the operator in the G-Code file. We will call this option
"OpMessage" and the content of the parameter fields on VCP's Options card may
look like this;
We need a subroutine called "OpMessage", which only expects the first string parameter
to be defined. It could be as simple as;
Sub OpMessage()
' #Option
' #C1 Operator message
Out "<N>(" & OptString1 & ")"
End Sub
The comment lines immediately following the "Sub" statement are not essential, but very
desirable. The "#Option" line identifies the subroutine as an option, so that its name can
be offered in a drop-down choice list on VCP's Options card. The "#C1" line provides
text to describe the meaning of the first character string parameter. This text gets shown
as a "tip" for the corresponding input field. "#C2", if present, would be for the second
83
CGTech Post-Processor Help
character string. "#N1" and "#N2" serve the same purpose for the two numeric values,
and "#S1" and "#S2" are for the switches.
PacketTrailer
Called after processing of a tow-packet. No additional variables defined.
PlyTrailer
Called once at the end of post-processing. No additional variables defined.
84
CGTech Post-Processor Help
A post-processor written for VERICUT Composites probing uses the same BASIC-like
language as a post-processor which generates programs for VERICUT Composites
material laying. But it is strongly recommended that you use separate post-processors for
these two functions, even for the same machine.
The subroutines and the order in which they are invoked when a user clicks on the second
Write button on VCP's Probe card, are very different. The "tree" below shows the
sequence in which post subroutines will be invoked. Click on a subroutine name to obtain
an alphabetic list of the variables that are defined just prior to that subroutine's call. Once
a variable is defined, it remains available for use by all subsequent calls, although its
value may be updated. The list of reserved variable names for a VERICUT Composites
probing post-processor is the same as the list for a VERICUT Composites material laying
post-processor.
• Modals
• ProgramHeader
• For each probe point ...
o SetAngle
o MoveTo
o Associated probe subroutine
• ProgramTrailer
85
CGTech Post-Processor Help
Post-Processor Subroutines/Variables
Modals
Called once at the start of post-processing.
ProgramHeader
Invoked once after the Modals call. No additional variables defined.
SetAngle
Called just prior to positioning to each probe point.
MoveTo
Called for each probe point. The coordinate system for the variables is the one specified
on VCP's Probe card.
86
CGTech Post-Processor Help
Probe
Called just after positioning to each probe point.
You should have at least as many of these subroutines as there are different probe macros
available. The simplest example subroutine is one which does nothing. It would be used
at intermediate points between probed features, and may look like this;
Sub Position()
' #Probe
End Sub
The comment line immediately following the "Sub" statement is not essential, but very
desirable. The "#Probe" keyword identifies the subroutine as potentially being associated
with a probe point, so that its name can be offered in drop-down choice lists within the
Probe point table on VCP's Probe card.
ProgramTrailer
Invoked once after all the probe points have been processed. No additional variables
defined.
87