Postprocessor

Download as pdf or txt
Download as pdf or txt
You are on page 1of 88

Back to VERICUT Help

CGTech Post-Processor Help


CGTech Post-Processor Help

Introduction to the CGTech Post-Processor

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

VERICUT Composite Programming:


VCP Programming
VCP Probing

2
CGTech Post-Processor Help

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 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

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.

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;

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

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.

' 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.

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

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.

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.

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;

8
CGTech Post-Processor Help

Sum = Radius1 + Radius2


Range = Radius1 & " to " & Radius2
If (Radius1 > Radius2) Then

9
CGTech Post-Processor Help

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"
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

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

Name Type Description Access


Current number Current value of the register. Read/Write
{+}{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.
Format string • second "#" is maximum number of decimal Read/Write
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.


Increment to be applied to Current value each time
the register is output.
Increment number Normally only non-zero for the sequence number Read/Write
register, N.
Restricted to be a fixed-point value.
isDefined number 1 if Current value is defined, 0 otherwise. Read Only
Maximum value that a register can attain.
Maximum number Read/Write
If not defined explicitly, will be implied by the

11
CGTech Post-Processor Help

number of leading and trailing digits in the Format.


Minimum value that a register can attain.
Minimum number If not defined explicitly, will be implied by the Read/Write
number of leading and trailing digits in the Format.
Output string Formatted current value. Read Only
Prefix used in formatted output.
Prefix string Read/Write
For example, "X" for the X register.
Previous number Previous value of the register. Read/Write
Scale to be applied to a value before formatting.
Scale number Read/Write
Scale can be used to adjust units or to reverse an axis.

12
CGTech Post-Processor Help

Reserved Variable Names


Reserved Variable Names, listed by the application for which they are used, are described
in the following sections:

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.

Variable Variable Status Feature Description


Type

String Sub-system Sub-system that the block


PostSubSystem
applies to.
String NC Program Name of the current NC
PostNcProgram
program.
Number NC Program Rec. # Line number of the current
PostNcProgramRecNum
NC program record.
String NC Program Record Current NC Program record
PostNcProgramRec
being processed.
Number Change Rec. # Line number of the last tool
PostChangeRecNum
change record.
String Change Record Last tool change record
PostChangeRec
processed.
Number Machine X Current location of the
PostMachineX
Machine's X axis.
Number Machine Y Current location of the
PostMachineY
Machine's Y axis.
Number Machine Z Current location of the
PostMachineZ
Machine's Z axis.
Number Machine A Current location of the
PostMachineA
Machine's A axis.

14
CGTech Post-Processor Help

Number Machine B Current location of the


PostMachineB
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.
Number Local X Current location of the X
axis within the local
PostLocalX
coordinates of the current
sub-system.
Number Local Y Current location of the Y
axis within the local
PostLocalY
coordinates of the current
sub-system.
Number Local Z Current location of the Z
axis within the local
PostLocalZ
coordinates of the current
sub-system.
Number Local A Current location of the A
axis within the local
PostLocalA
coordinates of the current
sub-system.

15
CGTech Post-Processor Help

Number Local B Current location of the B


axis within the local
PostLocalB
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.
Number Tool Tip X X coordinate of the current
PostToolTipX
tool tip location.
Number Tool Tip Y Y coordinate of the current
PostToolTipY
tool tip location.
Number Tool Tip Z Z coordinate of the current
PostToolTipZ
tool tip location.
Number Tool Tip I I component of the current
PostToolTipI
tool axis vector.

16
CGTech Post-Processor Help

Number Tool Tip J J component of the current


PostToolTipJ
tool axis vector.
PostToolTipK Number Tool Tip K K component of the current
tool axis vector.
Sequential number of the last
PostToolSeq Number Tool Sequence
tool change event.
PostToolNum String Tool Number Tool number in use.
String ID of a tool retrieved from a
PostToolID Tool ID
VERICUT Tool Library.
PostToolGeo String Tool Geometry Cutter shape geometry.
String Description of a tool
PostToolDesc Tool Description retrieved from a VERICUT
Tool Library.
Number Quantity of errors detected
PostToolErrors Errors
by VERICUT.
Number Quantity of warnings
PostToolWarnings Warnings
detected by VERICUT.
Number Time anticipated to machine
PostToolTime Time
the part.
Number Percentage of time in feed
PostToolPerc Time %
rate mode.
PostToolDist Number Distance Tool movement distance.
Number Percentage of tool movement
PostToolDistPerc Distance %
distance in feed rate mode.
String Current programmed feed
PostToolFeed Feedrate
rate.
String Current programmed spindle
PostToolSpindleSpeed Spindle
speed.
String Current programmed coolant
PostToolCoolant Coolant
condition
String Current motion type (Rapid,
PostToolMotionType Motion Type
Linear, CW, etc.).
String Current motion mode
PostAbsInc Abs/Inc
(absolute/incremental).
PostMotionPlane String Motion Plane Current motion plane.
PostUnitsTo String Units Current units.
PostSpindleMode String Spindle Mode Current spindle mode.

17
CGTech Post-Processor Help

String Current cutter compensation


PostCutterComp Cutter Comp
status.
PostCycle String Cycle Current cycle type.
PostInterpolation String Interpolation Current interpolation mode.
String Time anticipated to machine
PostOptiTime OptiPath Time the part with an optimized
NC program.
PostOptiFeed String OptiPath Feed Current optimized feedrate.
String OptiPath Spindle Current optimized spindle
PostOptiSpindleSpeed
Speed speed.
Number Volume Removal Current volume removal
PostVolumeRemovalRate
Rate rate.
PostChipThickness Number ChipThickness Current chip thickness.
Number Current cutter compensation
PostCutterCompValue Cutter Comp Value
value.
Number Percent of time spent cutting
PostAirTimePerc Air Time %
air.
Status of polar coordinate
PostPolarCoord String Polar Coordinates
input.
PostAxialDepth Number Axial Depth Current depth of the cut.
PostRadialWidth Number Radial Width Current width of the cut.
Number Area of the tool that is in
PostContactArea Contact Area
contact with the material.
PostSurfaceSpeed Number Surface Speed Current surface speed

18
CGTech Post-Processor Help

VERICUT Inspection Probe Cycle Programming


Numbers

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

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
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.)

