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:

Tool Inspection


Recommended Posts

I have a tool inspection routine I've used for years on mpmaster based posts

The last time I used it was in MC2020 and it worked great

We are doing a file in MC2022  now and tool instion is not working properly

This is the routine I've been using

prapidout       #Output to NC of linear movement - rapid
      sav_gcode = gcode$
      if convert_rpd$ = one,
        [
        gcode$ = one
        feed = maxfeedpm
        ipr_type = zero
        ]
      pcan1, pbld, n$, sgplane, `sgcode, [if gcode$ = 1, sgfeed], sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, [if gcode$ = 1, `feed], strcantext, scoolant, e$
        if cur_cflg$ = 70000, tool_chk = 1
      if cur_cflg$ = 70000,
              [
              pbld, "M09" ,e$
              pretract0, e$
              pbld, "M00", "(TOOL INSPECTION POINT)", e$
              pbld, n$, *sgcode, sgabsinc, pwcs, pfxout, pfyout,e$
              pfspindleout, e$
              pbld, n$, "G43", *tlngno$, pfzout, e$
              pbld,*feed, *scoolant,e$
              tool_chk = 0
              ]
      gcode$ = sav_gcode 

 

as stated this will not work in MC2021 or 22

I have cut this out of a generic 5X Haas Mastercam post
It outputs a Z rapid to clearance then goes right back to work
It will not post any of the code from ptool_insp

ptool_insp   #Tool Inspection Point Customization Required
      #Modify following line to customize tool inspection points
      pcool_off #Coolant off before tool inspection
      sav_absinc = absinc$
      absinc$ = one
      pbld, n$, sm05, e$ #Spindle off
      pbld, n$, sm00,"(CAUTION POST GENERATING MOTION FOR TOOL INSPECTION)", e$
      pbld, n$, *sgabsinc, *sg28, "Z0.", scoolant, e$
      pbld, n$, *sg28, "X0.", "Y0.", e$
      pbld, n$, sm00, "(INSPECT TOOL)", e$
      absinc$ = sav_absinc
      pbld, n$, *sgcode, *sgabsinc, pwcs, *xabs, *yabs, *speed, *spindle, pgear, e$
      pinsp_cool_on #Coolant on after tool inspection
      pbld, n$, "G43", *tlngno$, *zabs, scoolant, e$   
 
   
   

prapidout       #Output to NC of linear movement - rapid
      sav_gcode = gcode$
      if convert_rpd$ = one,
        [
       gcode$ = one
        feed = maxfeedpm
        ipr_type = zero
        ]
      pcan1, pbld, n$, `sgplane, `sgcode, [if gcode$ = 1, sgfeed], sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, [if gcode$ = 1, `feed], strcantext, scoolant, e$
       #  if rpd_typ = 7 , inspect_delay = one #Delay tool inspection until null tool change
          if rpd_typ_v7$ = 7, ptool_insp #Tool Inspection Point
     
any idea what I need to do to get this working

 

 

 

Link to comment
Share on other sites

Tom,

1st, search for the variable 'skp_lead_flgs$'. This should be set to '0'.

2nd, search for the variable 'rpd_typ_v7$'. This should also be '0'.

Then, replace 'cur_cflg$ = 70000' with 'rpd_typ$ = 7' in your Tool Change block

And, finally, in 'prapidout', replace 'rpd_typ_v7$ = 7' with 'rpd_typ$ = 7'.

If that doesn't work, go in your Tool Change code, and just above the line   if cur_cflg$ = 70000, tool_chk = 1 and insert the following lines for debugging:

      pcan1, pbld, n$, sgplane, `sgcode, [if gcode$ = 1, sgfeed], sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, [if gcode$ = 1, `feed], strcantext, scoolant, e$
        result = mprint("Next is value of cur_cflg$.")
        result = mprint(cur_cflg$)
        if cur_cflg$ = 70000, tool_chk = 1

By adding that code, your Post will prompt you, and then show you the "Current value" of 'cur_cflg$'. I am guessing it is not "70000", but something else, including some of the extra contour flag information...

Link to comment
Share on other sites
Quote

Try changing the 'mprint' statement to 'rpd_typ$' instead of the cflag variable, and what is the result?

0

I also downloaded a fresh copy of 2022 MPFAN from Mastercam.com  .. it doesn't work either

It respects the tool change interval, but complete ignores the  ptool_insp  blocks

 

this is the output at an inspection point

 

N480 G1 X0.
N490 G3 X2. Y-35.5849 I0. J2.
N500 X0. Y-33.5849 I-2. J0.
N510 G0 Z2.                            <-------------------------- rapids to clearance
N520 Z-.15                               <------------------------- and straight back down  ptool_insp is not output
N530 G3 X-2. Y-35.5849 I0. J-2. F45.
N540 X0. Y-37.5849 I2. J0.

 

# Motion NC output
# --------------------------------------------------------------------------

ptool_insp   #Tool Inspection Point Customization Required
      #Modify following line to customize tool inspection points
      pcool_off #Coolant off before tool inspection
      sav_absinc = absinc$
      absinc$ = one
      pbld, n$, sm05, e$ #Spindle off
      pbld, n$, sm00,"(CAUTION POST GENERATING MOTION FOR TOOL INSPECTION)", e$
      pbld, n$, *sgabsinc, *sg28ref, "Z0.", scoolant, e$
      pbld, n$, *sg28ref, "X0.", "Y0.", e$
      pbld, n$, sm00, "(INSPECT TOOL)", e$
      absinc$ = sav_absinc
      pbld, n$, *sgcode, *sgabsinc, pwcs, *xabs, *yabs, *speed, *spindle, pgear, e$
      pinsp_cool_on #Coolant on after tool inspection
      pbld, n$, sg43, *tlngno$, *zabs, scoolant, e$

#region NC output postblocks
# --------------------------------------------------------------------------
#The variables for absolute output are xabs, yabs, zabs.
#The variables for incremental output are xinc, yinc, zinc.
# --------------------------------------------------------------------------

prapidout       #Output to NC of linear movement - rapid
      pcan1, pbld, n$, [if gcode$, `sgfeed], sgplane, `sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, [if gcode$, `feed], strcantext, pscool, e$
      if force_feed, result = force(feed)  # Force output of feed next time it's called for output
      if rpd_typ$ = 7, ptool_insp #Tool Inspection Point

 

