GCode syntax

Discussions about ideaMaker and other printing software.
User avatar
Vagulus
Posts: 78
Joined: Mon Mar 25, 2019 5:27 am

GCode syntax

Postby Vagulus » Fri Jun 28, 2019 6:09 am

How and where can I get a listing of the GCode Syntax for a Pro2?

Thanks
--------------------------------------------
God so loved the World that
He did not send a Committee

Jetguy
Posts: 2811
Joined: Tue Mar 22, 2016 1:40 am
Location: In a van, down by the river

Re: GCode syntax

Postby Jetguy » Fri Jun 28, 2019 12:08 pm

Since the same front end touch panel software AKA Raisetouch is used, since the same slicer Ideamaker is used, for all intensive purposes the same firmware commands in the N series applies to the Pro series. There may be some differences, but since the Pro2 isn't open source, we have to start somewhere, and this is the best answer we have at the moment.

As such, the standard guides apply.
#1 read the open source firmware source code list posted https://github.com/Raise3D/Marlin-Raise ... n_main.cpp
//Implemented Codes
//-------------------
// G0 -> G1
// G1 - Coordinated Movement X Y Z E
// G2 - CW ARC
// G3 - CCW ARC
// G4 - Dwell S<seconds> or P<milliseconds>
// G10 - retract filament according to settings of M207
// G11 - retract recover filament according to settings of M208
// G28 - Home all Axis
// G29 - Detailed Z-Probe, probes the bed at 3 or more points. Will fail if you haven't homed yet.
// G30 - Single Z Probe, probes bed at current XY location.
// G31 - Dock sled (Z_PROBE_SLED only)
// G32 - Undock sled (Z_PROBE_SLED only)
// G90 - Use Absolute Coordinates
// G91 - Use Relative Coordinates
// G92 - Set current position to coordinates given

// M Codes
// M0 - Unconditional stop - Wait for user to press a button on the LCD (Only if ULTRA_LCD is enabled)
// M1 - Same as M0
// M17 - Enable/Power all stepper motors
// M18 - Disable all stepper motors; same as M84
// M20 - List SD card
// M21 - Init SD card
// M22 - Release SD card
// M23 - Select SD file (M23 filename.g)
// M24 - Start/resume SD print
// M25 - Pause SD print
// M26 - Set SD position in bytes (M26 S12345)
// M27 - Report SD print status
// M28 - Start SD write (M28 filename.g)
// M29 - Stop SD write
// M30 - Delete file from SD (M30 filename.g)
// M31 - Output time since last M109 or SD card start to serial
// M32 - Select file and start SD print (Can be used _while_ printing from SD card files):
// syntax "M32 /path/filename#", or "M32 S<startpos bytes> !filename#"
// Call gcode file : "M32 P !filename#" and return to caller file after finishing (similar to #include).
// The '#' is necessary when calling from within sd files, as it stops buffer prereading
// M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
// M80 - Turn on Power Supply
// M81 - Turn off Power Supply
// M82 - Set E codes absolute (default)
// M83 - Set E codes relative while in Absolute Coordinates (G90) mode
// M84 - Disable steppers until next move,
// or use S<seconds> to specify an inactivity timeout, after which the steppers will be disabled. S0 to disable the timeout.
// M85 - Set inactivity shutdown timer with parameter S<seconds>. To disable set zero (default)
// M92 - Set axis_steps_per_unit - same syntax as G92
// M104 - Set extruder target temp
// M105 - Read current temp
// M106 - Fan on
// M107 - Fan off
// M109 - Sxxx Wait for extruder current temp to reach target temp. Waits only when heating
// Rxxx Wait for extruder current temp to reach target temp. Waits when heating and cooling
// IF AUTOTEMP is enabled, S<mintemp> B<maxtemp> F<factor>. Exit autotemp by any M109 without F
// M112 - Emergency stop
// M114 - Output current position to serial port
// M115 - Capabilities string
// M117 - display message
// M119 - Output Endstop status to serial port
// M120 - Enable endstop detection
// M121 - Disable endstop detection
// M126 - Solenoid Air Valve Open (BariCUDA support by jmil)
// M127 - Solenoid Air Valve Closed (BariCUDA vent to atmospheric pressure by jmil)
// M128 - EtoP Open (BariCUDA EtoP = electricity to air pressure transducer by jmil)
// M129 - EtoP Closed (BariCUDA EtoP = electricity to air pressure transducer by jmil)
// M140 - Set bed target temp
// M150 - Set BlinkM Color Output R: Red<0-255> U(!): Green<0-255> B: Blue<0-255> over i2c, G for green does not work.
// M190 - Sxxx Wait for bed current temp to reach target temp. Waits only when heating
// Rxxx Wait for bed current temp to reach target temp. Waits when heating and cooling
// M200 D<millimeters>- set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
// M201 - Set max acceleration in units/s^2 for print moves (M201 X1000 Y1000)
// M202 - Set max acceleration in units/s^2 for travel moves (M202 X1000 Y1000) Unused in Marlin!!
// M203 - Set maximum feedrate that your machine can sustain (M203 X200 Y200 Z300 E10000) in mm/sec
// M204 - Set default acceleration: P for Printing moves, R for Retract only (no X, Y, Z) moves and T for Travel (non printing) moves (ex. M204 P800 T3000 R9000) in mm/sec^2
// M205 - advanced settings: minimum travel speed S=while printing T=travel only, B=minimum segment time X= maximum xy jerk, Z=maximum Z jerk, E=maximum E jerk
// M206 - Set additional homing offset
// M207 - Set retract length S[positive mm] F[feedrate mm/min] Z[additional zlift/hop], stays in mm regardless of M200 setting
// M208 - Set recover=unretract length S[positive mm surplus to the M207 S*] F[feedrate mm/sec]
// M209 - S<1=true/0=false> enable automatic retract detect if the slicer did not support G10/11: every normal extrude-only move will be classified as retract depending on the direction.
// M218 - Set hotend offset (in mm): T<extruder_number> X<offset_on_X> Y<offset_on_Y>
// M220 S<factor in percent>- set speed factor override percentage
// M221 S<factor in percent>- set extrude factor override percentage
// M226 P<pin number> S<pin state>- Wait until the specified pin reaches the state required
// M240 - Trigger a camera to take a photograph
// M250 - Set LCD contrast C<contrast value> (value 0..63)
// M280 - Set servo position absolute. P: servo index, S: angle or microseconds
// M300 - Play beep sound S<frequency Hz> P<duration ms>
// M301 - Set PID parameters P I and D
// M302 - Allow cold extrudes, or set the minimum extrude S<temperature>.
// M303 - PID relay autotune S<temperature> sets the target temperature. (default target temperature = 150C)
// M304 - Set bed PID parameters P I and D
// M380 - Activate solenoid on active extruder
// M381 - Disable all solenoids
// M400 - Finish all moves
// M401 - Lower z-probe if present
// M402 - Raise z-probe if present
// M404 - N<dia in mm> Enter the nominal filament width (3mm, 1.75mm ) or will display nominal filament width without parameters
// M405 - Turn on Filament Sensor extrusion control. Optional D<delay in cm> to set delay in centimeters between sensor and extruder
// M406 - Turn off Filament Sensor extrusion control
// M407 - Displays measured filament diameter
// M500 - Store parameters in EEPROM
// M501 - Read parameters from EEPROM (if you need reset them after you changed them temporarily).
// M502 - Revert to the default "factory settings". You still need to store them in EEPROM afterwards if you want to.
// M503 - Print the current settings (from memory not from EEPROM). Use S0 to leave off headings.
// M540 - Use S[0|1] to enable or disable the stop SD card print on endstop hit (requires ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED)
// M600 - Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
// M665 - Set delta configurations
// M666 - Set delta endstop adjustment
// M605 - Set dual x-carriage movement mode: S<mode> [ X<duplication x-offset> R<duplication temp offset> ]
// M907 - Set digital trimpot motor current using axis codes.
// M908 - Control digital trimpot directly.
// M350 - Set microstepping mode.
// M351 - Toggle MS1 MS2 pins directly.

