mirror of
https://github.com/OrcaSlicer/OrcaSlicer_WIKI.git
synced 2026-05-17 08:35:46 +03:00
Machine Gcode examples + Warnings (#58)
* Add example for custom start G-code sequence Included a detailed example demonstrating custom notifications with M300 and a purge sequence in the start G-code section. * Add important note on safe use of machine G-code Added a warning highlighting the power and risks of custom machine G-code scripts. The note advises users to use known G-code bases for their firmware and to thoroughly test scripts before production use. * Add firmware G-code documentation links Added helpful links to Marlin, RepRap, and Klipper G-code documentation to guide users in referencing supported commands for their printer firmware. * Update code block language to gcode in docs Changed code block language from 'c++' to 'gcode' in printer_machine_gcode.md for better syntax highlighting and clarity in G-code examples.
This commit is contained in:
@@ -2,6 +2,18 @@
|
||||
|
||||
Machine G-code are custom G-code scripts that are executed at specific points during the printing process. These scripts can be used to customize printer behavior, such as setting temperatures, moving the print head, or controlling fans.
|
||||
|
||||
> [!TIP]
|
||||
> See your printer's firmware documentation for supported G-code commands and features.
|
||||
>
|
||||
> - [Marlin G-code](https://marlinfw.org/meta/gcode/)
|
||||
> - [RepRap G-code](https://reprap.org/wiki/G-code)
|
||||
> - [Klipper G-code](https://www.klipper3d.org/G-Codes)
|
||||
|
||||
> [!IMPORTANT]
|
||||
> Machine G-code scripts are powerful tools for customizing your printing process. However, they can also cause issues if not used correctly.
|
||||
> It's recommended to use a known base of G-code commands for your specific printer firmware (e.g., Marlin, RepRap, etc.) and to understand the implications of each command used in the scripts.
|
||||
> Always test your G-code scripts thoroughly before using them in production.
|
||||
|
||||
- [Machine start G-code](#machine-start-g-code)
|
||||
- [Machine end G-code](#machine-end-g-code)
|
||||
- [Printing by object G-code](#printing-by-object-g-code)
|
||||
@@ -18,6 +30,41 @@ Machine G-code are custom G-code scripts that are executed at specific points du
|
||||
|
||||
This G-code is executed at the beginning of a print job, before any printing starts. It is typically used to prepare the printer for printing, such as homing axes, heating the bed and nozzle, and performing any necessary pre-print checks.
|
||||
|
||||
You can also use it for setting up custom notifications with M300 (play beep sound) or use a custom purge sequence:
|
||||
|
||||
```gcode
|
||||
G90 ; use absolute coordinates
|
||||
M83 ; extruder relative mode
|
||||
M140 S[bed_temperature_initial_layer_single] ; set final bed temp
|
||||
M104 S150 ; set temporary nozzle temp to prevent oozing during homing
|
||||
G4 S10 ; allow partial nozzle warmup
|
||||
G28 ; home all axis
|
||||
G1 Z25 F240 ; lift nozzle
|
||||
G1 X2 Y10 F3000 ; move to front left
|
||||
M104 S[nozzle_temperature_initial_layer] ; set final nozzle temp
|
||||
M190 S[bed_temperature_initial_layer_single] ; wait for bed temp to stabilize
|
||||
M109 S[nozzle_temperature_initial_layer] ; wait for nozzle temp to stabilize
|
||||
; Start Beep to indicate ready to print
|
||||
M300 P136 S622
|
||||
M300 P136 S0
|
||||
M300 P136 S311
|
||||
M300 P136 S466
|
||||
M300 P273 S0
|
||||
M300 P136 S415
|
||||
M300 P409 S0
|
||||
M300 P136 S622
|
||||
M300 P136 S0
|
||||
M300 P545 S466
|
||||
; Purge Line
|
||||
G1 Z0.28 F240 ; move to a custom layer height for purge
|
||||
G1 X{first_layer_print_min[0]-15} Y{first_layer_print_min[1]} Z0.8 F6000.0 ; position 15mm left from the lower left of the first layer
|
||||
G1 X{first_layer_print_min[0]-15} Y{first_layer_print_min[1]+30} E30 F360.0 ; extrude 30mm of filament in the y direction
|
||||
G92 E0.0 ; reset extruder
|
||||
G1 E-0.5 F2100 ; small retraction
|
||||
G1 Y{first_layer_print_min[1]+40} F6000.0 ; move an additional 10mm without extruding
|
||||
G92 E0.0 ; reset extruder
|
||||
```
|
||||
|
||||
## Machine end G-code
|
||||
|
||||
This G-code is executed at the end of a print job, after all printing is complete. It is typically used to turn off heaters, move the print head away from the print, and perform any necessary post-print actions.
|
||||
@@ -53,7 +100,7 @@ This G-code is inserted when the extrusion role is changed.
|
||||
Example G-codes:
|
||||
|
||||
- Marlin g-code to set fan speed to 10% (S25 out of S255) for BridgeInfill role and 30% (S75 out of S255) for other roles:
|
||||
```c++
|
||||
```gcode
|
||||
{if( extrusion_role == "BridgeInfill")}
|
||||
M106 S25
|
||||
{else}
|
||||
@@ -61,7 +108,7 @@ Example G-codes:
|
||||
{endif}
|
||||
```
|
||||
- Marlin g-code to set pressure advance to 0 for InternalInfill role and restore it to previous value for other roles:
|
||||
```c++
|
||||
```gcode
|
||||
{if( extrusion_role == "InternalInfill")}
|
||||
M900 K0
|
||||
{else}
|
||||
|
||||
Reference in New Issue
Block a user