0% found this document useful (0 votes)
127 views

211 4 Axis Wire Output Processing

This document provides an overview of 4-axis wire output processing in Mastercam. It discusses the variables, postblocks, and concepts needed to perform 4-axis direct and 4-axis taper output. There are two types of 4-axis wirepaths: 4-axis taper wirepaths which produce a linearized wirepath between two chains, and 4-axis direct wirepaths which create a point-to-point wirepath consisting of arc and line moves. The document also discusses different NC output formats and calculation methods for 4-axis wire output values in a post processor.

Uploaded by

Hoang Lam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

211 4 Axis Wire Output Processing

This document provides an overview of 4-axis wire output processing in Mastercam. It discusses the variables, postblocks, and concepts needed to perform 4-axis direct and 4-axis taper output. There are two types of 4-axis wirepaths: 4-axis taper wirepaths which produce a linearized wirepath between two chains, and 4-axis direct wirepaths which create a point-to-point wirepath consisting of arc and line moves. The document also discusses different NC output formats and calculation methods for 4-axis wire output values in a post processor.

Uploaded by

Hoang Lam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Volume 2 Chapter 11 4-axis wire output processing

11 4-Axis Wire Output Processing


This chapter provides an overview of 4-axis wire output support in MP language and the
MPWFANUC.PST post customization file. It discusses the variables, postblocks, and concepts needed
to perform 4-axis direct and 4-axis taper output. For information on converting 2-axis wirepaths to
4-axis wirepaths see Volume 2, Wire 2-Axis to 4-Axis Conversion.

4-axis wirepaths in Mastercam


The 4-axis option in the Wirepaths menu produces wirepaths that have geometry in both the XY plane
(the lower contour) and UV plane (the upper contour). A 4-axis wirepath can have completely
different geometry in the two planes, resulting in different wire movement in the XY and UV planes. A
contour wirepath, on the other hand, derives the UV from the XY geometry by applying a taper angle.
There are two types of 4-axis wirepaths:
! A 4-axis taper wirepath produces a linearized (lines only) wirepath between the two chains.

! A 4-axis direct wirepath creates a point to point wirepath consisting of arc and line moves.

The following images show the two types of wirepaths.

Axis Taper Axis Direct

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)

4-axis direct output formats:


! G, X, Y, I, J, G, U, V, K, L
! G, X, Y, I, J, Q, R (Agie Style)

June 2002 Mastercam Version 9 MP Post Processor Reference Guide 11-1


Chapter 11 4-axis wire output processing Volume 2

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:

NCI Gcode Description

20 Direct 4-axis linear move at rapid rate - lower guide


21 Direct 4-axis linear move at feed rate - lower guide
22 Direct 4-axis arc move, clockwise - lower guide
23 Direct 4-axis arc move, counterclockwise - lower guide
30 Direct 4-axis linear move at rapid rate - upper guide
31 Direct 4-axis linear move at feed rate – upper guide
32 Direct 4-axis arc move, clockwise - upper guide
33 Direct 4-axis arc move, counterclockwise - upper guide

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.

NCI line set for a 4-axis taper move:


11
0 0.143737 -1.006063 0. 0.085019 -0.750473 2. 0. 1000

NCI line set for a 4-axis direct move at feed rate:


21 #Lower guide move
0 -0. -1.006047 0. 0. 0. 0 2000 0.
31 #Upper guide move
0 0.000292 -0.75604 2. 0. 0. 0 2000 0.

11-2 Mastercam Version 9 MP Post Processor Reference Guide June 2002


Volume 2 Chapter 11 4-axis wire output processing

Post processing methods


Overview
Several tasks are important to processing a 4-axis wirepath:
! Calculating the values for output
! Determining the Gcode of a 4-axis taper move
! Four-line processing of a 4-axis direct move

How you handle these issues in a post customization file will be discussed later in this chapter using the
MPWFANUC post as an example.

Calculating output values


All coordinates are written to the NCI file as absolute coordinates, so all output calculations must be
done in the post customization file. Depending on the desired output, many different calculations may
be needed.

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.

Number of lines processed at a time


For a 4-axis taper wirepath, the NCI file is processed normally, which means it is read two lines at a
time. The first line represents the Gcode. The second line represents the parameters associated with that
Gcode. For a 4-axis direct wirepath, the NCI file is processed four lines at a time, not two lines at a
time as is the norm.