Link to comment
Share on other sites
13 minutes ago, gcode said:

0

I also downloaded a fresh copy of 2022 MPFAN from Mastercam.com  .. it doesn't work either

It respects the tool change interval, but complete ignores the  ptool_insp  blocks

 

this is the output at an inspection point

 

N480 G1 X0.
N490 G3 X2. Y-35.5849 I0. J2.
N500 X0. Y-33.5849 I-2. J0.
N510 G0 Z2.                            <-------------------------- rapids to clearance
N520 Z-.15                               <------------------------- and straight back down  ptool_insp is not output
N530 G3 X-2. Y-35.5849 I0. J-2. F45.
N540 X0. Y-37.5849 I2. J0.

 

# Motion NC output
# --------------------------------------------------------------------------

ptool_insp   #Tool Inspection Point Customization Required
      #Modify following line to customize tool inspection points
      pcool_off #Coolant off before tool inspection
      sav_absinc = absinc$
      absinc$ = one
      pbld, n$, sm05, e$ #Spindle off
      pbld, n$, sm00,"(CAUTION POST GENERATING MOTION FOR TOOL INSPECTION)", e$
      pbld, n$, *sgabsinc, *sg28ref, "Z0.", scoolant, e$
      pbld, n$, *sg28ref, "X0.", "Y0.", e$
      pbld, n$, sm00, "(INSPECT TOOL)", e$
      absinc$ = sav_absinc
      pbld, n$, *sgcode, *sgabsinc, pwcs, *xabs, *yabs, *speed, *spindle, pgear, e$
      pinsp_cool_on #Coolant on after tool inspection
      pbld, n$, sg43, *tlngno$, *zabs, scoolant, e$

#region NC output postblocks
# --------------------------------------------------------------------------
#The variables for absolute output are xabs, yabs, zabs.
#The variables for incremental output are xinc, yinc, zinc.
# --------------------------------------------------------------------------

prapidout       #Output to NC of linear movement - rapid
      pcan1, pbld, n$, [if gcode$, `sgfeed], sgplane, `sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, [if gcode$, `feed], strcantext, pscool, e$
      if force_feed, result = force(feed)  # Force output of feed next time it's called for output
      if rpd_typ$ = 7, ptool_insp #Tool Inspection Point

 

put an astrex in front of ptool_insp here and see if that works.

prapidout       #Output to NC of linear movement - rapid
      pcan1, pbld, n$, [if gcode$, `sgfeed], sgplane, `sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, [if gcode$, `feed], strcantext, pscool, e$
      if force_feed, result = force(feed)  # Force output of feed next time it's called for output
      if rpd_typ$ = 7, *ptool_insp #Tool Inspection Point

 