And Exit Not To


Case For Or Until
Debug If Out Wend
Do Log Select While
Else Loop Step Xor
ElseIf mod Sub Zap
End Next Then zapFrom

22
CGTech Post-Processor Help

VERICUT Composites Programming


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.
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

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.
Flag to force at least one intermediate point in each off-part
NeedPointInTraverse
traverse.
Flag to request sum of prior layers' thicknesses at each on-part
NeedThickness
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.

25
CGTech Post-Processor Help

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.
Number of tows to reduce by when trying to comply with
TowReduction
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).
Virtual spin axis flag; 0 for none, 1 for automatically determined
VirtualAxis
virtual axis.
VirtDX X component of offset from spin axis.

26
CGTech Post-Processor Help

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.
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

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 • Exit • Not • Then


• Case • For • Or • To
• Debug • If • Out • Until
• Do • Log • Select • Wend
• Else • Loop • Show • While
• ElseIf • mod • Step • Xor
• End • Next • Sub • Zap

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)

NOTE: This group of functions is applicable only to VERICUT Composites Simulation

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)

NOTE: This group of functions is applicable only to VERICUT Composites Simulation

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

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-
number = getNthLength3(number)
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
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

Gets the numerical value of the specified


global numeric NC Variable in VERICUT and
number = getVariable(variable_name)
passes it to the post-processor. Supports
elements of Number Arrays and Frames.
Gets the word at the specified parameter
position in the current APT line.
Parameters are numbered from 1 for the major
string = getWord(number)
word.
If the requested parameter is numeric, its text is
returned.
Sets a flag so that the next FROM or GOTO
point will become the new HOME position.
zapFrom
Typically used during a tool change or tool axis
adjustment.

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.