Predefined 4-axis wirepath variables


Following is a list of variables associated with the 4-axis wirepaths.
See Volume 3, Numeric Variables for more detailed information.

Variable Description

qrtyp Sets options for wirepath coordinate output


x, y, z X, Y and Z absolute coordinates of lower guide
u, v, w U, V and W absolute coordinate of upper guide. (4-axis taper)
wq, wr Wire angle perpendicular wq (Q) and parallel wr (R) to the current wire motion. qrtyp
must be set to 1.
wx, wy, wz X, Y and Z coordinates of the 4-axis direct upper wirepath
wxc, wxy Arc center (X, Y) of the 4-axis direct upper wirepath
g20code Gcode from the first line in the four-line set NCI file read with 4-axis direct wirepaths
g30code Gcode from the third line in the four-line set NCI file read with 4-axis direct wirepaths
June 2002 Mastercam Version 9 MP Post Processor Reference Guide 11-3
Chapter 11 4-axis wire output processing Volume 2

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

Predefined 4-axis wirepath postblocks


Following is a list of predefined postblocks that are associated with 4-axis wirepaths.
See Volume 3, Postblocks for more detailed information.

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)

Calculating NC output values


Overview
Because all coordinates are written to the NCI file in absolute coordinates, certain calculations must be
performed to obtain the correct NC output. The NC output calculations are based on machines
requirements. This section discusses the different types of desired output and the calculations needed
to achieve them. It also discusses how the calculations are handled in the MPWFANUC post
customization file.

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

! Signed incremental start – center


! Signed incremental center – start
! Unsigned incremental
! Signed incremental XY - center
! Absolute

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.

See Volume 3, Numeric Variables for more information on variables.

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)

Signed incremental delta


A UV signed incremental delta requires that subtracting the previous delta value from the current delta
value. This calculation can be stated as:
uout = (u - x) - (prv_u - prv_x)

June 2002 Mastercam Version 9 MP Post Processor Reference Guide 11-5


Chapter 11 4-axis wire output processing Volume 2

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.

Signed incremental–start to center


To calculate a signed incremental output from the start to the center, subtract the start position or the
previous UV position from the center point position, for example:
kout = vsub(wxc, prv_u) or kout = wxc – prv_u

Signed incremental–center to start


To calculate signed incremental output from the center to the start, subtract the center position from the
start position or the previous UV position, for example:
kout = vsub(prv_u, wxc) or kout = prv_u – wxc

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)

Signed incremental–XY to center


To calculate signed incremental output from the XY to the center, subtract the lower guide center
position from the upper guide center position, for example:
kout = vsub(wxc, xc) or kout = wxc - xc

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.

11-6 Mastercam Version 9 MP Post Processor Reference Guide June 2002


Volume 2 Chapter 11 4-axis wire output processing

Determining the 4-axis taper Gcode


The 4-axis taper wirepath is written using the NCI Gcode 11, which contains both the lower and upper
wire guide positions. There is no parameter that indicates if the move is at rapid rate or at feed rate. To
determine the type of move, use the Contour Flags, described next.

Contour (control) flags


The control flags (also called “contour flags”) parameter is a single parameter passed from the NCI that
carries several pieces of information in a single numeric value. The control flags parameter appears in
every motion NCI Gcode (Gcodes 0, 1, 2, 11, 81) to control such values as contour start, stop, end,
coolant, and 5-axis angles (for Mill) or rapid behavior (for Lathe).

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.

Wire control flag parameter

Control flags = cur_cflg


cstop
+ cgstop
+ cend
+ cstart
+ thrd_cut
+ water
+ power
+ tank
cstop 0 Contour stop off
1 Contour stop on
cgstop 00 Contour optional stop off
10 Contour optional stop on
cend 000 Contour end off
100 Contour end on
cstart 0000 Contour start off
1000 Contour start on
thrd_cut 10000 Thread the wire
20000 Cut the wire
water 100000 Water off
200000 Water on
300000 Water option 1
power 1000000 Power off
2000000 Power on
tank 10000000 Tank empty
20000000 Tank fill

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.

June 2002 Mastercam Version 9 MP Post Processor Reference Guide 11-7


Chapter 11 4-axis wire output processing Volume 2

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.

4-axis taper processing overview


