Thursday, July 2, 2015

Teaching myself gCode

This a is low level CNC control language. Roughly similar to teaching yourself assembly language so that more fully understood what the C compiler is doing when you write a Hello, World program.

UPDATE:  Not as bad as writing PostScript, and the LinuxCNC paxckage has a nice simulator for  testing while waiting for stepper motors to arrive.

Stepper motors arrived.  But the mill is sitting on the kitchen table during a church board meeting, so I am still writing gCode.  Fortunately, this part involves only a few right angle mill operations, so it is only laborious to write the gCode.It's a bit more laborious perhaps than it needs to be because I am only taking off .01" on each pass, because I am sure that the cutters and mill can take off that much aluminum with no hiccups.  I might experiment at some point with .05" per pass.

Unfortunately, while the x- and y-axes wre doing their robotic thing perfectly, the z-axis was behaving oddly, and even manually refused to rise.  This kit came with three handwheels to attach to the far end of the stepper motor shafts, allowing m,anual use as well.  There were two sizes, and it weasn't clear which axis the larger handwheel was for.  The attachment mechanism and shafts were identical, but the fact that the small handwheel will  not come off the Z-axis suggests that there is something special about this, and it may have damaged the z-axis motor.  Of course, Sherline is closed for the 4th weekend, so I will have to wait until Monday to resolve this.  In the meantime, resume gCode development!

This is what it looks like:
 %
(machine bottom of VHAL part)
g20  (inches)
g40 g49
g90 f1000
G1 Z0.010 x0.25 y0 G80
g1 y2.676 X0.25 g80
g1 Y2.676 x0.5 g80
g1 y0     X0.5 g80
G1 y0     X0.75 G80
G1 Y2.676 X0.75 G80
G1 Y2.676 X1.0 G80
G1 Y0     X1.0 G80
G1 Y0     X1.25 G80
G1 Y2.676 X1.25 G80
(last pass narrower because we are only cutting to 1.562)
G1 Y2.676 X1.312 G80
G1 Y0     X1.312 G80
(return to zero point and cut another .01" deeper)
G1 Z0.020 x0.25 y0 G80
g1 y2.676 X0.25 g80
g1 Y2.676 x0.5 g80
g1 y0     X0.5 g80
G1 y0     X0.75 G80
G1 Y2.676 X0.75 G80
G1 Y2.676 X1.0 G80
G1 Y0     X1.0 G80
G1 Y0     X1.25 G80
G1 Y2.676 X1.25 G80
(last pass narrower because we are only cutting to 1.562)
G1 Y2.676 X1.312 G80
G1 Y0     X1.312 G80
m2
%

Now writing bash scripts to produce gCode to speed up the process.


























7 comments:

Mauser said...

Have you been going to that CNCZone forum I mentioned to you before? I'm sure you can get all kinds of help there.

w said...

Doesn't the open source CAD/CAM generate the gcode from the object's design specification? Solidworks and the other very spendy professional CAD/CAM packages do that---love to try those out but at many thousands of dollars per seat I'll have to win the lottery first....

One of these days I'd like to get into CNC it if I can ever find the money and time.

Clayton Cramer said...

w: open source CAD/CAM? Where?

w said...

I see several listed when I do a web search. Perhaps they are all too limited in capabilities though.

Cris said...

Clayton,

Befire you start on your scripting project, study this xkcd first.

Cris said...

Clayton, before you start scripting, consider this xkcd first.

Clayton Cramer said...

Cris: Not my experience. The two scripts are now done, and changing the feed depth (how much material I remove on each pass) is trivial.