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:

Dragun

Verified Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Dragun

  1. On 2/28/2020 at 4:28 PM, pro grammer said:

    This is how my .set outputs:

     

    ----------------------------------------------
     
    PROGRAM NAME   = 12446386-REV-B-OP4
    PROGRAM NUMBER = 0004
    DATE PROCESSED = FEB. 28 2020
    TIME           = 3:25 PM
    MATERIAL TYPE  = 4140 HT PRETURNED
    ----------------------------------------------

     

    The only problem with that for me is it is way too much info. In a thirty tool program this could put out a book!. I am trying to make them as short and sweet as possible. Any info I deem pertinent I will type in. I did modify it to spit out the spindle speed also. We have a small shop.  I don't have to worry about programming for "operators."
     

     

  2. PN = 661-20-14-0414 R00 OP1    DATE = 02-19-20   ALUMINUM inch - 6061  SIZE
    N10  T1  3 INCH FACE MILL  OP1   D3.0000  FR50.   CONTOUR   DOC +0.0000
    N20  T2  3/4 3FLUTE CARBIDE  OP1   D.7500  FR35.   CONTOUR   DOC -1.5100
    N30  T3  3/8 90 DRILL MILL  OP1   D.3750  FR4.   DRILL   DOC -0.1250
         T3  3/8 90 DRILL MILL  OP1   D.3750  FR4.   CONTOUR   DOC -0.0380
    N40  T4  #39 DRILL .0995  OP1   D.0995  FR2.5   DRILL   DOC -0.4050
    N50  T5   NO. 4-40 FORM TAP  OP1   D.1120  FR2.5   DRILL   DOC -0.3000
    N60  T6  1/4 60 DEGREE ENGRAVER  OP1   D.2500  FR45.   CONTOUR   DOC -0.0050

     

    The reason I want it to look like this is because I don't use line labels in programs. I want the tools labeled from  N10 so it doesn't matter what tool is called.  If it is N10 it is the first tool. If it is N70 it is the seventh tool no matter the tool number. It also takes me past the tool staging when searching the programs.  These would be the same line labels in the programs.

    • Like 1
  3. I worked long and hard on this, here is the whole thing if anyone wants it.

     

    [POST_VERSION] #DO NOT MOVE OR ALTER THIS LINE# V22.00 P0 E1 W22.00 T1579185598 M22.00 I0 O0
    # Post Name           : Mill.set (this file edited by J.Dragun 1/21/2020
    # MODIFIED            : BY JD 2/18/2020 2:10
    # Product             : Mill
    # Machine Name        : Generic
    # Control Name        : Generic
    # Description         : Generic setup sheet for Mill X
    # 4-axis/Axis subs.   : No
    # 5-axis              : No
    # Executable          : MP 19.0
    #
    # WARNING: THIS POST IS GENERIC AND IS INTENDED FOR MODIFICATION TO
    # THE MACHINE TOOL REQUIREMENTS AND PERSONAL PREFERENCE.
    # LINE 825 IS PUTTING OUT ALL THE INFO ON THE SETUP SHEET
    # --------------------------------------------------------------------------
    # Revision log:
    # --------------------------------------------------------------------------
    # CNC 04/28/05  -  Initial Setup for Version X.
    # CNC 11/15/05  -  Modified header section and layout, added new functionality
    # CNC 01/20/06  -  Fixed buffer logic to correctly handle null toolchanges
    # CNC 02/17/06  -  Added opcomment string reset in pcomment2
    #               -  Modified stock to leave to seperate 2D toolpath (XY and Z) from surface
    #                    toolpaths (Drive surface and Check surface)
    # CNC 02/22/06  -  Added check for "Write NC Operation Information" output error popup if not enabled in CD
    #               -  Reworked information output by various tool paths. Added surface machining operation name
    # CNC 03/14/06  -  Fixed typo in pwritbuf2. Modified pdrillcyc to use nextdc$ rather than drillcyc$
    # CNC 04/10/06  -  Modified output for surface high speed machining operations.
    # CNC 06/26/06  -  Initial post update for Mastercam X2
    # CNC 08/07/07  -  Fixed CDC Buffer read logic.
    # CNC 10/31/07  -  Added sub_level$ override to pprep$
    # CNC 12/18/07  -  Modified EOB (End of Block) in pprep$ postblock
    # CNC 04/08/08  -  X3 release - no changes made
    # CNC 01/22/09  -  Initial post update for Mastercam X4
    # CNC 02/03/10  -  Initial post update for Mastercam X5
    # CNC 08/17/10  -  Removed CD_VAR variables
    # CNC 05/20/11  -  Initial post update for Mastercam X6
    # CNC 10/16/12  -  Initial post update for Mastercam X7
    # CNC 03/22/13  -  Rewrite High Speed String Selector
    # CNC 02/06/14  -  Initial post update for Mastercam X8
    # CNC 12/23/14  -  Initial post update for Mastercam X9
    # CNC 11/09/15  -  Initial post update for Mastercam 2017
    # CNC 12/29/15  -  Replaced Operation description string selector with lookup table based on tool_op$
    #
    # --------------------------------------------------------------------------
    # Features:
    # --------------------------------------------------------------------------
    # This post supports output for 3 and 4 axis milling.
    # It is designed to support the features of Mastercam X Mill.
    #
    # NEW FEATURES FOR X:
    # - Supports X comments including machine name, group name and group comment output (see pcomment2)
    #     Output of these comments is controlled by setting outputxcom in the Optional Output Settings area.
    # - Enhanced output control via post switches (see Optional Output Settings area)
    #
    # --------------------------------------------------------------------------
    # Misc. Values:
    # --------------------------------------------------------------------------
    # Integers:
    #
    # mi1 - mi10 (NOT USED)
    #
    # Reals:
    #
    # mr1 - mr10 (NOT USED)
    #
    # --------------------------------------------------------------------------
    # Additional Notes:
    # --------------------------------------------------------------------------
    # File extension (.doc) is set internally in MP.  Use pprep$ postblock to override this setting.
    #
    # Rapid traverse times are determined by maximum rapid feedrates set in the selected Machine Definition
    # Time estimates will be wrong if these settings are incorrect.
    #
    # END_HEADER$
    #
    # --------------------------------------------------------------------------
    # Debugging and Factory Set Program Switches
    # --------------------------------------------------------------------------
    # Define constants
    m_one        := -1
    zero         := 0
    one          := 1
    two          := 2
    three        := 3
    four         := 4
    five         := 5
    c9k          := 9999
    m_c9k        := -99999

    bug1$        : 2     #0=No display, 1=Generic list box, 2=Editor
    bug4$        : 1     #Debug output with the tilde '~'.
                         #A value greater the zero applies the variable formatting with
                         #debug output (default is typically FS 1 but not a guarantee).
                         #A value of zero gets the value directly with NO formatting.

    linktolvar$  : 0     #Associate X tolerance variables to V9- variable?
    linkplnvar$  : 1     #Associate X plane specific variables to V9- variable?

    skp_lead_flgs$ : 0   #Do NOT use v9+ style contour flags
    get_1004$    : 0     #Find gcode 1004 with getnextop?
    rpd_typ_v7$  : 0     #Use Version 7 style contour flags/processing?
    strtool_v7$  : 2     #Use Version 7+ toolname?
    tlchng_aft$  : 2     #Delay call to toolchange until move line
    cant_tlchng$ : 1     #Ignore cantext entry on move with tlchng_aft
    newglobal$   : 1     #Error checking for global variables
    getnextop$   : 1     #Build the next variable table
    tooltable$   : 3     #Pre-read, call the pwrtt postblock (DO NOT CHANGE!)

    # --------------------------------------------------------------------------
    # General Output Settings
    # --------------------------------------------------------------------------
    linarc$      : yes$  #Linearize arcs? (DO NOT CHANGE!)
    progname$    : 1     #Use uppercase for program name (sprogname)

    # --------------------------------------------------------------------------
    # Optional Output Settings
    # --------------------------------------------------------------------------
    output_comments : no$  #Output Operation Comments in tool list?

    outputxcom   : no$  #Output new X comments? (Machine name, Group comment, Group name)

    xyz_limits   : 3     #Output Max/Min X,Y,Z information?
                         #0 = Do NOT output ANY Max/Min X,Y,Z information.
                         #1 = Output Max/Min X,Y,Z info. ONLY for EACH tool (not Program)
                         #2 = Output Max/Min X,Y,Z info. ONLY for entire Program
                         #3 = Output Max/Min X,Y,Z info. for EACH tool AND Program (if > 1 tool)

    # Individual axis output (if xyz_limits > 0)
    X_limits     : no$  #Output Max/Min values for the X axis?
    Y_limits     : no$ #Output Max/Min values for the Y axis?
    Z_limits     : yes$  #Output Max/Min values for the Z axis?

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

    time_est     : 3     #Output operation and/or cycle times?
                         #0 = Do NOT output time estimates (including det_time estimates below)
                         #1 = Output operation time ONLY for EACH tool (not Program)
                         #2 = Output comeplete cycle time ONLY for entire Program
                         #3 = Output operation time for EACH tool AND cycle time for Program (if > 1 tool)

    # The 'det_time' switch allows selecting the output 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     : 3     #Output Rapid/Feedrate times? (Requires time_est > 0)
                         #0 = Do NOT output ANY Rapid/Feedrate time breakdown.
                         #1 = Output Rapid/Feedrate times ONLY for EACH tool (not Program)
                         #2 = Output Rapid/Feedrate times ONLY at end for entire program
                         #3 = Output Rapid/Feedrate times for EACH tool AND Program (if > 1 tool)

    fr_limits    : 3     #Output Max/Min Feedrate information?
                         #0 = Do NOT output ANY Max/Min Feedrate information.
                         #1 = Output Max/Min Feedrate info. ONLY for EACH tool (not Program)
                         #2 = Output Max/Min Feedrate info. ONLY at end for entire program
                         #3 = Output Max/Min Feedrate info. for EACH tool AND Program (if > 1 tool)

    show_lengths : 3     #Output Feed/Rapid path length information?
                         #0 = Do NOT output ANY Feed/Rapid path length information.
                         #1 = Output Feed/Rapid path length info. ONLY for EACH tool (not Program)
                         #2 = Output Feed/Rapid path length info. ONLY at end for entire program
                         #3 = Output Feed/Rapid path length info. for EACH tool AND Program (if > 1 tool)

    stock_info        : yes$  #Display stock material and size/location?
    show_tool_mfg     : yes$  #Output the tool definition - 'manufacturer' data?
    show_chuck_name   : yes$  #Output the tool definition - 'chuck name' data?
    show_tool_details : yes$  #Output tool details information (20000's data)?

    # --------------------------------------------------------------------------
    # Common User-defined Variable Initializations (not switches!)
    # --------------------------------------------------------------------------
    drlgsel      : -1    #Selector variable for drill cycle string
    tol          : 0.0001#Tolerence for feed rates set to zero
    ttltime      : 0     #Total operation time
    tltime       : 0     #Feed time
    trtime       : 0     #Rapid time
    total        : 0     #Total machine 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
    result       : 0     #Test Variable
    comp         : 0     #CDC status from pre-scan (see 'look4comp')
    comp_cc      : 0     #CDC status from pre-scan (see 'look4comp')
    comp_cc_computer : 0 #CDC status from pre-scan (see 'look4comp')
    look4comp    : yes$  #Buffer null toolchanges to search for comp (yes or no)
    tool_end     : no$   #End flag when scanning for CDC settings at Null tlchgs
    cdc_found    : no$   #Was an active CDC setting found during scan
    sof          : 1     #Start of file flag
    use_across   : 0     #Use across distance? (True/False)
    hmm_type     : 0     #High speed machining style

    # --------------------------------------------------------------------------
    #String and string selector definitions for NC output
    # --------------------------------------------------------------------------
    #Seperator lines
    sepline      : "--------------------------------------------------------------"
    sepline2     : "========================================="
    sepline3     : "=============================================================="

    #Comment strings
    snull        : ""    #Null string
    smachname    : ""    #Machine name
    sgrpcomm     : ""    #Group comment
    sgrpname     : ""    #Group name
    sopcomment   : ""    #Operation comment
    stlopnote    : ""    #Operation type

    #String variables to hold 'sparameter' string data
    stl_mfg_com  : ""    #'tool mfg comment' from tool
    stl_chuck_com : ""   #'tool chuck comment' from tool

    # --------------------------------------------------------------------------
    # Error messages
    # --------------------------------------------------------------------------

    # --------------------------------------------------------------------------
    # Lookup tables
    # --------------------------------------------------------------------------
    #region Operation Type tool_op$ codes
    #
    # Operation type note based on tool_op$ codes
    # tool_op$ is in string form to allow for an exact match (i.e., not closest match)
    #       "DESCRIPTION"                                        tool_op$ value
    #
    flktbl  1                                                    92  #Table number, number of entries in table
            "CONTOUR"                                            "1"
            "DRILL"                                              "2"
            "POCKET"                                             "3"
            "TRANSFORM OPERATION"                                "4"
            "MULTISURFACE ROUGH PARALLEL"                        "5"
            "MULTISURFACE ROUGH RADIAL"                          "6"
            "MULTISURFACE ROUGH PROJECT"                         "7"
            "MULTISURFACE ROUGH FLOWLINE"                        "8"
            "MULTISURFACE ROUGH CONTOUR"                         "9"
            "MULTISURFACE ROUGH POCKET"                          "10"
            "MULTISURFACE FINISH PARALLEL"                       "11"
            "MULTISURFACE FINISH RADIAL"                         "12"
            "MULTISURFACE FINISH PROJECT"                        "13"
            "MULTISURFACE FINISH FLOWLINE"                       "14"
            "MULTISURFACE FINISH CONTOUR"                        "15"
            "FOR C-HOOK- CREATED OPERATIONS"                     "16"
            "MANUAL ENTRY"                                       "17"
            "CIRCLE MILL"                                        "18"
            "POINT"                                              "19"
            "TRIMMED"                                            "20"
            "RULED"                                              "21"
            "REVOLVED"                                           "22"
            "LETTERS"                                            "23"
            "SWEPT 2D"                                           "24"
            "SWEPT 3D"                                           "25"
            "COONS"                                              "26"
            "LOFTED"                                             "27"
            "5-AXIS DRILLING"                                    "28"
            "5-AXIS CURVE"                                       "29"
            "PROJECT TOOLPATH ONTO A PLANE"                      "30"
            "PROJECT TOOLPATH ONTO A CYLINDER"                   "31"
            "PROJECT TOOLPATH ONTO A SPHERE"                     "32"
            "PROJECT TOOLPATH ONTO A CONE"                       "33"
            "PROJECT TOOLPATH ONTO A CROSS SECTION"              "34"
            "PROJECT TOOLPATH ONTO A SURFACE"                    "35"
            "NON-ASSOCIATIVE CONTOUR"                            "36"
            "NON-ASSOCIATIVE DRILLING"                           "37"
            "NON-ASSOCIATIVE POCKETING"                          "38"
            "MULTISURFACE FINISH PENCIL TRACE"                   "39"
            "MULTISURFACE FINISH LEFTOVER STOCK"                 "40"
            "MULTISURFACE FINISH STEEP"                          "41"
            "MULTISURFACE FINISH SHALLOW"                        "42"
            "MULTISURFACE FINISH CONSTANT SCALLOP"               "43"
            "MULTISURFACE ROUGH PLUNGE"                          "44"
            "MULTISURFACE FINISH 5-AXIS FLOWLINE"                "45"
            "MULTISURFACE FINISH 4-AXIS"                         "46"
            "MERGED IN ASCII NCI"                                "47"
            "5-AXIS SWARF"                                       "48"
            "5-AXIS ROLL DIE"                                    "49"
            "THREAD MILL"                                        "100"
            "EDIT COMMON OPERATION PARAMETERS"                   "101"
            "FACING"                                             "102"
            "ASSOCIATIVE TRIMMED"                                "103"
            "SOLID DRILL CONTROL OPERATION"                      "104"
            "SLOT MILL"                                          "105"
            "HELIX BORE"                                         "106"
            "MULTI-SURFACE ROUGH RESTMILL"                       "107"
            "ASSOCIATIVE NESTING CONTAINER OPERATION"            "108"
            "MULTI-SURFACE FINISH BLEND"                         "109"
            "MULTI-SURFACE 5AXIS, ROUGH"                         "110"
            "SLICE 5AXIS"                                        "111"
            "PORT 5AXIS"                                         "112"
            "5-AXIS CIRCLE"                                      "113"
            "TAB CUTOFF"                                         "130"
            "MULTI-SURFACE ROUGH POCKET, LIGHT"                  "131"
            "HIGH-SPEED SURFACE TOOLPATHS"                       "132"
            "NESTING ONIONSKIN OPERATION"                        "133"
            "2-D HARDMILL MACHINING/PEEL MILL"                   "134"
            "FBM DRILL CONTROL OPERATION"                        "136"
            "FBM MILL POCKET OPERATION"                          "137"
            "FBM MILL CONTOUR OPERATION"                         "138"
            "SOLID MODEL OPERATION"                              "139"
            "PROBE CYCLE: PROBE MOTION"                          "150"
            "PROBE CYCLE COMMAND BLOCK"                          "151"
            "PROBE CYCLE HEADER"                                 "152"
            "PROBE CYCLE TRAILER"                                "153"
            "SAFETYZONE LINKING OR MULTIAXIS LINKING OPERATION"  "154"
            "ENGRAVING"                                          "416"
            "SAW"                                                "135"
            "BLOCK DRILL"                                        "306"
            "ART"                                                "439"
            "ADVANCED MULTIAXIS-SWARF"                           "441"
            "ADVANCED MULTIAXIS-MORPH"                           "442"
            "ADVANCED MULTIAXIS-PARALLEL"                        "443"
            "ADVANCED MULTIAXIS-ALONG CURVE"                     "444"
            "ADVANCED MULTIAXIS-TRIANGULAR MESH"                 "445"
            "ADVANCED MULTIAXIS-ROUGHING"                        "446"
            "ADVANCED MULTIAXIS-PROJECT"                         "447"
            "CONVERT TO 5AXIS"                                   "448"
            "PORT EXPERT"                                        "449"
            "BLADE EXPERT"                                       "450"
            "ROTARY ADVANCED"                                    "451"
    #endregion

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

    # --------------------------------------------------------------------------
    var1         : 0 #Varialbe for tool no. block number added 2/24/2014 JD
    var2         : 0     #added by JD
    var3         : 0 #added by JD

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

     

    # String select tables
    # --------------------------------------------------------------------------
    #Select drill operation note
    sdr00   : "SIMPLE"       #drill - no dwell
    sdrd0   : "COUNTERBORE"  #drill - with dwell
    sdr01   : "PECK"         #peck drill - no dwell
    sdrd1   : "PECK"         #peck drill - with dwell
    sdr02   : "CHIP BREAK"   #chip break - no dwell
    sdrd2   : "CHIP BREAK"   #chip break - with dwell
    sdr03   : "TAP"          #tap - right hand
    sdrd3   : "TAP"          #tap - left hand
    sdr04   : "SIMPLE BORE"  #bore #1 - no dwell
    sdrd4   : "BORE W/DWELL" #bore #1 - with dwell
    sdr05   : "BORE W/STOP"  #bore #2 - no dwell
    sdrd5   : "BORE W/STOP"  #bore #2 - with dwell
    sdr06   : "MISC_1"       #misc #1 - no dwell
    sdrd6   : "MISC_1"       #misc #1 - with dwell
    sdr07   : "MISC_2"       #misc #2 - right hand
    sdrd7   : "MISC_2"       #misc #2 - left hand
    sdrillcyc : ""           #Target string

    fstrsel sdr00 drlgsel sdrillcyc 16 -1
    # --------------------------------------------------------------------------
    #Surface high speed machining style selector
    shmm0   : "CORE ROUGHING"
    shmm1   : "AREA CLEARANCE"
    shmm2   : "WATERLINE"
    shmm3   : "SCALLOP"
    shmm4   : "HORIZONTAL AREA"
    shmm5   : "RASTER"
    shmm6   : "PENCIL"
    shmm7   : "HYBRID"
    shmm8   : ""#Place Holder
    shmm9   : "SPIRAL"
    shmm10  : "RADIAL"
    shmm11  : "REST ROUGHING"
    shmm12  : "OPTIAREA"
    shmm13  : "OPTICORE"
    shmm14  : "OPTIREST"
    shmm15  : "PROJECT"
    shmm    : ""         #Target string

    fstrsel shmm0 hmm_type shmm 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 : ""         #Target string

    fstrsel stk0 stck_crnr$ stknote 9 -1
    # --------------------------------------------------------------------------
    #Month selector
    smon0   : ""
    smon1   : "JAN."
    smon2   : "FEB."
    smon3   : "MAR."
    smon4   : "APR."
    smon5   : "MAY."
    smon6   : "JUN."
    smon7   : "JUL."
    smon8   : "AUG."
    smon9   : "SEP."
    smon10  : "OCT."
    smon11  : "NOV."
    smon12  : "DEC."
    smonth  : ""         #Target string

    fstrsel smon0 month$ smonth 13 -1
    # --------------------------------------------------------------------------
    # Format statements - n=nonmodal, l=leading, t=trailing, i=inc, d=delta
    # --------------------------------------------------------------------------
    fs2  1  0.4 0.3      #Decimal, absolute, 4/3 place, default for initialize (:)
    fs2  2  0.4 0.3n     #Decimal, absolute, 4/3 place, non-modal
    fs2  3  1 0 1 0n     #Integer, not leading, non-modal
    fs2  4  0.2 0.2n     #Decimal, absolute, 2 place, non-modal
    fs2  5  1.4 1.3ltn   #Decimal, absolute, 4/3 place, leading&trailing, non-modal
    fs2  6 +1.4 1.3ltn   #Decimal, absolute, 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, omit decimal if whole number, non-modal
    fs2  9  4 0 4 0l     #Integer, force four leading

    # These formats used for 'Date' & 'Time'
    fs2 17  1 0 1 0      #Integer, not leading
    fs2 18  2.2 2.2lt    #Decimal, force two leading & two trailing (time2)
    fs2 19  2 0 2 0t     #Integer, force trailing                   (hour)
    fs2 20  0 2 0 2lt    #Integer, force leading & trailing         (min)

    # --------------------------------------------------------------------------
    # Format assignments
    # --------------------------------------------------------------------------
    fmt     9   progno$     #Program number
    fmt     8  var3     #added by JD
    fmt     8  var2    #ADDED BY JD
    fmt    "N" 8  var1       #Added for tool block number 2/24/2014 JD
    fmt     3   t$          #Tool number
    fmt     7   tldia$      #Tool diameter
    fmt     7   tcr$        #Tool corner radius
    fmt     3   tloffno$    #Diameter offset number
    fmt     3   tlngno$     #Length offset number
    fmt     3   ss$         #Spindle speed
    fmt     4   fr_pos$     #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     2   total       #Total part time
    fmt     2   ttltime     #Total operation time
    fmt     3   thrs        #Time in hours
    fmt     3   tmin        #Time in minutes
    fmt     8   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
    # -------------------------------------------------------------------------
    # Variables to hold info read from 'additional parameters'
    fmt     2   stock       #Amount of stock to leave
    fmt     2   zstock      #Amount of stock to leave
    fmt     2   drive_stock #Amount of stock to leave on drive surfaces
    fmt     2   check_stock #Amount of stock to leave on check surfaces
    fmt     2   wall_stock  #High speed machining - stock to leave on walls
    fmt     2   floor_stock #High speed machining - stock to leave on floors
    fmt     2   rgh_ang     #Roughing angle
    fmt     2   rgh_step    #Roughing step size
    fmt     2   num_fin     #Number of finish passes
    fmt     2   fin_step    #Finish pass step size
    fmt     2   fin_stk     #Finish allowance
    fmt     2   across      #Across distance
    fmt     2   along       #Along distance
    fmt     2   cut_dir     #Cutting direction: 0 = along, 1 = across
    fmt     2   use_cdev    #Use chordal deviation (0 = no, 1 = yes)
    fmt     2   chdev       #Chordal deviation
    fmt     2   total_tol   #Total tolerance - HMM toolpaths
    fmt     2   step_down   #Stepdown distance
    fmt     2   across_dist   #Across cut: distance
    fmt     2   across_height #Across cut: scallop height
    # --------------------------------------------------------------------------
    # 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
    # --------------------------------------------------------------------------
    #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
    # --------------------------------------------------------------------------
    fmt     17  year2       #Calculated year value
    fmt     18  time2       #Capture 24-hour time value into 'time2' variable
    fmt     19  hour        #Hour
    fmt     20  min         #Minutes
    year2 = year$ + 2000

    # --------------------------------------------------------------------------
    # Tool Comment / Manual Entry Section
    # --------------------------------------------------------------------------
    pcomment$        #Comment from manual entry (must call pcomment2)
          pcomment2  #Required if doing boolean 'if' logic testing!

    pcomment2        #Output Comment from manual entry
          sopcomment = snull
          scomm$ = ucase(scomm$)
          if gcode$ = 1051, smachname = scomm$   #Machine name
          if gcode$ = 1052, sgrpcomm = scomm$    #Group comment
          if gcode$ = 1053, sgrpname = scomm$    #Group name
          if gcode$ = 1008, sopcomment = scomm$  #Operation comment

    pdrillcyc        #Output drillcycle type note if canned cycle was programmed
          if opcode$ = three,
            [
            ' - ', #Separator between op type & specific drill cycle type
            if nextdc$ = three | nextdc$ = 7, drlgsel = fsg1(-ss$) + nextdc$ * two
            else, drlgsel = fsg2(dwell$) + nextdc$ * two
            if drlgsel > 15,  #Custom canned cycle was programmed
              [
              custcycle = drlgsel - 7  #Shift it
              "CUSTOM CYCLE ", 35, *custcycle
              ]
            else, *sdrillcyc
            ]

    pprm_0           #Run parameter table
          if opcode$ = 1 | opcode$ = 2, pprm_1  #2D/3D Contour
          if opcode$ = 4, pprm_4    #Pocket
          if opcode$ = 5, pprm_5    #Ruled
          if opcode$ = 6, pprm_6    #2D Swept
          if opcode$ = 7, pprm_7    #3D Swept
          if opcode$ = 8, pprm_8    #Revolution
          if opcode$ = 9, pprm_9    #Loft
          if opcode$ = 10, pprm_10  #Coons
          if opcode$ = 13, pprm_13  #Surface Finish
          if opcode$ = 14, pprm_14  #Surface Rough
          if opcode$ = 19, pprm_19  #Face

    pprm_1           #Output Parameters for 2D/3D Contour
          # "STOCK TO LEAVE (XY)= ", *stock, e$
           #"STOCK TO LEAVE (Z) = ", *zstock, e$

    pprm_4           #Output Parameters for Pocket
          #"STOCK TO LEAVE (XY)= ", *stock, e$
        #  "STOCK TO LEAVE (Z) = ", *zstock, e$
         # "ROUGHING ANGLE = ", *rgh_ang, e$
         # "ROUGHING STEP SIZE = ", *rgh_step, e$
          #"NUMBER OF FINISH PASSES = ", *num_fin, e$
        #  "FINISH PASS STEP SIZE = ", *fin_step, e$
         # "FINISH ALLOWANCE = ", *fin_stk, e$

    pprm_5           #Output Parameters for Ruled
          #"STOCK TO LEAVE = ", *stock, e$
         # "ACROSS DISTANCE = ", *across, e$

    pprm_6           #Output Parameters for 2d Swept
         # "STOCK TO LEAVE = ", *stock, e$
        #  "ACROSS DISTANCE = ", *across, e$

    pprm_7           #Output Parameters for 3d Swept
         # "STOCK TO LEAVE = ", *stock, e$
          #"ALONG DISTANCE = ", *along, e$
         # "ACROSS DISTANCE = ", *across, e$
          #"CUTTING DIRECTION: (0 = ALONG, 1 = ACROSS) = ", *cut_dir, e$

    pprm_8           #Output Parameters for Revolve#
        #  "STOCK TO LEAVE = ", *stock, e$
        #  "STEP SIZE = ", *fin_step, e$

    pprm_9           #Output Parameters for Loft
        # "STOCK TO LEAVE = ", *stock, e$
          #"ALONG CUT DISTANCE = ", *along, e$
         # "ACROSS CUT DISTANCE = ", *across, e$

    pprm_10          #Output Parameters for Coons
         # "STOCK TO LEAVE = ", *stock, e$
          #"ALONG CUT DISTANCE = ", *along, e$
          #"ACROSS CUT DISTANCE = ", *across, e$
          #"CUTTING DIRECTION: (0 = ALONG, 1 = ACROSS) = ", *cut_dir, e$

    pprm_13          #Output Parameters for Msurf Finish
          if tool_op$ = 132,  #Surface High Speed
            [
         #   "STOCK TO LEAVE ON WALLS = ", *wall_stock, e$
          #  "STOCK TO LEAVE ON FLOORS = ", *floor_stock, e$
           # "TOTAL TOLERANCE = ", *total_tol, e$
            ]
          else,
            [
            #"STOCK TO LEAVE ON DRIVE SURFACES = ", *drive_stock, e$
           # "STOCK TO LEAVE ON CHECK SURFACES = ", *check_stock, e$
           # "TOTAL TOLERANCE = ", *chdev, e$
            ]
          #Parallel, Parallel Steep, Shallow, Leftover, Scallop or Blend
          #if tool_op$ = 11 | tool_op$ = 41 | tool_op$ = 42 | tool_op$ = 40 |
           # tool_op$ = 43 | tool_op$ = 109, "MAXIMUM STEPOVER DISTANCE = ", *fin_step, e$
          if tool_op$ = 14,  #Flowline
            [
          #  if use_across, "STEPOVER DISTANCE = ", *across_dist, e$
            else, "SCALLOP HEIGHT = ", *across_height, e$
            ]
          if tool_op$ = 15, "MAXIMUM STEPDOWN DISTANCE = ", *step_down, e$  #Contour

    pprm_14          #Output Parameters for Msurf Rough
          "STOCK TO LEAVE ON DRIVE SURFACES = ", *drive_stock, e$
          "STOCK TO LEAVE ON CHECK SURFACES = ", *check_stock, e$
          "TOTAL TOLERANCE = ", *chdev, e$
          #Parallel or Plunge
          if tool_op$ = 5 | tool_op$ = 44, "MAXIMUM STEPOVER DISTANCE = ", *rgh_step, e$
          #Parallel, Restmill or Pocket
          if tool_op$ = 5 | tool_op$ = 107 | tool_op$ = 10,
            "STEPOVER DISTANCE = ", *rgh_step, e$
          if tool_op$ = 8,  #Flowline
            [
            if use_across, "STEPOVER DISTANCE = ", *across_dist, e$
            else, "SCALLOP HEIGHT = ", *across_height, e$
            ]
          "MAXIMUM STEPDOWN DISTANCE = ", *step_down, e$

    pprm_19          #Output Parameters for Facing
          "STOCK TO LEAVE = ", *stock, e$
          "STEP SIZE = ", *fin_step, e$

    ptool_details    #Output requested tool details (20004, 20005, 20006, 20007 type)
          # 20004 = tool definition - 'tool parameters' data
          # 20005 = tool definition - 'DRILL type tool' parameters
          # 20006 = tool definition - 'MILL type tool' parameters
          # 20007 = tool definition - 'MILL type tool HOLDER' parameters
          #if opcode$ <> three, "NUMBER OF FLUTES = ", *tl_num_flutes, e$  #If NOT a canned cycle (drill) type toolpath
          else, "DRILL TIP ANGLE = ", *tl_tip_angle, e$  # If IS a canned cycle (drill) type toolpath(/suppressed J.D.)
          #"FLUTE LEN.    = ", *tl_flute_len, e$(suppresed this and next three lines.
          #"OVERALL LEN.  = ", *tl_overall_len, e$
          #"SHOULDER LEN. = ", *tl_shld_len, e$
          #"ARBOR DIA.    = ", *tl_arbor_dia, e$
          #"HOLDER DIA.   = ", *tl_holder_dia, e$

    # --------------------------------------------------------------------------
    # Start of File and Toolchange Setup
    # --------------------------------------------------------------------------
    ptimecalc        #Convert 24-hour time format into 12-hour AM/PM format
          if time$ >= 13, time2 = (time$ - 12)
          else, time2 = time$
          hour = int(time2), min = frac(time2)
          *hour, ":", *min,
          if time$ > 12, " PM"
          else, " AM"

    pheader$         #Call before start of file
          if pst_rpd_fr$ <= 0, pst_rpd_fr$ = 300  #Make it greater than ZERO !
          tmax_fr = fr_pos$  #Initialize (max fr used in current tool)
          tmin_fr = fr_pos$  #Initialize (min fr used in current tool)
          pmax_fr = fr_pos$  #Initialize (max fr used in program)
          pmin_fr = fr_pos$  #Initialize (min fr used in program)
         # "CUSTOMIZABLE MILL SETUP SHEET - MILL.SET", e$
         # sepline2, e$
        # " ", e$  #Blank line
          "PN = ", *sprogname$,"   ", " DATE = ", month$, "-", day$, "-", year$,"   ", stck_matl$, "  ", "SIZE",e$ #(CHANGED PART PROGRAM TO PN JD ADDED DATE)
                #if progno$ > zero, "PROGRAM NUMBER = ", *progno$, e$
                
          #Date/Time output
         # "DATE = ", month$, "-", day$, "-", year$, e$   #Date output as month,day,year - Ex. 02-12-05
         #"DATE PROCESSED = ", *smonth, " ", day$, " ", *year2, e$  #Date output as month,day,year - Ex. Feb. 12
          #"DATE PROCESSED (DD-MM-YY) = ", date$, " TIME(HH:MM) = ", time$, e$  #Date and time output Ex. 12-02-05 15:52
          #"TIME           = ", time$, e$                           #24 hour time output - Ex. 15:52
         # "TIME           = ", ptimecalc, e$                        #12 hour time output 3:52 PM
          pstock_info  #Stock information output

    psof0$           #Start of file for tool zero
          psof$

    psof$            #Start of file for non-zero tool number
          psetup   #Call for toolchange info output
          sof = 0  #Reset start of file flag
          !op_id$

    ptlchg0$         #Call from NCI null tool change (tool number repeats)
          !gcode$
          if op_id$ <> prv_op_id$, ptlchg$
          !op_id$

    ptlchg$          #Tool change - Output of time calculations for the last tool run
          if op_id$ = prv_op_id$, ex$
          ptooldata          #Total ending data for tool (Path Length and Times)
          tmax_fr = fr_pos$  #Initialize (max fr used in current tool)
          tmin_fr = fr_pos$  #Initialize (min fr used in current tool)
          psetup             #Call for toolchange info output
          !op_id$

    peof0$           #End of file for tool zero
          peof$

    peof$            #End of file for non-zero tool - Output of time calculations for the last tool and total time
          ptooldata  #Total ending data for tool (Path Length and Times)
          #Supress Program totals if only one tool or no output selected
           if tcnt > one & (fr_limits | xyz_limits | show_lengths | time_est),
            [
           # " ", e$  #Blank line(SUPRESSED JD)
           # sepline3, e$
           # "PROGRAM TOTALS (", *tcnt, " TOOLS):", e$
           # " ", e$ # Blank line

            #Output Max/Min Feedrate information
            if fr_limits = two | fr_limits = three,
              [
            #  "FEEDRATES: MAX = ", *pmax_fr, " MIN = ", *pmin_fr, e$
              #sepline, e$  #Output the separator '----' line
              ]

            #Output Max/Min X,Y,Z information
           # if xyz_limits = two | xyz_limits = three,
              [
              preadbuf1e   #Read Buffer 1 (get X,Y,Z extents of entire program)
             # pMaxMin      #Output Max/Min X,Y,Z coords for entire program
              #sepline, e$  #Output the separator '----' line
              ]

            #Output Feed/Rapid path lengths
            if show_lengths = two | show_lengths = three,
              [
             # "TOTAL FEED CUT LENGTH = ", *llen_total, e$
             # "TOTAL RAPID TRAVERSE LENGTH = ", *rlen_total, e$
            #  #sepline, e$  #Output the separator '----' line
              ]

            #Output Rapid/Feedrate times
            if time_est > 0 & (det_time = two | det_time = three),
              [
              ttltime = tot_rtime
             # "TOTAL RAPID TIME = ", ptimeout, e$
              ttltime = tot_ltime
            #  "TOTAL FEED TIME = ", ptimeout, e$
              #sepline, e$  #Output the separator '----' line
              ]

            #Output Cycle Time information
            if time_est = two | time_est = three,
              [
              ttltime = total                #Transfer TOTAL program time
             # "CYCLE TIME:  ", ptimeout, e$  #Program Total time output
              ]
            ]
          
                
    psetup           #Output of toolchange information
          !gcode$
          tcnt = tcnt + one  #Tool Counter
          if look4comp = yes$, preadbuf2 #Look for CDC settings @ Null tlchgs
          else,  #Load CDC setting for the current tool change
            [
            comp_cc = cc$                    #Capture CDC in control setting
            comp_cc_computer = cc_computer$  #Capture CDC in computer setting
            ]
          comment$
          if sof & outputxcom,  #If start of file and outputxcom = yes$
            [
            if smachname <> snull, "MACHINE NAME   = ", smachname, e$  #Machine name
            if sgrpcomm <> snull, "GROUP COMMENT  = ", sgrpcomm, e$    #Group comment
            if sgrpname <> snull, "GROUP NAME     = ", sgrpname, e$    #Group name
            ]
          #" ", e$  #Blank Line
         # sepline, e$  #Output the separator '----' line
          stlopnote = flook(1, no2str(tool_op$, 3))  #Get the operation type from the lookup table
          if stlopnote = "", stlopnote = "UNKNOWN OPERATION TYPE"
         # "TOOLPATH = " *stlopnote, [if tool_op$ = 132, " - ", *shmm], pdrillcyc, e$
          if output_comments & sopcomment <> snull, "OPERATION COMMENT " sopcomment, e$  #Operation comment
          if show_tool_mfg & strlen(stl_mfg_com) > zero & stl_mfg_com <> " ",
            "TOOL DEF. (MANUFACTURER) = ", stl_mfg_com, e$
          if show_chuck_name & strlen(stl_mfg_com) > zero & stl_mfg_com <> " ",
            "TOOL DEF. (CHUCK) = ", stl_chuck_com, e$
            
          var2=t$  
          if var2<>var3 | var3=0,
          [
          var1=var1+10
          var1,"  ",  "T",*t$,"  "  *strtool$,"  "  sopcomment,"   " "D" *tldia$,"  ", "FR",*fr_pos$,"   ","" *stlopnote,"   ",if Z_limits = no$, "DOC", *min_Zpos,"     ", e$
          ]
          else,
          [
          "     ","T",*t$,"  "  *strtool$,"  "  sopcomment,"   " "D" *tldia$,"  ", "FR",*fr_pos$,"   ","" *stlopnote,"   ",if Z_limits = no$, "DOC", *min_Zpos,"     ", e$
          ]
          var3=t$
             
          
         
          
          
          
          
           if show_tool_details, ptool_details
         # if tcr$ > zero, "TOOL CORNER RAD. = ", *tcr$, e$
         # "DIA. OFFSET = ", *tloffno$, e$ (suppressed by JD 11/24/2020
         # "LEN. OFFSET = ", *tlngno$,  (suppressed by JD)
         # if ss$ = zero, "SPINDLE OFF", e$
         # if ss$ > zero, "SPINDLE = ", *ss$, e$
        #  if ss$ < zero,
            [
            ss$ = abs(ss$)
          #  "SPINDLE (*REVERSE*) = ", *ss$, e$
            ]
          if fr_pos$ = zero, "*ERROR* - THE FEEDRATE WAS SET TO ZERO", e$
        #  else, "FEEDRATE = ", *fr_pos$, e$(SUPRESSED INSERTED ON LINE 819)
          # Show Cutter Diameter Compensation settings
          if opcode$ <> three & opcode$ < 13,  #If NOT a canned cycle or surface machining, output CDC setting
            [
          #  if comp_cc = zero & comp_cc_computer = zero, "CUTTER COMP. = OFF", (SUPRESSED J.D. 2/14/20202)
            if comp_cc <> zero & comp_cc_computer = zero,
              [
              # "CUTTER COMP. (CONTROL) = "
              # if comp_cc = 41, "LEFT", e$
               #if comp_cc = 42, "RIGHT", e$
              ]
            if comp_cc = zero & comp_cc_computer <> zero,
              [
             # "CUTTER COMP. (COMPUTER) = "
             # if comp_cc_computer = 41, "LEFT", e$
             # if comp_cc_computer = 42, "RIGHT", e$
              ]
           # if comp_cc <> zero & comp_cc_computer <> zero,
              [
             # if comp_cc = comp_cc_computer, "CUTTER COMP. (WEAR, IN CONTROL) = "
             # else, "CUTTER COMP. (REVERSE WEAR, IN CONTROL) = "
             # if comp_cc = 41, "LEFT", e$
             # if comp_cc = 42, "RIGHT", e$
              ]
            ]
          if result = 1, pprm_0 # Output 'additional parameter' information
          #else, "*** NO ADDITIONAL PARAMETER' INFORMATION AVAILABLE ", e
          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_pos$  #Update previous [prv_?] variables

    ptooldata        #Total ending data for tool (Path Length and Times)
          #Output Max/Min Feedrate used during prior toolpath
          if opcode$ <> three & (fr_limits = one | fr_limits = three),
            [
           # "FEEDRATES: MAX = ", tmax_fr, " MIN = ", tmin_fr, e$
            #"MAX FEEDRATE IN TOOLPATH = ", tmax_fr, e
            #"MIN FEEDRATE IN TOOLPATH = ", tmin_fr, e
            #sepline, e$  #Output the separator '----' line
            ]

          #Output Max/Min X,Y,Z information
          if xyz_limits = one | xyz_limits = three,
            [
            preadbuf1t   #Read the data from the Buffer 1
            pMaxMin      #Output Max/Min X,Y,Z coords during this tool operation
            #sepline, e$  #Output the separator '----' line
            ]

          #Output Feed/Rapid path lengths
          if show_lengths = one | show_lengths = three,
            [
           # "TOOL FEED CUT LENGTH = ", *llen, e$(supressed JD)
           # "TOOL RAPID TRAVERSE LENGTH = ", *rlen, e$(suppressed JD)
            #sepline, e$  #Output the separator '----' line
            ]
          llen_total = llen_total + llen  #Keep running total for Program
          rlen_total = rlen_total + rlen  #Keep running total for Program

          #Output Rapid/Feedrate times
          if time_est > 0 & (det_time = one | det_time = three),
            [
            ttltime = trtime
           # "RAPID TIME = ", ptimeout, e$  #Time at RAPID RATE (for last tool)
            ttltime = tltime
           # "FEED TIME  = ", ptimeout, e$  #Time at FEEDRATE (for last tool)
            #sepline, e$  #Output the separator '----' line
            ]

          pttltime  #Total tool times
          #Output Cycle Time information
          if time_est = one | time_est = three,
            [
          #  "OPERATION TIME = ", ptimeout, e$  #This operations time output
            #sepline, e$  #Output the separator '----' line
            ]

    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

    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            #Running total RAPID length
          trtime = rlen / pst_rpd_fr$  #Running total RAPID time

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

    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 time and length calc
          if gcode$ = one, ptimel   #FEED  time and length calc
          !x$, !y$, !z$, !fr_pos$   #Update previous [prv_?] variables
          if fr_limits, pfrcheck    #Track MAX/MIN Feedrates if requested

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

    pstock_info      #Output stock information if requested
          if stock_info,
            [
           # "MATERIAL TYPE  = (suppressed JD)
           # if stck_matl$ = "NONE" | stck_matl$ = "", "*NOT DEFINED*", e$  #No material type was selected
          #  else, stck_matl$, e$
            #" ", e$ # Blank line
            ]
           if stock_info & tlplnno$ <= one, #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$, "(", *stknote, ")", e$
              #" ", e$ # Blank line
              ]
            ]

    pMaxMin          #Output Max/Min X,Y, Z coordinates
          #Output MAX/MIN positions in the X,Y and Z axis
          if X_limits = yes$, "MAX_X = ", *max_Xpos, "  MIN_X = ", *min_Xpos, e$
          if Y_limits = yes$, "MAX_Y = ", *max_Ypos, "  MIN_Y = ", *min_Ypos, e$
          if Z_limits = yes$, "DOC ", *min_Zpos, e$

    # --------------------------------------------------------------------------
    # Motion NC output
    # --------------------------------------------------------------------------
    prapid$          #Output to NC of linear movement - rapid
          ptime

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

    plin$            #Output to NC of linear movement - feed
          ptime

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

    # --------------------------------------------------------------------------
    # Parameter read postblocks:
    # --------------------------------------------------------------------------
    pprep$           #Pre-process postblock
    #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
          rd_cd$       #Read CD Parameters
          sub_level$ = 0     #Force subs off
          subout$ = 0        #Force output stream to NC file
          comm_filter$ = 0   #Allow output of all comments
          #sextnc$ = ".doc"  #Uncomment and change extension here to override
          #Force longhand drilling cycles for proper time estimate
          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
          spaces$ = 0
          use_alt_eob$ = no$

    pwrtt$           #Pre-read NCI file
          pwritbuf1  #Write MAX/MIN X,Y,Z values to Buffer 1
          pwritbuf2  #Write COMP data to Buffer 2
          !op_id$

    pparameter$      #Read operation parameters
          #rd_params is used to call pparameter postblock and read the parameters of the operation specified in rd_param_op_no
          #"pparameter", ~prmcode$, ~sparameter$, e$
          #Read tool definition data
          if prmcode$ = 20002, stl_mfg_com = sparameter$              #'manufacturer' data
          if prmcode$ = 20003, stl_chuck_com = sparameter$            #'chuck name' data
          if prmcode$ = 20004, tl_number = rpar(sparameter$, 16)      #'tool parameters' data
          if prmcode$ = 20005, drl_cycle$ = rpar(sparameter$, 9)      #'DRILL type tool' parameters
          if prmcode$ = 20006, tl_cut_cap = rpar(sparameter$, 😎 #'MILL type tool' parameters
          if prmcode$ = 20007, tl_min_dia_plg = rpar(sparameter$, 11) #'MILL type tool HOLDER' parameters
          result = fprm(opcode$)  #Run the parameter table for current OPCODE

    # --------------------------------------------------------------------------
    # Parameter lookup tables - You must adjust the size value if you add any parameters to these tables!
    # --------------------------------------------------------------------------
    fprmtbl 1       2   #2D Contour
            10010   stock     #XY stock to leave
            10068   zstock    #Z stock to leave

    fprmtbl 2       2   #3D Contour
            10010   stock     #XY stock to leave
            10068   zstock    #Z stock to leave

    fprmtbl 4       7   #Pocket
            10010   stock     #XY stock to leave
            10068   zstock    #Z stock to leave
            10301   rgh_ang   #Roughing angle
            10302   rgh_step  #Roughing step size
            10304   num_fin   #Number of finish passes
            10305   fin_step  #Finish pass step size
            10314   fin_stk   #Finish allowance

    fprmtbl 5       2   #Ruled
            10010   stock     #Stock to leave
            12217   across    #Across distance

    fprmtbl 6       2   #2d Swept
            10010   stock     #Stock to leave
            12239   across    #Across distance

    fprmtbl 7       4   #3d Swept
            10010   stock     #Stock to leave
            12238   along     #Along distance
            12239   across    #Across distance
            12240   cut_dir   #Cutting direction: 0 = along, 1 = across

    fprmtbl 8       2   #Revolution
            10010   stock     #Stock to leave
            12054   fin_step  #Step size

    fprmtbl 9       3   #Loft
            10010   stock     #Stock to leave
            12238   along     #Along cut distance
            12239   across    #Across cut distance

    fprmtbl 10      4   #Coons
            10010   stock     #Stock to leave
            12238   along     #Along cut distance
            12239   across    #Across cut distance
            12240   cut_dir   #Cutting direction: 0 = along, 1 = across

    fprmtbl 13      13  #Multisurface Finish & HMM toolpaths
            10010   drive_stock   #Stock to leave on drive surfaces
            10227   check_stock   #Stock to leave on check surfaces
            10204   chdev         #Cut tolerance
            10205   fin_step      #Stepover distance
            12411   step_down     #Stepdown distance
            12117   use_across    #Use across cut distance (True/False)
            12118   across_dist   #Across cut: distance
            12119   across_height #Across cut: scallop height
            12302   fin_step      #Finish blend max stepover
            12628   hmm_type      #High speed machining style
            12665   wall_stock    #High speed machining - stock to leave on walls
            12666   floor_stock   #High speed machining - stock to leave on floors
            12593   total_tol     #Total cut tolerance - High speed machnining

    fprmtbl 14      10  #Multisurface Rough
            10010   drive_stock   #Stock to leave on drive surfaces
            10227   check_stock   #Stock to leave on check surfaces
            10204   chdev         #Cut tolerance
            10205   rgh_step      #Stepover distance
            12411   step_down     #Stepdown distance
            12117   use_across    #Use across cut distance (True/False)
            12118   across_dist   #Across cut: distance
            12119   across_height #Across cut: scallop height
            12124   rgh_step      #Restmill stepover distance
            10302   rgh_step      #Rough pocket stepover distance

    fprmtbl 19      2   #Face
            10010   stock     #Stock to leave
            12054   fin_step  #Step size

    # --------------------------------------------------------------------------
    # Machine Definition Parameters
    fprmtbl 17000  0    #Table Number, Size
    #       Param   Variable to load value into

    # Control Definition Parameters
    fprmtbl 18000  0    #Table Number, Size
    #       Param   Variable to load value into

    # Toolpath Group Parameters
    fprmtbl 19000  0    #Table Number, Size
    #       Param   Variable to load value into

    # --------------------------------------------------------------------------
    # Machine definition and control definition parameter capture:
    # --------------------------------------------------------------------------
    pmachineinfo$   #Machine information parameters postblock
          #rd_md is used to call pmachineinfo postblock and read the parameters of the selected axis
          #combination machine entity set in rd_mch_ent_no
          #rd_cd is used to call pmachineinfo postblock and read the active control definition parameters
          #rd_tlpathgrp is used to call pmachineinfo postblock and read the active toolpath group parameters
          #"-->pmachineinfo", ~prmcode$, "  ", ~sparameter$, e$  #Do not uncomment if being called from pprep$ - see pprep comment

          #Read parameter lookup tables -
          #Leave lines below commented until you enter values in related lookup tables
          #if prmcode$ >= 17000 & prmcode$ < 18000, result = fprm(17000) #Run the parameter table for Machine Definition Parameters
          #if prmcode$ >= 18000 & prmcode$ < 19000, result = fprm(18000) #Run the parameter table for Control Definition Parameters
          #if prmcode$ >= 19000 & prmcode$ < 19900, result = fprm(19000) #Run the parameter table for Toolpath Group Parameters

    # --------------------------------------------------------------------------
    # Buffer 1 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.

    # --------------------------------------------------------------------------
    # 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
          b1_gcode = gcode$
          if gcode$ = 1002 & op_id$ = prv_op_id$, b1_gcode = 1000
          if gcode$ = 1000 & op_id$ <> prv_op_id$, b1_gcode = 1002
          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

          #Loop thru possible NULL toolchanges
          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, zero)  #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 2 definition (for CDC settings storage)
    # --------------------------------------------------------------------------
    rc2          : 1     #Buffer2 READ pointer
    wc2          : 1     #Buffer2 WRITE pointer
    size2        : 0     #To hold 'size' of Buffer 2

    b2_gcode     : 0     #Data stored in Buffer 2
    b2_ccomp     : 0     #Data stored in Buffer 2
    b2_cc        : 0     #Data stored in Buffer 2 (comp. in control setting)
    b2_cc_computer : 0   #Data stored in Buffer 2 (comp. in computer setting)

    fbuf 2 0 4 0 0       #Declare Buffer2 to hold cutter dia. comp. settings

    # --------------------------------------------------------------------------
    # Buffer 2  Read / Write Routines
    # --------------------------------------------------------------------------
    pwritbuf2        #Write Buffer 2
          b2_gcode = gcode$
          if gcode$ = 1002 & op_id$ = prv_op_id$, b2_gcode = 1000
          if gcode$ = 1000 & op_id$ <> prv_op_id$, b2_gcode = 1002
          b2_ccomp = ccomp$
          b2_cc = cc$
          b2_cc_computer = cc_computer$
          b2_gcode = wbuf(two, wc2)  #Write the record

    preadbuf2        #Read Buffer 2 (at the toolchanges for cutter comp setting)
          #Reset flags
          size2 = rbuf(2,0) # Get the number of records on Buffer 2
          comp_cc = zero
          comp_cc_computer = zero
          cdc_found = no$
          tool_end = no$

          b2_gcode = rbuf(two, rc2)  #Read a record from the Buffer
          if b2_cc <> zero | b2_cc_computer <> zero,  #Tool change has active CDC
            [
            cdc_found = yes$
            comp_cc = b2_cc
            comp_cc_computer = b2_cc_computer
            ]
          while rc2 <= size2 & tool_end = no$,  #Loop thru to next tool change
            [
            b2_gcode = rbuf(two, rc2)  #Read the next record
            if b2_gcode = 1000,  #If Null tool change encountered
              [
              if cdc_found = no$,  #There was no CDC setting on the tool change
                [
                if b2_cc <> zero | b2_cc_computer <> zero,  #Null tool change has active CDC
                  [
                  cdc_found = yes$  #Report the CDC from the Null tool change
                  comp_cc = b2_cc
                  comp_cc_computer = b2_cc_computer
                  ]
                ]
              ]
            else, tool_end = yes$  #End of tool encountered break out of loop
            ]
          rc2 = rc2 - one  #Back up 1 record

    • Like 1
  4. Got it. Had to add some variables and do some conjuring and voila.

     

      var2=t$  
          if var2<>var3 | var3=0,
          [
          var1=var1+10
          var1,"  ",  "T",*t$,"  "  *strtool$,"  "  sopcomment,"   " "D" *tldia$,"  ", "FR",*fr_pos$,"   ","" *stlopnote,"   ",if Z_limits = no$, "DOC", *min_Zpos,"     ", e$
          ]
          else,
          [
          "     ","T",*t$,"  "  *strtool$,"  "  sopcomment,"   " "D" *tldia$,"  ", "FR",*fr_pos$,"   ","" *stlopnote,"   ",if Z_limits = no$, "DOC", *min_Zpos,"     ", e$
          ]
          var3=t$

    • Like 2
  5. My boss asked what it would take to obtain another seat for MC. I told him, get a hold of our distributor and ask them which he did. He told me  he was told it would be over ***** grand for another seat. I told him that does not sound right? Whats up with that?

  6. I have in the past and have never received any help. They want a minimum of 500.00 to do anything relating to a post processor of any type, so I am always stuck working on them. I will figure it out eventually without help. I just figured I might get some here and save myself hours of trial and error. Everything is simple once you know it. I could say the same to  a question about music theory, simple for me, difficult for many when they don't know the language.

  7. I am using a modified set file to do a basic set up sheet. I know nothing of the language being used except that I have massaged some post processors in the past including the one I am using now. I have got it to spit out just the basics I need.  Here is an example  of the output. My problem is when a tool repeats it is assigned a line label of N(X) as T3 has in the example shown. I would like to  output the info after the line label  for repetitive tools without the line label, then continue the line label on the following tool. I would like it to come out like the example at the end.

    Any help is appreciated

    Thank You

    Jerome

     

    PN = 661-20-14-0414 R00 OP1    DATE = 02-19-20   ALUMINUM inch - 6061  SIZE
    N10  T1  3 INCH FACE MILL  OP1   D3.0000  FR50.   CONTOUR   DOC +0.0000
    N20  T2  3/4 3FLUTE CARBIDE  OP1   D.7500  FR35.   CONTOUR   DOC -1.5100
    N30  T3  3/8 90 DRILL MILL  OP1   D.3750  FR4.   DRILL   DOC -0.1250
    N40  T3  3/8 90 DRILL MILL  OP1   D.3750  FR4.   CONTOUR   DOC -0.0380
    N50  T4  #39 DRILL .0995  OP1   D.0995  FR2.5   DRILL   DOC -0.4050
    N60  T5   NO. 4-40 FORM TAP  OP1   D.1120  FR2.5   DRILL   DOC -0.3000
    N70  T6  1/4 60 DEGREE ENGRAVER  OP1   D.2500  FR45.   CONTOUR   DOC -0.0050

     

    Here is the code I massaged to get this output. I stole the variable from my postporcessor and stuck it in this set file.

     

    var1         : 10    #Varialbe for tool no. block number added 2/24/2014 JD

    fmt    "N" 8  var1       #Added for tool block number 2/24/2014 JD

    this is the string that puts out the output above.

       *var1,"  ",  "T",*t$,"  "  *strtool$,"  "  sopcomment,"   " "D" *tldia$,"  ", "FR",*fr_pos$,"   ","" *stlopnote,"   ",if Z_limits = no$, "DOC", *min_Zpos,"     ",    e$
          var1=var1+10

     

    What I would like to put out.

    PN = 661-20-14-0414 R00 OP1    DATE = 02-19-20   ALUMINUM inch - 6061  SIZE
    N10  T1  3 INCH FACE MILL  OP1   D3.0000  FR50.   CONTOUR   DOC +0.0000
    N20  T2  3/4 3FLUTE CARBIDE  OP1   D.7500  FR35.   CONTOUR   DOC -1.5100
    N30  T3  3/8 90 DRILL MILL  OP1   D.3750  FR4.   DRILL   DOC -0.1250
         T3  3/8 90 DRILL MILL  OP1   D.3750  FR4.   CONTOUR   DOC -0.0380
    N40  T4  #39 DRILL .0995  OP1   D.0995  FR2.5   DRILL   DOC -0.4050
    N50  T5   NO. 4-40 FORM TAP  OP1   D.1120  FR2.5   DRILL   DOC -0.3000
    N60  T6  1/4 60 DEGREE ENGRAVER  OP1   D.2500  FR45.   CONTOUR   DOC -0.0050

     

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