VERICUT Composites Programming

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

Out string Sends a string to the G-Code output file.


Show string Sends a string to the product’s status area.

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"

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
ARCMOV
axis of the current arc.
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
BEGIN
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.
For a $$*CATIA0 statement, sets the G register's
CATIA0
current value to 0.
Sets the G register's current value to 0. CATMAT
Updates the arc variables, and sets the G register's CIRCLE, For a statement that
current value to 2 (CW) or 3 (CCW). For a ARCDAT, includes the arc end-
statement with just 4 numeric parameters (x, y, z, MOVARC, point (9 numeric
r), the arc axis and the G value cannot be trusted. ARC parameters), sets the
Direction should be deduced from the following or G register's current
GOTO point. SURFACE value to 1.

37
CGTech Post-Processor Help

Updates the NC program coordinates, and sets the


CNTRL
NURBS weight (defaulting to 1.0).
Sets the F register's current value to the first
FEDRAT
numeric parameter.
Sets the G register's current value to 0, updates the
NC program coordinates, converts to machine axis
FROM
positions, and sets the machine axis registers'
current values.
Adjusts the NC program coordinates, converts to
Sets the G register's
machine axis positions, and sets the machine axis GODLTA
current value to 1.
registers' current values.
Adjusts the NC program coordinates, converts to
machine axis positions, and sets the machine axis
GOHOME
registers' current values. If the statement has no
or
axis minor words, motion will be to the FROM
HOME
position unless the reserved variable, HomeRetract
is defined and non-zero.
GOTO,
Updates the NC program coordinates, converts to
CONT Sets the G register's
machine axis positions, and sets the machine axis
or current value to 1.
registers' current values.
VECTOR
Builds a list of cumulative NURBS knot values
which can be accessed by the getKnotValue KNOT
function.
If the first minor word in the statement is "TOOL"
or "WIRE", sets the T register's current value to LOAD
the first numeric parameter.
LOADTL
Sets the T register's current value to the first
or
numeric parameter.
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 NURBS
assumed to be the first knot (with a value of 0.0).
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,
NURBSTO
updates the NC program coordinates, converts to
machine axis positions and sets the machine axis
registers' current values.

38
CGTech Post-Processor Help

For a PPRINT/METRIC or PPRINT/INCH


statement, sets the reserved string Unit to "mm" or PPRINT
"in".
For a PPRINT/TOOL AXIS or $$TOOL AXIS
statement, updates the NC program coordinates,
PPRINT
converts to machine axis positions and sets the
machine axis registers' current values.
For a PPRINT/VERICUT-MATRIX statement,
PPRINT
sets the G register's current value to 0.
For a PPRINT/VERICUT-TOOLID statement,
sets the T register's current value to the first PPRINT
numeric parameter.
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
RETRCT
positions, and sets the machine axis registers'
current values.
Provided the first minor word in the statement is
not ORIENT, sets the S register's current value. If
SPINDL
the minor word is OFF, LOCK or NEUTRAL the
or
value will be 0. Otherwise it will be the first
SPNDL
numeric parameter, or if there isn't one, the prior
non-zero spindle speed.
Adjusts tool axis, updates the NC program
coordinates, converts to machine axis positions TLAXIS
and sets the machine axis registers' current values.
TLON
Updates the arc variables, and sets the G register's Sets the G register's
or
current value to 2 (CW) or 3 (CCW). current value to 1.
GOFWD
Sets the reserved string Unit to "mm" or "in". UNIT
If the first minor word in the statement is "TOOL"
UNLOAD
or "WIRE", sets the T register's current value to 0.

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

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"

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 2^3 8
the second.
Multiplication.
* 2*3 6
Multiplies two numbers
Division.
/ 7/2 3.5
Divides first number by second.
Integer Division.
Both numbers are rounded to the nearest
\ integer value, 7\2 3
the first is divided by the second,
and the result is truncated to its integer part.
Modulus.
mod The remainder after dividing the first 7 mod 3 1
number by the second.
Addition.
+ 2+2 4
Adds two numbers.

