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:

cncgotoguy

Verified Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by cncgotoguy

  1. Thanks Colin, I got it to work with the following code. Not pretty, but it does the trick. str_testTool : "" #Empty String str_warnTool : "" #Empty String str_testComment : "" #Empty String str_warnComment : "" #Empty String str_CheckComment : "" #Empty String ptoolCharacterCheck str_testTool = no2asc(33) #no2asc(33) #Convert ASCII Code decimal value to ! string representation pstr_testTool str_testTool = no2asc(40) #no2asc(40) #Convert ASCII Code decimal value to ( string representation pstr_testTool str_testTool = no2asc(41) #no2asc(41) #Convert ASCII Code decimal value to ) string representation pstr_testTool str_testTool = no2asc(176) #no2asc(176) #Convert ASCII Code decimal value to ° string representation pstr_testTool str_testTool = no2asc(177) #no2asc(177) #Convert ASCII Code decimal value to ± string representation pstr_testTool pOperationCommentCheck str_testComment = no2asc(33) #no2asc(33) #Convert ASCII Code decimal value to ! string representation pstr_testComment str_testComment = no2asc(40) #no2asc(40) #Convert ASCII Code decimal value to ( string representation pstr_testComment str_testComment = no2asc(41) #no2asc(41) #Convert ASCII Code decimal value to ) string representation pstr_testComment str_testComment = no2asc(176) #no2asc(176) #Convert ASCII Code decimal value to ° string representation pstr_testComment str_testComment = no2asc(177) #no2asc(177) #Convert ASCII Code decimal value to ± string representation pstr_testComment pstr_testTool result = strstr(str_testTool, strtool$) #Test string for character assigned with no2asc if result <> 0, [ str_warnTool = "BAD CHARACTER " + str_testTool + " FOUND IN" + " T#" + no2str(t$) + ", TOOL COMMENT IS " + strtool$ + " NAME." + " PLEASE FIX COMMENT AND REPOST!" result = mprint(str_warnTool) ] pstr_testComment str_CheckComment = scomm$ result = strstr(str_testComment, str_CheckComment) #Test string for character assigned with no2asc if result <> 0, [ str_warnComment = "BAD CHARACTER " + str_testComment + sbubbleinfo + " FOUND IN OPERATION " + drs_str(2,opnumber) + ", COMMENT IS " + str_CheckComment + " PLEASE FIX COMMENT AND REPOST!" result = mprint(str_warnComment) ]
  2. I'm trying to catch special characters before they get posted, our MAS system won't allow them. I was successful with the characters "(", ")", and "°" but when I put in the "±" it won't find it in the string. Is there a way to make it recognize this character? Below is the code I used to check for parenthesis in the tool name. The code below that worked when I put "°" in there, but not "±" Also, is there a way to run strstr on a list of characters without having to copy the code each time? Or... would it be easier to get a list of the allowable characters and check against those.
  3. Thanks! That worked for the most part. If I say no, it doesn't just exit the post, it brings up the setup sheet editor and throws an alarm as shown in the screenshot below, but it doesn't overwrite the file which is good. [POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V24.00 P0 E1 W24.00 T1629302588 M24.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 fiftyfour : 54 #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 fs2 10 1.2 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 fmt "G" 3 g_wcs #WCS G address fmt 3 fiftyfour #format 54 as an integer #=============================================================================== # 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 5 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 : 11 # max tool limit for the first page tl_cnt_pg_lmt : 15 # max tool limit for all other pages 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 sprglen_over : "" #used when ptool name is longer than max_chr to output over amount of string max_chr : 57 # set the maximum length of the tool name string 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 & 5 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 23 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" stl_type_24 : "Thread 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 if fexist(spathnc$ + snamenc$ + sextnc$), [ result = mprint(spathnc$ + snamenc$ + sextnc$ + " already exists." + no2asc(10) + "Do you want to replace it ?", 5) if result = 7, exitpost$ ] # -------------------------------------------------------------------------- # Post block assignments # -------------------------------------------------------------------------- pblsepline # Output a blank separator line " ",e$ 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) # preadbuf1t not in the okuma post 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$ pblsepline # 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$ "Posted From = ", *smcname$, 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 g_wcs = workofs$ + fiftyfour, #set up value for the work offset, have to add 54 to the mastercam offset$ value. "Offset used = ", *g_wcs, e$ #example workofs$ = 0 then g_wcs will = 54 ,this will then print G54 pblsepline # Blank line " ", " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", e$ " TOOL LIST", " KEEP ALL TOOLS AS SHORT AS POSSIBLE", e$ " ---------", " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", e$ ptableheader # call for header tooltable$ be inserted 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) 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) pdblsepline 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 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 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 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 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 name ] ] 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 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 if tl_type = 24, stl_type = stl_type_24 #Thread 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 = 24,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 # -------------------------------------------------------------------------- # formatting for different tool types # -------------------------------------------------------------------------- if tl_type = 1 |tl_type = 2 | tl_type = 3, # 1 = center drill 2 = spopt drill 3 = Drill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt ptltpangfmt pntltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 4 | tl_type = 5, #4 = RH tap 5 = LH tap [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt #pntltpangfmt #pntltpradfmt #pntlnosediafmt stab, *tl_tpi, " TPI", stab, stab, stab, space4, #this outputs the threads per inch pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 6 , # 6= Reamer [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt pntltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 7 | tl_type = 11, # 7 = Boring bar, 11 = Ball Endmill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt ptltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 8, #c-bore [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt pntltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 9, #counter sink [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt ptltpangfmt pntltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 10, # Flat Endmill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt pntltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 12, # Chamfer mill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt tl_tip_angle= tl_tip_angle + tl_tip_angle, # make tip angle included angle ptltpangfmt pntltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 13, # Face mill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt ptltpangfmt ptltpradfmt ptlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 14, # Slot mill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt ptltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 15, #Radius mill - corner rounder [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt ptltpradfmt ptlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 16, #Dovetail Cutter [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt tl_tip_angle= tl_tip_angle + tl_tip_angle, # make tip angle included angle ptltpangfmt ptltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 17, #taper mill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt ptltpangfmt pntltpradfmt ptlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 18, #lollipop mill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt ptltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 19, # Bull nose endmill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt ptltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] if tl_type = 24, #thread mill [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt #pntltpangfmt #pntltpradfmt #pntlnosediafmt stab, *tl_tpi, " TPI", stab, stab, stab, space4, #this outputs the threads per inch pcktlstrlen *strtool$, e$ plsepline ] # added this section for tools that we missed if tl_type = 0 | tl_type = 20 |tl_type = 21 |tl_type = 22 |tl_type = 23, # if not one of the above use this one [ ptlnumfmt ptldiafmt ptlnumflfmt ptlfllenfmt ptloalenfmt pntltpangfmt ptltpradfmt pntlnosediafmt pcktlstrlen *strtool$, e$ plsepline ] ppagebrk #check to see if a new page is required and insert a new header if tl_cnt_brk = tl_cnt_brk_lmt, [ pblsepline #call for blank line to be inserted ptableheader # call for header tooltable$ be inserted tl_cnt_brk_lmt = tl_cnt_brk_lmt + tl_cnt_pg_lmt ] tl_cnt_brk = tl_cnt_brk + 1, #----------------------------------------------------------------------- # Tool Table Header #----------------------------------------------------------------------- ptableheader #routine to create tool table header pblsepline #call for blank line to be inserted stab,stab,stab,stab,space3, "Min.", stab, "Min." ,stab, e$ "T", space3, " T", stab,space3,"Num.", space3,"Fl.", stab, " Oa.", stab,space1, "Tip",stab,space1, "Tip",stab, space1, "Nose", e$ "Num.", space3, "Dia.", stab, "Fl.", space4, "Len.", stab, "Len.", stab, "Ang.",stab, "Rad.", stab, "Dia.", stab,stab, "Tool Name", e$ pdblsepline #call double separator line ptableheaderall #outputs all headers used for testing "gcode$",stab,"t$",stab,"tldia$",stab,"tlngno$",stab,"tloffno$",stab,"tl_type",stab,"tl_tip_angle",stab,"tl_num_flutes",stab, "tl_tpi",stab,"tl_corner_rad",stab,"tl_tip_dia",stab,"tl_flute_len",stab,"tl_shld_len",stab,"tl_overall_len",stab, "tl_arbor_dia",stab,"tl_holder_dia",stab,"tl_holder_len",stab,"tl_units",stab,"strtool$",e$ #----------------------------------------------------------------------- # Tool Table data formats #----------------------------------------------------------------------- ptdatfmtall #prints all the infor for a tool used for testing gcode$,stab,t$,stab,tldia$,stab,tlngno$,stab,tloffno$,stab,tl_type,stab,tl_tip_angle,stab,tl_num_flutes,stab, tl_tpi,stab,tl_corner_rad,stab,tl_tip_dia,stab,tl_flute_len,stab,tl_shld_len,stab,tl_overall_len,stab, tl_arbor_dia,stab,tl_holder_dia,stab,tl_holder_len,stab,tl_units,stab,strtool$,e$ ptlnumfmt #check the tool number and format for number of spaces good to tool 99 if t$ <= 9, [ *t$, stab, space1, ] else, [ *t$, stab, ] ptldiafmt #check the tool diameter and format for number of spaces if body_dia < 10, [ *body_dia, space4, ] else, [ *body_dia, space3, ] pntldiafmt #use if no tool diameter is needed stab,stab, ptlnumflfmt #check the tool number of flutes and format for number of spaces if tl_num_flutes < 10, [ *tl_num_flutes, stab, ] else, [ *tl_num_flutes, space4, ] ptlfllenfmt #check the tool flute length and format for number of spaces if t_flute_len < 10, [ *t_flute_len, space4, ] else, [ *t_flute_len, space3, ] ptloalenfmt #check the tool over all length and format for number of spaces if t_overall_len < 10, [ *t_overall_len, space4, ] else, [ *t_overall_len, space3, ] ptltpangfmt #check the tool tip angle and format for number of spaces if tl_tip_angle <= 99.99, [ *tl_tip_angle, space4, ] else, [ *tl_tip_angle, space3, ] pntltpangfmt #use if no tip angle is needed stab, space4, ptltpradfmt #check the tool tip radius and format for number of spaces if tl_corner_rad < 100, [ *tl_corner_rad, space4, ] else, [ *tl_corner_rad, space3, ] pntltpradfmt #use if no tip radius is needed stab, stab, ptlnosediafmt if nose_dia < 10, [ *nose_dia, stab, space2 ] else, [ *nose_dia, stab, space1, ] pntlnosediafmt #use if no tool nose diameter is needed stab, stab, space3, pcktlstrlen #check the tool name srting length and shorten to max_chr if strlen(strtool$) > max_chr, [ sprglen_over = brksps(max_chr, strtool$), #This checks the length of the prglen_over and breaks it if to long ] # -------------------------------------------------------------------------- # 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 #
  4. Is there a way to have the .SET file ask before overwriting a file if it already exists? Ours overwrites without asking.
  5. I'm looking for an automated way to do the following: initial conditions; Mastercam open with parasolid imported 1. create new level 2. Create faces from solid on this new level 3. hide solid from its level I make fully dimensioned drawings in Solidworks and to ensure each model feature from the part is dimensioned, I use Mastercam to change the color of each surface as I dimension it. It has worked very well, but I would like to automate the creation of the faces.
  6. Trying to have the "Associate to library" checked each time the Wire - Contour toolpath is used. Also want to have the "Wire", "Power", and "Fill tank" check boxes unchecked as default.
  7. It looks like this topic has been covered in another thread The name of it is "Post help / manual entry" I'm going to read about it there, shows how to separate the two, since Comment$ is holding both right now.
  8. Thanks guys, that gets me closer. It's putting the tool comments up there as well. It would work, but I would prefer the tool comments to be under the tool change.
  9. It seems like the manual entry code should come after the previous operation and before the next, but it is being entered after the next tool change. Is this how it normally goes? Seems like it should be placed between the operations as it is in the operations tree.
  10. Thanks for the reply Colin, Always appreciate your input and see you have some Youtube videos uploaded. Gonna give those a view. Using MCAM 2020. Post is as old as I can remember, updated each time we updated MCAM, and a few different hands in there. All hacks including me. I did the following to get it to work. Copy and pasted the parameter 15346 to the post block below and gave it a new variable name. Colin, I like the idea of exiting the post. I've always just put an error in the NC code that won't run on the machine. this sounds like a better way.
  11. Trying to grab the variable for what compensation type is being used and throw a warning if Reverse Wear or Control type are used. I tried pulling the variable comp_type in, but it is staying the same for all and doesn't even match the first tool path correctly. Anybody got any ideas how to get this to work? Much appreciated for reading.
  12. Thanks everybody, especiialy Zaffin_D for the help on this. I went with the following code and got it to work. Probably not the prettiest code around fmt 4 modulo_result fmt 4 int_a fmt 4 int_n fmt 4 remainder modulo_result : 0 int_a : 0 int_n : 10 remainder : 0 p_modulo int_a = speed modulo_result = int_a / int_n modulo_result = int(modulo_result) modulo_result = modulo_result * int_n remainder = int_a - modulo_result if remainder <>0, result=mprint(ssingledigitspindle) If remainder <>0, "(TOOLPATH SPINDLE SPEED ENDS IN SINGLE DIGIT)", e$ Then I ran the post block p_modulo after each toolchange.
  13. 2020 Mcam I see some string functions to convert the number to a string, then break the string into pieces. We don't want to round. We want the posted file to be exactly the same as the source file.
  14. Our spindles don't like when we have a speed ending in a single digit, that isn't 0. We do however want the posted code to match the mastercam file Any idea the best way to throw a warning at posting to let the programmer know the spindle speed needs to be rounded?
  15. The infrastructure was there in the post. Got it working. Looks like all the tool definitions need to be edited for this to work. Does this have an effect on old files? Got these notifications when I pulled the edited machine definition into an old file. Attached is the text file with the errors. New Style Coolant Compatibility issue.txt
  16. I want to be able to set the coolant type under the tool parameters. We want thru tool coolant and flood on most tools, but some we want flood only. M26 for thru tool coolant and M8 for flood. Does anybody know what the easiest way to do this is? Under the General Machine Parameters/"coolant Commands", we have the box checked for "Support coolant using coolant value in post-processor"
  17. Thanks Jeff, I actually want to get a certain number of characters in the beginning and then capture the revision and the operation. I was going to set a specific way (fixed character length) to name the operation number and revision, so there would be a left over number of characters for the PN. I would need it to go to the first underscore and grab the characters after up until the next underscore and save that as the revision, then grab the characters after the next underscore and store it as the operation.
  18. Is there logic built in to look through a string and be able to truncate the string when it encounters a certain character? I see you wrote "trick". Not sure if that is an indication it isn't easily done? We have a machine that requires a line at the beginning that has 16 characters max. I would like to extract part of the part number and the entire revision and operation. For example: NC file name: 980-1000001258-56286_A_OP1.NC would like the line at the beginning of the program to show: 980-100000_A_OP1
  19. Thanks Jeff. That worked. Here is the postblock and the added forced variables if someone else has this problem. 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
  20. Thanks Jeff! That makes sense. Do you know which variables on which to put the (*)? 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 This is the code that is posted. % O0001(TWO DRILL CYCLES.NC) ( DOUBLE BORE CYCLE TEST ) (OKUMA) (NOT PROVEN) ( 04 / 08 / 19 ) (PROGRAMMED TO CENTER LINE OF CUTTER) N10 G20 N20 G90 G80 G40 G94 G17 G0 N30 N7 G116 T7 G15 H01 ( .249 REAMER HOLE .249/.2498 TOOL - 7 DIA. OFF. - 7 LEN. - 7 DIA. - .249 ) N40 G0 G90 X0. Y0. N50 S1069 M3 N60 G56 H7 Z1. M8 N70 G71 Z1. N80 G76 X0. Y0. Z-1. R.1 Q5. F6.4 M53 N90 G00 N100 G71 Z1. N110 G76 X0. Y0. Z-1. R.1 Q5. F6.4 M53 N120 G76 X2.2417 Y.7523 Z-1. Q5. F6.4 M53 N130 G00 N140 G76 X2.2417 Y.7523 Z-1. Q5. F6.4 M53 N150 G00 N160 M5 N170 M9 N180 G0 G90 Z20. N190 G0 G90 Y20. N200 M30 N210 %
  21. I'm using the custom drill cycle to create a double fine boring cycle. When there is only one hole, it works fine, but when there are additional holes, it doesn't post out the retract value. for one hole, It uses the postblock pdrlcst$ and outputs the retract value through the postblock prdrlout for the additional hole, it uses the postblock pdrlcst_2$, and even though I have the postblock prdrlout, it won't read it Looking to get the R value in all lines that have the G76 Here is the section of the post pdrlcst$ #Custom drill cycles 8 - 19 (user option) #Use this postblock to customize drilling cycles 8 - 19 pdrlcommonb pcan1, pbld, n$, "G76", pfxout, pfyout, pfzout, pcout,*prdrlout, *shftdrl$, dwell$, *feed, *sgdrlref, strcantext, e$ pcom_movea pbld, n$, "G00", e$ pdrlcommonb pcan1, pbld, n$, "G76", pfxout, pfyout, pfzout, pcout,*prdrlout, *shftdrl$, dwell$, *feed, *sgdrlref, strcantext, e$ pcom_movea pdrlcst_2$ #Custom drill cycles 8 - 19, additional points (user option) pdrlcommonb pcan1, pbld, n$, "G76", pfxout, pfyout, pfzout, pcout,*prdrlout, *shftdrl$, dwell$, *feed, *sgdrlref, strcantext, e$ pcom_movea pbld, n$, "G00", e$ pdrlcommonb pcan1, pbld, n$, "G76", pfxout, pfyout, pfzout, pcout,*prdrlout, *shftdrl$, dwell$, *feed, *sgdrlref, strcantext, e$ pcom_movea
  22. I can't for the life of me get the variable for the NC file name to go in the buffer file. I've successfully named the buffer file and chosen a location, but when I add the snamenc$, I can't get it to work. This works: "C:\Users\bilbroughb.TRESKE\Desktop\A working Folder\BEN.txt" This doesn't: "C:\Users\bilbroughb.TRESKE\Desktop\A working Folder\" + snamenc$ + "BEN.txt" I got one variable to go in there... "C:\Users\bilbroughb.TRESKE\Desktop\A working Folder\" + smon9 + "BEN.txt" Attached is the post, line 977 to 985 of the post is where I am naming the buffer file. MAKINO BUFFER FILE.PST
  23. 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 #
  24. I have a question along the lines of this thread. Is there a way to access the previous variable lstation$? I'm pulling the data to put a line before, but it is using the next tools lstation$ prv_tldia$ and prv_tlngno$ are giving me values, but not lstation$ #START OF TOOL BREAKAGE SENSOR CODE if prv_tldia$ < .750, [ Head_Number = lstation$ if Head_Number = -1, [ Sensor_Tolerance = 0.2 ] if Head_Number <> -1, [ Sensor_Tolerance = Head_Number /1000 ] pbld, n$, "M101", prv_tlngno$, prv_tldia$, *Sensor_Tolerance, e$ ] #END OF TOOL BREAKAGE SENSOR CODE #pbld, n$, sgabsinc, sgcode, *sg28ref, "Z0.", scoolant, e$ #if nextop$ = 1003 | tlchg_home, pbld, n$, *sg28ref, "Y0.", protretinc, e$ #"X0.", - removed before Y move #else, pbld, n$, protretinc, e$ absinc$ = sav_absinc coolant$ = sav_coolant
  25. I have a postblock to output the values in mi4$ thru mi10$ and also the toolpath number. I wrote some code to only output the values if they are present. Does anybody know if there is an easy way to exclude one if it is a duplicate? for example, if someone enters 1 for mi7$ and mi8$, then it outputs both in my NC code, but I only want one. Also, I would like to sort the numbers from lowest to highest left to right. Here is what would post out if mi4$ was 6, mi5$ was 3, mi7$ was 1, and mi8$ was 1. ( BUBBLE 6 3 1 1 MCAM TPN 2) I want it to read: ( BUBBLE 1 3 6 MCAM TPN 2) my postblock code that I have at the start of file and at all toolchanges: pbubbleinfo if mi4$ <> 0 , valueinmi4 = 1 if mi5$ <> 0 , valueinmi5 = 1 if mi6$ <> 0 , valueinmi6 = 1 if mi7$ <> 0 , valueinmi7 = 1 if mi8$ <> 0 , valueinmi8 = 1 if mi9$ <> 0 , valueinmi9 = 1 if mi10$ <> 0 , valueinmi10 = 1 If mi4$ = 0 , valueinmi4 = 0 If mi5$ = 0 , valueinmi5 = 0 If mi6$ = 0 , valueinmi6 = 0 If mi7$ = 0 , valueinmi7 = 0 If mi8$ = 0 , valueinmi8 = 0 If mi9$ = 0 , valueinmi9 = 0 If mi10$ = 0 , valueinmi10 = 0 #*valueinmi4, e$ #output values for debugging #*valueinmi5, e$ #output values for debugging #*valueinmi6, e$ #output values for debugging #*valueinmi7, e$ #output values for debugging #*valueinmi8, e$ #output values for debugging #*valueinmi9, e$ #output values for debugging #*valueinmi10, e$ #output values for debugging if mi4$ = 0, smi4="" if mi4$ <> 0, smi4= drs_str(2,mi4$) if mi5$ = 0, smi5="" if mi5$ <> 0, smi5= drs_str(2,mi5$) if mi6$ = 0, smi6="" if mi6$ <> 0, smi6= drs_str(2,mi6$) if mi7$ = 0, smi7="" if mi7$ <> 0, smi7= drs_str(2,mi7$) if mi8$ = 0, smi8="" if mi8$ <> 0, smi8= drs_str(2,mi8$) if mi9$ = 0, smi9="" if mi9$ <> 0, smi9= drs_str(2,mi9$) if mi10$ = 0, smi10="" if mi10$ <> 0, smi10= drs_str(2,mi10$) sbubblebeginning = "( BUBBLE " sopnumberbeginning = " MCAM TPN " if valueinmi4 = 0, sspacemi4="" if valueinmi5 = 0, sspacemi5="" if valueinmi6 = 0, sspacemi6="" if valueinmi7 = 0, sspacemi7="" if valueinmi8 = 0, sspacemi8="" if valueinmi9 = 0, sspacemi9="" if valueinmi10 = 0, sspacemi10="" if valueinmi4 = 1, sspacemi4=" " if valueinmi5 = 1, sspacemi5=" " if valueinmi6 = 1, sspacemi6=" " if valueinmi7 = 1, sspacemi7=" " if valueinmi8 = 1, sspacemi8=" " if valueinmi9 = 1, sspacemi9=" " if valueinmi10 =1, sspacemi10=" " if valueinmi4 =1 | valueinmi5 =1 | valueinmi6 =1 | valueinmi7 =1 | valueinmi8 =1 | valueinmi9 =1 | valueinmi10 =1, sbubbleinfo = sbubblebeginning + smi4 + sspacemi4 + smi5 + sspacemi5 + smi6 + sspacemi6 + smi7 + sspacemi7 + smi8 + sspacemi8 + smi9 + sspacemi9 + smi10 + sspacemi10 + sopnumberbeginning + drs_str(2,opnumber) + sclose_prn if valueinmi4 = 0 & valueinmi5 = 0 & valueinmi6 = 0 & valueinmi7 = 0 & valueinmi8 = 0 & valueinmi9 = 0 & valueinmi10 = 0, sbubbleinfo = sopen_prn + sopnumberbeginning + drs_str(2,opnumber) + sclose_prn if sprv_sbubbleinfo <> sbubbleinfo, [ if valueinmi4 =1 | valueinmi5 =1 | valueinmi6 =1 | valueinmi7 =1 | valueinmi8 =1 | valueinmi9 =1 | valueinmi10 =1, [sbubbleinfo = sbubblebeginning + smi4 + sspacemi4 + smi5 + sspacemi5 + smi6 + sspacemi6 + smi7 + sspacemi7 + smi8 + sspacemi8 + smi9 + sspacemi9 + smi10 + sspacemi10 + sopnumberbeginning + drs_str(2,opnumber) + sclose_prn sbubbleinfo , e$] if valueinmi4 = 0 & valueinmi5 = 0 & valueinmi6 = 0 & valueinmi7 = 0 & valueinmi8 = 0 & valueinmi9 = 0 & valueinmi10 = 0, [sbubbleinfo = sopen_prn + sopnumberbeginning + drs_str(2,opnumber) + sclose_prn sbubbleinfo , e$] ] sprv_sbubbleinfo = sbubbleinfo

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