# Thread: G code for semicircle

1. ## G code for semicircle

Hi!

I just bought a horizontal CNC lathe with Siemens (Sinumerik 802D) controller.

I need to machine a 25 mm dia. round aluminium bar to make a knob. Rough drawing below :

Can you help me to make a G code program for this.

I bought a vertical 35degree turning tool VNMG 130408 ...

Now, I tried to use RND and CR commands ... using a cycle for OD roughing and finishing.

I get some or the other error like :
1. Intersection cannot be found
2. Contour cannot be generated ...
3. Radius too small .. etc etc

I am able to use CR for some values to generate a quarter circle - CW direction ... nothing more than that..

Any insight or help will be greatly appreciated !!!

Thanks n regards
Kzar

2. You will need to employ some basic trigonmetry to calculate the starting and ending points for each radius.
Then you will use circular interpolation (G2/G3) to navigate to those points.
This should get you headed into the rught direction.
Good luck!

3. Proprocess,

Can you check your overall legth, something is not right. 31+30=61 and if add three diameter and the part is partly stretch out, adding it up is about the same overall legth ....... it won't work. Anyway, check you draw.

4. Hello, Thanks so much for your response.

I understand what both of you have suggested and I agree with that.

But the problem I am facing is more basic as of now :-)

I cant even make the CNC to cut a semicircle ...

Example : what i tried :
I used a cycle for OD roughin finishing.

This works ::
Contour is :
X11 Z0
G03 X22 Z-10 CR=20

This gives error in simulation itself :
Contour is :
X11 Z0
G03 X11 Z-15 CR=10

Now, this should draw an arc ... but it doesnt work
Even if I make z-20 ... which is a semi circle .. it doesnt work

I think I m making some silly mistake ... and so once I know how to make a semicircle .. i can try other complex shapes ..

Hope I m not confusing u guys !!

Thanks again
Kzar

5. I do not know that control at all so I cannot help much with respect to specifics.

Some, if not most, controls do not cut partial arcs with out using I,J,K to specify the center of the arc.

6. Originally Posted by Kzar
Hello, Thanks so much for your response.

I understand what both of you have suggested and I agree with that.

But the problem I am facing is more basic as of now :-)

I cant even make the CNC to cut a semicircle ...

Example : what i tried :
I used a cycle for OD roughin finishing.

This works ::
Contour is :
X11 Z0
G03 X22 Z-10 CR=20

This gives error in simulation itself :
Contour is :
X11 Z0
G03 X11 Z-15 CR=10

Now, this should draw an arc ... but it doesnt work
Even if I make z-20 ... which is a semi circle .. it doesnt work

I think I m making some silly mistake ... and so once I know how to make a semicircle .. i can try other complex shapes ..

Hope I m not confusing u guys !!

Thanks again
Kzar
I don't know what control you have but can cycle will has hard time with the geometry you give us unless Mitsubitshi control with Mazak configuration....... If there is pocket involve you will long hand program.

7. I tried to download a programming manual from the Siemens site, but all I could find is Italian, Spanish, or French. So, I don't know if the control will take R for radius.

The numbers in the attached program contour are for part-profile. Looks like your part gets a little narrow in the neck given the (3) 12.5 radii. Also, the 30 and 31mm dimensions don't work if you want tangent arcs.

8. dcoupar's program looks right. I run a 840d on a boring bar and you just need to replace the R with CR and it should run.

9. Originally Posted by dcoupar
I tried to download a programming manual from the Siemens site, but all I could find is Italian, Spanish, or French. So, I don't know if the control will take R for radius.

The numbers in the attached program contour are for part-profile. Looks like your part gets a little narrow in the neck given the (3) 12.5 radii. Also, the 30 and 31mm dimensions don't work if you want tangent arcs.

dcoupar !!! .... THANKS A BILLION !!!

And THANKS to everyone who posted here ... you guys ROCK !!!

I am short of words to thank you enough my friend ... I was scratching my head for two days ... I have worked on manual lathe for 40years ... and this is my first CNC ... and I want to learn it on my own :-)

You are right, my dimensions are not right`... my fault... i thought that my CNC will generate something close ... even if dimensions r not exact in microns ...

Now, if you can please give me some more help ... Can you please tell me :

1. How did you generate those coordinates. How do I design the curves bit differently and generate coordinates on my own.

2. Which software did you use to draw that beautiful figure (I will get the same one) ... and will that software generate the coordinates too ?

3. Did you generate the Gcode also from that .. or some other software ? ... or did the software just generated coordinates and u wrote Gcode manually

4. Any software u recommend me to buy (or free one) which will help a beginner like me

Once again, thank u so so much ... You are a great teacher !!

Kzar

10. You're welcome... glad I could help.

I used AutoSketch 10 to draw the part and dimension the drawing, then wrote the code manually.