Writing gcode

I am a former machinist and wanted to write gcode as I am comfortable doing so. Is this possible and if so how?

G-code is a computer language with many different dialects. There are entire books written to explain how to use G-code in CNC work.

To write the G-code by hand to mill all but the most simple designs would be a huge task.

Most people these days use a CAM program to generate the G-code based on a 2D or 3D model designed in a CAD program.

If it is necessary to tweak the G-code by hand then it would be valuable to know how the G-code language works.

Do you have a specific reason for wanting to write programs at the G-code level?

To answer your specific question: yes, it is possible.

*kinda of.

Since you were a machinist I assume you know what G-code is. The stock X-carve uses GRBL, and it does not have a very large g-code library. So if you want to write simple Cartesian points yes but more complicated canned cycles are out. GRBL is a very capiable system an will accept G-code but it may not be able to do some of the operations you may me thinking.

The link is for GRBL wiki which explains it a bit more.

Unfortunately, the G-codes which make for nice hand-coding are for the most part not supported by Grble due to memory constraints. Some discussion of supported codes here: http://www.shapeoko.com/wiki/index.php/G-Code#G-code_Not_supported_by_Grbl

There are some programmatic pre-processors which may facilitate your working in the style you prefer: http://www.shapeoko.com/wiki/index.php/Programmatic_G-Code_Generators — I’ve been surprised that none of the G-code senders do this support on the fly (maybe bCNC?).

Alternately, you could change your electronics to use LinuxCNC or Mach 3 which support most of the G-code standard.

I guess I didn’t ask the question real well but to answer the last persons reply. I am new to cad/cam and will learn it but there are some basic gcode functions that easily would do what I want and would be easier for me, I think for those who know cad/cam but not gcode, those people would think it difficult, not me. My problem is under what software can I write the code and then use with the x carve. also can you recommend a cad/cam program that is easy to learn and reasonably priced that will work with the x carve?

G-code is just text strings so you could use any text editor to write G-code.

Would the End Of Line character make a difference? The EOL character in something like Notepad is different from the one in Notepad++. I know the Arduino IDE can’t use configuration files written in Notepad because of that. Would that make a difference here?

You can use one of the previewers which includes edit functionality: http://www.shapeoko.com/wiki/index.php/Previewing_G-Code

I use NC Plot, but have been meaning to try http://nc-corrector.inf.ua/index_EN.htm

I avoid commercial software, preferring opensource. Lists of what I’ve found thus far at:

Thanks, I will give that a go.

@BradT

I didn’t think of that.

V-carve Pro uses CR LF as EOL
Notepad uses CR LF as EOL
Wordpad uses CR LF as EOL

Arduino uses LF as EOL

Since UGCS accepts the V-carve Pro files, I would assume that it would also accept Notepad and Wordpad files. I guess you would have to check your favorite text editor to see what it used.

what does cr lf and such mean, do you actually type that for EOL?

No. CR stands for carriage return and LF stands for line feed (also known as newline).

If you are using a program like Notepad, when you press the enter key on the keyboard that will place a carriage return and line feed character in the file you are editing as the EOL (end of line)

Some programs on Unix operating systems don’t use the carriage return, but only place a line feed character in the file as the EOL (end of line).

I think that was the point that @BradT was trying to make. He was asking if the termination character(s) would affect the acceptance of the line when sent to grbl.

CR == Carriage Return (used on Macs for End of Line)
LF == Line Feed (Unix)
CR/LF == PC/Windows

ok thanks

3d cad software FREE google sketch up. Great for beginners but lacks tool path generating capability.

FUSION 360 is also free. And AWESOME!! it is harder to learn but thats because you can do almost anything with it. And it has great cam software built in.

I reccomend starting with sketch up. Get comfortable. Then learn fusion 360.
Both have great you tube tutorials.

Yeah, I just know that has caught me in the past, and it can take forever to track down sometimes. I don’t know if it matters with GRBL or not, but worth noting. FWIW Notepad++ defaults to just LF.

Useless Trivia
If the names sound familiar, they are carryovers from the old typewriter days. A line feed (LF) was when the typewriter would move down a line. The carriage return (CR) was when that carriage returned home so you were typing at the start of the line.