MPFAN-法兰克立式加工中心后处理

温柔似野鬼°
711次浏览
2020年07月30日 17:12
最佳经验
本文由作者推荐

语境是什么意思-沾染

(此后处理是本人改好的,适用于零件加工,用了好久,没有问题!现呈上供网友共享!因PST文件不能上传,故改为文本文件上传,下载后打开另存为PST文件就可以用了!本段注释可删除)


# Post Name : MPFAN
# Product : MILL
# Machine Name : GENERIC FANUC
# Control Name : GENERIC FANUC
# Description : GENERIC FANUC MILL POST
# Associated Post : NONE
# Mill/Turn : NO
# 4-axis/Axis subs. : YES
# 5-axis : NO
# Subprograms : YES
# Executable : MP v9.0
#
# WARNING: THIS POST IS GENERIC AND IS INTENDED FOR MODIFICATION TO
# THE MACHINE TOOL REQUIREMENTS AND PERSONAL PREFERENCE.
#
# --------------------------------------------------------------------------
# Revision log:
# --------------------------------------------------------------------------
# Programmers Note:
# CNC 01/12/01 - Initial post update for V8.1, grt
# CNC 07/02/01 - Add cantext to cancel drill and tool retract, jph
# CNC 01/09/02 - Initial post update for V9.0, rjm
#
# --------------------------------------------------------------------------
# Features:
# --------------------------------------------------------------------------
# This post supports Generic Fanuc code output for 3 and 4 axis milling.
# It is designed to support the features of Mastercam Mill V8.
#
# Following Misc. Integers are used:
#
# mi1 - 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.
#
# mi2 - Absolute or Incremental positioning at top level
# 0 = absolute
# 1 = incremental
#
# mi3 - Select G28 or G30 reference point return.
# 0 = G28, 1 = G30
#
#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
#
#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 -
# Ro
tation 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.
#
# --------------------------------------------------------------------------
# Debugging and Factory Set Program Switches
# --------------------------------------------------------------------------
m_one : -1 #Define constant
zero : 0 #Define constant
one : 1 #Define constant
two : 2 #Define constant
three : 3 #Define constant
four : 4 #Define constant
five : 5 #Define constant
c9k :
9999 #Define constant

fastmode : yes #Enable Quick Post Processing, (set to no for debug)
bug1 : 2 #0=No display, 1=Generic list box, 2=Editor
bug2 : 40 #Append postline labels, non-zero is column position?
bug3 : 0 #Append whatline no. to each NC line?
bug4 : 1 #Append NCI line no. to each NC line?
whatno : yes #Do not perform whatline branches? (leave as yes)

get_1004 : 1 #Find gcode 1004 with getnextop?
rpd_typ_v7 : 0 #Use Version 7 style contour flags/processing?
strtool_v7 : 2 #Use Version 7+ toolname?
tlchng_aft : 2 #Delay call to toolchange until move line
cant_tlchng : 1 #Ignore cantext entry on move with tlchng_aft
newglobal : 1 #Error checking for global variables
getnextop : 0 #Build the next variable table

# --------------------------------------------------------------------------
# General Output Settings
# --------------------------------------------------------------------------
sub_level : 1 #Enable automatic subprogram support
breakarcs : 0 #Break arcs, 0 = no, 1 = quadrants, 2 = 180deg. max arcs
arcoutput : 0 #0 = IJK, 1 = R no sign, 2 = R signed neg. over 180
skp_lead_flgs : 1 #Do NOT use v9 style contour flags
arctype : 2 #Arc center 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc.
do_full_arc : 0 #Allow full circle output? 0=no, 1=no
helix_arc : 0 #Support helix arc output, 0=no, 1=all planes, 2=XY plane only
arccheck : 1 #Check for small arcs, convert to linear
atol : .01 #Angularity tolerance for arccheck = 2
ltol : .002 #Length tolerance for arccheck = 1
vtol : .0001 #System tolerance
maxfeedpm : 500 #Limit for feed in inch/min
ltol_m : .05 #Length tolerance for arccheck = 1, metric
vtol_m : .0025 #System tolerance, metric
maxfeedpm_m : 10000 #Limit for feed in mm/min
force_wcs : YES #Force WCS output at every toolchange?
spaces : 1 #Number of spaces to add between fields
omitseq : NO #Omit sequence numbers?
seqmax : 9999 #Max. sequence number
stagetool : 1 #0 = Do not pre-stage tools, 1 = Stage tools
use_gear : 0 #Output gear selection code, 0=no, 1=no
max_speed : 10000 #Maximum spindle speed
min_speed : 50 #Minimum spindle speed
nobrk : no #Omit breakup of x, y & z rapid moves
progname : 1 #Use uppercase for program name (sprogname)

