How to make g-code Compatible for X-Carve

I’d like to make some g-code that’s compatible with or can be run on the X-Carve Machine. Would I simply save it as compatible with Mach2-3 software or is there some code that I would have to alter slightly so that it runs with the Machine etc.

I’m interested in running long codes that would create more of a 3D bas-relief type of carving.

Alan

The X-Carve is using GRBL An open source, embedded, high performance g-code-parser and CNC milling controller written in optimized C that will run on a straight Arduino. Standard g-code is supported. If you want to see the headers you can export g-code from Easel in the Machine menu by clicking the advanced link.

1 Like

You can see the full list of g-code commands supported by Grbl on their wiki.

I’ll make a bas-relief carving pattern g-code of whatever you would like if you want to test it. Something that is maybe 3/16" inch deep, and perhaps about 4" inches square. Very small step over. Something that would be for a tapered ball nose bit. Show me an image or tell me what you want and I’ll throw it together. Also I would need to know the bit size.

To tell the truth I’m not that good at manually working with g-code. But I can make anything with software. Sure would like to see if you could get it to work.

I’ve made some g-code but I don’t think there’s a way to upload it.

1 Like

I found the upload link and uploaded the milimeter g-code. The g-code is saved as Mach2-3 because thats pretty standard.
The code should be run with a 1/16" ball nose bit that tapers upward. The code will carve less that 1/8" inch in depth.
InventablesFlowers7MM.zip (221.8 KB)

I think I may have set up the MM g-code wrong so here’s the right code:

InventablesFlowers177MM.zip (257.5 KB)

And here’s the g-code in inches. These are all about 7 inches wide and 4 1/2 inch hieght:

InventablesFlowers7Inch.zip (252.8 KB)

@AlanMalmstrom that’s awesome! You should upload it as a project.

Well the purpose of this thread is to see if the g-code can run on the machine. Once someone says that it works then I’ll upload as a project. I’ll probably make more projects too. And perhaps I’ll buy a machine too.

I just looked on our short stock shelf and we have a piece of material that is 1.25" x 6" x 12". Would you be willing to change the file to that size? If so I’d try cutting it out.

Zach

I would make it propositional but keep the long side 12" inches or maybe 11.5". Would you want the x or y to be 12". And it sounds like your machine is set up for inches. Would you want the inches g-code? And as long as were at it what bit do you want to use? The g-code is custom made for the bit so that it has the right amount of over cut or under cut. Also I would want to increase the depth for a larger size. I think that 3/16" would work good.

@AlanMalmstrom out of curiousity, how did you make that blue image above? Is that simulated with OpenSCAM or something?

I have a software that I use to view height map raster images as 3D. It’s part of my Carvewright software. I captured the screen and colorized it blue.

I make images using open source gimp. Then I use a software called bmp2cnc to make g-code. It’d be interesting to see if the g-code works with the X-Carve.

Anybody want to try this g-code and see if it works with grbl?

It’s set up as Mach2-3 compatible and is 3/32" in depth and 7" in width. You need a pencil shaped bit.

InventablesFlowing7Inch.zip (218.2 KB)

1 Like

This won’t work well. It is pretty machine specific.

Here is the beginning of the file.

%
O0001(INVENTABLESFLOWING7INCH.CNC)
N1 G00 G17 G20 G40 G49 G80 G90
N2
N3 G00 X0. Y0. M03
N4 G43H0 Z0. M8
N5 G01 F20

  • grbl likes comments in parentheses rather than the %
  • grbl does not use sub routines like “O” command.
  • grbl is not normally setup for use with line numbers like “N1”
  • grbl does not support G40 (cutter compensation)
  • grbl supports G49 (tool length offset), it is probably going to cause problems for you in this case
  • you might need to set the spindle speed with an “S12000” type command (speed = 12000RPM)

Edit: We will provide some gcode guidelines for grbl and the X-Carve soon.

I read on a youtube post that if I saved g-code as ISO that it might work with Universal G-code Sender. Can someone test this code out and see if it works for 3D carving? Even just air carving.

InventablesFlowingISOgcode.zip (150.5 KB)

That looks much better @AlanMalmstrom, but I noticed that it doesn’t have the standard set of “header” instructions that you usually send to make sure that the Grbl is in the right mode. That usually involves setting the units (G20 for inches, G21 for mm) and setting the positioning mode (G90 for absolute, which you probably want, or G91 for relative).

So then all I have to do is put a G20 and G90 in front of the code and it will work right. Like this is the start of the g-code:

G20G90G00 X0. Y0. Z0.
G01 X0. Y0. Z0. F20
G01 X5.918 Y0. Z0. F90
G01 X5.918 Y0.0055 Z0.
G01 X5.918 Y0.0125 Z0.
G01 X5.918 Y0.0125 Z0.
G01 X5.9126 Y0.0125 Z-0.0004
G01 X5.9071 Y0.0125 Z-0.0037
G01 X0.0109 Y0.0125 Z-0.0037
G01 X0.0055 Y0.0125 Z-0.0004

grbl likes comments in parentheses rather than the %

The way I read this is % is a common start line when you save it on a computer and want to “send” the file to the machine. It tells it this is the start of the transmission. An m30 or m90 is read as the end of the transmission.

Also on the same note On any cnc machine I’ve worked on, when a program is wrote in g and m code the program number starts with an O and followed by numbers depending on how many the machine supports. I’ve ran a lathe that only supports 4, and one that supports 5. My mazak mill supports 8. It just depends on what’s supported. But what I’m getting at it’s just a file number so you can call up the right program, not a sub program (which is usually calling with a p). The file number is basically a storage number. So does grbl only allow a single program to be ran at a time? So you can’t use a sub program within a single program? Can you use m98 and skip to a numbered line and back with m99?

Look here for your answers.

1 Like