Wednesday, August 31, 2016

GCode

G Code *(Geometric Code) aka RS-274

or G&N cdeo as descibed on you tube
https://www.youtube.com/watch?v=r5bimWKeMbY

GCode is a code language for CnC machines
it controls how and where a machine moves
code vary for different machines

movements are done with Cartesion Coordinates.
X indicates the X axis
Y indicates the vetical postion of the machines Y axis
(usually Y is also up in world space for CAD software, with the exception of 3DsMax)
Z controls depth or Z axis

numbers direcly following X,Y,Z are the distances the machine should travel in that direction
specific Codes can change the units of measurement
ie G20 will mean subsequent code will be executed in inches
ie G21 will mean subsequent code will be executed in mm

the machines speed is determined by the code
ie G00 use max speed

spindle rotation speed I also controlled

G01 - move at a feed rate (determined by F)

some codes are like predetermied movements
G20 - makes a clockwise circular motion, G30 in in a counter clockwise circular motion
G02 circular interpolation clockwise, G03 circular interpolation counter clockwise


an Arc is determined by I, J for incremental centers and J determines the radius
ie to arc (clockwise) from p1 to p2, p2 must be a point tot he right of p1 or in the + X axis

(if it was negative in X in relation to p1 then it would form a counter clockwise arc)
the center of the arc would lie at the midpoint of P1 and P2
the center is specified with coordinates I and J
the radius of the arc is specified in the GCode - this will give us the arc.

the Gcode would be :
X_Y_I_J_F_

where X,Y is the pos of p1, I,J is the pos of the arcs center (relative to the start),
and F is the feed rate - how fast to move the nozzle/end mill.

G90 - set the coordinate system to absolute (the arc center is always relative to the start point)
G91 - set the coordinate system to relative (aka incremental)


MCodes (misc machine codes) ie
M06 tool change on a CnC machines

Init code
Saftety codes - cancel offsets - set measurements etc.
N07 tool change and speed setting


then the actual movements are specified
Ncodes - return the machine to the home position then stop and rewind the program in preparation for another print.


nozzle is sometimes referred to as the end mill.
a complete set of GCodes is refferred to as a part program

start and end of GCode is indicated with a %
Prep codes are unique to machines


M15 tells the machine to stop the spindle

typically a nozzle is lifted up in Y above a machines part

GCodes are typically simulated for identify errors and prevent expensive machine damage.

GCode Tutorials
http://linuxcnc.org/docs/html/gcode.html (Quick Reference)https://www.youtube.com/watch?v=r5bimWKeMbY
https://www.youtube.com/watch?v=hq47wq9qBbs
https://www.youtube.com/watch?v=iMx_UYrvuos (HAAS)

TCPC - controlling part and machine 'tip' at the same time akin to rotating worldspace in a
3D virtual environment
https://www.youtube.com/watch?v=HxPjH4v5iEg

code Details : http://reprap.org/wiki/G-code

No comments:

Post a Comment