# --------------------------------------------------------------------------
# Rotary Axis Settings
# --------------------------------------------------------------------------
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
rot_ccw_pos : 1 #Axis signed dir, 0 = CW positive, 1 = CCW positive
index : 0 #Use index positioning, 0 = F
ull Rotary, 1 = Index only
ctable : 5 #Degrees for each index step with indexing spindle
use_frinv : 0 #Use Inverse Time Feedrates in 4 Axis, (0 = no, 1 = no )
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 : .01 #Tolerance in deg. for index error
frdegstp : 10 #Step limit for rotary feed in deg/min

# --------------------------------------------------------------------------
# Enable Canned Drill Cycle Switches
# --------------------------------------------------------------------------
usecandrill : yes #Use canned cycle for drill
usecanpeck : yes #Use canned cycle for Peck
usecanchip : yes #Use canned cycle for Chip Break
usecantap : yes #Use canned cycle for Tap
usecanbore1 : yes #Use canned cycle for Bore1
usecanbore2 : yes #Use canned cycle for Bore2
usecanmisc1 : yes #Use canned cycle for Misc1
usecanmisc2 : yes #Use canned cycle for Misc2

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

cuttype : 0 #Cut type flag
#0 = Tool Plane, 1 = Axis Subs, 2 = Polar, 3 = 4/5 axis
bld : 0 #Block delete active
result : 0 #Return value for functions
sav_spc : 0 #Save spaces
sav_gcode : 0 #Gcode saved
sav_absinc : 0 #Absolute/Incremental Saved Value
sav_coolant : 0 #Coolant saved
sav_frc_wcs : 0 #Force work offset flag saved
toolchng : 1 #On a toolchange flag
spdir2 : 1 #Copy for safe spindle direction calculation

#Drill variables
drlgsel : -1 #Drill Select Initialize
drillref : 0 #Select drill reference
peckacel : 0 #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

#Vector Constants for Rotatary Calculations
aaxisx : 1 #A axis rotation vector constant
aaxisy : 0 #A axis rotation vector constant
aaxisz : 0 #A axis rotation vector constant
baxisx : 0 #B axis rotation vector constant
baxisy : 1 #B axis rotation vector constant
baxisz : 0 #B axis rotation vector constant
caxisx : 0 #C axis rotation vector constant
caxisy : 0 #C axis rotation vector constant
caxisz : 1 #C axis rotation vector constant

#Feedrate calculation variables
frdelta : 0 #Calculation for deg/min
frinv : 0 #Feedrate inverse time
frdeg : 0 #Feedrate deg/min actual
prvfrdeg : 0 #Feedrate deg/min actual
ldelta : 0 #Calculation for deg/min, linear
cldelta : 0 #Calculation for deg/min, linear and rotary
circum : 0 #Calculation for deg/min
ipr_type : 0 #Feedrate for Rotary, 0 = UPM, 1 = DPM, 2 = Inverse

# --------------------------------------------------------------------------
# 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 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
fs2 16 1 0 1 0n #Integer, forced output

# --------------------------------------------------------------------------
#String and string selector definitions for NC output
# --------------------------------------------------------------------------
#Numbered question 164. string to detect Rotary axis y/n
sq164

#Address string definitions
strm "M"
strn "N"
stro "O"
strp "P"
srad "R"
srminus "R-"
sblank

#Cantext string definitions (spaces must be padded here)
sm00 "M00"
sm01 "M01"
strtextno
strcantext

#Transform mirror and rotate codes
strns_mir_on "G51.1" #Programmable mirror image code
strns_mir_off "G50.1" #Programmable mirror image cancel code
strns_rot_on "G68" #Coordinate System
Rotation
strns_rot_off "G69" #Coordinate System Rotation Cancel

# --------------------------------------------------------------------------
# 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 ('mi1') DOES NOT SUPPORT TRANSFORM SUBPROGRAM"
sprgnerror "ERROR-SUBPROGRAM NUMBER MATCHES THE MAIN PROGRAM NUMBER"

# --------------------------------------------------------------------------
# General G and M Code String select tables
# --------------------------------------------------------------------------
# Motion G code selection
sg00 G0 #Rapid
sg01 G1 #Linear feed
sg02 G2 #Circular interpolation CW
sg03 G3 #Circular interpolation CCW
sg04 G4 #Dwell
sgcode #Target for string

fstrsel sg00 gcode sgcode
# --------------------------------------------------------------------------
# Select work plane G code
sg17 G17 #XY plane code
sg19 G19 #YZ plane code
sg18 G18 #XZ plane code
sgplane #Target string

fstrsel sg17 plane sgplane
# --------------------------------------------------------------------------
#Select english/metric code
sg20 G20 #Inch code
sg21 G21 #Metric code
smetric #Target string

fstrsel sg20 met_tool smetric
# --------------------------------------------------------------------------
#Select reference return code
sg28 G28 #First reference point return
sg30 G30 #Second reference point return
sg28ref #Target string

