G-code: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
m (Created page with '== Introduction == Category: 3D Category: RapMan Category: Hardware')
 
mNo edit summary
Line 1: Line 1:
== Introduction ==
== Introduction ==


This is g-code page for the [[RapMan]] printer
== List of G-codes ==
List of RapMan G-code (thanks to [http://rapmanv3.blogspot.com/2009/05/gcodes.html Bits from Bytes] blog:
RapMan special codes
{|
|-
! Code || Explanation || Example
|-
| G0 || Rapid Motion in X, Y, and Z axes. || G0 X10.0 Y20.0 Z1.15
|-
| G1 || Coordinated Motion in X, Y, and Z axes with speed F mm/minute. || G1 X10.0 Y20.0 Z1.15 F960.0
|-
| G2 || Arc – Clockwise (Not used by Skienforge) ||
|-
| G3 || Arc - Counter (Clockwise Not used by Skienforge) ||
|-
| G4 || Dwell Time || G4 S20
|-
| G20 || Inches as units used || G20
|-
| G21 || Millimetres as units used || G21
|-
| G28 || Go Home (far left) || G28
|-
| G90 || Absolute Positioning || G90
|-
| G92 || Set current as home || G92
|-
| M101 || Turn extruder on (forward/filament in). || M101
|-
| M102 || Turn extruder on Reverse (Still to add) ||
|-
| M103 || Turn extruder off. || M103
|-
| M104 || Set target temperature to 245.0 C. || M104 S245
|-
| M105 || Custom code for temperature reading. Not used ||
|-
| M106 || Turn fan on. || M106
|-
| M107 || Turn fan off. || M107
|-
| M108 || Set Extruder speed to S value/10 = 40rpm. || M108 S400
|-
| M220 || Turn off AUX V1.0.5 || M220
|-
| M221 || Turn on AUX V1.0.5 || M221
|-
| M222 || Set speed of fast XY moves || M222
|-
| M223 || Set speed of fast Z moves || M223
|-
| M224 || Enable extruder during fast moves || M224
|-
| M225 || Enable extruder during fast moves || M225
|-
| M226 || Pause RapMan as if pause button pressed || M226
|}
Typical file headers produced by the Skeinforge program
{|
|-
| G21|| millimeter system selection
|-
| G90|| absolute distance mode
|-
| G28|| Return to home position
|-
| M222 S800 || Manually added to file. Set speed of fast XY moves. Default value 500 -V1.0.5
|-
| M223 S768 || Manually added to file. Set speed of fast Z moves. Default value 500 -V1.0.5
|-
| M103|| Turn extruder OFF.
|-
| M105|| Custom code for temperature reading – not used by RapMan
|-
| M104 S247.0 || Set temperature to 247.0 DegC.
|-
| G1 X0.0 Y0.0 Z0.0 F480.0 || example of linear interpolation at speed 480
|-
| M101|| Turn extruder ON.
|-
| Main|| code follows||.....
|}
== Recovery from printing abortion ==
A case study:
Printing stopped at line 299941 after 3 days of printing. I mean I had the printer on hold sometimes (ESC), but it was a 24 job. Anyhow, big low down, but I decided that I must recover from this without super glue, i.e. leave the object on the print bed and restart.
Problem is IMHO that the rapman always expects to be able to home in order to find x,y,z = 0. If you have a "real" print it can't, since raising the print bed will destroy a 14cm high print for example.
I tried all sorts of things fiddling with G90 and G92 codes, but did not mange to restart g-code where the printer left.
G90
G92 X0 Y0 Z-142
or
G90
G92 X0 Y0 Z142
So I came up with a typical bricoleur solution :(
* Fix the g-code to start at z=0
* Fool the printer to believe that it is at z=0
Here are the two steps:
'''(1) Fixing the g-code file'''
Normally, you should write a script (argl for stupid end-user programmers) that replaces all the Z values. E.g. Z142.2 should become 0 or 0.2. In my case I was lucky since I just print vertically. So I decided to restart at 14cm and not 14.2cm (makes it higher, but that's fine).
GCode where it stopped:
G1 X-90.5 Y68.33 Z142.2 F960.0
So I went to start of the 140mm series and killed all the lines from beginning to there. Then I used three Regexps with a text editor ([[emacs]]) to change:
Z14\(.\)\(..\) by Z\1\2
Z15\(.\)\(..\) by Z1\1\2
Z16\(.\)\(..\) by Z2\1\2
Then of course, the g-code must have a header.
Resulting g-code start:
<source lang="dos">
G90
G21
M113 S1.0
M108 S380.0
M104 S210
M101
M103
M108 S380.0
M106
M103
G1 X40.96 Y-19.95 Z0.2 F869.59
M101
G1 X39.55 Y-18.93 Z0.2 F960.0
G1 X36.66 Y-17.64 Z0.2 F960.0
</source>
'''(2) Fool the printer'''
a) Move the print head next to a top level point NEXT to home. Path toward -X (left) must be unobstructed. Then align it, i.e. make it touch the top.
b) Move it to the left a bit, and switch off.
c) Switch on. Then position the print head about 1mm below the point where you want to restart. This can be a bit less or more. You can see how much you go down on the control panel. I.e. press the Z+ button and move the print board up.
d) Switch off
e) Hold you finger on the Z switch (grey box which is usually touched by the long 6cm bolt. Run the file and release after 1-2 seconds, i.e. the print bed should move down again by 1mm.
f) Now the printer will move to Xmax/Ymin. If it barely scratches the print when it moves you are fine. If it is too high or too low, then repeat from (c). Took me about 4 attempts to get this right.
'''Remarks'''
I REALLY think that rapman firmware should include a control code to recover more easily e.g. Some g-code that says:
* Home to X=0 and Y=0 (but leave Z ALONE)
* Read from the G-code file the current Z-position (e.g. Z=142.2)
* Then just print ....
Disclaimer: Uhh maybe this can be done actually, but I wasnt't smart enough to see it ....


