Skip to content

Commit

Permalink
🎨 G-code formatting, related, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 19, 2024
1 parent ec49d74 commit 7603a69
Show file tree
Hide file tree
Showing 236 changed files with 6,825 additions and 8,031 deletions.
147 changes: 70 additions & 77 deletions _gcode/G000-G001.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,92 +8,85 @@ since: 1.0.0-beta
group: motion

codes: [ G0, G1 ]

related: [ G2, G3, G5, M82, M83, G91 ]

notes: |
- Coordinates are given in millimeters by default. Units may be set to inches by [`G20`](/docs/gcode/G020.html).
- In Relative Mode ([`G91`](/docs/gcode/G091.html)) all coordinates are interpreted as relative, adding onto the previous position.
- In Extruder Relative Mode ([`M83`](/docs/gcode/M083.html)) the E coordinate is interpreted as relative, adding onto the previous E position.
- A single linear move may generate several smaller moves to the planner due to kinematics and bed leveling compensation. Printing performance can be tuned by adjusting segments-per-second.
notes:
- Coordinates are given in millimeters by default. Units may be set to inches by [`G20`](/docs/gcode/G020.html).
- In Relative Mode ([`G91`](/docs/gcode/G091.html)) all coordinates are interpreted as relative, adding onto the previous position.
- In Extruder Relative Mode ([`M83`](/docs/gcode/M083.html)) the E coordinate is interpreted as relative, adding onto the previous E position.
- A single linear move may generate several smaller moves to the planner due to kinematics and bed leveling compensation. Printing performance can be tuned by adjusting segments-per-second.

devnotes: |
- Developers: Keep using `G0` for non-print moves. It makes G-code more adaptable to lasers, engravers, etc.
devnotes:
- "Developers: Keep using `G0` for non-print moves. It makes G-code more adaptable to lasers, engravers, etc."

parameters:
-
tag: X
optional: true
description: An absolute or relative coordinate on the X axis (in current units).
values:
-
tag: pos
type: float
-
tag: Y
optional: true
description: An absolute or relative coordinate on the Y axis (in current units).
values:
-
tag: pos
type: float
-
tag: Z
optional: true
description: An absolute or relative coordinate on the Z axis (in current units).
values:
-
tag: pos
type: float
-
tag: E
optional: true
description: An absolute or relative coordinate on the E (extruder) axis (in current units). The E axis describes the position of the filament in terms of input to the extruder feeder.
values:
-
tag: pos
type: float
-
tag: F
optional: true
description: The maximum movement rate of the move between the start and end point. The feedrate set here applies to subsequent moves that omit this parameter.
values:
-
tag: rate
type: float
-
tag: S
since: 2.1.1
requires: LASER_FEATURE
optional: true
description: Set the laser power for the move.
values:
-
tag: power
type: float

- tag: X
optional: true
description: An absolute or relative coordinate on the X axis (in current units).
values:
- tag: pos
type: float

- tag: Y
optional: true
description: An absolute or relative coordinate on the Y axis (in current units).
values:
- tag: pos
type: float

- tag: Z
optional: true
description: An absolute or relative coordinate on the Z axis (in current units).
values:
- tag: pos
type: float

- tag: E
optional: true
description: An absolute or relative coordinate on the E (extruder) axis (in current units). The E axis describes the position of the filament in terms of input to the extruder feeder.
values:
- tag: pos
type: float

- tag: F
optional: true
description: The maximum movement rate of the move between the start and end point. The feedrate set here applies to subsequent moves that omit this parameter.
values:
- tag: rate
type: float

- tag: S
since: 2.1.1
requires: LASER_FEATURE
optional: true
description: Set the laser power for the move.
values:
- tag: power
type: float

examples:
-
pre: The most basic move sets a feedrate and moves the tool to the given position.
code:
- G0 X12 ; Move to 12mm on the X axis
- G0 F1500 ; Set the feedrate to 1500 mm/min
- G1 X90.6 Y13.8 ; Move to 90.6mm on the X axis and 13.8mm on the Y axis
-
pre: There are some caveats related with feedrates. Consider the following:
code:
- G1 F1500 ; Set the feedrate to 1500 mm/min
- G92 E0
- G1 X50 Y25.3 E22.4 ; Move while extruding
post: In the above example the feedrate is set to 1500 mm/min, then the tool is moved 50mm on the X axis and 25.3mm on the Y axis while extruding 22.4mm of filament between the two points.
-
code:
- G1 F1500
- G92 E0
- G1 X50 Y25.3 E22.4 F3000
post: However, in the above example, we set a feedrate of 1500 mm/min on line 1 then do the move described above, accelerating to a feedrate of 3000 mm/min (if possible). The extrusion will accelerate along with the X and Y movement, so everything stays synchronized.
- pre: The most basic move sets a feedrate and moves the tool to the given position.
code:
- G0 X12 ; Move to 12mm on the X axis
- G0 F1500 ; Set the feedrate to 1500 mm/min
- G1 X90.6 Y13.8 ; Move to 90.6mm on the X axis and 13.8mm on the Y axis