Link to comment
Share on other sites

I've noticed this same behavior where Mastercam won't break up motion to insert tool inspections in the newer releases of Mastercam.  I'm assuming that there must have been some issues with being able to interupt and then restart an operation without crashing or gouging.  

Lathe dynamic in particular.

 

It makes it difficult to get predictable tool life...    especially with ceramic inserts

Link to comment
Share on other sites

Tom had a great suggestion that it would be useful to be able to "force tool inspection routines", when using Depth Cuts or Multi-Passes with Contour. I'm going to see if I can write some code to force that to happen, just using the Post. I think there may be a possibility to get this working even on older versions of Mastercam.

  • Like 1
Link to comment
Share on other sites
On 4/13/2022 at 4:07 PM, Colin Gilchrist said:

I'm going to see if I can write some code to force that to happen, just using the Post.

I didn't realize that you guys had a conversation going on over here about this.

Colin, can I ask you a question? 

What is the cur_cflg$ = 70000  all about?  The contour flags doesn't have 70000 listed as an option and the only reference I can find to 70000 anything is that it's reserved for future functionality? 

  • Like 1
Link to comment
Share on other sites
On 4/16/2022 at 12:09 PM, neurosis said:

I didn't realize that you guys had a conversation going on over here about this.

Colin, can I ask you a question? 

What is the cur_cflg$ = 70000  all about?  The contour flags doesn't have 70000 listed as an option and the only reference I can find to 70000 anything is that it's reserved for future functionality? 

Hi Dave,

The variable 'cur_cflg$' is an Integer, with "up to 8 integer digits". Each "place" (1's place, 10's place, 100's place, 1000's place, etc.) indicates the 'state of a particular flag'. For the Contour Flag variable, the 10,000's place indicates the "Rapid Type", with "7" being the type for Tool Inspection.

In this particular case, Gcode found a bug in Mastercam. He was enabling the new "secondary leads" functionality, and the bug means that when enabling this function, the 'cur_cflg$' value is actually not output.

The thing to know here though, in general, it is a poor-practice to "read the value of 'cur_cflg$' directly". This is because there is a mechanism in MP (preexisting), parses each 'digit' of that variable, and uses these digits to set the "flag variables", which are designed to be used by the Post Developer to "test" the current state of the Contour Flag.

In this case, there is a variable which gets set: 'rpd_typ$' or 'rpd_typ_v7$', (depending on if you initialized 'rpd_typ_v7$' and 'skp_lead_flgs$').

Normally, we'd be testing like this:

      if rpd_typ$ = 7, ptool_inspect #Call Tool Inspection Routine

The tricky thing is > these flags should really only be updated "during motion". But I haven't done any experimentation to check and see "are these values maintained during a Null Tool Change event"?

For Tool Inspection moves, these can be "rapid moves" (tool just moves up to a clearance Z value, based on toolpath parameters).

With both "multi-passes", and "depth-cuts", Mastercam outputs these various "passes" with a Null Tool Change event separating each pass.

So, it is always possible that during the development of MPMaster (where I think that code came from), that they were testing 'rpd_typ$', and it wasn't getting updated at the Null Tool Change (showing "0.", instead of "7."), so IHS added the 'if cur_cflg$ = 70000' to try and detect "if we're at a Null Tool Change" but also have 'Tool Inspection' active.

