Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Setup Sheet Won't Output Thread Mill to Tool LIst


Recommended Posts

I'm trying to output a threadmill in my setup sheet.  It skips the tool in the setup sheet when it is a threadmill. From talking to people, it hasn't been in there for many years and they have used a workaround. 

I'm not finding the tool type for Threadmill in my setup sheet post or MP documentation.

Here are the types it does have:

stl_type : ""  # string to hold the tool type description
stl_type_0  : "Undefined         "
stl_type_1  : "Center Drill      "   # tool type 1
stl_type_2  : "Spot Drill        "
stl_type_3  : "Drill             "
stl_type_4  : "Right Hand tap    "
stl_type_5  : "Left Hand Tap     "
stl_type_6  : "Reamer            "
stl_type_7  : "Boring Bar        "
stl_type_8  : "Counter Bore      "
stl_type_9  : "Counter Sink      "
stl_type_10 : "Flat End Mill     "
stl_type_11 : "Ball End Mill     "
stl_type_12 : "Chamfer Mill      "
stl_type_13 : "Face Mill         "
stl_type_14 : "Slot Mill         "
stl_type_15 : "Radius Mill       "
stl_type_16 : "Dovetail Mill     "
stl_type_17 : "Tapered Mill      "
stl_type_18 : "Lollipop Mill     "
stl_type_19 : "Bull Nose End MIll"

 

Below is the entire setup sheet post:

 

 

 

[POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V20.00 P0 E1 W20.00 T1507203040 M20.00 I0 O0
# SETUP SHEET         : HAAS.SET
# Product             : MILL
# Machine Name        : GENERIC
# Control Name        : GENERIC
# Description         : GENERIC SETUP SHEET FOR MILL VERSION 9
# Mill/Turn           : NO
# 4-axis/Axis subs.   : NO
# 5-axis              : NO
# Executable          : MP v9.10
#
# WARNING: THIS POST IS GENERIC AND IS INTENDED FOR MODIFICATION TO
# THE MACHINE TOOL REQUIREMENTS AND PERSONAL PREFERENCE.
#
# --------------- 
#| REVISION LOG: |
# ----------------------------------------------------------------------
# Programmers Note:
# CNC  05/16/00 - Initial update for V8 (fixed preadbuf2)
# CNC  05/21/01 - Added Max/Min X,Y,Z axis output option.
# CNC  07/17/01 - Added 'fs2' formats for Inch/Metric output
# CNC  07/18/01 - Created MILL2.SET (style #2)
#                 An alternate 'stripped down' output format.
# CNC  12/14/01 - Altered to use Rapid Feedrate setting from numbered questions.
# CNC  02/04/03 - Initial update for V9.1
# MCNW 04/01/03 - setup to omit same-tool output in the tool list
# ROD  01/21/08 - setup to sort tools sequentially and to check for  tools with 
#                 the same tool number but different diameters or descriptions
#
#ROD   01/22/08 - routine added to ask for the programmers name
# ---------------
#| FEATURES:     |
# ------------------------------------------------------------------------
# Users Note -->>
#
#=============================================================================
# Specific setting to allow tuning the cycle time calculations ->

# Set the time it takes for machine to do a toolchange ->
tlchgtime : 0.1    # Tool Change Time (* in Minutes *)

# Set the Rapid Traverse Rate of the machine 
38. Rapid feedrate (Inches per Minute)? 300.0
1538. Rapid feedrate (MM per Minute)? 10000.0
#These values are loaded into the pre-defined post variable -> pst_rpd_fr (v9)

#=============================================================================
# Post specific "switches" to allow turning ON/OFF the following functions ->

# The 'xyz_limits' switch allows selecting to output MAX/MIN X,Y,Z information.
xyz_limits : yes$  # Output Max/Min X,Y,Z information? (yes/no)

# X,Y,Z axis limits output option switches...
# By setting the switch variables (to 'yes' or 'no') ->
# You can select which axis you wish to monitor (See 'xyz_limits' above).
X_limits    : yes$  # Output MAX/MIN values for the X axis (yes/no)?
Y_limits    : yes$  # Output MAX/MIN values for the Y axis (yes/no)?
Z_limits    : yes$  # Output MAX/MIN values for the Z axis (yes/no)?

# The 'fr_limits' switch allows selecting to output the FEEDRATE MAX/MIN 
# information.
fr_limits : no$     # Output Max/Min Feedrate information (yes/no)?

# The 'det_time' switch allows selecting the outut of 'Detailed Times"
# In addition to the usual 'Cycle Time' you can get the time spent at
# RAPID and at FEEDRATE during the program.
# *IMPORTANT*
# Note that the Program TOTAL TIME includes the Toolchange time(s),
# so it will be longer than the Total RAPID time + Total FEED time!
det_time : no$     # Output Rapid/Feedrate times (yes/no)

# The 'show_lengths' switch allows selecting to output the FEED/RAPID
# Path Length information. 
show_lengths : no$  # Output Feed/Rapid path length info.?

# The 'stock_info' switch allows selecting to output detailed Stock Information
stock_info : yes$  # Display Part location, stock size/location 

# END_HEADER$
#
# --------------------------------------------------------------------------
# DEBUG - Switches for debugging purposes
# --------------------------------------------------------------------------
fastmode$    : 1     # Posting speed optimizition
bug1$        : 2     # 0=No display, 1=Generic list box, 2=Editor
bug2$        : 0     # Append postline labels, non-zero is column position? 
#CNC<<FAIL>>bug3$        : 0     # Append whatline number to each NC line?
#CNC<<MSG-ERROR(87)>> The variable, postblock, or other keyword is no longer supported
bug4$        : 0     # Append NCI line number to each NC line?

newglobal$   : 1     #Error checking for global variables
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?
linklvar$  : 1  #Associate X lathe specific variables to V9- variable?
cant_tlchng$ : 1  #Ignore cantext entry on move with tlchng_aft?
strtool_v7$  : 2     # Use Version 7 toolname?
tooltable$   : 3     # Yes, do NCI pre-scan (do NOT change!)

# --------------------------------------------------------------------------
# Define constants
# --------------------------------------------------------------------------
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         : 99999  #Define constant
m_c9k       :  -99999#Define constant

# --------------------------------------------------------------------------
# Format statements - i=incr, n=nonmodal, l=leave ldg, t=leave trlg, d=delta
# --------------------------------------------------------------------------
fs2  1   0.4   0.3    #Decimal, 4/3 place, default for initialize (:)
fs2  2   0.4   0.3n   #Decimal, 4/3 place, non-modal
fs2  3   1 0   1 0n   #Integer, not leading, non-modal
fs2  4   0.2   0.2n   #Decimal, 2 place, non-modal
fs2  5   1.4   1.3ltn #Decimal, 4/3 place, leading&trailing, non-modal
fs2  6  +1.4  1.3 ltn #Decimal, 4/3 place, leading&trailing with SIGN
fs2  7   0.4   0.3ltn #Decimal, 4/3 place, trailing, non-modal
fs2  8   0^2   0^2n   #Decimal, 2 place, non-modal
fs2  9   1.3   1.2ltn #Decimal, 3/2 place, leading&trailing, non-modal
# --------------------------------------------------------------------------
# Format assignments
# --------------------------------------------------------------------------
fmt    3 progno$      # Program number
fmt    3 t$           # Tool number
fmt    5 tldia$       # Tool diameter
fmt    5 tcr$         # Tool corner radius
fmt    3 tloffno$     # Diameter offset number
fmt    3 tlngno$      # Length offset number
fmt    9 t_flute_len # flute length
fmt    9 t_overall_len #over all tool length
fmt    9 tapr_ang     # taper angle
fmt    9 inc_ang      # included angle
fmt    5 nose_dia     #nose dia
fmt    5 body_dia     #body dia 
fmt    3 ss$          # Spindle speed
fmt    4 fr$          # Feedrate
fmt    2 llen        # Feed cut length
fmt    2 rlen        # Rapid traverse cut length
fmt    2 llen_total  # Feed cut length (program total)
fmt    2 rlen_total  # Rapid traverse cut length (program total)
fmt    3 thrs        # Time in hours
fmt    3 tmin        # Time in minutes
fmt    3 tsec        # Time in seconds
fmt    3 tcnt        # Tool Counter
fmt    3 custcycle   # Custom Cycle number
fmt    4 tmax_fr     # Max Feedrate in current Tool
fmt    4 tmin_fr     # Min Feedrate in current Tool
fmt    4 pmax_fr     # Max Feedrate in Program
fmt    4 pmin_fr     # Min Feedrate in Program
fmt "X" 7 stck_ht$    # X - Stock Height
fmt "Y" 7 stck_wdth$  # Y - Stock Width
fmt "Z" 7 stck_thck$  # Z - Stock Thickness
fmt "X" 2 stck_x$     # X origin of block
fmt "Y" 2 stck_y$     # Y origin of block
fmt "Z" 2 stck_z$     # Z origin of block
fmt    2 stck_crnr$   # Origin corner of stock
#===============================================================================
# See 'Parameters Information.PDF' from the Post Processor Reference Guide CD
# for more details on these '20000 type' OPS parameters.
#
# Numeric variables to hold '20004' tool parameters
# Do NOT change the order of these (16) variable definitions !
fmt    2  tl_number
fmt    3  tl_type
fmt    3  tl_material
fmt    3  tl_corner_typ   # 0=flat, 1=bullnose, 3=ball
fmt    2  tl_dia
fmt    2  tl_corner_rad
fmt    2  tl_tpi
fmt    2  tl_tip_angle
fmt    3  tl_dia_ofs
fmt    3  tl_len_ofs
fmt    2  tl_feed
fmt    2  tl_plunge_feed
fmt    2  tl_retract_rate
fmt    2  tl_spindle_rpm
fmt    3  tl_coolant
fmt    3  tl_num_flutes

# Numeric variables to hold '20005' DRILL type tool parameters
# Do NOT change the order of these (9) variable definitions !
fmt    3  drl_cycle$
fmt    2  drl_peck1
fmt    2  drl_peck2
fmt    2  drl_peck_clr
fmt    2  drl_chip_brk
fmt    2  drl_dwell
fmt    2  drl_angle
fmt    2  drl_tap_drl_dia
fmt    2  drl_shift

# Numeric variables to hold '20006' MILL type tool parameters
# Do NOT change the order of these (8) variable definitions !
fmt    3  tl_cut_cap
fmt    2  tl_rgh_XY_step
fmt    2  tl_rgh_Z_step
fmt    2  tl_fin_XY_step
fmt    2  tl_fin_Z_step
fmt    2  tl_tip_dia
fmt    2  tl_minor_dia
fmt    2  tl_thrd_mill_angle

# Numeric variables to hold '20007' MILL type tool holder parameters
# Do NOT change the order of these (11) variable definitions !
fmt    2  tl_min_dia_plg
fmt    2  tl_flute_len
fmt    2  tl_overall_len
fmt    2  tl_shld_len
fmt    2  tl_arbor_dia
fmt    2  tl_holder_dia
fmt    2  tl_holder_len
fmt    3  tl_dummy_pos8
fmt    3  tl_dummy_pos9
fmt    3  tl_dummy_pos10
fmt    3  tl_units        # 0=inches, 1=metric

#===========================================================================

# --------------------------------------------------------------------------
# Variable declarations
# --------------------------------------------------------------------------
tl_cnt_brk : 0        #tool counter for page break 
tl_cnt_brk_lmt : 13    # tool limit check for page break 
vtol$      : 0.0001   # System tolerance
vtol_m    : 0.0025   # System tolerance, metric

total     : 0        # Total part time
ttltime   : 0        # Total operation time
linarc$    : yes$      # Linearize arcs?  (leave as yes!)
drlgsel   : 0        # Select drill cycle string
arctype$   : 1        # Arc center 1=abs, 2=St-Ctr, 3=Ctr-St, 4=unsigned inc.
getnextop$ : 1        # Get the next variables, nextop, nextccomp, nextdc
progname$  : 1        # Capitalize progname
tol       : 0.0001   # Tolerence for feed rates set to zero
tltime    : 0        # Feed time 
trtime    : 0        # Rapid time
tot_ltime : 0        # Total FEED time
tot_rtime : 0        # Total RAPID time
len       : 0        # Length for calculation
dx        : 0        # Delta x
dy        : 0        # Delta y
dz        : 0        # Delta z

spaceit : ""           # 0 or 1 spaces depending on Inch/Metric output format
space_t : ""              #number of spaces depending on tool size
space0  : ""           # 0 space
space1  : " "          # 1 space
space2  : "  "         # 2 spaces
space3  : "   "        # 3 spaces
space4  : "    "       # 4 spaces
stab : "  "       # tab & 2 spaces
tlcounter : 1        #tool counter
toolflg   : 0        #flag for same tool
d_tl_des_flg : 0     #flag for duplicate tool description 
d_tl_dia_flg : 0     #flag for duplicate tool diameter 
real_result : 0      #used to display duplicate tool mesage
small_tool  : 0      # smallest tool number
bf_4_counter : 0     #counter for number of tools left to sort
result    : 0        # Test Variable
# --------------------------------------------------------------------------
# Buffer definition (for Max/Min X,Y,Z storage)
# --------------------------------------------------------------------------
rc1     : 2  #Buffer1 READ pointer (YES, '2' is correct for this case!)
wc1     : 1  #Buffer1 WRITE pointer
size1   : 0  #To hold 'size' of Buffer 1

b1_gcode : 0 #Stored in Buffer #1
b1_tcode : 0 #        "
b1_xmax  : 0 #        "
b1_xmin  : 0 #        "
b1_ymax  : 0 #        "
b1_ymin  : 0 #        "
b1_zmax  : 0 #        "
b1_zmin  : 0 #        "

fbuf 1 0 8 0 0#Declare Buffer1 to hold Min/Max X,Y,Z axis info.

#Format the variables used to output the X,Y,Z Max/Min values
fmt 6  max_Xpos
fmt 6  min_Xpos
fmt 6  max_Ypos
fmt 6  min_Ypos
fmt 6  max_Zpos
fmt 6  min_Zpos

#----------------------------------------------------------------------------------
#Buffer definition (used to check for the same tool)
#----------------------------------------------------------------------------------
rc2 : 1    #buffer 2 read pointer
rc3 : 1    #buffer 3 read pointer
wc2 : 1    #buffer 2 write pointer
wc3 : 1    #buffer 3 write pointer
size2 : 0  #to hold size of buffer 2
size3 : 0  #to hold size of buffer 3

b2_tcode : 0  #stored in buffer #2 (tdt)
b2_tldia : 0  # stored in buffer #2 tool dia    
strtool_3 : ""  # tool description (strtool) stored in buffer 3

fbuf 2 0 1 0 0# declare buffer 2 to hold tool #
fbuf 3 0 80 0 1# declare buffer 3 to hold tool description

#--------------------------------------------------------------------------------
#Buffer definition  (used to store tool data for tool sorting)
#--------------------------------------------------------------------------------
rc4 : 1    #buffer 4 read pointer
rc5 : 1    #buffer 5 read pointer
wc4 : 1    #buffer 4 write pointer
wc5 : 1    #buffer 5 write pointer
size4 : 0  #to hold size of buffer 4
size5 : 0  #to hold size of buffer 5

b4_gcode          : 0 # gcode
b4_t              : 0 # stored in buffer # 4 (t)
b4_tldia          : 0 # stored in buffer #4 (tldia)
b4_tlngno         : 0 # stored in buffer #4  (tlngno) (tool length offset #)
b4_tloffno        : 0 # stored in buffer #4 (tloffno)  (tool rad offset #)
b4_tl_type        : 0 # tool type number    
b4_tl_tip_angle   : 0 # tool tip angle  
b4_tl_num_flutes  : 0 # number of flutes
b4_tl_tpi         : 0 # thread per inch or lead
b4_tl_corner_rad  : 0 # corner radius
b4_tl_tip_dia     : 0 # tip diameter
b4_tl_flute_len   : 0 # flute length
b4_tl_shld_len    : 0 # shoulder length
b4_tl_overall_len : 0 # overall length
b4_tl_arbor_dia   : 0 # arbor dia
b4_tl_holder_dia  : 0 # holder dia
b4_tl_holder_len  : 0 # holder length
b4_tl_units       : 0 # units 0 = inches 1 = metric

strtool_5 : ""  # tool description (strtool) stored in buffer 5

fbuf 4 0 18 0 0# declare buffer 4 to hold tool information
fbuf 5 0 80 0 1# declare buffer 5 to hold tool description

#----------------------------------------------------------------------------------
#Buffer definition (used to check for a duplicate tool) 
#----------------------------------------------------------------------------------
rc6 : 1    #buffer 6 read pointer
rc7 : 1    #buffer 7 read pointer
wc6 : 1    #buffer 6 write pointer
wc7 : 1    #buffer 7 write pointer
size6 : 0  #to hold size of buffer 6
size7 : 0  #to hold size of buffer 7

b6_t : 0     #stored in buffer #6 (t)
b6_tldia : 0 # stored in buffer #6 tool dia (tldia) 
strtool_7 : ""    # tool description (strtool) stored in buffer 7

fbuf 6 0 2 0 0# declare buffer 6 to hold toolnumber  & tool dia 
fbuf 7 0 80 0 1# declare buffer 7 to hold tool description

# --------------------------------------------------------------------------
#  USE CANNED CYCLES?
# --------------------------------------------------------------------------
usecandrill$ : no$  # Use canned cycle for drill
usecanpeck$  : no$  # Use canned cycle for Peck
usecanchip$  : no$  # Use canned cycle for Chip Break
usecantap$   : no$  # Use canned cycle for Tap
usecanbore1$ : no$  # Use canned cycle for Bore1
usecanbore2$ : no$  # Use canned cycle for Bore2
usecanmisc1$ : no$  # Use canned cycle for Misc1
usecanmisc2$ : no$  # Use canned cycle for Misc2

# --------------------------------------------------------------------------
# String functions - String labels must start with 's' 
# --------------------------------------------------------------------------
sextnc$     : "doc"     # -.NC extension override string (ouptut as .DOC file)

#Select operation note
sop00   : "NULL"
sop01   : "CONTOUR"
sop02   : "CONTOUR"
sop03   : "DRILL CYCLE - "
sop04   : "POCKET"
sop05   : "RULED"
sop06   : "2D-SWEPT"
sop07   : "3D-SWEPT"
sop08   : "REVOLVED"
sop09   : "LOFT"
sop10   : "COONS"
sop11   : "TRIM "
sop12   : "FLOWLINE"
sop13   : "SURF-FINISH"
sop14   : "SURF-ROUGH"
sop15   : "POINT"
sop16   : "DRILL-5AX"
sop17   : "CURVE-5AX"
sop18   : "SWARF-5AX"
sop19   : "FACING"
sop20   : "OP20?"
sopnote : ""
stl_type : ""  # string to hold the tool type description
stl_type_0  : "Undefined         "
stl_type_1  : "Center Drill      "   # tool type 1
stl_type_2  : "Spot Drill        "
stl_type_3  : "Drill             "
stl_type_4  : "Right Hand tap    "
stl_type_5  : "Left Hand Tap     "
stl_type_6  : "Reamer            "
stl_type_7  : "Boring Bar        "
stl_type_8  : "Counter Bore      "
stl_type_9  : "Counter Sink      "
stl_type_10 : "Flat End Mill     "
stl_type_11 : "Ball End Mill     "
stl_type_12 : "Chamfer Mill      "
stl_type_13 : "Face Mill         "
stl_type_14 : "Slot Mill         "
stl_type_15 : "Radius Mill       "
stl_type_16 : "Dovetail Mill     "
stl_type_17 : "Tapered Mill      "
stl_type_18 : "Lollipop Mill     "
stl_type_19 : "Bull Nose End MIll"


fstrsel  sop00 opcode$ sopnote 21 -1

#Select drill operation note
sdr00   : "SIMPLE"
sdrd0   : "COUNTERBORE"
sdr01   : "PECK"
sdrd1   : "PECK"
sdr02   : "CHIP BREAK"
sdrd2   : "CHIP BREAK"
sdr03   : "TAP"
sdrd3   : "TAP"
sdr04   : "SIMPLE BORE"
sdrd4   : "BORE W/DWELL"
sdr05   : "BORE W/STOP"
sdrd5   : "BORE W/STOP"
sdr06   : "MISC_1"
sdrd6   : "MISC_1"
sdr07   : "MISC_2"
sdrd7   : "MISC_2"
sdrillcyc : ""

drlgsel = nextdc$ * 2 + fsg2 ( dwell$ )

fstrsel sdr00 drlgsel sdrillcyc 16 -1

#Select stock orientation note
stk0  : "At Center, Z at Top"
stk1  : "Upper Left corner, Z at Top"
stk2  : "Upper Right corner, Z at Top"
stk3  : "Lower Right corner, Z at Top"
stk4  : "Lower Left corner, Z at Top"
stk5  : "Upper Left corner, Z at Bottom"
stk6  : "Upper Right corner, Z at Bottom"
stk7  : "Lower Right corner, Z at Bottom"
stk8  : "Lower Left corner, Z at Bottom"
stknote : ""

sduptool : "YOU HAVE DUPLICATED A TOOL PLEASE FIX THE PROBLEM AND REPOST"
sametool : "THIS TOOL NUMBER HAS AREADY BEEN USED PLEASE RENUMBER AND RE POST"
fstrsel stk0 stck_crnr$ stknote 9 -1

#--------------------------------------------------------------------------
#setup for prompt questions
#--------------------------------------------------------------------------
sprogrammer : ""  #string to hold the programmers name
fq 1 sprogrammer "ENTER YOUR NAME"# programmer name and question definition
scustomer : ""    #string to hold customer name
fq 2 scustomer "ENTER THE CUSTOMER"   # customer name definition
# --------------------------------------------------------------------------
# Parameter read postblocks:
# --------------------------------------------------------------------------
pprep$           #Pre-process postblock
    spathnc$ = "N:\MC_X_Docs\HAAS\"  #path for setup file
#Allows post instructions after the post is parsed but before the NC and NCI file are opened.
#DO NOT ATTEMPT TO OUTPUT TO THE NC FILE IN THIS POSTBLOCK (OR ANY POSTBLOCKS YOU MAY CALL FROM HERE)
#BECAUSE THE NC OUTPUT FILE IS NOT YET OPENED!
#      rd_mch_ent_no$ = 0  #Read only the machine base parameters (use to collect common parameters from CNC_MACHINE_TYPE)
#      rd_md$       #Read machine definition parameters


# --------------------------------------------------------------------------
# Post block assignments 
# --------------------------------------------------------------------------


psepline      # Output the 'separator' line
          "----------------------------------------", e$
plsepline    # Output long separator line
       "----------------------------------------------------------------------------------------------------------------------", e$
pdblsepline # double separator line
       "======================================================================================================================", e$

#pcomment       # COMMENTS (from tool parameter page comment box)#Rod comment out 4-3-03
          #pcomment1 #Rod comment out 4-3-03

#pcomment1      # Only output COMMENT if from a 'real' toolchange#Rod comment out 4-3-03
          if gcode$ = 1008 & (prv_gcode$ = 1001 | prv_gcode$ = 1002),
            [
             scomm$ = ucase(scomm$)
             "                                    ", scomm$, e$
            ]

pdrillcyc     # Output drillcycle type note if canned cycle was programmed
          if opcode$ = 3,
            [
            if drlgsel > 15, # Custom canned cycle was programmed
              [
              custcycle = drlgsel - 7 # Shift it
              "CUSTOM CYCLE ", 35, *custcycle
              ]
            else,
              *sdrillcyc
            ]

ptspace    # Creates spaces based on tool number
           if t$ < 10, space_t = space0
           if t$ >= 10, space_t = space1
           if t$ >= 100, space_t = space2
           if t$ >= 1000, space_t = space3
           if t$ >= 10000, space_t = space4
        space_t

phspace    # Creates spaces based on length offset number
           if tlngno$ < 10, space1

pdspace    # Creates spaces based on diameter offset number
           if tloffno$ < 10, space1

pdiamspc   # Creates spaces based on diameter offset number
           if tldia$ < 10, space1

ptooldata     # Total ending data for tool (Path Length and Times)
          llen_total = llen_total + llen  # Keep running total for Program
          rlen_total = rlen_total + rlen  # Keep running total for Program
          pttltime      # Total tool times

pthrminsec    # Convert minutes to hr/min/sec format
          thrs = int ( ttltime / 60 )
          tmin = int ( ttltime - thrs * 60 )
          tsec = ( ttltime - thrs * 60 - tmin ) * 60

pttltime      # Total tool times and total program time
          tot_ltime = tot_ltime + tltime      # Total FEED time
          tot_rtime = tot_rtime + trtime      # Total RAPID time
          ttltime = tltime + trtime           # Calc. current Tool Time
          total = ttltime + total + tlchgtime # Calc. total Program Time

pprtime       # Time at RAPID RATE (for entire program)
          ttltime = tot_rtime
          ptimeout  # Output time

ppftime       # Time at FEEDRATE  (for entire program)
          ttltime = tot_ltime
          ptimeout  # Output time

ptimeout      # Output "times"
          pthrminsec    # Convert minutes to hr/min/sec format
              # Output 'HOURS'
          if thrs = one, *thrs, " Hour, "
          if thrs > one, *thrs, " Hours, "
             # Output 'MINUTES'
          if tmin = one, *tmin, " Minute, "
          if tmin > one, *tmin, " Minutes, "
             # Output 'SECONDS'
          if tsec > zero, *tsec, " Seconds"

ptimer        # Rapid time and length calc
          rlen = rlen + len
          trtime = rlen / pst_rpd_fr$

ptimel        # Feed time and length calc
          if fr$ < zero, fr$ = prv_fr$
          if fr$ < tol, fr$ = tol
          llen = llen + len
          tltime = tltime + len / fr$

ptime         # Distance calculations
          dx = x$ - prv_x$
          dy = y$ - prv_y$
          dz = z$ - prv_z$
          len = sqrt( dx^2 + dy^2 + dz^2 )
          if gcode$ = zero, ptimer # Rapid
          if gcode$ = one, ptimel  # Feed
          !x$, !y$, !z$, !fr$         # Update previous [prv_?] variables
          if fr_limits, pfrcheck  # Track MAX/MIN Feedrates if requested

pfrcheck     # Track Feedrates (Max/Min)
          if fr$ > zero,
            [
            if fr$ < tmin_fr, tmin_fr = fr$ # Tool MIN
            if fr$ > tmax_fr, tmax_fr = fr$ # Tool MAX
            if fr$ < pmin_fr, pmin_fr = fr$ # Program MIN
            if fr$ > pmax_fr, pmax_fr = fr$ # Program MAX
            ]

pstock_info  # output stock information if requested
          if stock_info,
            [
            if stck_matl$ = "NONE", # No material type was selected
              "Material Type  = *NONE*", e$
            else,
              "Material Type  = ", stck_matl$, e$
            ]

          #if stock_info & tlplnno$ <= 1, #ONLY if in TOP plane
            #[
            # If any stock values are empty, disable don't output
            if stck_ht$ > 0 & stck_wdth$ > 0 & stck_thck$ > 0,
              [
              "Stock Size     = ", stck_ht$, " ", stck_wdth$, " ", stck_thck$, e$
              #"Stock Origin   = ", stck_x, " ", stck_y, " ", stck_z, e#Rod added #
              #Output the stock orientation note (spaced over...)
              #"                 ",  "(", *stknote, ")", e#Rod added # 
              ]
            #]

# ------------------------------------------------------------------------

pheader$       # File header
          if pst_rpd_fr$ <= 0, pst_rpd_fr$ = 300 # Make it greater than ZERO !
          if met_tool$ = one, #Metric constants and variable adjustments
            [
            vtol$ = vtol_m
            spaceit = space1 # 1 additional space for Metric output format
            ]


psof0$         # Start of file for tool zero                   
          psof$

psof$          # Output of setup sheet header

    spaces$ = 0  # sets the dafault spaces to zero

         #pparameter #rq  #read tool parameters
         #pprint_tl_data  #rq# print tool parameters
         q1   #question 'enter your name' is ask here
         q2   #question 'enter the customer' is ask here    

          tmax_fr = fr$  # Initialize (max fr used in current tool)
          tmin_fr = fr$  # Initialize (min fr used in current tool)
          pmax_fr = fr$  # Initialize (max fr used in program)
          pmin_fr = fr$  # Initialize (min fr used in program)

         "                 HAAS SETUP SHEET", e$
         "        ========================================", e$
          " ", e$ # Blank line

          #Outputs date in this format ->   Jul-19-01
          #"Date           = ", mon, "-", day, "-", year, e

          #Outputs date in this format ->   07-19-01
          "Date           = ", month$, "-", day$, "-", year$, e$

          #"Time           = ", time, e


          "Program Name = ", *sprogname$,e$
          if progno$ > zero, "Program Number = ", *progno$, e$
          pstock_info # Stock information output
      scustomer = ucase (scustomer)  # make all upper case
      "CUSTOMER      ", scustomer, e$ #print the programmers name
      sprogrammer = ucase (sprogrammer)  # make all upper case
      "PROGRAMMED BY ", sprogrammer, e$ #print the programmers name

          " ", e$ # Blank line
      "                    TOOL LIST", e$
          "                    ---------", e$
          " ", e$ # Blank line
    "          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", e$
    "            KEEP ALL TOOLS AS SHORT AS POSSIBLE", e$
    "          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", e$
    " ", e$ # Blank line

          stab, stab, "  Min.", stab, "Min." , e$
          "T", stab, "   T", stab, "   Fl.", stab, " Oa.", stab, "Tapr.", stab, "Inc.", stab, "Nose", e$
          "Num.", stab, "Dia.", stab, "Len.", stab, "Len.", stab, "Ang.", stab, "Ang.", stab, "Dia.", stab, "Tool Description", e$
          pdblsepline #call double separator line                         
          psetup  # Call for toolchange info output       
      pwritbuf45  # write tool info to buffer 4 
ptlchg0$       # Null tool change                                  
          !gcode$

ptlchg$        # Output of time calculations for the last tool run
          #pparameter #rq  #read tool parameters
      #pprint_tl_data #rq  # print tool parameters 

          ptooldata     # Total ending data for tool (Path Length and Times)
          tmax_fr = fr$  # Initialize (max fr used in current tool)
          tmin_fr = fr$  # Initialize (min fr used in current tool)           
          psetup  # Call for toolchange info output 

psetup        # Output of toolchange information
          !gcode$
          tcnt = tcnt + one # Tool Counter
          preadbuf1t # Read Buffer 1 (at the toolchanges for X,Y,Z limits)
          #"****",~b1_tcode,"****", e
          psametool
          !b1_tcode
          llen = zero     # Reset counter for next tool
          rlen = zero     # Reset counter for next tool
          tltime = zero   # Reset counter for next tool
          trtime = zero   # Reset counter for next tool
          ttltime = zero  # Reset counter for next tool
          x$ = xh$
          y$ = yh$
          z$ = zh$
          !x$, !y$, !z$, !fr$ # Update previous [prv_?] variables

peof0$         # End of file for tool zero                      
          peof$

peof$          # Output of time calculations for the last tool and total time

    preadbuf45 #read buffer 4 tool data 
    ptoolsort  # read tool sorted data

          ptooldata     # Total ending data for tool (Path Length and Times)
          "===================================================================================================================", e$
          if show_lengths,  # Output Feed/Rapid path lengths
            [
            "Feed Cut Length = ", *llen_total, e$
            "Rapid Traverse Length = ", *rlen_total, e$
             psepline      # Output the separator '----' line
            ]

          if det_time,
            [
            "Total Feed  Time = ", ppftime, e$  # Time at FEEDRATE 
            "Total Rapid Time = ", pprtime, e$  # Time at RAPID RATE
            psepline      # Output the separator '----' line
            ]

          if xyz_limits,
            [
            preadbuf1e # Read Buffer 1 (get X,Y,Z extents of entire program)
            pMaxMin    # Output Max/Min X,Y,Z coords for entire program
            psepline      # Output the separator '----' line
            ]

          if fr_limits, # Feedrate limits
            [
            "FEEDRATES: MAX= ", *pmax_fr, "  MIN= ", *pmin_fr, e$
            psepline      # Output the separator '----' line
            ]

          # Output Cycle Time
          ttltime = total              # Transfer TOTAL program time
          "Cycle Time:  ", ptimeout, e$ # Program Total time output

prapid$        # Linear line movement - at rapid feedrate             
          ptime

pzrapid$       # Linear movement in Z axis only - at rapid feedrate   
          ptime

plin$          # Linear line movement - at feedrate                   
          ptime

pz$            # Linear movement in Z axis only - at feedrate         
          ptime

pwrtt$   # Pre-Scan NCI data file 
          pwritbuf1           # Write MAX/MIN X,Y,Z values to Buffer 1

#-----------------------------------------------------------------------
# tool sorting 
#-----------------------------------------------------------------------
ptoolsort #routine to sort tools 

      #-------------------- find the smallest tool -------------
        size4 = rbuf(4, 0)     #Get the size of the Buffer 4
    bf_4_counter = size4   #set the counter = to buffer 4   
    rc4 = 1                #Reset read pointer for buffer 4
    rc5 = 1                #Reset read pointer for buffer 5

    b4_gcode = rbuf(4, rc4) #Read a record from the Buffer
    strtool_5 = rbuf(5,rc5) #read tool comment from buffer 5    
        #gcode = b4_gcode       # gcode
        #t = b4_t               # tool number
        #tldia = b4_tldia       # tool dia
        #tlngno = b4_tlngno     # tool length offset number
        #tloffno = b4_tloffno   # tool rad offset number
                #strtool = strtool_5    # tool comment
            gcode$          = b4_gcode          # gcode
        t$              = b4_t              # tool number
        tldia$          = b4_tldia          # tool dia
        tlngno$         = b4_tlngno         # tool length offset number
        tloffno$        = b4_tloffno        # tool rad offset number
                tl_type        = b4_tl_type        # tool type number   
            tl_tip_angle   = b4_tl_tip_angle   # tool tip angle 
            tl_num_flutes  = b4_tl_num_flutes  # number of flutes
            tl_tpi         = b4_tl_tpi         # thread per inch or lead
            tl_corner_rad  = b4_tl_corner_rad  # corner radius
            tl_tip_dia     = b4_tl_tip_dia     # tip diameter
            tl_flute_len   = b4_tl_flute_len   # flute length
            tl_shld_len    = b4_tl_shld_len    # shoulder length
            tl_overall_len = b4_tl_overall_len # overall length
            tl_arbor_dia   = b4_tl_arbor_dia   # arbor dia
            tl_holder_dia  = b4_tl_holder_dia  # holder dia
            tl_holder_len  = b4_tl_holder_len  # holder length
            tl_units       = b4_tl_units       # units 0 = inches 1 = metric
                strtool$ = strtool_5                # tool comment            

    while rc4 <= size4,      #Loop thru entire program
            [
            b4_gcode = rbuf(4, rc4) #Read a record from the Buffer
        strtool_5 = rbuf(5,rc5) #read tool comment from buffer 5

        if b4_t < t$,  #find the smallest tool number
        [
        #gcode = b4_gcode       # gcode
        #t = b4_t               # tool number
        #tldia = b4_tldia       # tool dia
        #tlngno = b4_tlngno     # tool length offset number
        #tloffno = b4_tloffno   # tool rad offset number
                #strtool = strtool_5    # tool comment
                gcode$          = b4_gcode          # gcode
        t$              = b4_t              # tool number
        tldia$          = b4_tldia          # tool dia
        tlngno$         = b4_tlngno         # tool length offset number
        tloffno$        = b4_tloffno        # tool rad offset number
                tl_type        = b4_tl_type        # tool type number   
            tl_tip_angle   = b4_tl_tip_angle   # tool tip angle 
            tl_num_flutes  = b4_tl_num_flutes  # number of flutes
            tl_tpi         = b4_tl_tpi         # thread per inch or lead
            tl_corner_rad  = b4_tl_corner_rad  # corner radius
            tl_tip_dia     = b4_tl_tip_dia     # tip diameter
            tl_flute_len   = b4_tl_flute_len   # flute length
            tl_shld_len    = b4_tl_shld_len    # shoulder length
            tl_overall_len = b4_tl_overall_len # overall length
            tl_arbor_dia   = b4_tl_arbor_dia   # arbor dia
            tl_holder_dia  = b4_tl_holder_dia  # holder dia
            tl_holder_len  = b4_tl_holder_len  # holder length
            tl_units       = b4_tl_units       # units 0 = inches 1 = metric
                strtool$ = strtool_5    # tool comment            


        ]
            ]

    #psepline      # Output the separator '----' line

              #ptspace, *t, "  ", pdiamspc, *tldia, "  ", spaceit, phspace, *tlngno, 
              #"    ", pdspace, *tloffno, "     ",  *strtool, e#Rod removed min_zops, "    ",  ",# print the smallest tool
           pprint_tl_data, e$ #rq print for test
        bf_4_counter = bf_4_counter - 1   #count down the total of the tools left to sort


     while bf_4_counter > 0,  # loop through the entire routine untill all of the tools are sorted
      [
     #------------- start tool sorting-----------
     #------------- find a tool larger than the last tool


          rc4 = 1                #Reset read pointer for buffer 4
          rc5 = 1                #Reset read pointer for buffer 5
        small_tool = t$ #smallest tool

           while rc4 <= size4,      #Loop thru entire program
            [
            b4_gcode = rbuf(4, rc4) #Read a record from the Buffer
        strtool_5 = rbuf(5,rc5) #read tool comment from buffer 5        
        if b4_t > small_tool,  #find a tool number larger than the last tool used 
        [
        #gcode = b4_gcode       # gcode
        #t = b4_t               # tool number
        #tldia = b4_tldia       # tool dia
        #tlngno = b4_tlngno     # tool length offset number
        #tloffno = b4_tloffno   # tool rad offset number
                #strtool = strtool_5    # tool comment
                gcode$          = b4_gcode          # gcode
        t$              = b4_t              # tool number
        tldia$          = b4_tldia          # tool dia
        tlngno$         = b4_tlngno         # tool length offset number
        tloffno$        = b4_tloffno        # tool rad offset number
                tl_type        = b4_tl_type        # tool type number   
            tl_tip_angle   = b4_tl_tip_angle   # tool tip angle 
            tl_num_flutes  = b4_tl_num_flutes  # number of flutes
            tl_tpi         = b4_tl_tpi         # thread per inch or lead
            tl_corner_rad  = b4_tl_corner_rad  # corner radius
            tl_tip_dia     = b4_tl_tip_dia     # tip diameter
            tl_flute_len   = b4_tl_flute_len   # flute length
            tl_shld_len    = b4_tl_shld_len    # shoulder length
            tl_overall_len = b4_tl_overall_len # overall length
            tl_arbor_dia   = b4_tl_arbor_dia   # arbor dia
            tl_holder_dia  = b4_tl_holder_dia  # holder dia
            tl_holder_len  = b4_tl_holder_len  # holder length
            tl_units       = b4_tl_units       # units 0 = inches 1 = metric
                strtool$ = strtool_5    # tool comment            


                ]
         ]

        #--------------find the tool that is larger than the last tool but smaller than the others 
          rc4 = 1                #Reset read pointer for buffer 4
          rc5 = 1                #Reset read pointer for buffer 5
          while rc4 <= size4,      #Loop thru entire program
            [
            b4_gcode = rbuf(4, rc4) #Read a record from the Buffer
        strtool_5 = rbuf(5,rc5) #read tool comment from buffer 5

        if b4_t < t$ & b4_t > small_tool ,  #find the smallest tool number that is larger than last tool
        [
        #gcode = b4_gcode       # gcode
        #t = b4_t               # tool number
        #tldia = b4_tldia       # tool dia
        #tlngno = b4_tlngno     # tool length offset number
        #tloffno = b4_tloffno   # tool rad offset number
                #strtool = strtool_5    # tool comment
                gcode$          = b4_gcode          # gcode
        t$              = b4_t              # tool number
        tldia$          = b4_tldia          # tool dia
        tlngno$         = b4_tlngno         # tool length offset number
        tloffno$        = b4_tloffno        # tool rad offset number
                tl_type        = b4_tl_type        # tool type number   
            tl_tip_angle   = b4_tl_tip_angle   # tool tip angle 
            tl_num_flutes  = b4_tl_num_flutes  # number of flutes
            tl_tpi         = b4_tl_tpi         # thread per inch or lead
            tl_corner_rad  = b4_tl_corner_rad  # corner radius
            tl_tip_dia     = b4_tl_tip_dia     # tip diameter
            tl_flute_len   = b4_tl_flute_len   # flute length
            tl_shld_len    = b4_tl_shld_len    # shoulder length
            tl_overall_len = b4_tl_overall_len # overall length
            tl_arbor_dia   = b4_tl_arbor_dia   # arbor dia
            tl_holder_dia  = b4_tl_holder_dia  # holder dia
            tl_holder_len  = b4_tl_holder_len  # holder length
            tl_units       = b4_tl_units       # units 0 = inches 1 = metric
                strtool$ = strtool_5    # tool comment            

        ]
            ]
            small_tool = t$  # last tool used
      #psepline      # Output the separator '----' line            
              #ptspace, *t, "  ", pdiamspc, *tldia, "  ", spaceit, phspace, *tlngno, 
              #"    ", pdspace, *tloffno, "     ",  *strtool, e#Rod removed min_zops, "    ",  ",# print the last tool used
           pprint_tl_data, e$ #rq print for test
    bf_4_counter = bf_4_counter - 1   #count down the total of the tools left to sort

         ]
# --------------------------------------------------------------------------
# Buffer 1  Read / Write Routines
# --------------------------------------------------------------------------
pinit    #Initialize the limit checking variables
          max_Xpos = m_c9k #Initialize
          min_Xpos = c9k   #     "
          max_Ypos = m_c9k #     "
          min_Ypos = c9k   #     "
          max_Zpos = m_c9k #     "
          min_Zpos = c9k   #     "

plimits  # Check for NEW X,Y,Z limits
          if b1_xmax > max_Xpos, max_Xpos = b1_xmax
          if b1_xmin < min_Xpos, min_Xpos = b1_xmin
          if b1_ymax > max_Ypos, max_Ypos = b1_ymax
          if b1_ymin < min_Ypos, min_Ypos = b1_ymin
          if b1_zmax > max_Zpos, max_Zpos = b1_zmax
          if b1_zmin < min_Zpos, min_Zpos = b1_zmin

pwritbuf1   # Write Buffer 1
#          "****",~t,"****",e
          b1_gcode = gcode$
          b1_tcode = t$
          b1_xmax  = x_max$
          b1_xmin  = x_min$
          b1_ymax  = y_max$
          b1_ymin  = y_min$
          b1_zmax  = z_max$
          b1_zmin  = z_min$
          b1_gcode = wbuf(one, wc1) # Write the record

preadbuf1t # Read Buffer 1 (at the toolchanges for X,Y,Z limits)
          pinit                     #Initialize the limit checking variables
          b1_gcode = rbuf(one, rc1) #Read a record from the Buffer
          plimits                   #Check for NEW limits
          # Need this loop to scan thru possible NULL Tlchgs
          while (b1_gcode = 1000),  #Find the next NON-NULL toolchange
          [
            b1_gcode = rbuf(one,rc1)  #Read the next record from the Buffer
            plimits                   #Check for NEW limits
          ]

preadbuf1e # Read Buffer 1 (at the END of Program for X,Y,Z limits)
          pinit                    #Initialize the limit checking variables
          size1 = rbuf(one, 0)     #Get the size of the Buffer 1
          rc1 = two                #Reset read pointer (SKIP 1st record!)
          while rc1 <= size1,      #Loop thru entire program
            [
            b1_gcode = rbuf(one, rc1) #Read a record from the Buffer
            plimits                   #Check for NEW limits
            ]

# --------------------------------------------------------------------------
# Buffer 4  Read / Write Routines
# --------------------------------------------------------------------------
pwritbuf45   # Write Buffer 4 & 5 
     pparameter$  # read tool parameters #rq
    b4_gcode = gcode$                     # gcode
    b4_t = t$                             # tool number
    b4_tldia = tldia$                     # tool dia
    b4_tlngno = tlngno$                   # tool length offset number
    b4_tloffno = tloffno$                 # tool rad offset number   
    b4_tl_type = tl_type                # tool type number  
    b4_tl_tip_angle = tl_tip_angle      # tool tip angle    
    b4_tl_num_flutes = tl_num_flutes    # number of flutes
    b4_tl_tpi = tl_tpi                   # thread per inch or lead
    b4_tl_corner_rad = tl_corner_rad    # corner radius
    b4_tl_tip_dia = tl_tip_dia          # tip diameter
    b4_tl_flute_len = tl_flute_len      # flute length
    b4_tl_shld_len = tl_shld_len        # shoulder length
    b4_tl_overall_len = tl_overall_len  # overall length
    b4_tl_arbor_dia = tl_arbor_dia      # arbor dia
    b4_tl_holder_dia = tl_holder_dia    # holder dia
    b4_tl_holder_len = tl_holder_len    # holder length
    b4_tl_units = tl_units              # units 0 = inches 1 = metric

        strtool_5 = strtool$  # tool comment     
    b4_gcode = wbuf(4, wc4) # Write the record 
        strtool_5 = wbuf(5,wc5)  #write tool description to buffer 5   

preadbuf45 # Read Buffer 4 & 5(at the END of Program )

    size4 = rbuf(4, 0)     #Get the size of the Buffer 1
    rc4 = 1                #Reset read pointer for buffer 4
    rc5 = 1                #Reset read pointer for buffer 5
    while rc4 <= size4,      #Loop thru entire program
            [
            b4_gcode = rbuf(4, rc4) #Read a record from the Buffer
        strtool_5 = rbuf(5,rc5) #read tool comment from buffer 5    
        gcode$          = b4_gcode          # gcode
        t$              = b4_t              # tool number
        tldia$          = b4_tldia          # tool dia
        tlngno$         = b4_tlngno         # tool length offset number
        tloffno$        = b4_tloffno        # tool rad offset number
                tl_type        = b4_tl_type        # tool type number   
            tl_tip_angle   = b4_tl_tip_angle   # tool tip angle 
            tl_num_flutes  = b4_tl_num_flutes  # number of flutes
            tl_tpi         = b4_tl_tpi         # thread per inch or lead
            tl_corner_rad  = b4_tl_corner_rad  # corner radius
            tl_tip_dia     = b4_tl_tip_dia     # tip diameter
            tl_flute_len   = b4_tl_flute_len   # flute length
            tl_shld_len    = b4_tl_shld_len    # shoulder length
            tl_overall_len = b4_tl_overall_len # overall length
            tl_arbor_dia   = b4_tl_arbor_dia   # arbor dia
            tl_holder_dia  = b4_tl_holder_dia  # holder dia
            tl_holder_len  = b4_tl_holder_len  # holder length
            tl_units       = b4_tl_units       # units 0 = inches 1 = metric
                strtool$ = strtool_5    # tool comment            

            ]


#--------------------------------------------------------------------------
pMaxMin # Output Max/Min X,Y, Z coordinates
          if X_limits = yes$, # Output MAX/MIN positions in the X axis
            "Max_X = ", *max_Xpos, "  Min_X = ", *min_Xpos, e$
          if Y_limits = yes$, # Output MAX/MIN positions in the Y axis
            "Max_Y = ", *max_Ypos, "  Min_Y = ", *min_Ypos, e$
          if Z_limits = yes$, # Output MAX/MIN positions in the Z axis
            "Max_Z = ", *max_Zpos, "  Min_Z = ", *min_Zpos, e$

psametool  # used to remove tools with the same tool number 
    toolflg = 0        #same tool flag
    d_tl_des_flg = 0   #duplicate tool description flag
    d_tl_dia_flg = 0   #duplicate tool diameter flag


    if gcode$ = 1001,#start of file tool change
          [
    t$ = wbuf(2,wc2)        #write tool to buffer 2
    strtool$ = wbuf(3,wc3)  #write tool description to buffer 3

    b6_t = t$  # tool number 
    b6_tldia = tldia$ # tool dia  
    strtool_7 = strtool$ # tool description  
    b6_t = wbuf(6,wc6)        #write tool to buffer 6 
    strtool_7 = wbuf(7,wc7)  #write tool description to buffer 7           
          ]
          else,
          [
    rc2 = 1 #read pointer buffer 2
    rc3 = 1 #read pointer buffer 3

    size2 = rbuf(2,0) # get the size of buffer 2    
    tlcounter = 1
    while rc2 <= size2, #loop through the entire buffer
    [
    b2_tcode = rbuf(2,rc2) #read buffer 2
    strtool_3 = rbuf(3,rc3) #read buffer 3  
    if b2_tcode = t$ ,toolflg = 1
    if b2_tcode <> t$ & tlcounter = 1,
    [
    tlcounter = tlcounter +1
        t$ = wbuf(2,wc2)        #write tool to buffer 2
    strtool$ = wbuf(3,wc3)  #write tool description to buffer 3
    ]
    ]
    rc6 = 1 #read pointer buffer 6
    rc7 = 1 #read pointer buffer 7       
    size6 = rbuf(6,0) # get the size of buffer 6

    while rc6 <= size6, #loop through the entire buffer
    [
    b6_t = rbuf(6,rc6) #read buffer 6   
    strtool_7 = rbuf(7,rc7) #read buffer 7  
    if b6_t = t$ & strtool_7 <> strtool$, d_tl_des_flg = 1
    if b6_t = t$ & b6_tldia <> tldia$, d_tl_dia_flg = 1
    ]
    b6_t = t$  # tool number 
    b6_tldia = tldia$ # tool dia     
    strtool_7 = strtool$ # tool description    
    b6_t = wbuf(6,wc6)        #write tool to buffer 6 
    strtool_7 = wbuf(7,wc7)  #write tool description to buffer 7       

    if toolflg <> 1,
    [

      pwritbuf45  #write to buffer 4 & 5     

    ]

    if toolflg = 1 & d_tl_des_flg = 1 &d_tl_dia_flg = 1 ,
      [
        "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",e$
         "TOOL ",t$," ",strtool$," HAS ALL READY BEEN USED ",e$
     "PLEASE RENUMBER TOOL ", t$, " AND REPOST", e$
    "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",e$
    real_result = mprint(sametool)
     ]
    else,
    [
    if toolflg = 1 & d_tl_des_flg = 1,
        [
        "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",e$
         "TOOL ",t$," ",strtool$," IS A DUPLICATE TOOL",e$
     "IT HAS A DIFFERENT DESCRIPTION THAN TOOL ", t$, e$
    "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",e$
    real_result = mprint(sduptool)
         ]
    if toolflg = 1 & d_tl_dia_flg = 1 ,
        [
        "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",e$
         "TOOL ",t$,"  DIAMETER = ",tldia$," IS A DUPLICATE TOOL",e$
     "IT HAS A DIFFERENT DIAMETER THAN TOOL ", t$, e$
    "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",e$
    real_result = mprint(sduptool)
         ]
    ]
        ]

# --------------------------------------------------------------------------
# Access tool data strings from NCI '20000' series parameters
# --------------------------------------------------------------------------
pindent  #indent statement
         "    ",
pparameter$   # Read in the 20000 series 'additional parameters' from OPS file   


             # 20004 = tool definition - 'tool parameters' data
          if (prmcode$ = 20004), tl_number = rpar(sparameter$, 16) # 16 items

             # 20005 = tool definition - 'DRILL type tool' parameters
          if (prmcode$ = 20005), drl_cycle$ = rpar(sparameter$, 9) # 9 items

             # 20006 = tool definition - 'MILL type tool' parameters
          if (prmcode$ = 20006), tl_cut_cap = rpar(sparameter$, 8) # 8 items

             # 20007 = tool definition - 'MILL type tool HOLDER' parameters
          if (prmcode$ = 20007), tl_min_dia_plg = rpar(sparameter$, 11) # 11 items

          result = fprm(opcode$) # Run the parameter table for current OPCODE


pprint_tl_data #print out tool date for testing

    if tl_type = 0, stl_type = stl_type_0   #undefined
    if tl_type = 1, stl_type = stl_type_1   #Center Drill
    if tl_type = 2, stl_type = stl_type_2   #spot drill
    if tl_type = 3, stl_type = stl_type_3   #drill
    if tl_type = 4, stl_type = stl_type_4   #right hand tap
    if tl_type = 5, stl_type = stl_type_5   #left hand tap
    if tl_type = 6, stl_type = stl_type_6   #reamer
    if tl_type = 7, stl_type = stl_type_7   #boring bar
    if tl_type = 8, stl_type = stl_type_8   #counter bore
    if tl_type = 9, stl_type = stl_type_9   #counter sink
    if tl_type = 10, stl_type = stl_type_10 #Flat end mill
    if tl_type = 11, stl_type = stl_type_11 #ball end mill
    if tl_type = 12, stl_type = stl_type_12 #chamfer mill
    if tl_type = 13, stl_type = stl_type_13 #face mill
    if tl_type = 14, stl_type = stl_type_14 #slot mill
    if tl_type = 15, stl_type = stl_type_15 #radius mill
    if tl_type = 16, stl_type = stl_type_16 #dovetail mill
    if tl_type = 17, stl_type = stl_type_17 #tapered mill
    if tl_type = 18, stl_type = stl_type_18 #lollipop mill
    if tl_type = 19, stl_type = stl_type_19 #bullnose end mill

    t_overall_len = tl_overall_len
    t_flute_len = tl_flute_len

        if tl_type <= 5, inc_ang = tl_tip_angle
    if tl_type = 7, tapr_ang = tl_tip_angle
    if tl_type = 9, inc_ang = tl_tip_angle
    if tl_type = 12, tapr_ang = tl_tip_angle
    if tl_type = 13, tapr_ang = tl_tip_angle
    if tl_type = 16, tapr_ang = tl_tip_angle
    if tl_type = 17, tapr_ang = tl_tip_angle

    if tl_type <= 12,body_dia = tldia$
    if tl_type = 13,body_dia = tl_tip_dia
    if tl_type = 14,body_dia = tldia$
    if tl_type = 16,body_dia = tldia$
    if tl_type = 18,body_dia = tldia$
    if tl_type = 19,body_dia = tldia$

    if tl_type = 12,nose_dia = tl_tip_dia
    if tl_type = 13,nose_dia = tldia$
    if tl_type = 15,nose_dia = tldia$
    if tl_type = 17,nose_dia = tldia$

    #"tl_type = ", tl_type, " tldia$ = ", tldia$, " tl_tip_angle = ", tl_tip_angle, " tl_tip_dia = ", tl_tip_dia, e$
    ppagebrk #call for page break

    if tl_type = 6 | tl_type = 8,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, stab, stab, stab,
        *strtool$, e$
        plsepline
        ]

    if tl_type = 10 | tl_type = 11,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, stab, stab, stab,
        *strtool$, e$
        plsepline
        ]

    if tl_type = 18 | tl_type = 19,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, stab, stab, stab,
        *strtool$, e$
        plsepline
        ]

    if tl_type = 14,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, stab, stab, stab,
        *strtool$, e$
        plsepline
        ]


    if tl_type <= 5,
        [
        # "------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, stab,
        *inc_ang, stab, stab, *strtool$, e$
        plsepline
        ]

    if tl_type = 9,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, stab,
        *inc_ang, stab, stab, *strtool$, e$
        plsepline
        ]

    if tl_type = 12 | tl_type = 13,
        [
         #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, *tapr_ang, stab,
        stab, *nose_dia, stab, *strtool$, e$
        plsepline
        ]

    if tl_type = 7 | tl_type = 16,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, *body_dia, stab, *t_flute_len, stab, *t_overall_len, stab, *tapr_ang, stab,
         stab, stab, *strtool$, e$
        plsepline
        ]

    if tl_type = 15,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab,  stab, *t_flute_len, stab, *t_overall_len, stab, stab,
        stab, *nose_dia, stab, *strtool$, e$
        plsepline
        ]

    if tl_type = 17,
        [
        #"------------------------------------------------------------------------------------------------------------------", e$
        *t$, stab, stab, *t_flute_len, stab, *t_overall_len, stab, *tapr_ang, stab,
      stab, *nose_dia, stab, *strtool$, e$
        plsepline
        ]
