View Single Post
  #2   Spotlight this post!  
Unread 20-12-2009, 23:52
sanddrag sanddrag is offline
On to my 16th year in FRC
FRC #0696 (Circuit Breakers)
Team Role: Teacher
 
Join Date: Jul 2002
Rookie Year: 2002
Location: Glendale, CA
Posts: 8,510
sanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond reputesanddrag has a reputation beyond repute
Re: G Code with a Mill

First, welcome to the world of CNC! It is SO much fun. There are a few problems in your code; let me try to help.

There is no need to move to the center of the circle before making the circular interpolation. The line that reads "G01 X5 Y5 //Put to center of circle, 5,5" can be eliminated.

Your next line to position the machine at the start of the arc is fine, however usually this would be a "rapid" G0 (or G00) move through air rather than a G01 "feed" move that is usually used for cutting the material.

Your G02 (clockwise circular interpolation) line should read:

G02 X9. Y5. I4. J0

The I and J coordinates are the incremental distances from the starting point to the center of the arc, not the coordinates of the center itself. The coordinates of the center itself never actually appear in the code. So if you are starting at 1,5 the center (at 5,5) is located at an incremental/additional 4 in the X (I), and 0 in the Y (J) directions (since you are sitting directly to the left of your intended center).

The code revised as listed above will yield a semi-circle (half circle). If you wanted a full circle, you would leave out the X and Y coordinates, and the end point would be the same as the start point, resulting in a full circle.

Also, not sure about yours, but many machines are very particular about leaving decimal points off of a number. For example, on a HAAS machine, "F4" does not mean the same thing as "F4." Oh, and that's the the other thing. You are missing feed rates all around. The units of feed rates are in inches per minute. To start out, I'd keep the feeds under 10 IPM.

Also, in your first line (the G90 absolute line) I would add G0 X0 Y0 Z1 to make it do what you say in the comment.

Finally, many CAM programs such as MasterCAM really make coding for the CNC a piece of cake. You should investigate these.

If you wish to improve your understanding of G-code and the machine's interpretation of it, you will find this manual very helpful: http://coestudentshop.engr.wisc.edu/...llWorkbook.pdf
__________________
Teacher/Engineer/Machinist - Team 696 Circuit Breakers, 2011 - Present
Mentor/Engineer/Machinist, Team 968 RAWC, 2007-2010
Technical Mentor, Team 696 Circuit Breakers, 2005-2007
Student Mechanical Leader and Driver, Team 696 Circuit Breakers, 2002-2004

Last edited by sanddrag : 21-12-2009 at 11:47.