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:

MAX & MIN DEPTH


Recommended Posts

Hi All,

 

My operators want me to post max & min z depth after tool change for them so that they watch out tools.

here is my example

GO G20 G40 G80 G90 G98

T1 M6 OLD

 

 

G0 G20 G40 G80 G90 G98

T1 M6

(MIN DEPTH Z = 0)

(MAX DEPTH Z = -1.5) NEW

 

could someone help me to modify the post. I use MPFANPOST.

 

Thanks.

 

 

Lamlinh

Link to comment
Share on other sites

This code can be found in the mpmaster post which I'll just show here for simplicity.

 

First you need to create a buffer near the top of the post, somewhere around all the variable declarations:

 

# --------------------------------------------------------------------------
# Buffer 5 - Min / Max
# --------------------------------------------------------------------------
b5_gcode : 0
b5_zmin  : 0
b5_zmax  : 0
rc5     : 2
wc5     : 1
size5   : 0

fbuf 5 0 3 0 0          #Min / Max

 

Now let's define the variables for output and format them. There should be a list of variables all with a similar structure that the following can be added to:

 

fmt  Z 2 min_depth  # Tool z_min
fmt  Z 2 max_depth  # Tool z_max

 

Then, in the pwrtt$ post block, add the following code to write the max and min values to the buffer:

 

           b5_gcode = gcode$
           b5_zmin = z_min$
           b5_zmax = z_max$
           b5_gcode = wbuf(5, wc5)

 

Now all that's left is to read the buffer after the tool change and output the max/min values. To do this you will need to create a new post block:

 

preadbuf5   # Read Buffer 1
           size5 = rbuf(5,0)
           b5_gcode = 1000
           min_depth = 99999
           max_depth = -99999
           while rc5 <= size5 & b5_gcode = 1000,
             [
             if rc5 <= size5, b5_gcode = rbuf(5,rc5)
             if b5_zmin < min_depth, min_depth = b5_zmin
             if b5_zmax > max_depth, max_depth = b5_zmax
             ]

 

 

Then call the new post block in both ptlchg$ and psof$ since you are using mpfan. This should go right after the post line with the M06 (either sm06 or "M06" in the code):

 

       preadbuf5
       if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19,
         [
         n$, pspc, scomm_str, "MAX - ", *max_depth, scomm_end, e$
         n$, pspc, scomm_str, "MIN - ", *min_depth, scomm_end, e$
         ]

 

That should be all there is to it!

 

If you are having trouble setting this up, have a look at the mpmaster post which has the functionality built in as a reference: Mpmaster Download

Link to comment
Share on other sites

Hi All,

Now I got z min & max for each tools however when I output NC file, I get a message "errors were detected during posting!" and here is

 

29 Oct 2011 04:22:00 PM - <0> - Report created.

29 Oct 2011 04:22:00 PM - <2> - Initialize posting log file

29 Oct 2011 04:22:00 PM - <2> - Using MP run version 14.00 and post components version 14.00

29 Oct 2011 04:22:00 PM - <2> - Initiate opening the post processor file(s).

29 Oct 2011 04:22:00 PM - <2> - C:\USERS\PUBLIC\DOCUMENTS\SHARED MCAMX5\MILL\POSTS\MPFAN5X.PST

29 Oct 2011 04:22:00 PM - <2> - The post processor file has been successfully opened.

29 Oct 2011 04:22:00 PM - <2> - Post version information (input):

29 Oct 2011 04:22:00 PM - <2> - UPDATEPOST Version 14. was used to modify this file.

29 Oct 2011 04:22:00 PM - <2> - The file was modified by this product on 22 Jan 09 10:52:44

29 Oct 2011 04:22:00 PM - <2> - The post was written to run with Mastercam Version 14.

29 Oct 2011 04:22:00 PM - <2> - The post product type is Mill.

29 Oct 2011 04:22:00 PM - <2> - Initialization of pre-defined post variables, strings, postblocks was successful.

29 Oct 2011 04:22:00 PM - <2> - Search for defined post variables, strings, postblocks was successful.

29 Oct 2011 04:22:00 PM - <2> - PST LINE (766) - Label has not been defined[7]