ppagebrk  #check to see if a new page is required and insert a new header 

    tl_cnt_brk = tl_cnt_brk + 1,
     if tl_cnt_brk = tl_cnt_brk_lmt,
    [
    12, e$

       stab, stab, "Min.", stab, "Min." , e$
          "T", stab, "T", stab, "Fl.", stab, "Oa.", stab, "Tapr.", stab, "Inc.", stab, "Nose", e$
          "Num.", stab, "Dia.", stab, "Len.", stab, "Len.", stab, "Ang.", stab, "Ang.", stab, "Dia.", stab, "Tool Description", e$
          #pdblsepline
      pdblsepline
    tl_cnt_brk_lmt = tl_cnt_brk_lmt + 20
    ]

# --------------------------------------------------------------------------
# Numbered Questions for Mastercam
# --------------------------------------------------------------------------

91. Name of executable post processor? MP

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

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

Link to comment
Share on other sites
  • 1 month later...

Hi CNC Guy,
  I think setup sheet with images is best, I hope these images can give your more ideas how to arrange them.  I personally created this setup sheet and tools list because I live in California and most operators don't speak English well.  Pictures worth thousand words of which reduce confusions and personal bad attitude....

 

PS:  See sample images, I used ACTIVE REPORT to design them.

SETUP SHEET.PNG

