cncgotoguy

Verified Members
  • Content count

    17
  • Joined

  • Last visited

Community Reputation

0 Neutral

About cncgotoguy

  • Rank
    Member

Profile Information

  • Gender
    Male
  • Interests
    Rock climbing, process improvement, computers, etc.

Uncategorized

  • Location
    Sherwood, OR
  1. 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
  2. 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"
  3. cncgotoguy

    Character counts

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

    Character counts

    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
  5. 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
  6. 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 %
  7. 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
  8. cncgotoguy

    Buffer Files - How they work explained

    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
  9. 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 #
  10. cncgotoguy

    Lathe Post Variable - Tool Station Number

    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
  11. 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
  12. I set up my Misc Values to have an entry for bubble number. (mi4$) When there is a value in there, I want to write it and other tool and operational values to the buffer file and output as txt file. I've gotten it to output farely well, but I put the pbufferfile post block I created right after psof$, ptlchg0$, ptlchg$. It doesn't put the correct operational info for the first operation and the depths are off by a count of 1. Could someone help me get on the right direction to getting this data to output correctly? This is what I have so far: size8 : 0 rc8 : 1 wc8 : 1 str8 : "" #Empty string to be input for buffer write fbuf 8 1 256 0 1 pbufferfile size8 = rbuf(8, 0) #Reading record zero initializes buffer str8 = drs_str(2, mi5$) + " | " + drs_str(2,g_wcs) + " | " drs_str(2, mi4$) + " | " + drs_str(2, t$) + " | " + strtool$ + " | " + drs_str(2, speed) + " | " + drs_str(2, feed) + " | " + drs_str(2,depth$) + " | " + snamenc$ + " | " + drs_str(2,g_wcs) + " | " + drs_str(2,zabs) + " | " + drs_str(2,zinc) + " | " + drs_str(2,depth$) + " | " + drs_str(2,tool_op$) + " | " + drs_str(2,op_id$) + " | " str8 = wbuf(8, wc8) Which gives me: OP#_100 | G0 | | T1 | 5/16 CARBIDE DRILL | S1000 | F0. | depth$ -3. | MASTERCAM DATA FOR IPIR PULL | G0 | Z0. | Z0. | depth$ -3. | tool_op$ 2. | op_id$ 1. | OP#_200 | G56 | | T2 | 1/2 CARBIDE DRILL | S7500 | F1. | depth$ -1. | MASTERCAM DATA FOR IPIR PULL | G56 | Z1. | Z-1.1 | depth$ -1. | tool_op$ 2. | op_id$ 2. | OP#_210 | G56 | | T2 | 1/2 CARBIDE DRILL | S7500 | F112.5 | depth$ -2. | MASTERCAM DATA FOR IPIR PULL | G56 | Z1. | Z-2.1 | depth$ -2. | tool_op$ 2. | op_id$ 3. | OP#_300 | G56 | | T3 | 2.2 MM DRILL | S4000 | F112.5 | depth$ -2.1 | MASTERCAM DATA FOR IPIR PULL | G56 | Z1. | Z-2.2 | depth$ -2.1 | tool_op$ 2. | op_id$ 4. |
  13. cncgotoguy

    Buffer won't take string value

    Thank you very much for the help. That solved my problem.
  14. I'm trying to output data into .txt file for use in our intranet system. I can pull most variables just fine, but some won't work. This is my code that works: size8 : 0 rc8 : 1 wc8 : 1 str8 : "" #empty string to be input for buffer write fbuf 8 1 256 0 0 size8 = rbuf(8,0) #reading record zero initializes buffer str8 = drs_str(2, mi4$) + " | " + drs_str(2, mi4$) + " | " + drs_str(2, Tool_var2) + " | " + drs_str(2, t$) + " | " + drs_str(2, speed) + " | " + drs_str(2, feed) + " | " str8 = wbuf(8, wc8) When I try to add drs_str(2, snamenc$) I get the error: (21 May 2015 09:47:11 AM - <2> - PST LINE (1007) - The arguments for this operator/function are not the same type (var/string)[9]) Could someone steer me towards getting the tool description to output to my buffer text file?
  15. Thanks so much, it got us started, but we were a little confused on what the following means: drs_str(2, t$) Also, how do you get the file name to automatically be named either the mastercam file name or some other variable of our choice? We try to put a variable in where the t$ is and it doesn't work. Is that just for integers, or can we put a string or variable in there? Each tool is going to have a description. How and where do we put the logic in the post to get this to capture and add lines in the buffer file?

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