fstrsel sg28 mi3 sg28ref
# --------------------------------------------------------------------------
# Cutter compensation G code selection
scc0 G40 #Cancel cutter compensation
scc1 G41 #Cutter compensation left
scc2 G42 #Cutter compensation right
sccomp #Target for string

fstrsel scc0 cc_pos sccomp
# --------------------------------------------------------------------------
# Canned drill cycle string select
sg81 G81 #drill - no dwell
sg81d G82 #drill - with dwell
sg83 G83 #peck drill - no dwell
sg83d G83 #peck drill - with dwell
sg73 G73 #chip break - no dwell
sg73d G73 #chip break - with dwell
sg84 G84 #tap - right hand
sg84d G74 #tap - left hand
sg85 G85 #bore #1 - no dwell
sg85d G89 #bore #1 - with dwell
sg86 G86 #bore #2 - no dwell
sg86d G86 #bore #2 - with dwell
sgm1 G76
#misc #1 - no dwell
sgm1d G76 #misc #1 - with dwell
sgm2 G81 #misc #2 - no dwell
sgm2d G82 #misc #2 - with dwell
sgdrill #Target for string

fstrsel sg81 drlgsel sgdrill
# --------------------------------------------------------------------------
# Select incremental or absolute G code
sg90 G90 #Absolute code
sg91 G91 #Incremental code
sgabsinc #Target string

fstrsel sg90 absinc sgabsinc
# --------------------------------------------------------------------------
# Feed mode G code selection
sg94 G94 #UPM
sg94d G94 #DPM, See pfcalc_deg if you use another gcode
sg93 G93 #Inverse
sgfeed #Target for string

fstrsel sg94 ipr_type sgfeed
# --------------------------------------------------------------------------
#Canned drill cycle reference height
sg98 G98 #Reference at initht
sg99 G99 #Reference at refht
sgdrlref #Target for string

fstrsel sg98 drillref sgdrlref # Drill cycle G string select
# --------------------------------------------------------------------------
# Generate string for spindle
sm04 M4 #Spindle reverse
sm05 M5 #Spindle off
sm03 M3 #Spindle forward
spindle #Target for string

fstrsel sm04 spdir2 spindle
# --------------------------------------------------------------------------
# Coolant M code selection
sm09 M9 #Coolant Off
sm08 M8 #Coolant Flood
sm08_1 M8 #Coolant Mist
sm08_2 M8 #Coolant Tool
scoolant #Target for string

fstrsel sm09 coolant scoolant
# --------------------------------------------------------------------------
# Table rotation direction
# Table rotation direction, index
sindx_cw M22 #Rotate CW code
sindx_ccw M21 #Rotate CCW code
sindx_mc #Target for string

fstrsel sindx_cw indx_mc sindx_mc
# --------------------------------------------------------------------------
# Define the gear selection code
flktbl 1 3 #Lookup table definition - table no. - no. entries
40 0 #Low gear range
41 400 #Med gear range
42 2250 #Hi gear range

# --------------------------------------------------------------------------
# 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 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 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 Q 2 shftdrl #Fine bore tool shift
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 tldia # Note format

# --------------------------------------------------------------------------
# Tool Comment / Manual Entry Section
# --------------------------------------------------------------------------
ptoolcomment #Comment for tool
tnote = t
toffnote = tloffno
tlngnote = tlngno
"(", pstrtool, *tnote, *toffnote, *tlngnote, *tldia, ")", e

pstrtool #Comment for tool
if strtool <> sblank,
[
strtool = ucase(strtool)
*strtool, " "
]

pcomment #Comment from manual entry (must call pcomment2 if booleans)
pcomment2

pcomment2 #Comment from manual entry
scomm = ucase (scomm)
if gcode = 1007, "(", scomm, ")"
else, "(", scomm, ")", e

# --------------------------------------------------------------------------
# Start of File and Toolchange Setup
# --------------------------------------------------------------------------
psof0 #Start of file for tool zero
psof

psof #Start of file for non-zero tool number
pcuttype
toolchng = one
if ntools = one,
[
#skip single tool outputs,
stagetool must be on
stagetool = m_one
!next_tool
]
"%", e
#*progno, e
"(PROGRAM NAME - ", sprogname, ")", e
"(DATE=DD-MM-YY - ", date, " TIME=HH:MM - ", time, ")", e

*sgcode, *sgplane, "G40", "G49", "G80", *sgabsinc, e
sgabsinc, "G91",*sg28ref, "Z0.", e
*sg28ref, "X0.", "Y0.", e

sav_absinc = absinc
if mi1 <= one, #Work coordinate system
[
absinc = one
"G90", *xh, *yh, e
absinc = sav_absinc
]
pcom_moveb
c_mmlt #Multiple tool subprogram call
ptoolcomment
comment
pcan
if stagetool >= zero, pbld, "/", n, *t, "M6", e