The MP executable reads and processes the 4-axis taper NCI data in normal fashion, that is, two lines
at a time. Those two lines represent the NCI Gcode 11.

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.

4-axis direct processing overview


The MP executable reads and processes the 4-axis direct wirepath differently from all other wirepaths.
Because a 4-axis direct move writes a four-line set to the NCI file, the executable must read four lines
at a time before making calls into the post customization file. The four-line set is interpreted as follows:
! The Gcode from the first line in the four-line set is read and stored in the g20code NCI variable.
! The parameters on the second line are read and stored into the appropriate NCI variables.
! The Gcode from the third line is read and stored in the g30code NCI variable.
! The parameters on the fourth line are read and stored into the appropriate NCI variables.

11-8 Mastercam Version 9 MP Post Processor Reference Guide June 2002


Volume 2 Chapter 11 4-axis wire output processing

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.

How MPWFANUC handles 4-axis wirepaths


Overview
This section describes how the MPWFANUC post customization file handles 4-axis wirepaths. The
MPWFANUC post supports all the format types mentioned previously except Q&R. For an example
of using Q&R, please use the MPWAGIE post processor.

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


Following is a list of post switches used to set different formats and functionality in MPWFANUC.
Many of these post switches are user-defined, so refer to MPWFANUC.PST for more information.
Switch Type Description

arcoutput Predefined Sets the XY arc output format (IJK, R).


arctype User-defined Sets the XY arc center description format. (predefined)
uvtyp_lin User-defined Sets the UV output format for linear moves.
uvtyp_arc User-defined Sets the UV output format for arc moves.
kltyp_lin User-defined Sets the KL output format for linear moves.
kltyp_arc User-defined Sets the UV output format for arc moves.
qrtyp Predefined Sets options for wirepath coordinate output. 0=delta, 1=wq & wr,
2=absolute.

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.

Flag Type Description

cuttype User-defined Cut type flag: 0=2D, 1=direct, 2=taper


leadintype User-defined Lead type flag: 0=None, 1=move
strtflag User-defined Start position flag: 0 = thread/start equal, 1 = not equal

June 2002 Mastercam Version 9 MP Post Processor Reference Guide 11-9


Chapter 11 4-axis wire output processing Volume 2

thdcutflag User-defined Thread/cut flag: 0 = thread/start equal, 1 = not equal


cntrflag User-defined Contour flag: 0 = before, 1 = contour, 2 = after, 3 = single move case
kltyp_arc User-defined Sets the UV output format for arc moves.
qrtyp User-defined Sets options for wirepath coordinate output: 0=delta, 1=wq & wr,
2=absolute.

4-axis output variables


Following is a list of variables used to output 4-axis motion to the NC file. Many of these variables are
user-defined so refer to the MPWFANUC post customization file for more information.

Variable Type Description

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

4-axis postblock calls


Following is a list of postblocks that are common to all 4-axis wirepaths. Many of these postblocks are
user-defined, so refer to the MPWFANUC post customization file for more information.

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

11-10 Mastercam Version 9 MP Post Processor Reference Guide June 2002


Volume 2 Chapter 11 4-axis wire output processing

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.

4-axis taper processing flowchart

Start-of-file and tool change postblocks called. Calls to pcuttype,


ptlch_start or ptlch_nstart postblocks are made.

pedm postblock is called when NCI Gcode 11 is read. A call to the


pcntr postblock is made to set cntrflag along with many others. g20code
and g30code are assigned and the prapid postblock is called.

pcom_moveb is called from prapid, where the following user-defined


variables are calculated:
xabs, yabs, zabs, xia, yia, zia, xinc, yinc, zinc, uia, via, wia, uinc, vinc,
zinc.

pnc_out is called from prapid, where a call to pnc_out_4 is made based


on the value of cuttype.

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.

4-axis direct processing flowchart

Start-of-file and tool change postblocks called. Calls to pcuttype,


ptlch_start or ptlch_nstart postblocks are made.

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.

pcom_moveb is called from prapid, where the following user-defined


variables are calculated:
xabs, yabs, zabs, xia, yia, zia, xinc, yinc, zinc, uia, via, wia, uin, vinc,
zinc.

pnc_out is called from prapid, where a call to pnc_out_4 is made based


on the value of cuttype.

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.

11-12 Mastercam Version 9 MP Post Processor Reference Guide June 2002

You might also like