cncgotoguy

Create Warning When Reverse Wear or Control cutter compen

Recommended Posts

Trying to grab the variable for what compensation type is being used and throw a warning if Reverse Wear or Control type are used.

I tried pulling the variable comp_type in, but it is staying the same for all and doesn't even match the first tool path correctly.

Anybody got any ideas how to get this to work? Much appreciated for reading. 

image.png.d60bc3106fc28b6178fb96b0b2174e68.png

image.thumb.png.299865e77b04283802661bb65b51fe97.png

 

image.png.6f64d1df7749a3c73fa3904970b4a317.png

image.png.990a6b8b7219f7c8bad686e1ff8f349f.png

 

 

 

Share this post


Link to post
Share on other sites

Sure.

This isn't available as a NCI Variable.

But not to worry; it is available as an Operation Parameter: 15346. In fact, the option to capture this data is already in MPMaster.

What Post did you start with, and what Version of Mastercam are you using?

Because I added the [*comp_type, e$] code to a stock 'MPMaster 2021' Post, and got this:

%
O0000 (T)
(MCX FILE  - C:\USERS\CGILCHRIST\DOCUMENTS\MY MASTERCAM 2021\MASTERCAM\PARTS\TEST.MCAM)
(PROGRAM   - T.NC)
(DATE      - NOV-20-2020)
(TIME      - 3:20 PM)
(T239 -  1/2 FLAT ENDMILL    - H239 - D239 - D0.5000")
N5 G00 G17 G20 G40 G80 G90
N10 G91 G28 Z0.
N15 (COMP IN COMPUTER)
N20 (COMPENSATION TYPE - COMPUTER)
comp_type 0.
N25 T239 M06 ( 1/2 FLAT ENDMILL)
N30 (MAX - Z.25)
N35 (MIN - Z0.)
N40 G00 G17 G90 G54 X-.8543 Y2.7894 S1069 M03
N45 G43 H239 Z.25
N50 Z.2
N55 G94 G01 Z0. F6.42
N60 Y2.2894
N65 G03 X-.3543 Y1.7894 I.5 J0.
N70 G01 X2.1654
N75 G02 X2.4154 Y1.5394 I0. J-.25
N80 G01 Y-1.7283
N85 G02 X2.1654 Y-1.9783 I-.25 J0.
N90 G01 X-2.874
N95 G02 X-3.124 Y-1.7283 I0. J.25
N100 G01 Y1.5394
N105 G02 X-2.874 Y1.7894 I.25 J0.
N110 G01 X-.3543
N115 G03 X.1457 Y2.2894 I0. J.5
N120 G01 Y2.7894
N125 Z.2
N130 G00 Z.25
N135 (COMP IN CONTROL)
comp_type 1.
N140 X-.8543 Y2.5394
N145 Z.2
N150 G01 Z0.
N155 G41 D239 Y2.0394
N160 G03 X-.3543 Y1.5394 I.5 J0.
N165 G01 X2.1654
N170 Y-1.7283
N175 X-2.874
N180 Y1.5394
N185 X-.3543
N190 G03 X.1457 Y2.0394 I0. J.5
N195 G01 G40 Y2.5394
N200 Z.2
N205 G00 Z.25
N210 (WEAR COMP)
comp_type 2.
N215 X-.8543 Y2.7894
N220 Z.2
N225 G01 Z0.
N230 G41 D239 Y2.2894
N235 G03 X-.3543 Y1.7894 I.5 J0.
N240 G01 X2.1654
N245 G02 X2.4154 Y1.5394 I0. J-.25
N250 G01 Y-1.7283
N255 G02 X2.1654 Y-1.9783 I-.25 J0.
N260 G01 X-2.874
N265 G02 X-3.124 Y-1.7283 I0. J.25
N270 G01 Y1.5394
N275 G02 X-2.874 Y1.7894 I.25 J0.
N280 G01 X-.3543
N285 G03 X.1457 Y2.2894 I0. J.5
N290 G01 G40 Y2.7894
N295 Z.2
N300 G00 Z.25
N305 (REVERSE WEAR)
comp_type 3.
N310 X-.8543
N315 Z.2
N320 G01 Z0.
N325 G42 D239 Y2.2894
N330 G03 X-.3543 Y1.7894 I.5 J0.
N335 G01 X2.1654
N340 G02 X2.4154 Y1.5394 I0. J-.25
N345 G01 Y-1.7283
N350 G02 X2.1654 Y-1.9783 I-.25 J0.
N355 G01 X-2.874
N360 G02 X-3.124 Y-1.7283 I0. J.25
N365 G01 Y1.5394
N370 G02 X-2.874 Y1.7894 I.25 J0.
N375 G01 X-.3543
N380 G03 X.1457 Y2.2894 I0. J.5
N385 G01 G40 Y2.7894
N390 Z.2
N395 G00 Z.25
N400 (COMP OFF)
comp_type 4.
N405 X-.8543 Y2.5394
N410 Z.2
N415 G01 Z0.
N420 Y2.0394
N425 G03 X-.3543 Y1.5394 I.5 J0.
N430 G01 X2.1654
N435 Y-1.7283
N440 X-2.874
N445 Y1.5394
N450 X-.3543
N455 G03 X.1457 Y2.0394 I0. J.5
N460 G01 Y2.5394
N465 Z.2
N470 G00 Z.25
N475 M05
N480 G91 G28 Z0.
N485 G28 Y0.
N490 G90
N495 M30
%

 

  • Like 1

Share this post


Link to post
Share on other sites

The warning part is pretty easy:

#Initialize some String Variables, near the top of the Post:
str_warn1  : ""
str_warn2  : ""
str_warn3  : ""
str_warn4  : ""
str_warn_out  : ""
str_warn_typ : "" #Lookup String from String Select Table

#Next, include some logic in your Post Block, to trap and build the error message.


      if comp_type = 1 | comp_type = 3,
        [
        #comp_type[1] = Control, comp_type[3] = Reverse Wear
        str_warn_typ = slout(comp_type, scomp) #Get String, from String List
        str_warn1 = "Error detected in Operation Number: "
        str_warn2 = no2str(comp_type)
        str_warn3 = ". Fix the Operation, and Repost!"
        str_warn4 = "Press Cancel to quit Posting Process."
        str_warn_out = str_warn1 + str_warn2 + str_warn3 + no2asc(13)
		  + "COMP TYPE: " + str_warn_typ + no2asc(13) + str_warn4
        if mprint(str_warn_out, 2) = 2, exitpost$
        ]
      if comp_type = 0 | comp_type = 2,
        [
        #comp_type[0] = Computer, comp_type[2] = Wear
        #This is what we want, so we don't do anything.
        #We technically, don't even need this Post Block here
        ]
      if comp_type = 4,
        [
        #comp_type[4] = Off
        str_warn_typ = slout(comp_type, scomp) #Get String, from String List
        str_warn1 = "Error detected in Operation Number: "
        str_warn2 = no2str(comp_type)
        str_warn3 = ". Fix the Operation, and Repost!"
        str_warn4 = "Press Cancel to quit Posting Process."
        str_warn_out = str_warn1 + str_warn2 + str_warn3 + no2asc(13)
		  + "COMP TYPE: " + str_warn_typ + no2asc(13) + str_warn4
        if mprint(str_warn_out, 2) = 2, exitpost$
        ]

 

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the reply Colin,

Always appreciate your input and see you have some Youtube videos uploaded. Gonna give those a view.

Using MCAM 2020. Post is as old as I can remember, updated each time we updated MCAM, and a few different hands in there. All hacks including me.

I did the following to get it to work.

Copy and pasted the parameter 15346 to the post block below and gave it a new variable name.

image.thumb.png.952fa85e51ecb821ee54f3265f9d36b6.png

 

 

 

Colin,

I like the idea of exiting the post. I've always just put an error in the NC code that won't run on the machine. this sounds like a better way. 

Share this post


Link to post
Share on other sites

No need to rename the variable.

The first place it was located was 'pwrttparams'. <- This is the Tool Table Parameters. So these variables are available, only during the Tool Table output.

You can just copy it straight over to 'pparameter$' without causing any issues.

7 minutes ago, cncgotoguy said:

Thanks for the reply Colin,

Always appreciate your input and see you have some Youtube videos uploaded. Gonna give those a view.

Using MCAM 2020. Post is as old as I can remember, updated each time we updated MCAM, and a few different hands in there. All hacks including me.

I did the following to get it to work.

Copy and pasted the parameter 15346 to the post block below and gave it a new variable name.

image.thumb.png.952fa85e51ecb821ee54f3265f9d36b6.png

 

 

 

Colin,

I like the idea of exiting the post. I've always just put an error in the NC code that won't run on the machine. this sounds like a better way. 

Yes, if you add the 2nd Argument to the 'Mprint' Statement, you get to pick from one of 5 different Message Boxes. There are (I think) up to 7 different Numeric Responses (0-6), which get returned, based on the "type" of Message Box you initiate. (Ok/Cancel, Yes/No/Cancel, Cancel/Abort, Yes/No, Etc.)

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • 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