Welcome! Log In Create A New Profile

Advanced

G2 and G3 (arc) codes for G-code interpreter

Posted by Anonymous User 
Anonymous User
G2 and G3 (arc) codes for G-code interpreter
March 24, 2008 10:11PM
I've added support for G2 and G3 (clockwise and counterclockwise arcs) to the G-code firmware (see attached file). Not the most sophisticated way of doing it (it breaks the arc down into straight sections and moves according to these), but it seems to work. Note also that the arc must be in the X-Y plane.

Also, I have added a constant to indicate if the sensors are active high or active low (since mine are active low).
Attachments:
open | download - GCode_Interpreter.zip (7.5 KB)
Re: G2 and G3 (arc) codes for G-code interpreter
March 26, 2008 05:21PM
nice!

i'll test it and try to integrate it with the subversion GCode stuff.

great work. this should definitely go into v1.3 of the arduino firmware (which will be released soon.)
While generating gcode files with various layer thicknesses, I started losing track of them and realized it would be good for the file to include nozzle size. In the future the information would be useful for machines with different nozzle size to make fine and thick layers. For now, we would just reserve an mcode and the print spooler would just ignore it. Also it would be useful in future to define a material.

The traditional way to handle arcs is to calculate them on the generation program and read them in the print spooler. However, this way the file size is twice as large as if we generated lines on the generation program, indicated the arc size, then the print spooler calculates the arcs in the path. For this to work we need a command to set the arc size, a command to turn arc mode on and a command to turn arc mode off. For now, we would just reserve the arc commands and the print spooler would just ignore them.

To summarize, I suggest we reserve the five M commands listed below for future use. Since M107 was the highest number I saw in the process_string.pde file, we could start at M108, but it don't matter where we start, we just have to reserve five.

M108 set nozzle size
M109 set material
M110 set arc radius P; for example M110 P0.3
M111 set arc mode on
M112 set arc mode off

Cheers,
Enrique
emt
Re: G2 and G3 (arc) codes for G-code interpreter
March 29, 2008 05:03AM
Hi

Perhaps it might be easier to stick to G code G2 & G3 for arcs and parse them in the firmware. That way you maintain G code standard which may become important in the future as people build hybrid machines i.e. Milling and extruding.


Regards

Ian
Anonymous User
Re: G2 and G3 (arc) codes for G-code interpreter
March 29, 2008 05:01PM
> Perhaps it might be easier to stick to G code G2 &
> G3 for arcs and parse them in the firmware. That
> way you maintain G code standard which may become
> important in the future as people build hybrid
> machines i.e. Milling and extruding.

This is exactly what the code I have posted does, specifically because I am building a hybrid machine.
Anonymous User
Re: G2 and G3 (arc) codes for G-code interpreter
April 03, 2008 09:57AM
Hi Chris,

This is great...I managed to incorporate it into my code and compile it no problem, but I can't seem to get the GCode Arc commands right. How many arguments do I give, and in what order/format?

From the code, it looks at though we're looking for a "I" and a "J" string along with X and Y coordinates, but none of the combos I tried did anything.

Help?

Thanks so much!
balm
Re: G2 and G3 (arc) codes for G-code interpreter
April 03, 2008 01:53PM
good news! i added this update to the subversion copy. i'll be making a new arduino firmware release soon which will include it. thanks for the hard work.

ps. if you want subversion access, just PM me your sourceforge ID and i'll add you.
Anonymous User
Re: G2 and G3 (arc) codes for G-code interpreter
April 03, 2008 07:10PM
balm Wrote:
-------------------------------------------------------
> Hi Chris,
>
> This is great...I managed to incorporate it into
> my code and compile it no problem, but I can't
> seem to get the GCode Arc commands right. How
> many arguments do I give, and in what
> order/format?
>
> From the code, it looks at though we're looking
> for a "I" and a "J" string along with X and Y
> coordinates, but none of the combos I tried did
> anything.

I and J are always relative. So for example, if you are in absolute mode and at starting position X100 Y100 Z0

G2 X110 Y110 I10 J0

would draw a clockwise arc to X110 Y110 Z0 with its circle at X110 Y100 Z0 (since I10+X100=X110 and J0+Y100=Y100). Does this make sense?

Every piece of software I have tried that produces G-code does it in this format, so it seems to be fairly standard.


Chris
Anonymous User
Re: G2 and G3 (arc) codes for G-code interpreter
April 14, 2008 02:43PM
Thanks Chris! That works great!
-balm
Sorry, only registered users may post in this forum.

Click here to login