What's new
What's new

what is wrong with my code?

rbregn

Aluminum
Joined
Jan 8, 2014
Location
Montana
The heat must be getting to me, I don't see an issue with my code. I get an invalid R in g02 alarm.

N3 G20
N4 T101
N5 G54
N6 G50 S1000
N7 G96 S500 M03
N8 M08
N9 G00 X5.
N10 Z0.1
N11 X3.7505
N12 G71 P13 Q21 D.05 U0. W0. F0.015
N13 G00 X1.75
N14 G01 Z0.
N15 Z-1.375
N16 X1.99
N17 Z-1.687
N18 G02 X2.49 Z-1.937 R0.25
N19 G01 X2.875
N20 Z-2.937
N21 X3.
N22 M09
N23 M05
N24 M30
 
X1.99 + .25 = x2.24

Hell alphonso,
You have to add 0.25 x 2, but Rob gave you a tick for your math.

Hello Rob,
R minus is required when the arc angle is greater than 180deg. R-0.25 in the OP's code would have produced a 0.25 arc through 270deg and raised a Non-monotonous X move error in the G71 cycle.

To rbregn
What is the error code being raised. Your code looks OK; its a 0.25 radius arc through 90degs.

It should not make any difference, but for the sake of testing, replace:

N18 G02 X2.49 Z-1.937 R0.25

with

N18 G02 X2.49 Z-1.937 I0.25

to see if you get the same error.

Not that it should cause an error, but the N14 G01 Z0. in your profile description is superfluous; it can be omitted.


Regards,

Bill
 
G03, counter clockwise arc.
Why are you using a G02, when going from X1.99, Z-1.687 to X2.49 Z-1.937 ???
Isn't that a counter clockwise (anti clockwise for a brothers across the pond) move?
 
G03, counter clockwise arc.
Why are you using a G02, when going from X1.99, Z-1.687 to X2.49 Z-1.937 ???
Isn't that a counter clockwise (anti clockwise for a brothers across the pond) move?

Hello doug925,
It seems to me that it could be a concave radius between a horizontal and vertical surface, hence the G02. Even if G03 were to be used, the code should still work with the OP's numbers.

Regards,

Bill
 
G03, counter clockwise arc.
Why are you using a G02, when going from X1.99, Z-1.687 to X2.49 Z-1.937 ???
Isn't that a counter clockwise (anti clockwise for a brothers across the pond) move?

@ Angel, thanks for the correction.

@ Doug, I think he is trying to generate a concave radius not an convex, I only say that because there aren't any other "edge breaks" in the code.

@ Freakin' Brits, Do you really say "anti clockwise"? Sounds a bit panties to moy eaa.

 
Numbers look fine. I'd retype the R0.25 to R.25 just to make sure the 0 is a zero, not the letter O.

Prolly not the issue as it looks CAM generated- I write my lathe programs in notepad...
 
G03, counter clockwise arc.
Why are you using a G02, when going from X1.99, Z-1.687 to X2.49 Z-1.937 ???
Isn't that a counter clockwise (anti clockwise for a brothers across the pond) move?

Or his tool is sitting on the front of the part... So a front style turret or tool post.
The code looks good to me... I am guessing that it is just a typo in there somewhere like jancollc wrote. Very interested to see what the results are.

Yup anti-clockwise is the correct way to say it... not sure where you guys came up with this counter crap :D
 
Or his tool is sitting on the front of the part... So a front style turret or tool post.

Hello NAST555,
If the tool arrangement is at the front of the machine and X+ is also at the front of the machine, G02/G03 are specified to achieve the same results as for a machine with the tool arrangement and X+ at the rear of the machine. When the tool arrangement and X+ are at the front of the machine, CW/CCW movement of the tool is viewed from underneath the tool looking up. In essence, the tool turret and X+ are placed at the front of the machine by rotating the whole arrangement about the Centre Line of the machine.

Regards,

Bill
 
Just a thought here, since the code, as written looks good...

Back in the day I used to run an old Accuslide with a Fagor on it...
Sometimes the code would be perfect, go through it with a fine tooth
comb and it SHOULD work... Re-write it from scratch, exactly as it
was and it was fine..

I've also had the problem with cam posted stuff.. Send it to the machine and it throws
an error.. Check the code, remove "white spaces" etc.. resend.. Same thing, again and
again, error, error, error.... Go back and repost it, and no problem..

I don't know the answer, but when errors like this happen, I've learned not to keep banging
my head against the wall... I go back a few steps and start over.. I've found that usually
saves me time and aggravation.

Sometimes its something stupid like a 'tab' at the end of a line. Oh instead of zero.
Comma instead of a period.
 
Just to be sure, did you hand-type the code into your post or cut and paste it from the same program in the control? I've seen many instances where the code was posted isn't what was in the control.
 
The code I showed was generated from my software, I wrote it first directly on my lathe, that got an alarm. So I drew the part in my Cadcam and generated the code. Mine and the software's code are identical, except for some redundant code in the generated code. The alarm I get is a "302 invalid R in G02 or G03". If I change the R to an I, I get the same alarm. If I change the G02 to a G03, I get a 612 and a 604 alarm. Soooooooooooooo much for a 5 minute job! I will delete everything shut everything down and try again. Should have just buzzed it out in the manual, but now it is personal :willy_nilly:
 
just eliminate the G02....it knows you want a radius between the 2 moves by the X and Z moves....no need for using G02 or G03 when specifying an R value...if using the G02 then eliminate the R value and do it long hand code
 
just eliminate the G02....it knows you want a radius between the 2 moves by the X and Z moves....no need for using G02 or G03 when specifying an R value...if using the G02 then eliminate the R value and do it long hand code

So if you just put the R without G2/G3 witch direction does it go cw or anti-cw?

Brent
 
just eliminate the G02....it knows you want a radius between the 2 moves by the X and Z moves....no need for using G02 or G03 when specifying an R value...if using the G02 then eliminate the R value and do it long hand code

:rolleyes5:

Only works if the control has the optional corner rounding and chamfering function.
 








 
Back
Top