pindex
if mi1 > one, absinc = zero
pcan1, *sgcode, *sgabsinc, pwcs, pfxout, pfyout,
pfcout, *speed, *spindle, pgear, strcantext, e
"G43", *tlngno, pfzout, scoolant, next_tool, e
absinc = sav_absinc
pcom_movea
toolchng = zero
c_msng #Single tool subprogram call

ptlchg0 #Call from NCI null tool change (tool number repeats)
pcuttype
pcom_moveb
c_mmlt #Multiple tool subprogram call
comment
pcan
sgplane, e
pspindchng
scoolant, e
if mi1 > one & workofs <> prv_workofs,
[
sav_absinc = absinc
absinc = zero
sgabsinc, pwcs, pfxout, pfyout, pfzout, pfcout, e
pe_inc_calc
ps_inc_calc
absinc = sav_absinc
]
if cuttype = zero, ppos_cax_lin
if gcode = one, plinout
else, prapidout
pcom_movea
c_msng #Single tool subprogram call

ptlchg #Tool change
pcuttype
toolchng = one
if mi1 = one, #Work coordinate system
[

]
"M01", e
pcom_moveb
c_mmlt #Multiple tool subprogram call
ptoolcomment
comment
pcan
pbld, n, *t, "M6", e

pindex
sav_absinc = absinc
if mi1 > one, absinc = zero
pcan1, *sgcode, *sgabsinc, pwcs, pfxout, pfyout,
pfcout, *speed, *spindle, pgear, strcantext, e
"G43", *tlngno, pfzout, scoolant, next_tool, e
absinc = sav_absinc
pcom_movea
toolchng = zero
c_msng #Single tool subprogram call

pretract #End of tool path, toolchange
sav_absinc = absinc
absinc = one
sav_coolant = coolant
coolant = zero
#cc_pos is reset in the toolchange here
cc_pos = zero
gcode = zero
pcan
sccomp, *sm05, psub_end_mny, e
pcan1, sgabsinc, sgcode, *sg28ref, "Z0.", scoolant, strcantext, e
*sg28ref, "X0.", "Y0.", protretinc, e
pcan2
absinc = sav_absinc
coolant = sav_coolant

protretinc #Reset the
C axis revolution counter
if frc_cinit & rot_on_x,
[
rev = zero
sav_rev = zero
cabs = zero
csav = zero
indx_out = zero
if index, e, pindxcalc, pindex
else, *cabs
prvcabs = zero
!csav, !cabs
]

peof0 #End of file for tool zero
peof

peof #End of file for non-zero tool
pretract
comment
#Remove pound character to output first tool with staged tools
#if stagetool = one, *first_tool, e
"M30", e
mergesub
clearsub
mergeaux
clearaux
"%", e

pwcs #G54+ coordinate setting at toolchange
if mi1 > one,
[
sav_frc_wcs = force_wcs
if sub_level, force_wcs = zero
if workofs <> prv_workofs | (force_wcs & toolchng),
[
if workofs < 6,
[
g_wcs = workofs + 54
*g_wcs
]
else,
[
p_wcs = workofs - five
"G54.1", *p_wcs
]
]
force_wcs = sav_frc_wcs
!workofs
]

pgear #Find spindle gear from lookup table
if use_gear = one,
[
gear = frange (one, speed)
*gear
]

#Toolchange setup
pspindchng #Spindle speed change
if prv_spdir2 <> spdir2 & prv_speed <> zero, *sm05, e
if prv_speed <> speed | prv_spdir2 <> spdir2,
[
if speed, *speed, *spindle, pgear, e
]
!speed, !spdir2

pspindle #Spindle speed calculations for RPM
speed = abs(ss)
if maxss = zero | maxss > max_speed, maxss = max_speed
#zero indicates spindle off (not a mistake)
if speed,
[
if speed > max_speed, speed = maxss
if speed < min_speed, speed = min_speed
]
spdir2 = fsg3(spdir)

pq #Setup post based on switch settings
if stagetool = one, bldnxtool = one
#Rotaxtyp = 1 sets initial matrix to top
#Rotaxtyp = -2 sets initial matrix to front
if vmc, rotaxtyp = one
else, rotaxtyp = -2
#Shut off rotary axis if, Q164. Enable Rotary Axis button? n
if ucase(sq164) = strn, rot_on_x = zero
if arctype = one | arctype = four,
[
result = newfs(two, i)
result = newfs(two, j)
result = newfs(two, k)
]
else,
[
result = newfs(three, i)
result = newfs(three, j)
result = newfs(three, k)
]

pheader #Call before start of file
if met_tool = one, #Metric constants and variable adjustments
[
ltol = ltol_m
vtol = vtol_m
maxfeedpm = maxfeedpm_m
]

ptoolend #End of tool path, before reading new tool data