29 Oct 2011 04:22:00 PM - <2> - PST LINE (769) - Label has not been defined[4]

29 Oct 2011 04:22:00 PM - <2> - PST LINE (2222) - Label has not been defined[7]

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'maxnccomment$' was re-initialized from 256. to 120.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'dec_seq_left$' was re-initialized from 3. to 4.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'omitseq$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'sub_seq_typ$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'tplanemode$' was re-initialized from 2. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'bldnxtool$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'nobrk$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'nobrkxz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'nobrkyz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lnobrk$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lnobrkxz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lnobrkyz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'arctype$' was re-initialized from 5. to 2.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'arcoutput$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'arctypexz$' was re-initialized from 5. to 2.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'arcoutputxz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'arctypeyz$' was re-initialized from 5. to 2.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'arcoutputyz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'larcoutput$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'larctypexz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'larcoutputyz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'breakarcs$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'breakarcsxz$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'breakarcsyz$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lbreakarcs$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lbreakarcsxz$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lbreakarcsyz$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'do_full_arc$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'do_full_arcxz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'do_full_arcyz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'ldo_full_arc$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'ldo_full_arcxz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'ldo_full_arcyz$' was re-initialized from 1. to 0.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'rotfeed4$' was re-initialized from 2. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'rotfeed5$' was re-initialized from 3. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lrotfeed4$' was re-initialized from 2. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'lrotfeed5$' was re-initialized from 0. to 1.

29 Oct 2011 04:22:00 PM - <2> - CONTROL DEFINITION - Post variable 'sub_level$' was re-initialized from 0. to 0.

29 Oct 2011 04:22:00 PM - <2> - Successful completion of posting process!

 

could someone tell me what I am doing wrong?

 

Thanks

Link to comment
Share on other sites

Look at the post lines in the error report

29 Oct 2011 04:22:00 PM - <2> - PST LINE (766) - Label has not been defined[7]
29 Oct 2011 04:22:00 PM - <2> - PST LINE (769) - Label has not been defined[4]
29 Oct 2011 04:22:00 PM - <2> - PST LINE (2222) - Label has not been defined[7]

If you open the post in the Mastercam editor towards the bottom right the is a line counter. You might have used a Label that has not been defined or you didnt define it properly. Dont forget that you have to place

       preadbuf5 
       if (opcode$ > 0 & opcode$ < 16) | opcode$ = 19, 
         [ 
         n$, pspc, scomm_str, "MAX - ", *max_depth, scomm_end, e$ 
         n$, pspc, scomm_str, "MIN - ", *min_depth, scomm_end, e$ 
         ]


In the ptlchg$ and psof$ blocks like Chris mentioned; after the M06 string for the info to come out on every toolchange.

Link to comment
Share on other sites

Hi Chris & Greyman,

After I delete those lines

29 Oct 2011 04:22:00 PM - <2> - PST LINE (766) - Label has not been defined[7]

29 Oct 2011 04:22:00 PM - <2> - PST LINE (769) - Label has not been defined[4]

29 Oct 2011 04:22:00 PM - <2> - PST LINE (2222) - Label has not been defined[7]

My post works great!!!

 

Thank both of you.

Link to comment
Share on other sites

Glad to help, you would have placed the pspc block in the Tool Comment/ Manual Entry Section

# --------------------------------------------------------------------------
# Tool Comment / Manual Entry Section
# --------------------------------------------------------------------------
ptoolcomment    #Comment for tool...
...
...
pspc       # Creates spaces based tool level setting
          if sav_spc = one & omitseq$ = no$, " "

Just out of curiosity what was in those lines in your post ?

Link to comment
Share on other sites
  • 2 years later...

Can this be done in the tool list at the front of the NC program?

 

%

O00000( SPLIT LID CORE 5 )

( DATE - 04-09-14 )

( TIME - 2:18 PM )

( MCX FILE - SPLIT LID CORE )

( T7 = 1/2 FLAT ENDMILL , XY STK = .02 , Z STk = 0. -Z MAX .9355)

( T11 = 1/2 BULL ENDMILL 0.015 RAD -Z MAX 1.0355)

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