What's new
What's new

G65 Macro call line not passing values to correct local variables


Apr 26, 2023

On a FANUC Series 31i-MODEL B control for an OKK Horizontal Machining Center, the values being passed in a G65 Macro Call Command are not going to the local variables that I am expecting. Below is the G65 line and the values in the local variable table after reading that command.

(After typing this out, I realized it comes down to the I & J numbers that I expected to be passed to #4 and #5 were put in #7 and #8, and the values that I expected to be in #7 and #8 (D and E), are missing altogether. All other variables were passed as I understand they should.)

G65 P3333 D1.0 Q.922 Z1.250 V12. T0.7 K7.0 R5.0 I50. J200. E3.0 A75.0 B85.0 C95.0 F0.0004 W58. S1000. (spaces added for clarity).

00001 75.0000 (expected)
00002 85.0000 (expected)
00003 95.0000 (expected)
00004 DATA EMPTY (not expected - should have been the I-value - 50. - instead this value is in #7 (D))
00005 DATA EMPTY (not expected - should have been the J-value - 200. - instead this value is in #8 (E))
00006 7.0000 (expected)
00007 50.0000 (not expected - this should have been the D-value - 1.0, instead it is what should have been in #4 - I50.0)
00008 200.0000 (not expected - this should have been the E-value - 3.0, instead it is what should have been in #5 - J200.0)
00009 0.0040 (expected)
00010 DATA EMPTY (expected)
00011 DATA EMPTY (expected)
00012 DATA EMPTY (expected)
00013 DATA EMPTY (expected)
00014 DATA EMPTY (expected)
00015 DATA EMPTY (expected)
00016 DATA EMPTY (expected)
00017 0.9220 (expected)
00018 5.0000 (expected)
00019 1000.0000 (expected)
00020 0.7000 (expected)
00021 DATA EMPTY (expected)
00022 12.0000 (expected)
00023 58.0000 (expected)
00024 DATA EMPTY (expected)
00025 DATA EMPTY (expected)
00026 1.2500 (expected)
00027 DATA EMPTY (expected)
00028 DATA EMPTY (expected)
00029 DATA EMPTY (expected)
00030 DATA EMPTY (expected)
00031 DATA EMPTY (expected)
00032 DATA EMPTY (expected)
00033 DATA EMPTY (expected)

Any help would be greatly appreciated. If I figure it out, I will share what I found.

Thank you!

Best regards,

Mike M


Apr 26, 2023
Shift K7 to anywhere after J200, and the result will be as you expect.
Hi Sinha,

Thank you! I have your book, and I just found this (after reading your reply) on page 152 (Chapter Seven) in my edition of CNC Programming Using Fanuc Custom Macro B, where it states the arguments of G65/G66 can be specified in any order, but if I, J & K are used, they must be in alphabetical order (paraphrased from the book). I can't believe I never ran into that prior to this. Thanks again!

By the way, I purchased your book probably 10 years ago and it helped me write a conical interpolation macro on a machine that didn't have the spiral interpolation option active, which would have cost about $7,000 to activate, so I'd say purchasing your book was money well spent! So, thank you for that, as well!

Kind regards,

Mike M


Sep 25, 2010
We are thankful to the forum also which facilitates interaction among CNC users.
I also have learnt quite a few things.