//*************Raise3d Defined
// M928 - Start SD logging (M928 filename.g) - ended by M29
// M999 - Restart after being stopped by error


A key note, even though I know I just told you this list is in the firmware source, not all the commands may be implemented as configured. Examples would be- in N series firmware, EEPROM function is not enabled. The source code can be configured to enabled it, so as a function it exists, but stock off the shelf as supplied OEM firmware from Raise doesn't implement any of that (M500, M501, M502). In other words, take this as a list of commands, most of them work, this is the known "style" for this printer.

And then read any typical gcode syntax guide of how a line is formatted and all the other details. Again, it's a 2 part thing. The above list is the commands your firmware knows and would follow, followed by a basic syntax guide.
https://all3dp.com/g-code-tutorial-3d-p ... -commands/
https://reprap.org/wiki/G-code

Jetguy
Posts: 2811
Joined: Tue Mar 22, 2016 1:40 am
Location: In a van, down by the river

Re: GCode syntax

Postby Jetguy » Fri Jun 28, 2019 12:48 pm

Also, keep in mind, there is also the front end streaming the gcode to the motion control firmware, and the M1000 and M2000 commands are read by the raise touch application on the front panel computer. Those just tell it the starting gcode last line and the first line of the ending gcode. Why does that matter? Well the startup gcode is how you take a machine from an unknown state, home it, configure it to a baseline state, prime the nozzles and so forth so the machine is ready to run actual print gcode. In the event of a power loss recovery or error message event that stops a print mid print, if the dump file is saved, the print recovery allows you to restart the job. In order to do that, the front panel computer is going to send a modified starting gcode sequence to begin a recovery print, and so the M1000 let's it parse the print file, identify the starting gcode section, run a script that modifies that and sends the custom modified variant (examples include you cannot home Z, so the modified starting code omits that function that existed in the original print file starting gcd section- but there are others). Same with ending gcode. Ending gcode is used to finish the print by putting the machine back into a non printing safe state. Turn off heaters, park the machine, turn off fans. By knowing the end of the actual print VS the end of the file, the recovery print can know if it's reached the end of the print job. As such, M1000 and M2000 will be seen in print files produced by Ideamaker or must be added into other slicers for proper operation of a raise3d printer- but the motion control firmware doesn't use that command- the front panel streaming the gcode does. The concept of the architecture of this printer is a little bit like Octoprint- but not actually Octoprint. The front panel screen is a computer running an application (Raise Touch) that provides a user interface with menus and buttons and those commands send gcode over the USB cable to the motion control board running Marlin based protocol command structure, and the motion control board actually runs the hardware of the printer. When you print a print file, the front panel computer reads it, then streams line by line the gcode commands to the motion control board, receives replies from the motion control board of status and temps and some other details, and then the raise touch software updates those displays on the LCD. Thus there is always a delay and the front screen only displays the info it gets over the limited protocol. Why I say over and over- the front panel is not "running" or "controlling" the printer. It's sending commands, and receiving status- both limited by the protocol. It sends a command and you hope it gets executed. This all may be a lot to wrap your head around if you were not previously aware of this.

