Post Mastercam 4 Axis
Post Mastercam 4 Axis
00 T1613710284
M23.00 I0 O0
# Post Name : MPMASTER
# Product : MILL
# Machine Name : MACHINE
# Control Name : CONTROL
# Description : IHS MASTER GENERIC MILL G-CODE POST
# 4-axis/Axis subs. : YES
# 5-axis : NO
# Subprograms : YES
# Executable : MP v9.17
# Post Revision : 9.1.03346 (MC_FULL.MC_MINOR.YYDDD)
#
# WARNING: THIS POST IS GENERIC AND IS INTENDED FOR MODIFICATION TO
# THE MACHINE TOOL REQUIREMENTS AND PERSONAL PREFERENCE.
#
# --------------------------------------------------------------------------
# Revision log:
# --------------------------------------------------------------------------
# Programmers Note:
# IHS 01/30/02 - Mpmaster based on CNC Software's V8/V9 Mpfan, dat
# IHS 01/30/02 - Initial post update for V9, dat
# IHS 04/01/02 - Comments repeated in translational subs, dat
# IHS 05/01/02 - lock_codes logic tweak, dat
# IHS 05/07/02 - arccheck set to 3, dat
# IHS 05/17/02 - Removed null comment from subs, dat
# IHS 05/24/02 - Rotary subprograms mod, dat
# IHS 07/17/02 - Incremental drilling calculation mod, dat
# IHS 07/25/02 - Switch added to control rotary index move retracts, dat
# IHS 10/07/02 - force_dpts switch added, dat
# IHS 10/28/02 - Additional rotary sub logic mod, dat
# IHS 11/06/02 - Switch added for 4/3 decimal place tapping feeds, dat
# IHS 03/10/03 - Synched with updates to Mpfan from V9.1, dat
# IHS 04/30/03 - arccheck set to 1, dat
# IHS 05/08/03 - A2100-style G18/G19 helical move corrections, dat
# IHS 06/27/03 - Initial post update for V9.1 SP1, dat
# IHS 10/23/03 - Roughed out auto-launch of HTML.set, dat
# IHS 12/12/03 - Comp on arc move warning added, dat
# XXX MM/DD/03 - Written for Company X from Mpmaster, xxx
#
# --------------------------------------------------------------------------
# Features:
# --------------------------------------------------------------------------
# This post supports Generic Fanuc code output for 3 and 4 axis milling.
# It is designed to support the features of Mastercam Mill V9.
#
# Following Misc. Integers are used:
# mi2 - Absolute or Incremental positioning at top level
# 0 = absolute
# 1 = incremental
#
# mi9 - Lock on First WCS - Set in first operation
# 0 = No
# 1 = Yes
#
# mi10 - M00 before operation
# 0 = No
# 1 = Yes
#
# Work offsets:
# wcstype - Work coordinate system
# 0 = Reference return is generated and G92 with the
# X, Y and Z home positions at file head.
# 1 = Reference return is generated and G92 with the
# X, Y and Z home positions at each tool.
# 2 = WCS of G54, G55.... based on Mastercam settings.
# 0 thru 5 = The WCS of G54 thru G59 respectively.
# 6 and up = The WCS of G54.1 P1 and up.
# 3 = Off
#
#Canned text:
# Entering cantext on a contour point from within Mastercam allows the
# following functions to enable/disable.
# Cantext value:
# 1 = Stop = output the "M00" stop code
# 2 = Ostop = output the "M01" optional stop code
# 3 = Bld on = turn on block delete codes in NC lines
# 4 = bLd off = turn off block delete codes in NC lines
# 5 = Dwell = Input G04 P1 command
#
#Milling toolpaths (4 axis)
#Layout:
# The term "Reference View" refers to the coordinate system associated
# with the Top view (Alt-F9, the upper gnomon of the three displayed).
# Create the part drawing with the axis of rotation about the axis
# of the "Reference View" according to the setting you entered for
# 'vmc' (vertical or horizontal) and 'rot_on_x' (machine relative
# axis of rotation).
# vmc = 1 (vertical machine) uses the top toolplane as the base machine
# view.
# vmc = 0 (horizontal machine) uses the front toolplane as the base machine
# view.
# Relative to the machine matrix -
# Rotation zero position is on the Z axis for rotation on X axis.
# Rotation zero position is on the Z axis for rotation on Y axis.
# Rotation zero position is on the X axis for rotation on Z axis.
# The machine view rotated about the selected axis as a "single axis
# rotation" are the only legal views for 4 axis milling. Rotation
# direction around the part is positive in the CCW direction when
# viewed from the plus direction of the rotating axis. Set the variable
# 'rot_ccw_pos' to indicate the signed direction. Always set the work
# origin at the center of rotation.
#
#Toolplane Positioning:
# Create the Cplane and Tplane as the rotation of the machine view about
# the selected axis of rotation. The toolplane is used to calculate
# the position of the rotary axis. This is the default setting.
#
#3 Axis Rotary (Polar)
# Polar positioning is offered in Mastercam 3 axis toolpaths through the
# rotary axis options dialog. The selected toolpath is converted to angle
# and radius position. The axis of rotation is forced to zero.
#
#Axis substitution:
# Use the Rotary axis substitution by drawing the geometry flattened
# from the cylinder. The rotary axis button must be active for axis
# substitution information to be output to the NCI file. The radius of
# the rotary diameter is added to all the Z positions at output.
#
#Simultaneous 4 Axis (11 gcode):
# Full 4 axis toolpaths can be generated from various toolpaths under the
# 'multi-axis' selection (i.e. Rotary 4 axis). All 5 axis paths are
# converted to 4 axis paths where only the angle about the rotation axis
# is resolved.
#
#Drill:
# All drill methods are supported in the post. See Simultaneous 4 Axis.
#
#Additional Notes:
# 1) Disable 4 axis by setting the numbered question 164. to 'n'.
# 2) G54 calls are generated where the work offset entry of 0 = G54,
# 1 = G55, etc.
# 3) Metric is applied from the NCI met_tool variable.
# 4) Incremental mode calculates motion from home position at toolchanges.
# The home position is used to define the last position of the tool
# for all toolchanges.
# 5) The variable 'absinc' is now pre-defined, set mi2 (Misc. Integer) for
# the 'top level' absolute/incremental program output. Subprograms are
# updated through the Mastercam dialog settings for sub-programs.
# 6) Always avoid machining to the center of rotation with rotary axis!
# 7) Transform subprograms are intended for use with G54.. workshifts.
#
# END_HEADER$
#
# --------------------------------------------------------------------------
# General Output Settings
# --------------------------------------------------------------------------
spaces$ : 1 #Number of spaces to add between fields
omitseq$ : yes$ #Omit sequence numbers?
seqmax$ : 9999 #Max. sequence number
arcoutput$ : 0 #0 = IJK, 1 = R no sign, 2 = R signed neg. over 180
arctype$ : 2 #Arc center 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc.
breakarcs$ : 0 #Break arcs, 0 = no, 1 = quadrants, 2 = 180deg. max arcs
do_full_arc$ : 1 #Allow full circle output? 0=no, 1=yes
helix_arc$ : 1 #Support helix arc output, 0=no, 1=all planes, 2=XY plane only
compwarn : 1 #Warn if cutter comp applied on arc, 0=no, 1=yes
maxrad$ : 999 #Maximum arc radius
hel_2100 : no$ #Acramatic 2100 style helical moves, 0=no, 1=yes
usecanned : yes$ #Use canned drilling cycles? Set to no for long output.
force_dpts : no$ #Force XY output on all drilling lines including cycle call?
wcstype : 2 #0 = G92 at start, 1 = G92 at toolchanges, 2 = G54, 3 = Off
force_wcs : yes$ #Force WCS output at every toolchange?
stagetool : 1 #0 = Do not pre-stage tools, 1 = Stage tools
tool_table : 1 #Tool table, 0=no, 1=yes, 2=Predator VCNC, 3=MetaCut View
output_z : yes$ #Output Z Min and Z Max values (yes or no)
cool_zmove : yes$ #Coolant off with last move
use_pitch : 1 #0 = Use feed for tapping, 1 = Use pitch for tapping
tap_feed : 0 #0 = 2/1 (in/mm) decimal places, 1 = 4/3 (in/mm) decimal places
maxfeedpm : 500 #Limit for feed in inch/min
maxfeedpm_m : 10000 #Limit for feed in mm/min
use_gear : 0 #Output gear selection code, 0=no, 1=yes
max_speed : 10000 #Maximum spindle speed
min_speed : 50 #Minimum spindle speed
sextnc$ : ".NC" #NC extension override
# --------------------------------------------------------------------------
# Rotary Axis Settings
# --------------------------------------------------------------------------
# Typical Vertical
srotary : "A" #Rotary axis prefix
vmc : 1 #0 = Horizontal Machine, 1 = Vertical Mill
rot_on_x : 1 #Default Rotary Axis Orientation, See ques. 164.
#0 = Off, 1 = About X, 2 = About Y, 3 = About Z
# Typical Horizontal
#srotary "B" #Rotary axis prefix
#vmc : 0 #0 = Horizontal Machine, 1 = Vertical Mill
#rot_on_x : 2 #Default Rotary Axis Orientation, See ques. 164.
# #0 = Off, 1 = About X, 2 = About Y, 3 = About Z
rot_ccw_pos : 1 #Axis signed dir, 0 = CW positive, 1 = CCW positive
ret_on_indx : 1 #Machine home retract on rotary index moves, (0 = no, 1 = yes)
index : 0 #Use index positioning, 0 = Full Rotary, 1 = Index only
ctable : 5 #Degrees for each index step with indexing spindle
one_rev : 0 #Limit rotary indexing between 0 and 360? (0 = No, 1 = Yes)
lock_codes : 0 #Use rotary axis unlock/lock M-Codes? (0 = No, 1 = Yes)
use_frinv : 0 #Use Inverse Time Feedrates in 4 Axis, (0 = no, 1 = yes)
rot_feed : 1 #Use calculated rotary feed values, (0 = no, 1 = yes)
maxfrdeg : 2000 #Limit for feed in deg/min
maxfrinv : 999.99#Limit for feed inverse time
frc_cinit : 1 #Force C axis reset at toolchange
ctol : 225 #Tolerance in deg. before rev flag changes
ixtol : 0.01 #Tolerance in deg. for index error
frdegstp : 10 #Step limit for rotary feed in deg/min
# --------------------------------------------------------------------------
# Debugging and Factory Set Program Switches
# --------------------------------------------------------------------------
fastmode$ : yes$ #Posting speed optimizition
bug1$ : 2 #0=No display, 1=Generic list box, 2=Editor
bug2$ : 60 #Append postline labels, non-zero is column position?
#CNC<<?ㅽ뙣>>bug3$ : 0 #Append whatline no. to each NC line?
#CNC<<硫붿떆吏
bug4$ : 0 #Append NCI line no. to each NC line?
whatno$ : yes$ #Do not perform whatline branches? (leave as yes)
linktolvar$ : 1 #Associate X tolerance variables to V9- variable?
linkplnvar$ : 1 #Associate X plane specific variables to V9- variable?
# --------------------------------------------------------------------------
# Additional General Output Settings
# --------------------------------------------------------------------------
nobrk$ : no$ #Omit breakup of x, y & z rapid moves
progname$ : 1 #Use uppercase for program name (sprogname)
sub_level$ : 1 #Enable automatic subprogram support
sub_seq_typ$ : 1 #Enable subprogram sequence number reset at sub call
arccheck$ : 1 #Check for small arcs, convert to linear
atol$ : 0.01 #Angularity tolerance for arccheck = 2
ltol$ : 0.002 #Length tolerance for arccheck = 1
vtol$ : 0.0001#System tolerance
ltol_m : 0.05 #Length tolerance for arccheck = 1, metric
vtol_m : 0.0025#System tolerance, metric
tooltable$ : 1 #Read for tool table and pwrtt - use tool_table to disable
# --------------------------------------------------------------------------
# Common User-defined Variable Initializations (not switches!)
# --------------------------------------------------------------------------
xia : 0 #Formated absolute value for X incremental calculations
yia : 0 #Formated absolute value for Y incremental calculations
zia : 0 #Formated absolute value for Z incremental calculations
cia : 0 #Formated absolute value for C incremental calculations
#Drill variables
drlgsel : -1 #Drill Select Initialize
drillref : 0 #Select drill reference
peckacel$ : -1 #Fractional percent to reduce peck2 when usecan.. : no
drlgcode : 0 #Save Gcode in drill
sav_dgcode : 0 #Drill gcode saved
#Subprogram variables
mr_rt_actv : 0 #Flag to indicate if G51/G68 is active
#0=Off, 1=Toolchange, 2=Subprogram call/start, G68
#3=Absolute start, both
rt_csav : 0 #C saved value
end_sub_mny : 0 #Many tool setting captured at transform sub end
#Rotary/Index variables
csav : 0 #C saved value
prvcabs : 0 #Saved cabs from pe_inc_calc,
#Used for rotary feed and direction calculations
cdelta : 0 #Calculation for angle change
rev : 0 #Calculation for deg/min
sav_rev : 0 #Saved revolution counter
indx_out : c9k #Rotation direction calculation
fmt 16 indx_mc #Rotation direction calculation
#Misc variables
tcnt : 0 # Count the number of tool changes
toolcount : 1 # Tool counter for logic control
toolcountn : 0 # Next tool counter for logic control
toolcountp : 0 # Previous tool counter for logic control
tooltotal : 0 # Tool tool count
nexttool : 0 # Next actual tool
nexttp : 0 # Next tool plane
prvtp : 0 # Previous tool plane
counter : 0 # Counter
nstrlen : 0 # Length of string
last_op_id : 0 # Previous internal operation id
last_cuttype : 0 # Previous cuttype
stock_typ : 0 # Predator Stock Type
cyl_typ : 0 # Predator Cyl Stock Type
z_min$ : 99999 # Min Z
z_tmin : 99999 # Overall min Z
z_max$ : -99999 # Max Z
z_tmax : -99999# Overall max Z
tapflg : 0 # Flag for tap cycle
sav_mi9 : 0 # Saved mi9 value
rotretflg : 0
compwarnflg : 0
# --------------------------------------------------------------------------
# FORMULAS - global formulas
# --------------------------------------------------------------------------
toolcountn = toolcount + 1 # Index!
toolcountp = toolcount - 1 # Index!
# --------------------------------------------------------------------------
# Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
# --------------------------------------------------------------------------
#Default english/metric position format statements
fs2 1 0.7 0.6 #Decimal, absolute, 7 place, default for initialize (:)
fs2 2 0.4 0.3 #Decimal, absolute, 4/3 place
fs2 3 0.4 0.3d #Decimal, delta, 4/3 place
#Common format statements
fs2 4 1 0 1 0 #Integer, not leading
fs2 5 2 0 2 0l #Integer, force two leading
fs2 6 3 0 3 0l #Integer, force three leading
fs2 7 4 0 4 0l #Integer, force four leading
fs2 8 5 0 5 0l #Integer, force five leading
fs2 9 0.1 0.1 #Decimal, absolute, 1 place
fs2 10 0.2 0.2 #Decimal, absolute, 2 place
fs2 11 0.3 0.3 #Decimal, absolute, 3 place
fs2 12 0.4 0.4 #Decimal, absolute, 4 place
fs2 13 0.5 0.5 #Decimal, absolute, 5 place
fs2 14 0.3 0.3d #Decimal, delta, 3 place
fs2 15 0.2 0.1 #Decimal, absolute, 2/1 place (feedrate)
fs2 16 1 0 1 0n #Integer, forced output
fs 17 1.4lt #Decimal, absolute, four trailing
# --------------------------------------------------------------------------
#String and string selector definitions for NC output
# --------------------------------------------------------------------------
#Numbered question 164. string to detect Rotary axis y/n
sq164 : ""
# --------------------------------------------------------------------------
# Error messages
# --------------------------------------------------------------------------
saxiswarn : "WARNING-POST ROTARY AXIS ASSIGNMENT ('rot_on_x') OVERWRITTEN BY
OPERATION"
saxisoff : "ERROR-POST ROTARY AXIS ASSIGNMENT ('rot_on_x') IS DISABLED"
saxiserror : "ERROR-INVALID ROTARY AXIS ASSIGNMENT ('rot_on_x') FOR CURRENT
OPERATION"
sindxerror : "WARNING-INDEX ANGLE DOES NOT MATCH POST SETTING ('ctable')"
stlorgerr : "ERROR-TOOL ORIGIN DOES NOT MATCH CENTER OF ROTATION IN POLAR MILLING"
shomeserror : "ERROR-G92 WORK OFFSET ('wcstype') DOES NOT SUPPORT TRANSFORM
SUBPROGRAM"
sprgnerror : "ERROR-SUBPROGRAM NUMBER MATCHES THE MAIN PROGRAM NUMBER"
scompwarn : "WARNING-CUTTER COMP APPLIED ON ARC MOVE"
# --------------------------------------------------------------------------
# Misc strings
# --------------------------------------------------------------------------
snull : "" # Null character string
sdot : "." # dot string
stest1 : "" # Test string 1
stilde : "~" # Tidle string
snocomm : "DEFINE TOOL NAMES"
stoper : "" # String for tool notes
spostname : "" # Post name
snullop : "UNDEFINED OPERATION"
slicense : "IN-HOUSE SOLUTIONS"
# ------------------------------------------------------------------------
# Parameter Tables
# ------------------------------------------------------------------------
fprmtbl 13 2 # Multisurf Finish
10010 stock # Amount of stock to leave on drive surfs
10227 check # Amount of stock to leave on check surfs
# --------------------------------------------------------------------------
# Buffer 3 - Holds the variable 'tlplnno' for each toolpath segment
# --------------------------------------------------------------------------
rc3 : 1
wc3 : 1
fbuf 3 0 1 0 0 # Buffer 3
# --------------------------------------------------------------------------
# Buffer 4 - Holds the variable 't' for each toolpath segment
# --------------------------------------------------------------------------
rc4 : 1
wc4 : 1
fbuf 4 0 1 0 0 # Buffer 4
# --------------------------------------------------------------------------
# Buffer 5 - Min / Max
# --------------------------------------------------------------------------
b5_gcode : 0
b5_zmin : 0
b5_zmax : 0
rc5 : 2
wc5 : 1
size5 : 0
# --------------------------------------------------------------------------
# Question format statements
# --------------------------------------------------------------------------
fq 1 stock_typ "Predator Stock [0=Box,1=Cylindrical]"
fq 2 cyl_typ "Cylindrical Stock Axis [1=X,2=Y,3=Z]"
# --------------------------------------------------------------------------
# Strings - String labels must start with 's' - they are not pre-assigned
# --------------------------------------------------------------------------
#Select operation note
sop00 : "NULL......." # String definition
sop01 : "CONTOUR...." # " "
sop02 : "CONTOUR...." # " "
sop03 : "DRILL/MISC." # " "
sop04 : "POCKET....." # " "
sop05 : "RULED......" # " "
sop06 : "2D-SWEPT..." # " "
sop07 : "3D-SWEPT..." # " "
sop08 : "REVOLVED..." # " "
sop09 : "LOFT......." # " "
sop10 : "COONS......" # " "
sop11 : "FILLET....." # " "
sop12 : "FLOWLINE..." # " "
sop13 : "M.FINISH..." # " "
sop14 : "M.ROUGH...." # " "
sop15 : "POINT......" # " "
sop16 : "DRILL5AX..." # " "
sop17 : "CURVE5AX..." # " "
sop18 : "SWARF5AX..." # " "
sop19 : "FACING....." # " "
sop20 : "OP20......." # " "
# --------------------------------------------------------------------------
#Select operation note
sdr00 : "DRILL/CBORE" # String definition
sdr01 : "PECK DRILL." # " "
sdr02 : "CHIP BREAK." # " "
sdr03 : "TAP........" # " "
sdr04 : "BORE 1....." # " "
sdr05 : "BORE 2....." # " "
sdr06 : "FINE BORE.." # " "
sdr07 : "MISC 2....." # " "
sdr08 : "CUST 9....." # " "
sdr09 : "CUST 10...." # " "
sdr10 : "CUST 11...." # " "
sdr11 : "CUST 12...." # " "
sdr12 : "CUST 13...." # " "
sdr13 : "CUST 14...." # " "
sdr14 : "CUST 15...." # " "
sdr15 : "CUST 16...." # " "
sdr16 : "CUST 17...." # " "
sdr17 : "CUST 18...." # " "
sdr18 : "CUST 19...." # " "
sdr19 : "CUST 20...." # " "
sdrnote : "" # Target string
# --------------------------------------------------------------------------
# Select month
smon00 : ""
smon01 : "JAN"
smon02 : "FEB"
smon03 : "MAR"
smon04 : "APR"
smon05 : "MAY"
smon06 : "JUN"
smon07 : "JUL"
smon08 : "AUG"
smon09 : "SEP"
smon10 : "OCT"
smon11 : "NOV"
smon12 : "DEC"
smonth : ""
# --------------------------------------------------------------------------
# General G and M Code String select tables
# --------------------------------------------------------------------------
# Motion G code selection
sg00 : "G00" #Rapid
sg01 : "G01" #Linear feed
sg02 : "G02" #Circular interpolation CW
sg03 : "G03" #Circular interpolation CCW
sg04 : "G04" #Dwell
sgcode : "" #Target for string
# --------------------------------------------------------------------------
# Toolchange / NC output Variable Formats
# --------------------------------------------------------------------------
fmt "T" 4 t$ #Tool No
fmt "T" 4 first_tool$ #First Tool Used
fmt "T" 4 next_tool$ #Next Tool Used
fmt "D" 4 tloffno$ #Diameter Offset No
fmt "H" 4 tlngno$ #Length Offset No
fmt "G" 4 g_wcs #WCS G address
fmt "P" 4 p_wcs #WCS P address
fmt "S" 4 speed #Spindle Speed
fmt "M" 4 gear #Gear range
# --------------------------------------------------------------------------
fmt "N" 4 n$ #Sequence number
fmt "X" 2 xabs #X position output
fmt "Y" 2 yabs #Y position output
fmt "Z" 2 zabs #Z position output
fmt "X" 3 xinc #X position output
fmt "Y" 3 yinc #Y position output
fmt "Z" 3 zinc #Z position output
fmt "A" 11 cabs #C axis position
fmt "A" 14 cinc #C axis position
fmt "A" 4 indx_out #Index position
fmt "R" 14 rt_cinc #C axis position, G68
fmt "I" 3 i$ #Arc center description in X
fmt "J" 3 j$ #Arc center description in Y
fmt "K" 3 k$ #Arc center description in Z
fmt "K" 2 lead #Helical lead
fmt "R" 2 arcrad$ #Arc Radius
fmt "F" 15 feed #Feedrate
fmt "P" 11 dwell$ #Dwell
fmt "M" 5 cantext$ #Canned text
# --------------------------------------------------------------------------
#Move comment (pound) to output colon with program numbers
fmt "O" 7 progno$ #Program number
#fmt ":" 7 progno$ #Program number
fmt "O" 7 main_prg_no$ #Program number
#fmt ":" 7 main_prg_no #Program number
fmt "O" 7 sub_prg_no$ #Program number
#fmt ":" 7 sub_prg_no$ #Program number
fmt "P" 7 sub_prg_call#Program number
fmt "X" 2 sub_trnsx$ #Rotation point
fmt "Y" 2 sub_trnsy$ #Rotation point
fmt "Z" 2 sub_trnsz$ #Rotation point
# --------------------------------------------------------------------------
fmt "Q" 2 peck1$ #First peck increment (positive)
fmt 2 peck2$ #Second or last peck (positive)
fmt 2 peckclr$ #Safety distance
fmt 2 retr$ #Retract height
fmt "Q" 2 shftdrl$ #Fine bore tool shift
fmt "Z" 2 zdrl$ #Depth of drill point
fmt "Z" 2 tosz$ #Drilling top of stock
fmt "N" 4 n_tap_thds$ #Number of threads per inch (tpi) / Pitch (mm)
fmt "F" 2 pitch #Tap pitch (inches per thread)
fmt "R" 2 refht_a #Reference height
fmt "R" 2 refht_i #Reference height
# --------------------------------------------------------------------------
fmt "TOOL - " 4 tnote # Note format
fmt " DIA. OFF. - " 4 toffnote # Note format
fmt " LEN. - " 4 tlngnote # Note format
fmt " DIA. - " 1 tldianote # Note format
# --------------------------------------------------------------------------
fmt "D" 17 tldia$ # Note format
fmt "R" 4 tcr$ # Note format
fmt "D" 2 tldia_pred # Predator VCNC format
fmt "C" 2 tcr_pred # Predator VCNC format
fmt 2
slot # 20004 Parameter line
fmt 2
tool_type
fmt 2
matl_type
fmt 2
corner_rad_type
fmt 2
diameter
fmt 2
corner_rad
fmt 2
threads
fmt "A" 2 tip_angle
fmt 2 dia_off
fmt 2 len_off
fmt 2 tool_feed
fmt 2 plunge
fmt 2 retract
fmt 2 rpm
fmt 2 coolant1
fmt 2 n_flutes1
fmt "A" 2 tip_angle_ch
fmt 5 year$
fmt 5 month$
fmt 5 day$
fmt 4 hour
fmt 5 min
# --------------------------------------------------------------------------
# Tool Comment / Manual Entry Section
# --------------------------------------------------------------------------
ptoolcomment #Comment for tool
tnote = t$
toffnote = tloffno$
tlngnote = tlngno$
tldianote = tldia$
"(", pstrtool, *tnote, *toffnote, *tlngnote, *tldianote, ")", e$
if strtool$=snull, stest1=snocomm+stilde
else, stest1=strtool$+stilde
nstrlen = strstr(stilde,stest1)-1
counter = 1
while counter <= (25-nstrlen), pspace
"(SBOX ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min, " ",
*stck_ht$, " ", *stck_wdth$, " ", *stck_thck$, ")"
stck_diam = stck_wdth$
if stck_thck$ > stck_wdth$, stck_diam = stck_thck$
stck_ht$ = stck_ht$
"(SCYL ", *cyl_typ, " ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min,
" ", *stck_diam, " ", *stck_ht$, ")"
stck_diam = stck_ht$
if stck_thck$ > stck_ht$, stck_diam = stck_thck$
stck_ht$ = stck_wdth$
"(SCYL ", *cyl_typ, " ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min,
" ", *stck_diam, " ", *stck_ht$, ")"
stck_diam = stck_ht$
if stck_wdth$ > stck_ht$, stck_diam = stck_wdth$
stck_ht$ = stck_thck$
"(SCYL ", *cyl_typ, " ", *stck_x_min, " ", *stck_y_min, " ", *stck_z_min,
" ", *stck_diam, " ", *stck_ht$, ")"
stck_meta_ht = stck_ht$
stck_meta_wdth = stck_wdth$
stck_meta_thck = stck_thck$
# --------------------------------------------------------------------------
# Misc. Output
# --------------------------------------------------------------------------
pparameter$ # Run parameter table
if opcode$=13 | opcode$=14, result = fprm (opcode$)
if prmcode$ = 10000, stoper = ucase(sparameter$)
if prmcode$ = 10055, spostname = ucase(sparameter$)
#CNC<<메시지-오류(1148)>> Mastercam MP 포스트블럭 파라미터 문제:파라미터 번호 10055 이(가) 제
거되었습니다
#CNC<<메시지-오류(1148)>> 데이터 위치 참고 pre-X3 ASCII NCI information
#CNC<<메시지-오류(1148)>> 파라미터 참고 문서를 참고하거나 Mastercam 딜러에게 연락해 포스트 수정
또는 교체를 요청하십시오., 변수, 포스트블럭 또는 다른 키워드는 더이상 지원되지 않습니다 .
#CNC<<硫붿떆吏
#CNC<<硫붿떆吏
#CNC<<硫붿떆吏
if stoper=snull, stoper = snullop
# --------------------------------------------------------------------------
# Start of File and Toolchange Setup
# --------------------------------------------------------------------------
psof0$ #Start of file for tool zero
psof$
if tool_table = 2, ppredstck,e$
if tool_table = 3, pmetastck,e$
spaces$=0
if output_z = yes$ & tcnt > 0,
# [
n$, pspc, "(", "OVERALL MAX - ", *z_tmax, ")", e$
n$, pspc, "(", "OVERALL MIN - ", *z_tmin, ")", e$
# ]
spaces$=sav_spc
ptlchg0$ #Call from NCI null tool change (tool number repeats)
pcuttype
pcom_moveb
toolcount = toolcount + 1
prvtp = rbuf(3,toolcountp)
if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)
else, nexttool = first_tool$
if mi10$=one & op_id$<>last_op_id | (tlplnno$ <> prvtp & ret_on_indx), pstop
c_mmlt$ #Multiple tool subprogram call
comment$
pcan
if plane$ < 0, plane$ = 0
pbld, n$, sgplane, e$
pspindchng
if coolant$ <> 0 & coolant$ <> sav_coolant & sav_coolant, pbld, n$, sm09, e$
pbld, n$, scoolant, e$
sav_coolant = coolant$
if coolant$ = 1, sm09 = sm09_0
if coolant$ = 2, sm09 = sm09_1
if coolant$ = 3, sm09 = sm09_2
if op_id$<>last_op_id, pstock
if sav_mi9 = 1, workofs$ = sav_workofs
if (wcstype > one & workofs$ <> prv_workofs$) | (tlplnno$ <> prvtp &
ret_on_indx),
[
sav_absinc = absinc$
absinc$ = zero
if fmtrnd(prv_cabs) <> fmtrnd(cabs),
[
if lock_codes = 1 & not(index) & rot_on_x, pbld, n$, *sunlock, "(UNLOCK)",
e$
pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, e$
if lock_codes = 1 & not(index) & rot_on_x & cuttype = 0, pbld, n$, *slock,
"(LOCK)", e$
]
else,
[
pbld, n$, sgabsinc, pwcs, pfxout, pfyout, pfzout, pcout, e$
]
pe_inc_calc
ps_inc_calc
absinc$ = sav_absinc
]
if lock_codes = 1 & cuttype <> last_cuttype & cuttype > 0, pbld, n$, *sunlock,
"(UNLOCK)", e$
if cuttype = zero, ppos_cax_lin
if lock_codes = 1 & cuttype <> last_cuttype & cuttype = 0 & fmtrnd(prv_cabs) =
fmtrnd(cabs), pbld, n$, *slock, "(LOCK)", e$
if gcode$ = one, plinout
else, prapidout
pcom_movea
c_msng$ #Single tool subprogram call
last_op_id = op_id$
last_cuttype = cuttype
#pbld, n,"G53","Z0.", e
#pbld, n$, "G90","G53", "X-360.", "Y0.", protretinc, e$
#ppost #Called after posting is complete and all files are closed
#result = fexist(sdll)
#if result = 1, result = dll(sdll,sparams1)
#Toolchange setup
pspindchng #Spindle speed change
if prv_spdir2 <> spdir2 & prv_speed <> zero, pbld, n$, *sm05, e$
if prv_speed <> speed | prv_spdir2 <> spdir2,
[
if speed, pbld, n$, *speed, *spindle, pgear, e$
]
!speed, !spdir2
"%", e$
spaces$=0
progno$, "(",sprogname$,")", e$
#*progno$, "(",sprogname$,")", e$
spathnc$ = ucase(spathnc$)
smcname$ = ucase(smcname$)
"(Date-",*day$,"/",*month$,"/",*year$, " Time-",time$, ")", e$
"(Programmer Cuongnc",")", e$
#"(DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, ")", e$
#"(DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, ")", e$
#"(MASTERCAM - V", *vers_no, ")", e$
#"(MC9 FILE - ", smcpath, smcname, smcext, ")", e$
#"(POST - ", spostname, ")", e$
stck_matl$ = ucase(stck_matl$)
#"(MATERIAL - ", stck_matl, ")", e$
#"(PROGRAM - ",sprogname,sextnc,")", e$
#"(DATE - ", *smonth, "-", *day, "-", *year, ")", e$
#"(TIME - ", *time, ")", e$
#"(POST DEV - ", *slicense, ")", e$
spaces$=sav_spc
#seqno = 10
#seqinc = 10
#n = seqno
# --------------------------------------------------------------------------
# Motion NC output
# --------------------------------------------------------------------------
#The variables for absolute output are xabs, yabs, zabs.
#The variables for incremental output are xinc, yinc, zinc.
# --------------------------------------------------------------------------
prapidout #Output to NC of linear movement - rapid
pcan1, pbld, n$, sgplane, `sgcode, sgabsinc, pccdia,
pxout, pyout, pzout, pcout, strcantext, e$
scoolant, e$
# --------------------------------------------------------------------------
# Motion output components
# --------------------------------------------------------------------------
pbld #Canned text - block delete
if bld, '/'
pxout #X output
if absinc$ = zero, xabs, !xinc
else, xinc, !xabs
pyout #Y output
if absinc$ = zero, yabs, !yinc
else, yinc, !yabs
pzout #Z output
if absinc$ = zero, zabs, !zinc
else, zinc, !zabs
# --------------------------------------------------------------------------
# Drilling
# --------------------------------------------------------------------------
pdrill0$ #Pre-process before drill call
sav_dgcode = gcode$ #Capture gcode for 5 axis drill
if use_pitch = 0,
[
pcan1, pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,
prdrlout, *feed, strcantext, e$
]
else,
[
if met_tool$, pitch = n_tap_thds$ # Tap pitch (mm per thread)
else, pitch = 1/n_tap_thds$ # Tap pitch (inches per thread)
pcan1, pbld, n$, "M29", *speed , e$
pbld, n$, *sgdrlref, *sgdrill, pdrlxy, pfzout, pcout,
prdrlout, *pitch, !feed, strcantext, e$
]
pcom_movea
tapflg = 1
# --------------------------------------------------------------------------
#Subprogram postblocks
#sub_trnstyp - 0=mirror, 1=rotate, 2=scale, 3=translate
#sub_trnmthd (mirror) - 0=X axis, 1=Y axis, 2=line
#sub_trnmthd (rotate) - 0=tplane, 1=tplane origin only, 2=coordinates
# --------------------------------------------------------------------------
psub_call_m$ #Call to main level, single tool
psub_call_trans
# --------------------------------------------------------------------------
# Canned Text
# --------------------------------------------------------------------------
pcan #Canned text - before output call
strcantext = sblank
if cant_no$ > zero,
[
if cant_pos1$ = zero, pcant_1
if cant_pos2$ = zero, pcant_2
if cant_pos3$ = zero, pcant_3
if cant_pos4$ = zero, pcant_4
if cant_pos5$ = zero, pcant_5
if cant_pos6$ = zero, pcant_6
if cant_pos7$ = zero, pcant_7
if cant_pos8$ = zero, pcant_8
if cant_pos9$ = zero, pcant_9
if cant_pos10$ = zero, pcant_10
pbld, n$, strcantext, e$
strcantext = sblank
]
# --------------------------------------------------------------------------
# Position calculations, generally these do not need to be modified
# --------------------------------------------------------------------------
pmiscint$ #Capture the top level absinc for subprograms
if sub_level$ <= zero, absinc$ = mi2$
#Disable cutpos2 if not 4 axis, saves time
if rot_on_x = zero, cutpos2$ = m_one
#Feedrate calculations
pfcalc #Feedrate calculations, gcode 0 does not evaluate
if gcode$ <> zero,
[
if abs(fmtrnd(cabs)-prvcabs) <= 0.001 | index | not(rot_feed) | opcode$ = 3,
pfcalc_u_min
else,
[
#if cuttype = one & (cutpos2 <= one), #Proposed change
if cuttype = one & (cutpos2$ <= one | cutpos2$ = four & (opcode$ < 5 &
opcode$ > 12)),
pfcalc_u_min
else, pfclc_deg_inv
]
if ipr_type <> prv_ipr_type, prv_feed = c9k
]
#Incremental calculations
ps_inc_calc #Incremental calculations, start
xia = fmtrnd(xabs)
yia = fmtrnd(yabs)
zia = fmtrnd(zabs)
xinc = vsub (xia, prv_xia)
ps_cinc_calc
# --------------------------------------------------------------------------
# Tooltable Output
# --------------------------------------------------------------------------
pwrtt$ # Write tool table, scans entire file, null tools are negative
if rotaxis$ > 0 | rotary_type$ > 0 | mill5$ <> 0,
[
rot_on_x = sav_rot_on_x
output_z = no$
]
#if vmc = 0 & tlplnno <> 2, rot_on_x = sav_rot_on_x
#if vmc = 1 & tlplnno > 1, rot_on_x = sav_rot_on_x
if tlplnno$ > 1, rot_on_x = sav_rot_on_x
tlplnno$ = wbuf(3,wc3) #Buffers out tool plane values
t$ = wbuf(4,wc4) #Buffers out tool number values
if tool_table = 1, ptooltable,e$
if tool_table = 2, ppredtool,e$
if tool_table = 3, pmetatool,e$
if t$ >= zero, tcnt = tcnt + one
ptravel
pwritbuf5
ptooltable # Write tool table, scans entire file, null tools are negative
tnote = t$
toffnote = tloffno$
tlngnote = tlngno$
spaces$=0
#if t$ >= zero,
# [
#if tcr$>0, "(", *t$, ptspace, "|", plistcomm, "|", *tlngno$, phspace,
"|", *tloffno$, pdspace, "|", *tldia$,pdiamspc "|", *tcr$, "|", popnote, ")"
#if tcr$=0, "(", *t$, ptspace, "|", plistcomm, "|", *tlngno$, phspace,
"|", *tloffno$, pdspace, "|", *tldia$,pdiamspc "|", " |", popnote, ")"
#]
if t$ >= zero,
[
if tcr$>0, "(", *t$, ptspace, "|", plistcomm, "|",*tlngno$, phspace,
"|", popnote, ")"
if tcr$=0, "(", *t$, ptspace, "|", plistcomm, "|",*tlngno$, phspace,
"|", popnote, ")"
]
tcr_pred = tcr$
tldia_pred = tldia$
tip_angle_ch = tip_angle*2
spaces$=0
if t$ >= zero,
[
# CENTER DRILL
if tool_typ$ = 1, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle, "
", *flute_len, " S4)"
# SPOT DRILL
if tool_typ$ = 2, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle, "
", *flute_len, " S4)"
# DRILL
if tool_typ$ = 3, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle, "
", *flute_len, " S4)"
# TAP-RH
if tool_typ$ = 4,
[
if tip_angle <= 179, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tip_angle, " ", *flute_len, " S4)"
else, "(MTOOL ", *t$, " ", *tldia_pred, " ", "A179.", " ",
*flute_len, " S4)"
]
# TAP-LH
if tool_typ$ = 5,
[
if tip_angle <= 179, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tip_angle, " ", *flute_len, " S4)"
else, "(MTOOL ", *t$, " ", *tldia_pred, " ", "A179.", " ",
*flute_len, " S4)"
]
# REAMER
if tool_typ$ = 6,
[
if tcr$ = 0, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
if tcr$ = tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len,
" S2)"
if tcr$ > 0 & tcr$ < tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tcr_pred, " ", *flute_len, " S3)"
]
# BORING BAR
if tool_typ$ = 7,
[
if tcr$ = 0, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
if tcr$ = tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len,
" S2)"
if tcr$ > 0 & tcr$ < tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tcr_pred, " ", *flute_len, " S3)"
]
# COUNTER BORE
if tool_typ$ = 8,
[
if tcr$ = 0, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
if tcr$ = tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len,
" S2)"
if tcr$ > 0 & tcr$ < tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tcr_pred, " ", *flute_len, " S3)"
]
# COUNTER SINK
if tool_typ$ = 9, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle, "
", *flute_len, " S4)"
# END MILL FLAT
if tool_typ$ = 10, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
# END MILL SPHERE
if tool_typ$ = 11, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S2)"
# CHAMFER MILL
if tool_typ$ = 12, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tip_angle_ch, " ", *flute_len, " S7)"
# FACE MILL
if tool_typ$ = 13, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
# SLOT MILL
if tool_typ$ = 14, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
# CORNER RAD MILL
if tool_typ$ = 15,
[
if tcr$ = 0, "(MTOOL ", *t$, " ", *tldia_pred, " ", *flute_len, "
S1)"
else, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tcr_pred, " ",
*flute_len, " S5)"
]
# DOVETAIL MILL
if tool_typ$ = 16, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle, "
", *flute_len, " S8)"
# TAPER MILL
if tool_typ$ = 17,
[
if tcr$ = 0, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle, " ",
*flute_len, " S7)"
if tcr$ = tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tip_angle,
" ", *flute_len, " S9)"
if tcr$ > 0 & tcr$ < tlrad$, "(MTOOL ", *t$, " ", *tldia_pred, " ",
*tcr_pred, " ", *tip_angle, " ", *flute_len, " S10)"
]
# LOLLIPOP MILL
if tool_typ$ = 18, "(MTOOL ", *t$, " ", *tldia_pred, " S6)"
# END MILL BULL
if tool_typ$ = 19, "(MTOOL ", *t$, " ", *tldia_pred, " ", *tcr_pred, "
", *flute_len, " S3)"
]
spaces$=sav_spc
#(NWDTOOL NAME"1/2 CHAMFER MILL" T1 D.5 R0. F2. L3. A45. TD.06 CD2. CL1.
SD2. C0)
# N = "Tool name"
# T = Tool No.
# D = Tool Dia.
# R = Corner Radius
# F = Flute Length
# L = Tool over all length
# A = Tip angle or Taper angle
# TD = Tip Dia.
# CD = Colllet/Holder Dia.
# CL = Collet/Holder Height
# SD = Spindle Dia. (set equal to Collet Diameter)
# C = tip or center 0 = tip 1 = center
spaces$=0
if t$ >= zero, "(NWDTOOL N", 34, pmetacomm, 34, " ", *t$, " ",
*tldia_meta, " ",
[if tcr_meta > 0, *tcr_meta, " "], *flute_meta, " ",
*oa_meta, " ",
[if ta_meta<>180, *ta_meta, " "], [if td_meta > 0,
*td_meta, " "],
*cd_meta, " ", *cl_meta, " ", *sd_meta, " ", *tipcomp, ")"
spaces$=sav_spc
# --------------------------------------------------------------------------
# Buffer 5 Read / Write Routines
# --------------------------------------------------------------------------
pwritbuf5 # Write Buffer 1
b5_gcode = gcode$
b5_zmin = z_min$
b5_zmax = z_max$
b5_gcode = wbuf(5, wc5)