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:

How to get the min depth of each individual operation


Recommended Posts

21 minutes ago, bird2010 said:

Sorry  my bad english ....

How to get the min depth of each individual operation....not for tool !

thank you all...

That will be some work. The process is written to do a search of all operations for the tool and then dump them into a buffer. then from the buffer the max and min of all the values is output. I don't know how the new process works, but would be interested in what someone from the Post department has to say.

Craig or David are you lurking around?

Link to comment
Share on other sites

Like I was saying originally this will not do what you are thinking because of the way the logic is written to output this information. History lesson here folks. Everything in MPMASTER is in Mill.set and Mill2.set that anyone can run instead of a Post for any program they are making. This is an extremely detailed breakdown of everything your Mastercam file is doing. If we get back to the basics in which MPMASTER was created from we see that everything MPMASTER came from Mill.set and Mill2.set. Looking in there we will see everything you are asking for already built into that.

xyz_limits   : 2     #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     : yes$  #Output Max/Min values for the X axis?
Y_limits     : yes$  #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     : 2     #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    : 2     #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 : 2     #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?

Take a minute and educate yourself on what MPMASTER was built on and pretty much anything and everything you would like posted with a NC files can be used from either one of the .set files.

 

Anyone want to know what a specific OP ID is here you go from Mill2.set

# --------------------------------------------------------------------------
# Lookup tables
# --------------------------------------------------------------------------
flktbl 1     120
     # Note: "Unknown" entries must be made adjacent to known values to prevent flook's closest
     #         match from reporting incorrently on an unknown value
        "Unknown"                                                  0
        "Contour"                                                  1
        "Drilling - 3-Axis Output Format"                          2
        "Pocket"                                                   3
        "Transform"                                                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
        "C-Hook created"                                           16
        "Manual entry"                                             17
        "Circle mill - 3-Axis Output Format"                       18
        "Point"                                                    19
        "Trimmed"                                                  20
        "Ruled"                                                    21
        "Revolved"                                                 22
        "Letters"                                                  23
        "Swept 2D"                                                 24
        "Swept 3D"                                                 25
        "Coons"                                                    26
        "Lofted"                                                   27
        "Drilling - 4-Axis or 5-Axis Output Format"                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
        "Unknown"                                                  50
        "Unknown"                                                  99
        "Thread mill"                                              100
        "Edit common operation parameters"                         101
        "Facing"                                                   102
        "Associative trimmed"                                      103
        "Solid drill control"                                      104
        "Slot mill"                                                105
        "Helix bore"                                               106
        "Multi-surface rough restmill"                             107
        "Associative nesting container"                            108
        "Multi-surface finish blend"                               109
        "Multi-surface 5-axis, rough"                              110
        "Slice 5-axis"                                             111
        "Port 5-axis"                                              112
        "Circle mill - 4-Axis or 5-Axis Output Format"             113
        "Advanced drill"                                           114
        "Chamfer drill"                                            115
        "Unknown"                                                  116
        "Unknown"                                                  129
        "Tab cutoff"                                               130
        "Multi-surface rough pocket, light"                        131
        "High-speed surface toolpaths"                             132
        "Nesting onionskin"                                        133
        "2D hardmill machining/peel mill"                          134
        "Saw"                                                      135
        "FBM drill control"                                        136
        "FBM mill pocket"                                          137
        "FBM mill contour"                                         138
        "Solid model"                                              139
        "2D model chamfer"                                         140
        "Unknown"                                                  141
        "Unknown"                                                  149
        "Probe cycle: probe motion"                                150
        "Probe cycle command block"                                151
        "Probe cycle header"                                       152
        "Probe cycle trailer"                                      153
        "SafetyZone linking or multiaxis linking"                  154
        "SafetyZone for multiaxis drill - only used for link_op$"  155
        "Unknown"                                                  156
        "Unknown"                                                  300
        "Router contour - obsolete"                                301
        "Router pocket - obsolete"                                 302
        "Router circmill - obsolete"                               303
        "Router cutoff - obsolete"                                 304
        "Router surface rough pocket - obsolete"                   305
        "Block drill"                                              306
        "Unknown"                                                  307
        "Unknown"                                                  415
        "Engraving"                                                416
        "Unknown"                                                  417
        "Unknown"                                                  438
        "Art"                                                      439
        "Advanced multiaxis X9 and older"                          440
        "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 5-axis"                                        448
        "Port Expert"                                              449
        "Blade Expert"                                             450
        "Rotary advanced"                                          451
        "Unknown"                                                  452
        "Unknown"                                                  458
        "Deburr"                                                   459
        "3+2 Automatic roughing"                                   460
        "Unified milling"                                          461

# --------------------------------------------------------------------------
# Global assignments
# --------------------------------------------------------------------------
#Define operations to include in the category Drilling
drilling =
      (
      tool_op$ = 2   |  # Drill
      tool_op$ = 28  |  # 5-axis drilling
      tool_op$ = 37  |  # Non-associative drilling
      tool_op$ = 104 |  # Solid drill control operation
      tool_op$ = 114 |  # Advanced drill
      tool_op$ = 115 |  # Chamfer drill
      tool_op$ = 136 |  # FBM drill control operation
      tool_op$ = 306    # Block drill
      )

I have been editing Mastercam posts for over 20 years and I learned almost everything I know from good old fashioned effort. I looked it up on the forum. I asked questions. I made many failed attempts at things, but I did my research and used what was in front of me.

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

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

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

 

Link to comment
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

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

Follow us

×
×
  • Create New...