Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
g1 [2017/01/25 15:44]
arthur
g1 [2019/05/13 21:04] (current)
arthur [Parameters]
Line 1: Line 1:
 [[f>​image https://​i0.wp.com/​makezine.com/​wp-content/​uploads/​2016/​10/​gcodeb.png?​resize=620%2C433]] [[f>​image https://​i0.wp.com/​makezine.com/​wp-content/​uploads/​2016/​10/​gcodeb.png?​resize=620%2C433]]
 +
 +== G1 G-code
 +
 +G1 means "move while activating the tool".
 +
 +On CNC mills this is used to move while cutting, it is also called a "​linear"​ move. 
 +
 +On laser cutters, it is used the same way, and the laser is automatically turned on during the move.
 +
 +On 3D printers, it is also called an "​extrusion"​ move.
 +
 +G1's evil twin is [[G0]], which means "move while not activating the tool".
 +
 +=== Format
 +
 +The command is used as such : 
 +
 +<​code>​
 +G1 X10 Y20 F30
 +</​code>​
 +
 +Which means : move to X position 10, Y position 20, at a speed of 30 millimeters/​minute
 +
 +=== Parameters
 +
 +||~ Parameter ||~ Usage ||~ Example ||
 +|| <​kbd>​X</​kbd>​ || Move to this position in the X axis || G1 X10 ||
 +|| <​kbd>​Y</​kbd>​ || Move to this position in the Y axis || G1 Y10 ||
 +|| <​kbd>​Z</​kbd>​ || Move to this position in the Z axis || G1 Z10 ||
 +|| <​kbd>​A</​kbd>​ || Move to this position in the A axis || G1 A10 ||
 +|| <​kbd>​B</​kbd>​ || Move to this position in the B axis || G1 B10 ||
 +|| <​kbd>​C</​kbd>​ || Move to this position in the C axis || G1 C10 ||
 +|| <​kbd>​E</​kbd>​ || Move to this position in the E ( extruder ) axis || G1 E10 ||
 +|| <​kbd>​F</​kbd>​ || Move at this speed in millimeters/​minute || G1 Z10 F100 ||
 +|| <​kbd>​S</​kbd>​ || Laser power, <​kbd>​S1</​kbd>​ is 100%, <​kbd>​S0</​kbd>​ is 0% || G1 X10 S0.5 ||
 +
 +<callout type="​warning"​ icon="​true"​ title="​Extruder moves and scientific notation">​
 +
 +If you write this Gcode :
 +
 +<​code>​ G1X100E100 </​code>​
 +
 +You want Smoothie to interpret it as : 
 +
 +<​code> ​
 +G1 : move ...
 +X10 : ... by 10mm in the X direction ...
 +E10 : ... while also feeding the extruder 10mm of extrusion
 +</​code>​
 +
 +However Smoothie is going to interpret this as 
 +
 +<​code> ​
 +G1 : move ...
 +X10E10 : ... in the X direction by 10E10, which is also 10 to the power of 10, or 10000000000.
 +</​code>​
 +
 +The lesson here is : use spaces.
 +</​callout>​
 +
 +=== Feedrate
 +
 +The <​kbd>​F</​kbd>​ parameter is modal. The speed is remembered and each subsequent command uses it.
 +
 +This means if you do : 
 +
 +<​code>​
 +G1 X10 F100
 +G1 X20
 +G1 X30 F200
 +G1 X40
 +</​code>​
 +
 +The first two moves will happen at 100 mm/minute, and the last two moves will happen at 200mm/​minute.
 +
 +<callout type="​success"​ icon="​true"​ title="​ Independent feedrates">​
 +Note that both G0 and G1 have their own modal feedrates, and setting one doesn'​t influence the other.
 +
 +This means if you do :
 +
 +<​code>​
 +G0 X10 F100
 +G1 X20 F200
 +G0 X30
 +</​code>​
 +
 +The third move will actually move at 100 mm/minute as that is the latest feedrate set for G0 moves.
 +</​callout>​
 +
 +=== Default feedrate
 +
 +If you have just started your Smoothieboard and have never sent a <​kbd>​F</​kbd>​ parameter, your G1 moves will move at the default "​feed"​ feedrate.
 +
 +This is set in the [[http://​smoothieware.org/​configuring-smoothie|configuration file]] by setting the <​kbd>​default_feed_rate</​kbd>​ config option.
 +
 +=== Modal use
 +
 +The G1 command is modal, if a line doesn'​t contain any gcode, it is assumed to be a <​kbd>​G0</​kbd>​ or a <​kbd>​G1</​kbd>​ command depending on the latest used
 +
 +This means if you do : 
 +
 +<​code>​
 +G1 X10
 + X20
 + Y10
 +</​code>​
 +
 +It is the same as doing : 
 +
 +<​code>​
 +G1 X10
 +G1 X20
 +G1 Y10
 +</​code>​
 +
 +Note the space character before each modal line, without that space, Smoothie will not know this is a modal command.
 +
 +=== Absolute and relative motion
 +
 +There are two ways to ways of specifying positions : absolutely or relatively.
 +
 +Smoothie is in absolute mode by default.
 +
 +You enter absolute mode by sending the [[G90]] Gcode, and you enter the relative mode by sending the [[G91]] Gcode.
 +
 +In absolute mode, all positions passed to G1 are relative to the 0 position for the current work coordinate.
 +
 +In relative mode, all positions passed to G1 are relative to the current position.
 +
 +This means if you do : 
 +
 +<​code>​
 +G90
 +G1 X10
 +G1 X20
 +</​code>​
 +
 +Smoothie will move to the X position 10, then move to the X position 20, relative to the origin.
 +
 +But if you do : 
 +
 +<​code>​
 +G91
 +G1 X10
 +G1 X20
 +</​code>​
 +
 +Smoothie will move 10 millimeters relative to the current position, then move 20 millimeters further away from that new position ( moving 30 millimeters total ).
 +
 +=== Further reading
 +
 +These resources are used as references for Gcode : 
 +* [[http://​linuxcnc.org/​docs/​html/​gcode.html|LinuxCNC Gcode list]]
 +* [[http://​reprap.org/​wiki/​G-code|Reprap Gcode list]]