- pre: There are some caveats related with feedrates. Consider the following:
code:
- G1 F1500 ; Set the feedrate to 1500 mm/min
- G92 E0
- G1 X50 Y25.3 E22.4 ; Move while extruding
post: In the above example the feedrate is set to 1500 mm/min, then the tool is moved 50mm on the X axis and 25.3mm on the Y axis while extruding 22.4mm of filament between the two points.

- code:
- G1 F1500
- G92 E0
- G1 X50 Y25.3 E22.4 F3000
post: However, in the above example, we set a feedrate of 1500 mm/min on line 1 then do the move described above, accelerating to a feedrate of 3000 mm/min (if possible). The extrusion will accelerate along with the X and Y movement, so everything stays synchronized.

---

The `G0` and `G1` commands add a linear move to the queue to be performed after all previous moves are completed. These commands yield control back to the command parser as soon as the move is queued, but they may delay the command parser while awaiting a slot in the queue.

A linear move traces a straight line from one point to another, ensuring that the specified axes will arrive simultaneously at the given coordinates (by linear interpolation). The speed may change over time following an acceleration curve, according to the acceleration and jerk settings of the given axes.
Expand Down
177 changes: 83 additions & 94 deletions _gcode/G002-G003.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,109 +13,98 @@ codes: [ G2, G3 ]
related: [ G17, G18, G19 ]

parameters:
-
tag: X
optional: true
description: A coordinate on the X axis
values:
-
tag: pos
type: float
-
tag: Y
optional: true
description: A coordinate on the Y axis
values:
-
tag: pos
type: float
-
tag: Z
optional: true
description: A coordinate on the Z axis
values:
-
tag: pos
type: float
-
tag: I

- tag: X
optional: true
description: A coordinate on the X axis
values:
- tag: pos
type: float
optional: false
description: An offset from the current X position to use as the arc center
values:
-
tag: offset
type: float
-
tag: J

- tag: Y
optional: true
description: A coordinate on the Y axis
values:
- tag: pos
type: float
optional: false
description: An offset from the current Y position to use as the arc center
values:
-
tag: offset
type: float
-
tag: R

- tag: Z
optional: true
description: A coordinate on the Z axis
values:
- tag: pos
type: float

- tag: I
type: float
optional: false
description: An offset from the current X position to use as the arc center
values:
- tag: offset
type: float

- tag: J
type: float
optional: false
description: An offset from the current Y position to use as the arc center
values:
- tag: offset
type: float

- tag: R
type: float
optional: false
description: A radius from the current XY position to use as the arc center
values:
- tag: radius
type: float

- tag: E
type: float
optional: true
description: The amount to extrude between the start point and end point
values:
- tag: pos
type: float

- tag: F
optional: true
description: The maximum rate of the move between the start and end point
values:
- tag: rate
type: float
optional: false
description: A radius from the current XY position to use as the arc center
values:
-
tag: radius
type: float
-
tag: E

- tag: P
optional: true
description: Specify complete circles. (Requires `ARC_P_CIRCLES`)
values:
- tag: count
type: int

- tag: S
optional: true
since: 2.0.8
description: Set the Laser power for the move.
values:
- tag: power
type: float
optional: true
description: The amount to extrude between the start point and end point
values:
-
tag: pos
type: float
-
tag: F
optional: true
description: The maximum rate of the move between the start and end point
values:
-
tag: rate
type: float
optional: false
-
tag: P
optional: true
description: Specify complete circles. (Requires `ARC_P_CIRCLES`)
values:
-
tag: count
type: int
-
tag: S
optional: true
since: 2.0.8
description: Set the Laser power for the move.
values:
-
tag: power
type: float

examples:
-
pre: Move in a clockwise arc from the current position to [125, 32] with the center offset from the current position by (10.5, 10.5).
code: G2 X125 Y32 I10.5 J10.5
-
pre: Move in a counter-clockwise arc from the current position to [125, 32] with the center offset from the current position by (10.5, 10.5).
code: G3 X125 Y32 I10.5 J10.5
-
pre: Move in a complete clockwise circle with the center offset from the current position by [20, 20].
code: G2 I20 J20
- pre: Move in a clockwise arc from the current position to [125, 32] with the center offset from the current position by (10.5, 10.5).
code: G2 X125 Y32 I10.5 J10.5

- pre: Move in a counter-clockwise arc from the current position to [125, 32] with the center offset from the current position by (10.5, 10.5).
code: G3 X125 Y32 I10.5 J10.5

- pre: Move in a complete clockwise circle with the center offset from the current position by [20, 20].
code: G2 I20 J20

images:
-
title: G3 command geometry
caption: This illustrates a counter clockwise arc, starting at [9, 6]. It can be generated either by `G3 X2 Y7 I-4 J-3` or `G3 X2 Y7 R5`
path: G3fig.png
- title: G3 command geometry
caption: This illustrates a counter clockwise arc, starting at [9, 6]. It can be generated either by `G3 X2 Y7 I-4 J-3` or `G3 X2 Y7 R5`
path: G3fig.png

---

`G2` adds a clockwise arc move to the planner; `G3` adds a counter-clockwise arc. An arc move starts at the current position and ends at the given XYZ, pivoting around a center-point offset given by `I` and `J` or `R`.
Expand Down
Loading

0 comments on commit 7603a69

Please sign in to comment.