The issue to me (could be a non-issue), is that if any other flags are set (1's, 10's, 100's, etc.), then the value wouldn't be '70000', but could be '70001', or '70100', or another combination of values. So, it could be better to use 'if cur_cflg$ > 69999', just because that would mean "rapid type is seven" and some other conditions are set. But, the better way (provided MP is behaving as expected), would be to just read 'rpd_typ$'.

  • Thanks 2
Link to comment
Share on other sites
  • 4 months later...

I'm trying to get a tool inspection point setup for one of our boring mills. 

I've copied what Gcode took from a Haas 5X post and started making some changes. I can do really simple post editing like forcing code output and moving things around to where I like it, but when it comes to "arguments" or logic, I don't know what I'm doing.

I have something really close to what I want, however I cannot get a posted result from pwcs. I've tried using an asterisk as well as putting it in it's own line and it will not post. 

I'm hoping one of y'all can help point me in the right direction.

Here is the post section I currently have:

ptool_insp   #Tool Inspection Point Customization Required
      #Modify following line to customize tool inspection points
      sav_absinc = absinc$
      absinc$ = one
      pbld, n$, sm05, e$ 
	  pbld, n$, sm09, e$ 
      pbld, n$, *sgabsinc, *sg28, "Z0.", e$
      pbld, n$, "M0", "(INSPECT TOOL)", e$
      absinc$ = sav_absinc
	  if mi1$ > one, absinc$ = zero
        pbld, n$, *sgcode, *sgabsinc, *pwcs, pfxout, pfyout, 
        [if nextdc$ <> 7, *speed, *spindle], pgear, strcantext, e$
      pbld, n$, *sgabsinc, *pwcs, sw0, e$
      pbld, n$, sg43, *tlngno$, pfzout, pcan1, scoolant, e$  
	  
	  
	     
 
prapidout       #Output to NC of linear movement - rapid
      pcan1, pbld, n$, sgplane, `sgcode, sgabsinc, pccdia,
        pxout, pyout, pzout, pcout, strcantext, scoolant, e$
      #Modify following line to customize output for high-speed toolpath
      #tool inspection/change points
      if rpd_typ$ = 7, ptool_insp #pbld, n$, "M00", "(TOOL INSPECTION POINT - POST CUSTOMIZATION REQUIRED)", e$

 

Here is a snippet of the output:                                     

G2 X-10.0323 Y20.1437 Z3.9325 I-.0895 J.2335 
G0 Z4.8162
X-12.2731 Y-20.1437
M5
M9
G91 G28 Z0.
M0 (INSPECT TOOL)
G0 G90 X-12.2731 Y-20.1437 S477 M3      <----I want pwcs to output in this line
G90 W0.
G43 H5 Z4.8162
Z3.9325                                  <----How can I force a G1 and last commanded feed rate here?
G2 X-11.9502 Y-19.9997 Z3.8632 I.2335 J-.0895
G1 X-11.7634 Y-20.0713 Z3.86
Link to comment
Share on other sites
14 hours ago, Leon82 said:

What does the ptool_inpection look like?

 

Personally i would copy some of the ptoolcng block so it re issued everything. This way if for some reason somebody goes to start the program from there it's going to have the right tool and the spindle.

I posted the ptool_inspection above. It's the section under the first blue text. I'm still learning how to use the forum and make a clear-to-read post.

That was also the section I copied, but I removed the B-axis commands and tool-staging.

 

I was able to force the work offset output by using *g_wcs rather than *pwcs.

Still trying to figure out how to force a linear feed for Z and/or command the last feed on the first G1/G2/G3 line.

Link to comment
Share on other sites

You are going to need to save the PWCS out and then recall the saved PWCS. Normally in a post you will see something like sav_pwcs and that is where the post writer will save out the active workoffset. It seems tool inspection has lack track of what the active one is when being used so you will need to store it for recall when it is being used. That is one of the logic issues is knowing when and where variables are dumped to reduce file size. If they kept all the variables active then the posting time would grow exponentially when posting code. The MP logic keeps what is needed and then dumps everything else to control the size of the database needed to post code. That is all NCI is from Mastercam is sets of data points. The Post is the translator so to speak from Mastercam to the machine tool. By limiting what is pushed through then it is decrease the size of the buffer or stored data the system needs to process the resulting information. In our case that is NC code formatted to what ever machine we need the information for. It goes back to basic Database management 101 ideas. Control the inputs to use what is needed when it is needed to get the fastest outputs.

Link to comment
Share on other sites
38 minutes ago, crazy^millman said:

You are going to need to save the PWCS out and then recall the saved PWCS. Normally in a post you will see something like sav_pwcs and that is where the post writer will save out the active workoffset. It seems tool inspection has lack track of what the active one is when being used so you will need to store it for recall when it is being used. That is one of the logic issues is knowing when and where variables are dumped to reduce file size. If they kept all the variables active then the posting time would grow exponentially when posting code. The MP logic keeps what is needed and then dumps everything else to control the size of the database needed to post code. That is all NCI is from Mastercam is sets of data points. The Post is the translator so to speak from Mastercam to the machine tool. By limiting what is pushed through then it is decrease the size of the buffer or stored data the system needs to process the resulting information. In our case that is NC code formatted to what ever machine we need the information for. It goes back to basic Database management 101 ideas. Control the inputs to use what is needed when it is needed to get the fastest outputs.

Thanks, I'll look more into this. I did search for "sav_pwcs" in the post, but nothing came up.

I'm really close to what I want now. I had to specify a value in the "linear entry/exit" box in Linking Parameters then change the "plinout" section to look at "ptool_insp". However, the output is still a bit wonky. It would output a G1 in the work offset line, so I forced a G0 there. So now I just need it to output a G1 on the first commanded Z value that has the feedrate. 

G2 X-10.0323 Y20.1437 Z3.9325 I-.0895 J.2335
G1 Z3.9825
Z4.8162
X-12.2731 Y-20.1437
M5
M9
G0 G91 G28 Z0.
M0 (INSPECT TOOL)
N100
G0 G90 G54 X-12.2731 Y-20.1437 S477 M3 
<------- Before forcing a G0, it would output the G1 here
G90 G54 W0.
G43 H5 Z4.8162
Z3.9825
Z3.9325 F25.     
<------- I need a G1 in front of the Z here
G2 X-11.9502 Y-19.9997 Z3.8632 I.2335 J-.0895 F57.24

 

 

Link to comment
Share on other sites
1 hour ago, TFarrell9 said:

Thanks, I'll look more into this. I did search for "sav_pwcs" in the post, but nothing came up.

I'm really close to what I want now. I had to specify a value in the "linear entry/exit" box in Linking Parameters then change the "plinout" section to look at "ptool_insp". However, the output is still a bit wonky. It would output a G1 in the work offset line, so I forced a G0 there. So now I just need it to output a G1 on the first commanded Z value that has the feedrate. 

G2 X-10.0323 Y20.1437 Z3.9325 I-.0895 J.2335
G1 Z3.9825
Z4.8162
X-12.2731 Y-20.1437
M5
M9
G0 G91 G28 Z0.
M0 (INSPECT TOOL)
N100
G0 G90 G54 X-12.2731 Y-20.1437 S477 M3 
<------- Before forcing a G0, it would output the G1 here
G90 G54 W0.
G43 H5 Z4.8162
Z3.9825
Z3.9325 F25.     
<------- I need a G1 in front of the Z here
G2 X-11.9502 Y-19.9997 Z3.8632 I.2335 J-.0895 F57.24

 

 

Yes because that logic was not added because it was not needed. Now you are needing this type of logic because you need the ability to pull the value after it was used.

Link to comment
Share on other sites
On 9/15/2022 at 9:08 AM, TFarrell9 said:

Thanks, I'll look more into this. I did search for "sav_pwcs" in the post, but nothing came up.

I'm really close to what I want now. I had to specify a value in the "linear entry/exit" box in Linking Parameters then change the "plinout" section to look at "ptool_insp". However, the output is still a bit wonky. It would output a G1 in the work offset line, so I forced a G0 there. So now I just need it to output a G1 on the first commanded Z value that has the feedrate. 

G2 X-10.0323 Y20.1437 Z3.9325 I-.0895 J.2335
G1 Z3.9825
Z4.8162
X-12.2731 Y-20.1437
M5
M9
G0 G91 G28 Z0.
M0 (INSPECT TOOL)
N100
G0 G90 G54 X-12.2731 Y-20.1437 S477 M3 
<------- Before forcing a G0, it would output the G1 here
G90 G54 W0.
G43 H5 Z4.8162
Z3.9825
Z3.9325 F25.     
<------- I need a G1 in front of the Z here
G2 X-11.9502 Y-19.9997 Z3.8632 I.2335 J-.0895 F57.24

 

 

I was using the feedrate checkbox for linear entry/exit and it caused the rapid motion transitions to feed (even in backplot). I unchecked that box and used the plunge rate in tool parameters and got the output I wanted.

 

G2 X-3.1298 Y19.2925 Z3.8295 I-.2462 J.0434
G1 Z3.8795
G0 Z4.8162
X-2.9735 Y20.1788
M5
M9
G0 G91 G28 Z0.
M0 (INSPECT TOOL)
N100
G0 G90 G54 X-2.9735 Y20.1788 S477 M3
G90 G54 W0.
G43 H5 Z4.8162
Z3.8795
G1 Z3.8295 F35.
G2 X-2.7707 Y19.8892 Z3.7603 I-.0434 J-.2462 F62.45
  • Like 1
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...