!speed, !spdir2

ptlchg1002 #Call at actual toolchange, end last path here
sav_rev = rev #Axis Sub does not update to rev
pspindle
whatline = four #Required for vector toolpaths
if gcode = 1000,
[
#Null toolchange
]
else,
[
#Toolchange and Start of file
if gcode = 1002,
[
#Actual toolchange
pretract
]
if stagetool = one, prv_next_tool = m_one
prv_xia = vequ(xh)
prv_feed = c9k
]

# --------------------------------------------------------------------------
# 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, sgplane, `sgcode, sgabsinc, pccdia,
pxout, pyout, pzout, pcout, strcantext, scoolant, e

plinout #Output to NC of linear movement - feed
pcan1, sgfeed, sgplane, `sgcode, sgabsinc, pccdia,
pxout, pyout, pzout, pcout, feed, strcantext, scoolant, e

pcirout #Output to NC of circular interpolation
pcan1, `sgfeed, sgplane, sgcode, sgabsinc, pccdia,
pxout, pyout, pzout, pcout, parc, feed, strcantext, scoolant, e

pcom_moveb #Common motion preparation routines, before
pxyzcout
ps_inc_calc

pncoutput #Movement output
pcom_moveb
comment
pcan
if cuttype = zero, ppos_cax_lin #Toolplane rotary positioning
if gcode = zero, prapidout
if gcode = one, plinout
if gcode > one & gcode < four, pcirout
if mr_rt_actv, #Restore absolute/incremental for G51/G68
[
absinc = sav_absinc
mr_rt_actv = zero
]
pcom_movea

pcom_movea #Common motion preparation routines, after
pcan2
pe_inc_calc

pdwl_spd #Call from NCI gcode 4
pspindle
comment
pspindchng
pcan
if fmtrnd(dwell), pcan1, *sgcode, *dwell, strcantext, e
else, pcan1, strcantext, e
pcan2

prapid #Output to NC of linear movement - rapid
pncoutput

pzrapid #Output to NC of linear movement - rapid Z only
pncoutput

plin #Output to NC of linear movement - feed
pncoutput

pz #Output to NC of linear movement - feed Z only
pncoutput

pmx #Output to NC of vector NCI
pncoutput

pcir #Output to NC of circular interpolation

pncoutput

#Pre-process rotary motion control flags
pmx0 #5 axis gcode setup
if drillcur = zero,
[
if fr = -2, gcode = zero
else, gcode = one
]

plin0 #Linear movement, mill motion test
pmotion_su

pcir0 #Circular interpolation, mill arc motion test
pmotion_su

# --------------------------------------------------------------------------
# Motion output components
# --------------------------------------------------------------------------
pbld #Canned text - block delete
if bld, '/'

pfbld #Force - block delete
"/"

pccdia #Cutter Compensation
#Force Dxx#
if prv_cc_pos <> cc_pos & cc_pos, prv_tloffno = c9k
sccomp
if cc_pos, tloffno

pfxout #Force X axis output
if absinc = zero, *xabs, !xinc
else, *xinc, !xabs

pxout #X output
if absinc = zero, xabs, !xinc
else, xinc, !xabs

pfyout #Force Y axis output
if absinc = zero, *yabs, !yinc
else, *yinc, !yabs

pyout #Y output
if absinc = zero, yabs, !yinc
else, yinc, !yabs

pfzout #Force Z axis output
if absinc = zero, *zabs, !zinc
else, *zinc, !zabs

pzout #Z output
if absinc = zero, zabs, !zinc
else, zinc, !zabs

pfcout #Force C axis output
if index = zero & rot_on_x,
[
if absinc = zero, *cabs, !cinc
else, *cinc, !cabs
]

pcout #C axis output
if index = zero & rot_on_x,
[
if absinc = zero, cabs, !cinc
else, cinc, !cabs
]

