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:

Posting Min/Max XY values


Recommended Posts

My current Haas 3-axis post processor will post out min/max Z-values for every toolpath.  Is there a way to have it post out min/max XY values for each toolpath. I want to use this information as a secondary way to verify my toolpaths are safe to run.  I'm working on a big part with no extra material and an unfamiliar post processor.    I don't trust verify because its running off the NCI file.  

Any help is appreciated.

Link to comment
Share on other sites

There is always a way. The specifics are going to depend on which Post you initially started with for your Haas Post. If is was MPMaster, you'll need to look at 'pwritbuf5' and 'preadbuf5'

Add the following to 'Buffer 5 Read / Write Routines:

# --------------------------------------------------------------------------
# Buffer 5  Read / Write Routines
# --------------------------------------------------------------------------
pwritbuf5   # Write Buffer 1
            b5_gcode = gcode$
            b5_zmin = z_min$
            b5_zmax = z_max$
            b5_ymin = y_min$
            b5_ymax = y_max$
            b5_xmin = x_min$
            b5_xmax = x_max$
            b5_gcode = wbuf(5, wc5)

preadbuf5   # Read Buffer 1
            size5 = rbuf(5,0)
            #RESET values to force new read from buffer
            b5_gcode = 1000
            min_depth = 99999
            max_depth = -99999
            min_front  = 99999
            max_back = -99999
            min_left = 99999
            max_right = -99999
            while rc5 <= size5 & b5_gcode = 1000,
              [
              if rc5 <= size5, b5_gcode = rbuf(5,rc5)
              #Buffer read fills 7 variables, starting with b5_gcode
              if b5_xmin < min_left, min_left = b5_xmin
              if b5_xmax > max_right, max_right = b5_xmax
              if b5_ymin < min_front, min_front = b5_ymin
              if b5_ymax > max_back, max_back = b5_ymax
              if b5_zmin < min_depth, min_depth = b5_zmin
              if b5_zmax > max_depth, max_depth = b5_zmax
              ]

 

Edit the actual Buffer Definition:

# --------------------------------------------------------------------------
# Buffer 5 - Min / Max
# --------------------------------------------------------------------------
b5_gcode : 0
b5_zmin  : 0
b5_zmax  : 0
b5_ymin  : 0
b5_ymax  : 0
b5_xmin  : 0
b5_xmax  : 0

rc5     : 2
wc5     : 1
size5   : 0

fbuf 5 0 7 0 0          #Min / Max

 

Search for the variable 'max_depth', and look for the 'fmt' line. Add 4 variable format assignments:

fmt  "Z" 2 min_depth# Tool z_min
fmt  "Z" 2 max_depth# Tool z_max
fmt  "Y" 2 min_front# Tool y_min
fmt  "Y" 2 max_back # Tool y_max
fmt  "X" 2 min_left # Tool x_min
fmt  "X" 2 min_right# Tool x_max

 

Finally, find the output section in 'ptlchg_com':

      if output_z = yes$,
        [
        preadbuf5
        if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,
          [
          n$, pspc, scomm_str, "MAX - ", *max_right, scomm_end, e$
          n$, pspc, scomm_str, "MIN - ", *min_left, scomm_end, e$
          n$, pspc, scomm_str, "MAX - ", *max_back, scomm_end, e$
          n$, pspc, scomm_str, "MIN - ", *min_front, scomm_end, e$
          n$, pspc, scomm_str, "MAX - ", *max_depth, scomm_end, e$
          n$, pspc, scomm_str, "MIN - ", *min_depth, scomm_end, e$
          ]
        ]
      spaces$=sav_spc

 

 

 

  • Like 2
Link to comment
Share on other sites

Colin,

 

Thank you for the reply.  It looks like I need to take your post editing class.  That is something I plan to do in the future when I finish school.  I'm currently working days and going to school at night.  I'm certain the post I am using is not an MPmaster post.  I am doing this job for our other facility where I do not normally work.  I'm not sure where the post originally came from but I have updated it from MCX6 to MC2018. I think my best option may be to start fresh with the latest MPmaster post and try to incorporate the changes from there.  I'll let you know how it goes.  I may have some time to work on it over the holiday weekend.  Thank you again for your time.  

  • Like 1
Link to comment
Share on other sites

Feel free to post up a Zip 2 Go file with your MD, CD, and PST file, and I'll see what I can do with your specific Post. If you're already getting Min/Max Z values, there is most likely an easy place to add it.

Yes, the Basic Post Processor course is very helpful for learning the fundamentals of Post Processor editing. That said, my class is based around understanding the MP Post Processor Documentation. If you're a self-motivated person, you can pick up a lot of the information in my class by reading the documentation. 

Link to comment
Share on other sites

The code gets 'written' to the Buffer with the code in 'pwritbuf5'. That gets called from 'pwrtt$'.

So the buffer gets filled with data during the NCI pre-read, then we read data from the buffer at each Tool Change. The logic sets the 'b5 Gcode' variable to 1000, then reads a line from the buffer. If the 'gcode' value stays '1000' (meaning NullTool Change), then we keep reading from the buffer until 'gcode' turns to 1002. This indicates a new Tool has been called up, and we exit the 'while' loop.

Link to comment
Share on other sites
3 hours ago, jlw™ said:

Things like this make me wish we had about 90 more misc r/i.  You could do conditional formatting and output only Z if you wanted.  I need more misc r/i for my posts!!!

You can have as many as you want. Use the decimals and then you are allowed as many ways to do what you want as possible. Don't forget Cantext it gives you a lot of flexibility.

  • Like 1
Link to comment
Share on other sites

Jeremy,

Look into the 'pcval' function. You can make any of the Real Numbers function as up to a 9.6 number. (Nine Integer digits, and 6 decimal digits.) Each "place value" (10's place, 100's place, 1000's place, ect) can be read by this function, and assigned to a variable. That way you can have 1 real number control multiple mechanisms in the Post.

Another way to do this "cleanly" is to use the Machine Group Comment to enable/disable Post Switches. Look at the 'Scan' string function. 

Link to comment
Share on other sites

Colin,

I really appreciate you taking a look at it.  I am attaching the machine definition, control definition, and post.  I was going to upload a zip to go but I think that sends the 

Mastercam part file which I'm not allowed to share.  Let me know if I have supplied you with enough information. Any help is greatly appreciated.

2018_HAAS 3X .mcam-control

2018_HAAS 3X .mcam-mmd

2018_HAAS 3X .PST

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