[[Category: 3D]]
[[Category: 3D]]
[[Category: RapMan]]
[[Category: RapMan]]
[[Category: Hardware]]
[[Category: Hardware]]

Revision as of 13:49, 2 April 2010

Introduction

This is g-code page for the RapMan printer

List of G-codes

List of RapMan G-code (thanks to Bits from Bytes blog: RapMan special codes

Code Explanation Example
G0 Rapid Motion in X, Y, and Z axes. G0 X10.0 Y20.0 Z1.15
G1 Coordinated Motion in X, Y, and Z axes with speed F mm/minute. G1 X10.0 Y20.0 Z1.15 F960.0
G2 Arc – Clockwise (Not used by Skienforge)
G3 Arc - Counter (Clockwise Not used by Skienforge)
G4 Dwell Time G4 S20
G20 Inches as units used G20
G21 Millimetres as units used G21
G28 Go Home (far left) G28
G90 Absolute Positioning G90
G92 Set current as home G92
M101 Turn extruder on (forward/filament in). M101
M102 Turn extruder on Reverse (Still to add)
M103 Turn extruder off. M103
M104 Set target temperature to 245.0 C. M104 S245
M105 Custom code for temperature reading. Not used
M106 Turn fan on. M106
M107 Turn fan off. M107
M108 Set Extruder speed to S value/10 = 40rpm. M108 S400
M220 Turn off AUX V1.0.5 M220
M221 Turn on AUX V1.0.5 M221
M222 Set speed of fast XY moves M222
M223 Set speed of fast Z moves M223
M224 Enable extruder during fast moves M224
M225 Enable extruder during fast moves M225
M226 Pause RapMan as if pause button pressed M226

Typical file headers produced by the Skeinforge program

G21 millimeter system selection
G90 absolute distance mode
G28 Return to home position
M222 S800 Manually added to file. Set speed of fast XY moves. Default value 500 -V1.0.5
M223 S768 Manually added to file. Set speed of fast Z moves. Default value 500 -V1.0.5
M103 Turn extruder OFF.
M105 Custom code for temperature reading – not used by RapMan
M104 S247.0 Set temperature to 247.0 DegC.
G1 X0.0 Y0.0 Z0.0 F480.0 example of linear interpolation at speed 480
M101 Turn extruder ON.
Main code follows .....


Recovery from printing abortion

A case study:

Printing stopped at line 299941 after 3 days of printing. I mean I had the printer on hold sometimes (ESC), but it was a 24 job. Anyhow, big low down, but I decided that I must recover from this without super glue, i.e. leave the object on the print bed and restart.

Problem is IMHO that the rapman always expects to be able to home in order to find x,y,z = 0. If you have a "real" print it can't, since raising the print bed will destroy a 14cm high print for example.

I tried all sorts of things fiddling with G90 and G92 codes, but did not mange to restart g-code where the printer left.

G90
G92 X0 Y0 Z-142
or
G90
G92 X0 Y0 Z142

So I came up with a typical bricoleur solution :(

  • Fix the g-code to start at z=0
  • Fool the printer to believe that it is at z=0

Here are the two steps:

(1) Fixing the g-code file

Normally, you should write a script (argl for stupid end-user programmers) that replaces all the Z values. E.g. Z142.2 should become 0 or 0.2. In my case I was lucky since I just print vertically. So I decided to restart at 14cm and not 14.2cm (makes it higher, but that's fine).

GCode where it stopped:

G1 X-90.5 Y68.33 Z142.2 F960.0

So I went to start of the 140mm series and killed all the lines from beginning to there. Then I used three Regexps with a text editor (emacs) to change:

Z14\(.\)\(..\) by Z\1\2
Z15\(.\)\(..\) by Z1\1\2
Z16\(.\)\(..\) by Z2\1\2

Then of course, the g-code must have a header. Resulting g-code start:

G90
G21
M113 S1.0
M108 S380.0
M104 S210
M101
M103
M108 S380.0
M106
M103
G1 X40.96 Y-19.95 Z0.2 F869.59
M101
G1 X39.55 Y-18.93 Z0.2 F960.0
G1 X36.66 Y-17.64 Z0.2 F960.0

(2) Fool the printer

a) Move the print head next to a top level point NEXT to home. Path toward -X (left) must be unobstructed. Then align it, i.e. make it touch the top.

b) Move it to the left a bit, and switch off.

c) Switch on. Then position the print head about 1mm below the point where you want to restart. This can be a bit less or more. You can see how much you go down on the control panel. I.e. press the Z+ button and move the print board up.

d) Switch off

e) Hold you finger on the Z switch (grey box which is usually touched by the long 6cm bolt. Run the file and release after 1-2 seconds, i.e. the print bed should move down again by 1mm.

f) Now the printer will move to Xmax/Ymin. If it barely scratches the print when it moves you are fine. If it is too high or too low, then repeat from (c). Took me about 4 attempts to get this right.

Remarks

I REALLY think that rapman firmware should include a control code to recover more easily e.g. Some g-code that says:

  • Home to X=0 and Y=0 (but leave Z ALONE)
  • Read from the G-code file the current Z-position (e.g. Z=142.2)
  • Then just print ....

Disclaimer: Uhh maybe this can be done actually, but I wasnt't smart enough to see it ....