What's new
What's new

fanuc tool offset macro

ChippyMcChip

Plastic
Joined
Jan 13, 2018
does anybody have a length tool offset macro for fanuc control. basically i want to touch off on a block and have the tool offset change to the machine number to whatever tool is in the spindle when i enter an mcode.
 
Why not just write one?

I'm not the sharpest tool in the shed when it comes to coding either macros or g-code by hand, but between the Macro tutorial at the top of the forum and the Peter Smid Fanuc Custom Macros book you can buy used for about $40 on Amazon, I wrote my own tool setter program from scratch. It's even activated by a G-code you can call with variables to automatically offset all the tools in my Robodrill turret, offset face mills, and do tool break detect.

It really isn't rocket surgery, and you'll get a pretty good base of knowledge in how macro programming works.
 
Why not just write one?

I'm not the sharpest tool in the shed when it comes to coding either macros or g-code by hand, but between the Macro tutorial at the top of the forum and the Peter Smid Fanuc Custom Macros book you can buy used for about $40 on Amazon, I wrote my own tool setter program from scratch. It's even activated by a G-code you can call with variables to automatically offset all the tools in my Robodrill turret, offset face mills, and do tool break detect.

It really isn't rocket surgery, and you'll get a pretty good base of knowledge in how macro programming works.

I guess you have a probe correct. He is setting tool with a 123 right?
 
I guess you have a probe correct. He is setting tool with a 123 right?

Sure, but it's the same sorta deal...

1- Set up the macro by touching the spindle nose face off of the 123 block (or whatever) and write the machine coordinates down. Use that number in the macro as the offset value.

2- Set the macro up to pull the current machine coordinates whenever it is fired off, subtract that offset number from step 1, and write the new value to the tool offset table for the tool currently in the spindle. Saave this macro to the appropriate 9000 series program and set the params so it can be called with an M or G code.

3- To run it, you would call up the tool you want to set, hand jog it over the 123 block until it touches off the way you want, go to MDI, type G106 (or whatever G-code you set up), and the tool offset is automatically written to the table. Done.

Most of the code is very similar to how an auto tool setter works as far as pulling things like machine coordinates, basic math, and writing to the tool table. The only thing really missing is all the skip signal trickery to automate the actual tool touch off.

It's actually a pretty solid little macro to start learning macro programming, especially because it doesn't involve any risky machine movement trickery that might cause a disaster as you're learning.
 
does anybody have a length tool offset macro for fanuc control. basically i want to touch off on a block and have the tool offset change to the machine number to whatever tool is in the spindle when i enter an mcode.

This can be done easily, but are you using positive tool lengths or negative? Simply using Input c on offset page may be easier and less steps then handling down then going to mdi and calling up macro.
 
This can be done easily, but are you using positive tool lengths or negative? Simply using Input c on offset page may be easier and less steps then handling down then going to mdi and calling up macro.

This is how we do it currently but you have to home the machine on z and then zero out the relative because the input c enters the relative z coordinate and we have had some machinist forget to home the machine so we want to make it easier for them to set the height offset.
 
This will get you started it uses negative tool offset lengths.handle down and touch off block. In mdi type G65P9 Works on OM

%
O9(TOOL TOUCH OFF MACRO)
(HANDLE TOOL DOWN IN Z)

#100=#4120 (STORE SPINDLE TOOL)

#101=#100+2000.(FIND H OFFSET NUMBER)

#[#101]=#5023 (STORE MACHINE Z INTO H OFFSET)

G0G90G53Z0.0
M99
%
 
so i learned a bit and made this program

%O9002
#1=#5023;(machine z)
#2=#4120;(tool number)
#[2200+#2]=#1;
G53;
G54;
M30;
%

i also associated an M code to program 9002. so all i have to do is mdi m120 and it changes the height offset. the reason i don't want to use input c is because you have to home the machine before you pick your tool up.
 
One thing to keep in mind is that #4120 only represents the last T code executed. That is not necessarily the current tool in the spindle. Depending on how your machine performs toolchanges, there is a possibility that an offset could be set incorrectly because of that if an M6 was not performed. It really is a procedural thing that needs to be established.

You could add some code to your macro to ensure that the last T code executed was also followed by an M6.

In MDI mode enter M120 T-- (macro calls T-- and performs M6 and then M0)
Switch to handle mode and touch off tool.
Switch back to MDI and press Cycle start. (macro resumes execution, writes offset, etc.)
 








 
Back
Top