TOOLS SHEET.PNG

  • Like 1
Link to comment
Share on other sites
  • 5 years later...
On 23/5/2018 at 14:35, PcRobotic said:

Hola CNC Guy,
  creo que lo mejor es una hoja de configuración con imágenes. Espero que estas imágenes puedan darte más ideas sobre cómo organizarlas. Yo personalmente creé esta hoja de configuración y lista de herramientas porque vivo en California y la mayoría de los operadores no hablan bien inglés. Imágenes que valen más que mil palabras y que reducen confusiones y malas actitudes personales....

 

PD: Ver imágenes de muestra, utilicé ACTIVE REPORT para diseñarlas.

HOJA DE CONFIGURACIÓN.PNG

HOJA DE HERRAMIENTAS.PNG

Hello @PcRobótica, I've seen your setup sheet, and I really liked it. I noticed that on your "x" and "y" axes, you have indicated the angles. How can I generate that, and how do you place the ruler on the sides? I liked it. 

Link to comment
Share on other sites
On 1/16/2024 at 5:32 PM, tay87 said:

Hello @PcRobótica, I've seen your setup sheet, and I really liked it. I noticed that on your "x" and "y" axes, you have indicated the angles. How can I generate that, and how do you place the ruler on the sides? I liked it. 

He hasn't visited in a few years, so I'll guess at his answer.  I don't think it's auto-generated.  I think it's part of his setup process, make a level that has all of his pallet information, clamping, and those lines & text.

  • Like 1
Link to comment
Share on other sites
7 hours ago, Aaron Eberhard said:

He hasn't visited in a few years, so I'll guess at his answer.  I don't think it's auto-generated.  I think it's part of his setup process, make a level that has all of his pallet information, clamping, and those lines & text.

I always have a "notes" layer to go with each op. way too handy for the auto-output to setup sheets.

 

NOTES.png

  • Like 3
Link to comment
Share on other sites
  • 3 weeks later...
On 1/16/2024 at 2:32 PM, tay87 said:

Hello @PcRobótica, I've seen your setup sheet, and I really liked it. I noticed that on your "x" and "y" axes, you have indicated the angles. How can I generate that, and how do you place the ruler on the sides? I liked it. 

 

Hello,
   I have an updated version, which is more automated (it spits its own from the source.)

image.thumb.jpeg.780af26ede8b959835ca96095f6d405c.jpeg

 

image.jpeg.53f9a63b4f365de4dbfb0728e3f77eb4.jpeg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...