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 can I write this program?


EFE
 Share

Recommended Posts

The way understand the way you want to mange the tool is that it lasts 100 minutes but after 50 minutes of cutting to want it use a wear value of .010. If your machine doesn't have tool life management on the CNC control you can set up a "poor mans" cut timer or parts counter using macro programming. On a Fanuc control you'll need the Fanuc Macro B option though which most builders provide. You'll want to set up a timer for the tool you want to adjust the offset for. You'll use 2 different macro variables, say #500 for time in the cut and #501 for the cumulative total time. You could do all this with just 1 #500 variable but the statements get more complicated so by using 2 #500 & #501 variables is code cleaner and easier for me to explain.

 

For example at the beginning of the tools' 1st cut you'll start the clock with a statement like #3002=0 to set the clock to zero and at the beginning of the 1st cut another statement like #500=0 to set the current time in cut back to zero. At the end of the cut you will stop the clock with a statement like #500= #3002 which will save the time from the internal clock to variable #500. NOTE: if you want to time multiple cuts where the timer is turned on and off while that tool is being used you have to reset the clock back to zero with #3002=0 again then to stop the clock after cutting and add that time to the other cuts you want to have a statement like #500= #500+#3002.  Now at the end of the tool you will want to add that time to the cumulative time with a statement like #501=#500+#501

 

Now #501 has the total time for that tool so now, just as you suggest in your example, at the beginning of the tool change it would look like this 

 

M6 T10

IF[#501 LT 50.] GOTO1

G90 G10 L11 P1 R0.01

N1

M3 S5000

G0 G54 G90 X0 Y0

G43 H1 Z1. M8

#3002=0

#500=0

cut...

cut...

#500=#3002

#501=#500+#501

G28 G91 Z0

M1

 

 

So with this example each time the tool is called up with more than 50 minutes on it the tool will use the adjusted offset from the G10 line of code. When you replace the tool with a new one you would need to set your #501 cumulative time back to zero with a MDI statement like #501=0 or go to the Macro page and set it to zero there. Also you will need to manually set your Wear offset back to zero.

Also note that you could set up an alarm to alert the operator when the tool gets to 100 minutes with a statement like IF[#501 GT 100.] THEN #3000=1(TOOL LIFE EXPIRED) and the machine will alarm out or if you don't want an alarm but just want to warn the operator you can send it to the message screen with no alarm with a different #3000 but I can't remember which number it is off hand but it is possible not to alarm the machine out and even possibly call up a spare tool just like Tool Life Management as well.

 

The Fanuc programming manual has a time counter example in the Macro section for 5 tools however it starts/stops the clock with a M3/M5 M-code macro that uses #4120 which is last T command, not necessarily the T that is in the spindle, so be careful. I wouldn't recommend using it though. Which a little effort you can learn macro programming with a challenge like this from the Fanuc book but the language is questionable and it doesn't go into much detail and doesn't explain things very well. A better book would be CNC Custom Macros from Peter Smid 

 

Hope this helps!

 

Cheers!

Len Dye

  • Like 2
Link to comment
Share on other sites

Be careful how you apply "G91" and "G90" in your G10 lines.

 

One(G90) will overwrite, and one(G91) will add to the offset.

 

In your first example, the "G91 G10 L11 P1 R0" has no effect, because it's adding zero to the offset.

 

Just some food for thought.

 

J

  • Like 2
Link to comment
Share on other sites

Be careful how you apply "G91" and "G90" in your G10 lines.

 

One(G90) will overwrite, and one(G91) will add to the offset.

 

In your first example, the "G91 G10 L11 P1 R0" has no effect, because it's adding zero to the offset.

 

Just some food for thought.

 

J

yes Jaydenn that's very important, thanks! Unfortunately I found this out the hard way where the program had neither the G90 or a G91 on the G10 line so it depends what mode the machine is in when it reads it. The program ran fine for months then one day a big SUPRISE

 

Cheers!

Len Dye

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