41
CGTech Post-Processor Help

Subtraction.
- 5-3 2
Subtracts second number from first.

String Operators

Operator Description Example Result


Concatenation.
& "tool" & "path" toolpath
Second string is appended to first.

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. X=Y
String comparisons are case insensitive.
True if the expressions are different.
<> Can be used with numbers or strings but not a mix. X<>Y
String comparisons are case insensitive.
True if the first number is smaller than the second,
< or if the first string collates before the second. X<Y
String comparisons are case insensitive.
True if the first number is greater than the second,
> or if the first string collates after the second. X>Y
String comparisons are case insensitive.
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 X <= Y
second.
String comparisons are case insensitive.
True if the first number is greater than or equal to
the second,
>= X >= Y
or if the first string collates after or is equal to the
second.

42
CGTech Post-Processor Help

String comparisons are case insensitive.


Not Changes true to false, or false to true. Not (Z > 0)
(X > 2) And (X
And True if both expressions are true.
<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.

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 ... 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

44
CGTech Post-Processor Help

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

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.

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

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.

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|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 ... 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.

48
CGTech Post-Processor Help

Post-Processor Output

Post-Processor Output commands vary slightly depending on the application in which


they are being used. The specific behavior for each application is described in the
following sections:

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;

N12 G01 X1.25 Y2.375 Z4.5 F200

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;

Out "Tool Diameter = <Temp>mm"

It is sometimes necessary to force output of a modal register's value whether it has


changed or not. A good example would be the need to re-specify the feed rate after a head
change, even though the feed rate for the new head may be the same as that for the prior
one. There are two ways to do this. The first involves artificially changing the register's
Previous property so that it doesn't match the Current value. The Zap function is
provided for this purpose and you could have;

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

VERICUT Inspection Probe Cycle Programming

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;

Out "(Load Palette)"

or it could involve concatenation of constants, string variables and textual register


properties.

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;

N12 G01 X1.25 Y2.375 Z4.5 F200

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, 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;

Log "Tool Diameter = <Temp>mm"

It is sometimes necessary to force output of a modal register's value whether it has


changed or not. A good example would be the need to re-specify the feed rate after a tool
change, even though the feed rate for the new tool may be the same as the that for the
prior one. There are two ways to do this. The first involves artificially changing the
register's .Previous property so that it doesn't match the .Current value. The Zap
function is provided for this purpose and you could have;

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

With the following APT input;

RAPID
GOTO/1,2,6
RAPID
GOTO/1,2,2

The generated G-Code would be;

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

VERICUT Composites Programming


VERICUT Composite Probing

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;

N12 G01 X1.25 Y2.375 Z4.5 F200

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;

Out "Tool Diameter = <Temp>mm"

It is sometimes necessary to force output of a modal register's value whether it has


changed or not. A good example would be the need to re-specify the feed rate after a head
change, even though the feed rate for the new head may be the same as that for the prior
one. There are two ways to do this. The first involves artificially changing the register's
Previous property so that it doesn't match the Current value. The Zap function is
provided for this purpose and you could have;

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

While developing a VcPost file for a machine/control combination, it can be helpful to


step through a test NC program with the post-processor and watch the effect that each
input line has on the numbers, strings and registers. To see a dialog like the one below,
you need to insert a simple post-processor language statement into your code.

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

Application Specific Post-Processor Information


The following sections describe the basic construct and features used for creating a post-
processor related to a specific CGTech application. The specific information for each
application is described in the following sections:

VERICUT – See Notes about Using Post-Processors in VERICUT in the Notes


about Special Topics section in the CGTech Help Library.
VERICUT Inspection Probe Cycle Programming
VERICUT Composite Programming
VERICUT Composite Probing

60
CGTech Post-Processor Help

VERICUT Inspection Probe Cycle Programming

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;

#Init #End #Rapid #Move #Approach #Retract #Cycle #Save

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

A corresponding row in the table will initially look like,

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

VERICUT Composites Programming

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.

• If an initialization subroutine has been requested ...


o Primer
• Modals
• Extent
• For each tow number present in the ply ...
o Length
• Length
• PlyHeader
• For each tow-packet ...
o LinkHeader
o If a virtual spin axis is in use ...
ƒ CamHeader
ƒ For each point on the virtual spin axis ...
ƒ CamPoint
ƒ CamTrailer
o If link has a spinning egress ...
ƒ For each point or option in the egress ...
ƒ MoveTo or Option
o If link is from a preceding tow-packet ...
ƒ PulloutHeader
ƒ For each point in the pullout ...
ƒ MoveTo

68
CGTech Post-Processor Help

ƒ After first point in the pullout ...


ƒ OffForm
ƒ PulloutTrailer
ƒ TraverseHeader
ƒ For each point in the traverse ...
ƒ TraverseTo
o For each point or option in the traverse ...
ƒ MoveTo or Option
ƒ After first point in the traverse ...
ƒ OffForm
o If link is from a preceding tow-packet ...
ƒ TraverseTrailer
ƒ 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 OnForm
o If link has a spinning ingress ...
ƒFor each point or option in the ingress ...
ƒ MoveTo or Option
o LinkTrailer
o Extent
o For each tow present in the tow-packet ...
ƒ Length
o Length (for all the tows)
o For each add and cut point (not associated with an optional safe restart
location) in the packet ...

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;

' Sets S value for M38 to 3.


Sub S3_Vertical()
' #Primer
SForM38 = 3
End Sub

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.

Variable Type Description


Acceleration/deceleration distance, between zero and
AccDecDist Number
TraverseSpeed.
Tow add location adjustment at maximum roller
AddAdjustMax Number
compression.
Tow add location adjustment at minimum roller
AddAdjustMin Number
compression.
AngleSpacing Number Maximum rotation between output points, in degrees.
The maximum desirable departure of a tow from the ply
AngleTol Number
direction, in degrees.
Compression Number Maximum roller compression.
CourseSpread Number Course spread.
Tow cut location adjustment at maximum roller
CutAdjustMax Number
compression.

71
CGTech Post-Processor Help

Tow cut location adjustment at minimum roller


CutAdjustMin Number
compression.
Directions Number 1 for uni-directional, 2 for bi-directional.
EgressLength Number Length of egress motion.
FileName String Name of the G-code file.
FOff Number Off-part feed rate.
FOn Number On-part feed rate.
Header String G-Code header line.
HeadReverse Number Head reversal flag; 0 for slow, 1 for fast.
IngressLength Number Length of ingress motion.
LandOnShelf Number Shelf landing flag; 0 for no, 1 for yes.
LeadInLen Number Desired lead-in length.
LimitedEntry Number Limited entry/exit flag; 0 for unlimited, 1 for limited.
MandrelRPM Number Rotisserie revolutions per minute.
MatDense Number Density of each tow, in g/cu.cm or oz/cu.in.
MatThick Number Thickness of each tow.
MaxGrader Number Maximum grader length.
MaxTraverse Number Maximum on-form traverse.
MinGapLen Number Minimum permissible gap in any tow.
MinGrader Number Minimum grader length.
MinSteering Number Minimum desirable tow steering radius.
MinTowLen Number Minimum permissible tow length.
Path geometry flag; 0 for rosette rule, 1 for natural, 2 for
Natural Number
limited steer, 3 for parallel, 4 for geodesic.
NominalPress Number Nominal roller compression.
Numbering Number Tow numbering flag; 0 for left-to-right, 1 for right-to-left.
OffSpacing Number Maximum distance between off-part output points.
OnSpacing Number Maximum distance between on-part output points.
Part String Name of the CAD file (CATPart or SAT).
PlyAngle Number Ply angle, in degrees.
PlyIdent String Ply identifier.

72
CGTech Post-Processor Help

PlyNumber Number Ply number.


Post String Name of the VcPost file.
Product String Software product's name, "VCP".
RetractDist Number Retract distance.
RollerAction Number Roller action flag; 0 for "press", 1 for "wrap".
RollerClear Number Roller clearance.
RollOffset Number Offset of roll center from head path.
Rotisserie Number Rotisserie flag; -1 if none, 0 for stationary, 1 for spinning.
RunOutLen Number Desired run-out length.
Screw direction; -1 for left-hand, 0 for none, +1 for right-
ScrewHand Number
hand.
SeqIdent String Sequence identifier.
SeqNumber Number Sequence number.
ShelfAngle Number Shelf approach angle, in degrees.
ShelfInset Number Shelf boundary inset.
SpinAxis Number Rotisserie axis; 0 for X, 1 for Y, 2 for Z.
SpiralAngle Number Angular extent of limited entry or exit, in degrees.
SpliceLen Number Desired tow splice length.
SpliceSpace Number Minimum permissible distance between tow splices.
Stamp String Time stamp for the G-code file's creation.
StartX Number X coordinate of ply's start point.
StartY Number Y coordinate of ply's start point.
StartZ Number Z coordinate of ply's start point.
Thumb String Name of JPEG thumbnail file.
TowCount Number Number of tows on the machine's head.
TowEdgeLap Number Distance that each tow should overlap the ply boundaries.
Number of tows to reduce by when trying to comply with
TowReduction Number
maximum roller compression.
TowTowLap Number Maximum permissible overlap of adjacent tows.
TowWidth Number Width of each tow.
TraverseSpeed Number Maximum traverse velocity, in mm/min or in/min, parallel

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.

Variable Type Description


AMax Number Maximum normal angle about the spin axis, in degrees.
AMin Number Minimum normal angle about the spin axis, in degrees.
RMax Number Maximum radius from the real spin axis.
-1 if the tow-packet requires clockwise rotisserie motion, 0 if
Rotation Number there is no rotisserie, or there is one and it is stationary, +1 if
the tow-packet requires counter-clockwise rotisserie motion.
TowWidth Number Width of each tow in this packet.
XMax Number Maximum X coordinate.
XMin Number Minimum X coordinate.
YMax Number Maximum Y coordinate.
YMin Number Minimum Y coordinate.
ZMax Number Maximum Z coordinate.
ZMin Number Minimum Z coordinate.

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

Variable Type Description


TowArea Register Tow area.
TowLen Register Tow length.
TowNum Register Tow number, or zero for all tows combined.

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.

Variable Type Description


RMax Number Maximum radius from the real spin axis.
X Register X of point on virtual spin axis.
Y Register Y of point on virtual spin axis.
Z Register Z of point on 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.

Variable Type Description


LinkType Number -1 or initial entry, 0 for link, +1 for final exit
-1 if the tow-packet that follows requires clockwise rotisserie
Rotation Number
motion, 0 if there is no rotisserie, there is one and it is

75
CGTech Post-Processor Help

stationary, or this link is a final exit, +1 if the tow-packet that


follows requires counter-clockwise rotisserie motion.
TowWidth Number Width of each tow in the following tow-packet, if there is one.

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.

Variable Type Description


Counter-clockwise rotation of (DX,DY,DZ) vector about
DTwist Number
surface normal, in degrees.
X component of unit vector in direction of motion. Sequence
DX Number of (DX,DY,DZ) vectors provide shorter of two possible head
rotations.
DY Number Y component of unit vector in direction of motion.
DZ Number Z component of unit vector in direction of motion.
Counter-clockwise rotation of (EX,EY,EZ) vector about
ETwist Number
surface normal, in degrees.
X component of unit vector in alternate direction. Sequence of
EX Number (EX,EY,EZ) vectors provide longer of two possible head
rotations.
EY Number Y component of unit vector in alternate direction.
EZ Number Z component of unit vector in alternate direction.
I Number X component of unit outward surface normal vector.
J Number Y component of unit outward surface normal vector.
K Number Z component of unit outward surface normal vector.

76
CGTech Post-Processor Help

ToLeadIn Number Distance to start of lead-in. Negative if no lead-in (pull-out).


X component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDX Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
Y component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDY Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
Z component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDZ Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
X Register X of mid-roller point closest to form.
Y Register Y of mid-roller point closest to form.
Z Register Z of mid-roller point closest to form.

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

the sequence of direction vectors passed in (DX,DY,DZ) or (EX,EY,EZ) is better suited


to avoiding head "wind-up".

Variable Type Description


Counter-clockwise rotation of (DX,DY,DZ) vector about
DTwist Number
surface normal, in degrees.
X component of unit vector in direction of motion. Sequence
DX Number of (DX,DY,DZ) vectors provide shorter of two possible head
rotations.
DY Number Y component of unit vector in direction of motion.
DZ Number Z component of unit vector in direction of motion.
Counter-clockwise rotation of (EX,EY,EZ) vector about
ETwist Number
surface normal, in degrees.
X component of unit vector in alternate direction. Sequence of
EX Number (EX,EY,EZ) vectors provide longer of two possible head
rotations.
EY Number Y component of unit vector in alternate direction.
EZ Number Z component of unit vector in alternate direction.
I Number X component of unit outward surface normal vector.
J Number Y component of unit outward surface normal vector.
K Number Z component of unit outward surface normal vector.
X component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDX Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
Y component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDY Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
Z component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDZ Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
X Register X of mid-roller point closest to form.
Y Register Y of mid-roller point closest to form.
Z Register Z of mid-roller point closest to form.

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.

Variable Type Description


Binary string representation of the tow on/off state. For a 16
AddCutA String
tow head an example would be "0001111111111100".
Reversed binary string representation of the tow on/off state.
For the same example, it would be "0011111111111000". The
AddCutB String lowest order bit, on the right end of the string, corresponds to
the tow on the right side of the head, when "sitting" on top of
the head and looking in the direction of motion.
Number whose binary representation encapsulates the tow
AddCutI Number
on/off state. For the same example, the value would be 8188.
Number whose reversed binary representation encapsulates
the tow on/off state. For the same example, the value would
AddCutJ Number
be 16376. The lowest order bit in this value, corresponds to
the tow on the right side of the head, when "sitting" on top of

79
CGTech Post-Processor Help

the head and looking in the direction of motion.


DX Number X component of unit vector in direction of motion.
DY Number Y component of unit vector in direction of motion.
DZ Number Z component of unit vector in direction of motion.
I Number X component of unit outward surface normal vector.
J Number Y component of unit outward surface normal vector.
K Number Z component of unit outward surface normal vector.
Good approximation of the distance of point along the head
LParam Number path from start of tow-packet's original lead-in. Increases
monotonically in the direction of lay.
Thickness of material in prior layers at this point, provided
SumThick Number
the variable NeedThickness is defined and non-zero.
X component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDX Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
Y component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDY Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
Z component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDZ Number
spinning in one direction, or if the virtual spin axis capability
has not been turned on.
X Register X of mid-roller contact point on form.
Y Register Y of mid-roller contact point on form.
Z Register Z of mid-roller contact point on form.

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

Variable Type Description


Binary string representation of the tow on/off state. For a 16
tow head an example would be "0001111111111100". The
AddCutA String lowest order bit, on the right end of the string, corresponds
to the tow on the left side of the head, when "sitting" on top
of the head and looking in the direction of motion.
Reversed binary string representation of the tow on/off state.
For the same example, it would be "0011111111111000".
The lowest order bit, on the right end of the string,
AddCutB String
corresponds to the tow on the right side of the head, when
"sitting" on top of the head and looking in the direction of
motion.
Number whose binary representation encapsulates the tow
on/off state. For the same example, the value would be
AddCutI Number 8188. The lowest order bit in this value, corresponds to the
tow on the left side of the head, when "sitting" on top of the
head and looking in the direction of motion.
Number whose reversed binary representation encapsulates
the tow on/off state. For the same example, the value would
AddCutJ Number be 16376. The lowest order bit in this value, corresponds to
the tow on the right side of the head, when "sitting" on top
of the head and looking in the direction of motion.
Cache flag; 1 if point was placed in the cache, and is thus an
Cached Number
add or cut point, 0 otherwise.
Counter-clockwise rotation of (DX,DY,DZ) vector about
DTwist Number
surface normal, in degrees.
DX Number X component of unit vector in direction of motion.
DY Number Y component of unit vector in direction of motion.
DZ Number Z component of unit vector in direction of motion.
I Number X component of unit outward surface normal vector.
J Number Y component of unit outward surface normal vector.
K Number Z component of unit outward surface normal vector.
Good approximation of the distance of point along the head
LParam Number path from start of tow-packet's original lead-in. Increases
monotonically in the direction of lay.
Thickness of material in prior layers at this point, provided
SumThick Number
the variable NeedThickness is defined and non-zero.

81
CGTech Post-Processor Help

Distance to last cut (start of run-out). Negative if last cut


ToLastCut Number
already passed.
ToNextAdd Number Distance to the next add. Negative if last add already passed.
ToNextCut Number Distance to the next cut. Negative if last cut already passed.
ToRunOut Number Distance to end of run-out.
TowsInPacket Number Number of tows in the current tow-packet.
X component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDX Number
spinning in one direction, or if the virtual spin axis
capability has not been turned on.
Y component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDY Number
spinning in one direction, or if the virtual spin axis
capability has not been turned on.
Z component of offset from rotisserie's spin axis to virtual
spin axis. Will be zero if there is no rotisserie, if it is not
VirtDZ Number
spinning in one direction, or if the virtual spin axis
capability has not been turned on.
X Register X of mid-roller contact point on form.
Y Register Y of mid-roller contact point on form.
Z Register Z of mid-roller contact point on form.

Function Type Description


Length of the next tow segment to be cut, for the given tow
getNthLength1 Number
number (0 <= tow number < TowsInPacket).
Distance to next tow add, for the given tow number (0 <=
getNthLength2 Number
tow number < TowsInPacket).
Distance to next tow cut, for the given tow number (0 <=
getNthLength3 Number
tow number < TowsInPacket).

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

Variable Type Description


OptNumber1 Number 1st optional numeric parameter.
OptNumber2 Number 2nd optional numeric parameter.
OptNumber3 Number 3rd optional numeric parameter.
OptNumber4 Number 4th optional numeric parameter.
OptString1 String 1st optional string parameter.
OptString2 String 2nd optional string parameter.
OptSwitch1 Number 1st optional Boolean parameter (0 for "Off", 1 for "On").
OptSwitch2 Number 2nd optional Boolean parameter (0 for "Off", 1 for "On").

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

VERICUT Composites Probing

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.

Variable Type Description


FileName String Name of the G-code file.
Header String G-Code header line.
Part String Name of the CAD file (CATPart or SAT).
Post String Name of the VcPost file.
Product String Software product's name, "VCP".
Stamp String Time stamp for the G-code file's creation.
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.

ProgramHeader
Invoked once after the Modals call. No additional variables defined.

SetAngle
Called just prior to positioning to each probe point.

Variable Type Description


Rotisserie Number Required rotisserie angle, in degrees.

MoveTo
Called for each probe point. The coordinate system for the variables is the one specified
on VCP's Probe card.

Variable Type Description

86
CGTech Post-Processor Help

I Number X component of unit outward vector, if supplied.


J Number Y component of unit outward vector, if supplied.
K Number Z component of unit outward vector, if supplied.
X Register X of probe point.
Y Register Y of probe point.
Z Register Z of probe point.

Probe
Called just after positioning to each probe point.

Variable Type Description


OptNumber1 Number Numeric parameter.

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy