211 4 Axis Wire Output Processing
211 4 Axis Wire Output Processing
! A 4-axis direct wirepath creates a point to point wirepath consisting of arc and line moves.
NC output formats
There are numerous machine output formats for 4-axis wirepaths.
4-axis taper output formats:
! G, X, Y, U, V
! G, X, Y, Q, R (Agie Style)
These output formats are not supported automatically in the post customization file. The post
customization file might need to be customized to support the format required by your machine.
Contact your local Mastercam Dealer for customization.
NCI format
4-axis taper
4-axis taper moves are written using the NCI Gcode 11 line. The NCI Gcode 11 line is written as X, Y,
Z, U, V, W. The X, Y, Z represents the lower point and the U, V, W represents the upper point. Both
points are written in absolute world coordinates.
4-axis direct
4-axis direct moves are written using the following NCI Gcode lines:
These NCI Gcodes are written as X, Y, Z and arc center descriptions in absolute coordinates.
See Volume 3, The NCI File for more information regarding the 4-axis NCI Gcodes.
When a 4-axis taper path is written, the NCI Gcode 11 line contains all coordinates for both the lower
and upper guide positions, so only one set of NCI lines is written for each move. When a 4-axis direct
wirepath is written to the NCI file, the lower and upper guide moves are written separately, causing two
sets of NCI lines to be written.
How you handle these issues in a post customization file will be discussed later in this chapter using the
MPWFANUC post as an example.
Determining Gcode
You must determine whether the NCI Gcode 11 move is at rapid rate or at feed rate is necessary
because the NCI Gcode 11 line doesn’t contain this information.
Variable Description
Variable Description
uvflag Indicates whether a wirepath is in the XY (Gcode 0-3) or XY-UV plane (Gcode 20-23
and 30-33 for 4-axis direct)
cstart Start-of-contour flag
cend End-of-contour flag
Postblock Description
pedm0 Pre-output postblock that allows manipulation of NCI Gcode 11 (taper wirepath) data
prior to wr and wq calculations.
pedm Postblock called for 4-axis taper wirepaths
prapid Linear move at rapid rate. (20, 30)
plin Linear move at feed rate. (21, 31)
pcir Postblock call to output the circular move. (22, 23, 32, 33)
NC output formats
Some of the common NC output formats are:
! UV signed incremental (u – prv_u)
! UV delta (u – x)
! UV signed incremental delta (u –x) – (prv_u – prv_x)
! UV absolute
! Q & R (Agie Style)
Some of the common NC output formats for arc centers (KL) are:
11-4 Mastercam Version 9 MP Post Processor Reference Guide June 2002
Volume 2 Chapter 11 4-axis wire output processing
Calculation methods
The MP language allows you to capture the previous value of variables by using the prv_(variable
name). variable. A variable name is a label that points to a memory location that holds the value.
When the post executable records the label in its internal database, it also creates a duplicate entry for
the numeric variable to specifically hold the last or previous value that was generated. The variable
label is prefixed with the characters “prv_” and this label is now assigned to the specific memory
location that holds the previous value. A previous variable is assigned its value only when the current
variable is output or a forced update occurs.
Signed incremental
For a signed incremental output, subtract the previous value from the current value. This calculation
can be stated in one of two ways:
uout = u – prv_u
or
uout = vsub(u, prv_u)
The first method is a simple calculation with the result stored in the uinc variable. In this example, you
would also need to calculate the v and w component separately.
The second method uses the vsub (vector subtract) math function. This math function takes a 3D
vector and subtracts another 3D vector, calculating all three components at one time.
See Volume 3, Formulas for information on vsub and other math functions.
Delta
To calculate the UV delta, subtract the lower guide position from the upper guide. This calculation
can be stated as:
uout = vsub(u, x)
UV absolute
Because the NCI file is written in absolute coordinates, no calculation is needed for absolute UV
output. You can use the u and v output variables without changing them. However, you will notice in
most post customization files that a common output variable is created and used for variables that
require manipulation prior to output. The above examples use the user-defined variable xout to store
the result of the calculations.
Q and R
To obtain Q and R output, use the wpq and wpr predefined post-calculated variables. These values are
calculated by the MP executable when the predefined variable qrtyp is set to 1.
K and L calculations
Perform the K and L calculations in the same manner as the U and V calculations using different
variables.
Unsigned incremental
To calculate unsigned incremental output, subtract the start position from the center point and take the
absolute value of the result, for example:
kout = abs(wxc - prv_u)
Absolute KL
Because the NCI file is written in absolute coordinates, no calculation is needed for absolute KL
output. You can use the wxc and wxy output variables unchanged.
Each decimal position in the control flags parameter value represents an individual flag. When added
together, the result is a single number that represents multiple flags. See Volume 3, The NCI File for
more information.
NCI Gcode 11 causes a call into the pedm postblock. In this postblock, you can check the value of the
cstart and cend flags to determine the location in a toolpath. Based on the value of cstart and cend, you
can determine what Gcode (0 or 1) to output.
For wire motion NCI lines, the contour flag is combined to indicate the start of the contour and where
cutter compensation is engaged or canceled on a lead in/ lead out (even when no compensation was
selected). The values follow:
Cstart
1 = Start-of-contour flag
2 = Compensation point
3 = Both on same point
Cend
1 = End-of-contour flag
2 = Compensation cancel point
3 = Both on same point
See Volume 3, Numeric Variables for more information.
After the data has been read and stored in the appropriate variables, the predefined postblock pedm0 is
called. Pedm0 is a pre-output postblock that allows the post writer to manipulate the NCI Gcode 11
data prior to the internal calculations of wq and wr.
Note: This postblock isn’t necessary unless you need to manipulate data prior to internal calculations.
After the pedm0 call, the predefined standard postblock pedm is called, which is the only other
postblock called into from the NCI Gcode 11 line. In the pedm postblock, you can determine the
appropriate output gcode (G0 or G1) for the move. You must also calculate the appropriate output
formats for X, Y, U and V, and output the data to the NCI file. Because of the amount of work needed
here, it is common to create user-defined variables and postblocks and to call them from pedm.
Remember that this is the only postblock called from the NCI Gcode 11.
See “How MPWFANUC Handles 4-Axis Wirepaths” for more information.
Because the calls into the post caused by the Gcode are made to the prapid, plin and pcir postblocks as
they would be for normal 2D linear and circular motion, you must differentiate between the 2- and 4-
axis calls. Use the predefined variable uvflag to determine if the wirepath is 2- or 4-axis. On a 4-axis
direct wirepath, you can make calls to the appropriate postblock to make any calculations and output
calls for both the lower guide move and the upper guide move. Using the value of g20code and
g30code, you can call the appropriate motion output postblocks.
In MPWFANUC, you will find user-defined post switches for setting the UV and KL output formats,
along with user-defined variables for output and logic control.
Post flags
Following is a list of post flags used to set some specific conditions for use during the post process.
Many of these flags are user-defined, so refer to the MPFANUC for more information.
sg20code User-defined String selector for Gcode (G0, G1, G2, G3) output for lower guide
Sg30code User-defined String selector for Gcode (G0, G1, G2, G3)output for upper guide
xabs, yabs, User-defined X, Y, Z output variables for absolute output
zabs
xinc, yinc, zinc User-defined X, Y, Z output variables for incremental output
uout, vout User-defined U,V output variables
wabs, winc User-defined W output variables for absolute and incremental output
iout, jout User-defined I, J output variables for XY arc center description
Kout, lout User-defined K, L output variables for KL arc center description
pcuttype User-defined Called from start of file and tool change. Sets cuttype flag based on
uvflag and Gcode 11.
pleadintype User-defined Called from pcuttype. Determines the lead in type and sets the
leadintype flag.
pcom_moveb User-defined Called from prapid , ptlch_start and ptlch_nstart. Common motion
preparations routines called prior to output.
pcom_movea User-defined Called from prapid , ptlch_start and ptlch_nstart. Common motion
preparations routines called after output.
prapid Predefined Called from EXE on NCI gcode 0, 20, 30, pzrapid, pz, plin, pcir and
pedm. All motion calls go through prapid.
pzrapid, pz Predefined Called from MP EXE on NCI Gcode 0, 20, 30 for linear Z-only
motion. Calls prapid for all output.
plin Predefined Called from MP EXE on NCI Gcode 1, 21 and 31 for linear motion.
Calls prapid for all output.
pcir Predefined Called from MP EXE on NCI Gcodes 2, 3, 22, 23, 32, and 33 for all
arc motion. Calls prapid for all output.
pnc_out User-defined Called from prapid. Checks cuttype and calls either pnc_out_2 (2D) or
pnc_out_4 (4 axis).
pnc_out_4 User-defined Called from pnc_out. Calls 4-axis output postblocks based on g20code
and g30code.
plinxy4 User-defined Called from pnc_out_4 for 4-axis XY linear motion output.
plinuv4 User-defined Called from pnc_out_4 for 4-axis UV linear motion output.
Pcirxy4 User-defined Called from pnc_out_4 for 4-axis XY arc motion output.
Pciruv4 User-defined Called from pnc_out_4 for 4-axis UV arc motion output.
pxout, pyout,zout User-defined Called from plinxy4, pcirxy4. Outputs actual X, Y, Z value to NC file.
puvout User-defined Called from plinuv4 and pciruv4. Calculates UV output based on UV
format switches and outputs UV to NC file.
Pwout User-defined Called from plinuv4 and pciruv4. Outputs actual W value to NC file.
Parc User-defined Called from pcirxy4. Outputs XY arc center values to NC file.
Parckl User-defined Called from pciruv4. Calculates arc center values (KL) based on KL
format switches. Outputs KL values to the NC file.
Pnc_out_4 is called, where calls are made to the following 4-axis output
postblocks based on the values of g20code, g30code and the XYUV
June 2002 Mastercam Version 9 MP Post Processor Reference Guide 11-11
Chapter 11 4-axis wire output processing Volume 2
incremental variables:
plinxy4, pcirxy4, plinuv4, pciruv4
The plinxy4, pcirxy4, plinuv4 and pciruv4 postblocks perform output and
make calls to the output postblocks for X ,Y, Z, U, V, U, I, J, K, L.
Control works back through the calling structure to prapid, where a call
to pcom_movea is made and after-motion preparation routines are
performed.
Control is returned to the MP executable and the next four NCI lines of
motion are read.
Prapid, plin or pcir postblocks are called when NCI Gcodes 20,30, 21,
31, 22, 23, 32 and 33 are read. A call to prapid is made from all motion
postblocks. Prapid makes a call to the pcntr postblock to set cntrflag
along with many others. g20code and g30code are assigned based on
the Gcode read from the NCI file.
pnc_out_4 is called, where calls are made to the following 4-axis output
postblocks based on the values of g20code, g30code and the XY and
UV incremental variables:
plinxy4, pcirxy4, plinuv4, pciruv4.
The plinxy4, pcirxy4, plinuv4 and pciruv4 postblocks perform output and
make calls to the output postblocks for X, Y, Z, U, V, U, I, J, K, L.
Control works back through the calling structure to prapid, where a call
to pcom_movea is made and after-motion preparation routines are
performed.
Control is returned to the MP executable and the next two NCI lines are
read. NCI Gcode 11 causes a repeat of the above steps.