pindex #Index output
if index & rot_on_x,
[
`sindx_mc, indx_out, e
!cabs, !cinc
]

parc #Select the arc output
if arcoutput = zero | full_arc_flg | arc_pitch,
[
#Arc output for IJK
i, j, k
]
else,
[
#Arc output for R
if abs(sweep)<=180 | arcoutput=one, result = nwadrs(srad, arcrad)
else, result = nwadrs(srminus, arcrad)
*arcrad
]

ppos_cax_lin #Position the rotary axis before move - rapid
if index, pindex
else,
[
if fmtrnd(prv_cabs) <> fmtrnd(cabs) & rot_on_x,
[
sav_gcode = gcode
gcode = zero
sgcode, pcout, e
!cia
ps_cinc_calc
gcode = sav_gcode
]
]

# --------------------------------------------------------------------------
# Drilling
# --------------------------------------------------------------------------
pdrill0 #Pre-process before drill call

sav_dgcode = gcode #Capture gcode for 5 axis drill

pdrlcommonb #Canned Drill Cycle common call, before
if sav_dgcode = 81,
[
result = newfs (two, zinc)
if drillcyc = three, drlgsel = fsg1(-ss) + drillcyc * two
else, drlgsel = fsg2(dwell) + drillcyc * two
if initht <> refht, drillref = zero
else, drillref = one
prv_refht_a = c9k
prv_refht_i = c9k
prv_dwell = zero
]
if cuttype = three, sav_dgcode = gcode
else, z = depth
if cuttype = one, prv_zia = initht + (rotdia/two)
else, prv_zia = initht
feed = fr_pos
pcom_moveb
comment
pcan
#5 axis must map the true Z, correct Z calculation here
if cuttype = three,
[
prv_zia = zabs + (-depth) + initht
zia = fmtrnd(zabs)
zinc = zia - prv_zia
]

prdrlout #R drill position
if cuttype = one, refht_a = refht + (rotdia / two))
else, refht_a = refht
refht_i = refht - initht
if cuttype = three, refht_a = w
if absinc = zero, refht_a, !refht_i
else, refht_i, !refht_a

pdrill #Canned Drill Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, dwell, *feed, strcantext, e
pcom_movea

ppeck #Canned Peck Drill Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, *peck1, *feed, strcantext, e
pcom_movea

pchpbrk #Canned Chip Break Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, *peck1, *feed, strcantext, e
pcom_movea

ptap #Canned Tap Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, *feed, strcantext, e
pcom_movea

pbore1 #Canned Bore #1 Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, dwell, *feed, strcantext, e
pcom_movea

pbore2 #Canned Bore #2 Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, *feed, strcantext, e
pcom_movea

pmisc1 #Canned Misc #1 Cycle
pdrlcommonb
pcan1, *sgdrlref, *sgdrill, pxout, pyout, pfzout, pcout,
prdrlout, shftdrl, dwell, *feed, strcantext, e
pcom_movea

pmisc2 #Canned Misc #2 Cycle (User Option)
pdrill

pdrill_2 #Canned Drill Cycle, additional points
pdrlcommonb
pcan1, pxout, pyout, pzout, pcout, prdrlout, dwell,
feed, strcantext, e
pcom_movea

ppeck_2 #Canned Peck Drill Cycle
pdrill_2

pchpbrk_2 #Canned Chip Break Cycle
pdrill_2

ptap_2 #Canned Tap Cycle
pdrill_2

pbore1_2 #Canned Bore #
1 Cycle
pdrill_2

pbore2_2 #Canned Bore #2 Cycle
pdrill_2

pmisc1_2 #Canned Misc #1 Cycle
pdrill_2

pmisc2_2 #Canned Misc #2 Cycle
pdrill_2

pdrlcst #Custom drill cycles 8 - 19 (user option)
#Use this postblock to customize drilling cycles 8 - 19
pdrlcommonb
"CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, pfcout, e
pcom_movea

pdrlcst_2 #Custom drill cycles 8 - 19, additional points (user option)
#Use this postblock to customize drilling cycles 8 - 19
pdrlcommonb
"CUSTOMIZABLE DRILL CYCLE ", pfxout, pfyout, pfzout, pfcout, e
pcom_movea

pcanceldc #Cancel canned drill cycle
result = newfs (three, zinc)
z = initht
if cuttype = one, prv_zia = initht + (rotdia/two)
else, prv_zia = initht
pxyzcout
!zabs, !zinc
prv_gcode = zero
pcan
pcan1, "G80", strcantext, e
pcan2

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

psub_call_mm #Call to main level, multiple tools
psub_call_trans

psub_call_trans #Translate level calls from toolchange, user
if mi1 <= one, result = mprint(shomeserror)
sav_absinc = absinc
pindex
#Mirror or Rotate Coord's
if sub_trnstyp = zero | (sub_trnstyp = one & mr_rt_actv),
[
#The original pattern is not mirrored or rotated
if sub_sec_no,
[
absinc = zero
if sub_trnstyp, psub_rotate
else, psub_mirror
]
mr_rt_actv = three
]
else, #Translate
[
if sub_mny_t,
[
if mi1 > one, absinc = zero
*sgcode, *sgabsinc, pwcs, pfxout, pfyout, pfzout,
pfcout, e
pe_inc_calc
ps_inc_calc
]
]
absinc = sav_absinc
result = nwadrs(strp, main_prg_no)
if progno = main_prg_no, result = mprint(sprgnerror)
"M98", *main_prg_no, e
prv_feed = c9k #Force feed in sub

psub_mirror #Mirror start code, user
#Mirror Y axis
if sub_trnmthd, *sgabsinc, strns_mir_on, *sub_trnsx, e
#Mirror X axis
else, *sgabsinc, strns_mir_on, *sub_trnsy, e

psub_rotate #Rotate start code, user
*sgcode, *sgabsinc, strns_rot_on, *sub_trnsx, *sub_trnsy,
[absinc = one], *sgabsinc, *rt_cinc, e

psub_st_m #Header in main level
result = nwadrs(stro, main_prg_no)
" ", e
*main_prg_no, e
#G51/G68 requires absolute pos
ition on first move
if mr_rt_actv & absinc = one,
[
sav_absinc = absinc
absinc = zero
prv_absinc = m_one
prv_xabs = m_one
prv_yabs = m_one
]
else, sgabsinc, e

psub_end_m #End in main level
"M99", e
prv_absinc = -1
#Reset update variables for subs at main level
#Mirror or Rotate cancel, output is forced
if (sub_trnstyp = zero & esub_sec_no > zero)
| (sub_trnstyp = one & esub_sec_no = esub_totl_no-one
& sub_trnmthd = two),
[
subout = zero
no_nc_out = m_one
sav_absinc = absinc
#Mirror cancel
if sub_trnstyp = zero,
[
absinc = zero
*sgabsinc, strns_mir_off, *sub_trnsx, *sub_trnsy, e
]
else, #Rotate cancel
[
strns_rot_off, e
]
absinc = sav_absinc
no_nc_out = zero
]
end_sub_mny = sub_mny_t

psub_end_mny #End in main level for many tools sub, user
#Check for coming out of xform with stage tool.
if end_sub_mny & stagetool = one,
[
*t
end_sub_mny = zero
]

psub_call_s #Call to sub level
result = nwadrs(strp, sub_prg_no)
sub_prg_no = sub_prg_no + 1000 #Add sub number offset
if progno = sub_prg_no, result = mprint(sprgnerror)
"M98", *sub_prg_no, e

psub_st_s #Header in sub leveln
result = nwadrs(stro, sub_prg_no)
" ", e
*sub_prg_no, e
sgabsinc, e

psub_end_s #End in sub level
"M99", e
prv_absinc = -1

# --------------------------------------------------------------------------
# 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
strcantext, e
strcantext = sblank
]

pcan1 #Canned text - with move
strcantext = sblank
if cant_no > zero,
[
if cant_pos1 = one, pcant_1
if cant_pos2 = one, pcant_2
if cant_pos3 = one, pcant_3
if cant_pos4 = one, pcant_4
if cant_pos5 = one, pcant_5
if cant_pos6 = one, pcant_6
if cant_pos7 = one, pcant_7
if cant_pos8 = one, pcant_8
if cant_pos9 = one, pcant_9
if cant_pos10 = one, pcant_10
]
if cstop, strcantext = strcantext + sm00
if cgstop, strcantext = strcantext +
sm01
#Output of strcantext occurs at the end of the output line

pcan2 #Canned text - after output call
strcantext = sblank
if cant_no > zero,
[
if cant_pos1 = two, pcant_1
if cant_pos2 = two, pcant_2
if cant_pos3 = two, pcant_3
if cant_pos4 = two, pcant_4
if cant_pos5 = two, pcant_5
if cant_pos6 = two, pcant_6
if cant_pos7 = two, pcant_7
if cant_pos8 = two, pcant_8
if cant_pos9 = two, pcant_9
if cant_pos10 = two, pcant_10
strcantext, e
strcantext = sblank
]

pcant_1 #Canned text - output call
cantext = cant_val1
pcant_out

pcant_2 #Canned text - output call
cantext = cant_val2
pcant_out

pcant_3 #Canned text - output call
cantext = cant_val3
pcant_out

pcant_4 #Canned text - output call
cantext = cant_val4
pcant_out

pcant_5 #Canned text - output call
cantext = cant_val5
pcant_out

pcant_6 #Canned text - output call
cantext = cant_val6
pcant_out

pcant_7 #Canned text - output call
cantext = cant_val7
pcant_out

pcant_8 #Canned text - output call
cantext = cant_val8
pcant_out

pcant_9 #Canned text - output call
cantext = cant_val9
pcant_out

pcant_10 #Canned text - output call
cantext = cant_val10
pcant_out

pcant_out #Canned text - build the string for output
#Assign string select type outputs
if cantext = three, bld = one
if cantext = four, bld = zero
#Build the cantext string
if cantext = one, strcantext = strcantext + sm00
if cantext = two, strcantext = strcantext + sm01
if cantext > four,
[
strtextno = no2str(cantext)
strcantext = strcantext + strm + strtextno
]

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

pmotion_su #Motion Setup (Set brklinestype & linarc)
brklinestype = zero
linarc = zero
if rot_on_x,
[
if cuttype = one, linarc = one #Axis subs
if cuttype = two, #Polar
[
brklinestype = rotary_axis + three
linarc = one
]
]

pcuttype #Determine the cut type
#cuttype (0 = Tool Plane, 1 = Axis Subs, 2 = Polar, 3 = 4/5 axis)
cuttype = rotary_type
if cuttype = three, cuttype = zero
if mill5,
[
if rot_on_x = zero, result = mprint
type <> prv_ipr_type,
[
#Control output of frdeg
prvfrdeg = frdeg
feed = frdeg
]
if frdeg > maxfrdeg, feed = maxfrdeg
]

#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

ps_cinc_calc #Incremental calculations, start rotary
cia = fmtrnd(cabs)
cinc = cia - prv_cia

pe_inc_calc #Incremental calculations, end
prvcabs = fmtrnd(cabs) #Avoid updating until called explicitly
!xia, !yia, !zia, !cia
!x, !y, !z

# --------------------------------------------------------------------------
# Numbered questions for Mastercam Mill
# --------------------------------------------------------------------------
38. Rapid feedrate? 300.0
#76. 命名关联的规划档? MILL9M
#400. 命名关联的规划档? MILL9M
76. 命名关联的规划档? MILL9M
400. 命名关联的规划档? MILL9M
1538. Rapid feedrate (metric)? 10000.0

80. Communications port number for receive and transmit (1 or 2) ? 2
81. Data rate (110,150,300,600,1200,2400,4800,9600,14400,19200,38400)? 1200
82. Parity (E/O/N)? E
83. Data bits (7 or 8)? 7
84. Stop bits (1 or 2)? 2
85. Strip line feeds? N
86. Delay after end of line (seconds)? 0
87. Ascii, Eia, or Binary (A/E/B)? A
88. Echo keyboard to screen in terminal emulation? n
89. Strip carriage returns? N

90. Drive and subdirectory for NC files?
91. Name of executable post processor? MP
92. Name of reverse post processor? RP
93. Reverse post PST file name? RPFAN

100. Number of places BEFORE the decimal point for sequence numbers? 3
101. Number of places AFTER the decimal point for sequence numbers? 0
103. Maximum spindle speed? 5000
107. Average time for tool change (seconds)? 2.0

159. Show first and last position as fully compensated in simulation? n

161. Enable Home Position button? y
162. Enable Reference Point button? y
163. Enable Misc. Values button? y
164. Enable Rotary Axis button? N
165. Enable Tool Plane button? y
166. Enable Construction Plane button? y
167. Enable Tool Display button? y
168. Check tplane during automatic work origin creation? y

# --------------------------------------------------------------------------
# Default Miscellaneous Real Values
# --------------------------------------------------------------------------
201. Default miscellaneous real variable 1 (mr1)? 0.0
202. Default miscellaneous real variable 2 (mr2)? 0.0
203. Default miscellaneous real variable 3 (mr3)? 0.0
204. Default miscellaneous real variable 4 (mr4)? 0.0
205. Default miscellaneous real variable 5 (mr5)? 0.0
206. Default miscellaneous real variable 6 (mr6)? 0.0
207. Default miscellaneous real variable 7 (mr7)? 0.0
208. Default miscellaneous real varia
aneous integer variable 8? y
1629. Enable miscellaneous integer variable 9? y
1630. Enable miscellaneous integer variable 10? y


# --------------------------------------------------------------------------
# Configuration File association parameters (default is "y")
# --------------------------------------------------------------------------
#400. Name of associated cfg file?
401. Read SYSTEM COLORS section? y
402. Read ALLOCATIONS section? y
403. Read TOLERANCES section? y
404. Read DATA PATHS section? y
405. Read COMMUNICATIONS section? y
406. Read DRAFT SETTINGS section? y
407. Read MISCELLANEOUS section? y
408. Read NC SETTINGS section? y
409. Read DIALOG SCRIPTS section? y
410. Read DESIGN SETTINGS section? y
411. Read PLOTTER SETTINGS section? y
412. Read ALT-KEY ASSIGNMENTS section? y
413. Read CAD section? y
414. Read START/EXIT section? y
415. Read SCREEN section? y
416. Read FILE NAMES section? y

1500. Chook to execute from 'Misc. values' button?
1501. Insert parameter information in the ascii NCI? n
1502. Write operation information to binary file (.ops)? n
1503. Write transform operations (0=transform ops, 1=source ops, 2=both)? 1


1520. Display a warning when cutter compensation in control simulation finds an error? n

1521. Number of controller look-ahead blocks for CDC in control? 2

1530. Ignore work offset numbers when processing subprograms? y

# Do NOT manually change the answer for Q.1999 !
1999. Product major version number that post supports? 9

3001. Machine acceleration? 2
3002. timing size? .1


核电荷数-罅隙


爱因斯坦英文-召见拼音


附点八分音符-疫怎么读


反义词的词语-眼浅


厉害的伯父-安闲的近义词


丛的拼音-馐怎么读


概括主要内容的方法-佼怎么读


非常的英文-欢乐的反义词是什么