View Full Version : Use both I & K and R modes in G2 and G3


Karl_T
04-15-2005, 12:02 PM
Hi, I lurk here often, seldom post. I normally ask all questions direct to the kind helpful folks at Camsoft, but I'll give Rubin a break today. I have CNC Pro on a lathe.

My operator would like to be able to program arcs in both Fanucarc=0 mode (G2 X# Y# I# K#) and Fanucarc=2 mode (G2 X# Y# R#) in the same Gcode program. He tells me this is SOP on other controls.

I'm getting an error at program load on any G2 or G3 with syntax that doesn't agree with the Fanucarc mode. IE if Fanucarc=0, then G2 X# Y# R# will bomb.

Anyone doing something like this? Any work arounds to try?

Karl

camsoft
04-15-2005, 12:28 PM
Karl,

This is a tough one to answer, because it throws people off when there are both incremental arc and radius arc styles of programming in the same G code file for arc centers.

To cut to the chase, the FANUCARC command can be issued on-the-fly to swap between incremental and radius style arcs through either a MCODE that issues
FANUCARC=0 for absolute arcs
FANUCARC=1 for incremental arcs
FANUCARC=2 for R for radius.

Plus you also have to use an IF THEN to change teh CW & CCW command line from
CW x;y;z;i;j;k
-to-
CW x;y;z;r


-or-

If you were clever you could use the ISTHERE command in the GCODE.FIL file inside G2 and G3 to test if there is an R on the G2/G3 line or not then based on the result issue IF THEN FANUCARC 0,1 or 2.

This would trap for the programming style automatically on-the-fly

Tech Support
CamSoft Corp.
(951) 674-8100
support@camsoftcorp.com
www.cnccontrols.com

Karl_T
04-15-2005, 06:11 PM
I'm sorry, I should have taken a minute to be more clear in my original post. I had rewritten the G2 and G3 codes exactly as you suggest to check for the presence of the "R" character in the line, if so change to fanucarc=2 and run a different CW or CCW.

The trouble I ran into: There must be a syntax checker at program load. My default is FANUCARC=0. If the checker sees an R in the Gcode line it spits out an error before running that G code. Or at least, that's sure what it appears to be doing.

Karl

camsoft
04-15-2005, 06:23 PM
Karl,

That should still be okay and still work. If you're using CNC Pro it does have a syntax checker when the program loads, but the syntax in this case that it is comparing to is the logic in the GCODE.FIL file.

Send us your latest CBK and G code program to support@camsoftcorp.com

Tech Support
CamSoft Corp.
(951) 674-8100
support@camsoftcorp.com
www.cnccontrols.com

Karl_T
04-15-2005, 06:53 PM
DANG!

Once again, You were right, I was wrong.

I had a syntax error in my G2. Camsoft finds it right away when compiling the program. I tell you this Camsoft is GREAT STUFF.

FWIW, this G2 code works for anyone else interested.

DISPLAY4 {f*(\73/100)}
DISPLAY5 \41
RUNTIME \4
DISPLAY8 \4
ISTHERE R;\104;\105
IF \104>0 THEN FANUCARC 2 : CW z;(x/2);0;r : FANUCARC 0 : EXIT
CW z;{x/2};0;k;i;0
-----G2

camsoft
04-15-2005, 07:00 PM
Hi Karl,

Thanks for the compliment!

Watch out here, we noticed that you used ( ) rather than { } for math:

CW z;(x/2);0;r

Tech Support
CamSoft Corp.
(951) 674-8100
support@camsoftcorp.com
www.cnccontrols.com