User avatar
Vagulus
Posts: 78
Joined: Mon Mar 25, 2019 5:27 am

Re: GCode syntax

Postby Vagulus » Sat Jun 29, 2019 4:40 am

Thanks Jetguy.
--------------------------------------------
God so loved the World that
He did not send a Committee

User avatar
Vagulus
Posts: 78
Joined: Mon Mar 25, 2019 5:27 am

Re: GCode syntax

Postby Vagulus » Sat Jun 29, 2019 5:29 am

Jetguy

I found this reference site.

http://marlinfw.org/docs/gcode/G000-G001.html

Is this the GCode for Pro2 you were talking about?
--------------------------------------------
God so loved the World that
He did not send a Committee

Jetguy
Posts: 2811
Joined: Tue Mar 22, 2016 1:40 am
Location: In a van, down by the river

Re: GCode syntax

Postby Jetguy » Sat Jun 29, 2019 10:58 am

Yes, official Marlin site is good info and details on commands, just remember not all commands are likely to be implemented.
Happy reading.

In a nutshell, the line of gcode you are reading is the target position or command, the previous line(s) is where you are or what you were doing before this new command.

User avatar
Vagulus
Posts: 78
Joined: Mon Mar 25, 2019 5:27 am

Re: GCode syntax

Postby Vagulus » Sat Jun 29, 2019 10:42 pm

Happiness (for now anyway) will be getting to the stage where I can interpret a line of GCode. Actually writing GCode is not on the agenda. That Marlin link should provide the key.

Thanks again
--------------------------------------------
God so loved the World that
He did not send a Committee

User avatar
jetdillo
Posts: 186
Joined: Mon Jun 12, 2017 5:10 am

Re: GCode syntax

Postby jetdillo » Sat Jul 06, 2019 4:00 pm

In a similar vein, has anybody decoded the format of the Raise3D .data file or the ASCII-ized blob that's at the end of an uploaded .gcode file ? I understand this has the template data that the object was sliced from encoded in it. I'm working on a version control app for my printing and it would be helpful if I didn't reinvent certain wheels.

User avatar
jetdillo
Posts: 186
Joined: Mon Jun 12, 2017 5:10 am

Re: GCode syntax

Postby jetdillo » Sun Jul 07, 2019 6:47 pm

jetdillo wrote:In a similar vein, has anybody decoded the format of the Raise3D .data file or the ASCII-ized blob that's at the end of an uploaded .gcode file ? I understand this has the template data that the object was sliced from encoded in it. I'm working on a version control app for my printing and it would be helpful if I didn't reinvent certain wheels.

NM, I see that this has been discussed extensively in other threads here.

User avatar
jetdillo
Posts: 186
Joined: Mon Jun 12, 2017 5:10 am

Re: GCode syntax

Postby jetdillo » Sun Jul 07, 2019 6:49 pm

jetdillo wrote:
jetdillo wrote:In a similar vein, has anybody decoded the format of the Raise3D .data file or the ASCII-ized blob that's at the end of an uploaded .gcode file ? I understand this has the template data that the object was sliced from encoded in it. I'm working on a version control app for my printing and it would be helpful if I didn't reinvent certain wheels.


I see that the format/contents of the .data file have been discussed extensively elsewhere here.

User avatar
jetdillo
Posts: 186
Joined: Mon Jun 12, 2017 5:10 am

Re: GCode syntax

Postby jetdillo » Wed Jul 24, 2019 8:21 am

I have one further question. At the tail end of a .gcode file there's this statement:

Code: Select all

;M117 Printing...
;Recover end
;Print Time: 5395
;Material#1 Used: 922.9
;Material#2 Used: 0.0
;Material#1 Cost: 0.08
;Material#2 Cost: 0.00


How is the "Material Used" calculated ?


Return to “Software”

Who is online

Users browsing this forum: No registered users and 2 guests