Actions

Difference between revisions of "Sample G-Code"

From PROBOTIX :: wiki

 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
<code>
+
Square-Circle Test: Creates a 4in square folled by a 4in circle inside of the square. This is the code that we use to calibrate the machines.<pre>
 
%
 
%
 
 
G54 G90 G20 G0
 
G54 G90 G20 G0
 
 
G64 P0.01
 
G64 P0.01
 
 
M3 S1
 
M3 S1
 
 
G0 X0 Y2
 
G0 X0 Y2
 
 
G1 Z0 F150
 
G1 Z0 F150
 
 
Y0
 
Y0
 
 
X4
 
X4
 
 
Y4
 
Y4
 
 
X0
 
X0
 
 
Y2
 
Y2
 
 
G3 I2.0
 
G3 I2.0
 
 
G0 Z1 M5
 
G0 Z1 M5
 
 
X0 Y0
 
X0 Y0
 +
M30
 +
%
 +
</pre>
 +
 +
Tool Sensor Test: This code will loop through tools 1-4 to prove that the tool sensor is working. This calls the tool, measures the length, drives it to zero, then pauses for 3 seconds before calling the next tool.
 +
<pre>
 +
%
 +
G54 G20 G90 G0 X0 Y0
 +
G64 P0.005
 +
 +
#1 = 1
 +
o100 CALL [#1]
 +
 +
G0 X0 Y0
 +
G1 Z0 F50
 +
G4 P3
 +
 +
#1 = 2
 +
o100 CALL [#1]
 +
 +
G0 X0 Y0
 +
G1 Z0 F50
 +
G4 P3
 +
 +
#1 = 3
 +
o100 CALL [#1]
 +
 +
G0 X0 Y0
 +
G1 Z0 F50
 +
G4 P3
 +
 +
#1 = 4
 +
o100 CALL [#1]
 +
 +
G0 X0 Y0
 +
G1 Z0 F50
 +
G4 P3
  
 
M30
 
M30
 +
%
 +
</pre>
  
 +
Counter-bored Hole Pattern: This code will create a pattern of counterbored holes in your spoilboard using an 1/8" end mill. This program demonstrates nested loops.
 +
 +
<pre>
 +
%
 +
(create counterbored holes for threaded inserts)
 +
(use 1/8" end mill)
 +
G0 G49 G40 G54 G90 X0 Y0
 +
G64 P0.001
 +
 +
#1 = 25 (Y length)
 +
#2 = 25 (X width)
 +
#3 = 4  (increments)
 +
#4 = 0.1 (z safe)
 +
 +
#11 = 0 (X)
 +
#12 = 0 (Y)
 +
 +
o105 SUB
 +
  G91 X0.2275
 +
  G90 G0 Z0
 +
  G91
 +
  G3 I-0.2275 Z-0.125 F80
 +
  G3 I-0.2275
 +
  G0 X-0.2275
 +
 +
  X0.1175
 +
  G3 I-0.1175 Z-0.725 P6 F80
 +
  G3 I-0.1175
 +
  G0 X-0.1175
 +
 +
  G90 G0 Z#4
 +
o105 ENDSUB
 +
 +
o107 SUB
 +
  #11 = 0
 +
  o106 while [#11 LT #2]
 +
    G90 G0 X[#11]
 +
    o105 CALL [#1] [#2] [#3] [#4] [#5]
 +
    G0 Z[#5]
 +
    #11 = [#11+#3]
 +
  o106 endwhile
 +
  #11 = 0 (reset)
 +
o107 ENDSUB
 +
 +
 +
M3 S1 M8
 +
/G4 P20
 +
 +
 +
o106 while [#12 LT #2]
 +
  o107 CALL [#1] [#2] [#3] [#4] [#5]
 +
  G91 G0 Y[#3]
 +
  #12 = [#12+#3]
 +
o106 endwhile
 +
 +
 +
 +
M5 M9
 +
G90
 +
G28
 +
M30
 
%
 
%
</code>
+
</pre>

Latest revision as of 08:29, 9 March 2015

Square-Circle Test: Creates a 4in square folled by a 4in circle inside of the square. This is the code that we use to calibrate the machines.
%
G54 G90 G20 G0
G64 P0.01
M3 S1
G0 X0 Y2
G1 Z0 F150
Y0
X4
Y4
X0
Y2
G3 I2.0
G0 Z1 M5
X0 Y0
M30
%

Tool Sensor Test: This code will loop through tools 1-4 to prove that the tool sensor is working. This calls the tool, measures the length, drives it to zero, then pauses for 3 seconds before calling the next tool.

%
G54 G20 G90 G0 X0 Y0
G64 P0.005

#1 = 1
o100 CALL [#1]

G0 X0 Y0
G1 Z0 F50
G4 P3

#1 = 2
o100 CALL [#1]

G0 X0 Y0
G1 Z0 F50
G4 P3

#1 = 3
o100 CALL [#1]

G0 X0 Y0
G1 Z0 F50
G4 P3

#1 = 4
o100 CALL [#1]

G0 X0 Y0
G1 Z0 F50
G4 P3

M30
%

Counter-bored Hole Pattern: This code will create a pattern of counterbored holes in your spoilboard using an 1/8" end mill. This program demonstrates nested loops.

%
(create counterbored holes for threaded inserts)
(use 1/8" end mill)
G0 G49 G40 G54 G90 X0 Y0 
G64 P0.001

#1 = 25 (Y length)
#2 = 25 (X width)
#3 = 4  (increments)
#4 = 0.1 (z safe)

#11 = 0 (X)
#12 = 0 (Y)

o105 SUB
  G91 X0.2275
  G90 G0 Z0
  G91
  G3 I-0.2275 Z-0.125 F80
  G3 I-0.2275
  G0 X-0.2275

  X0.1175
  G3 I-0.1175 Z-0.725 P6 F80
  G3 I-0.1175
  G0 X-0.1175
 
  G90 G0 Z#4
o105 ENDSUB

o107 SUB
  #11 = 0
  o106 while [#11 LT #2]
    G90 G0 X[#11]
    o105 CALL [#1] [#2] [#3] [#4] [#5]
    G0 Z[#5]
    #11 = [#11+#3]
  o106 endwhile
  #11 = 0 (reset)
o107 ENDSUB


M3 S1 M8
/G4 P20


o106 while [#12 LT #2]
  o107 CALL [#1] [#2] [#3] [#4] [#5]
  G91 G0 Y[#3]
  #12 = [#12+#3]
o106 endwhile



M5 M9
G90
G28
M30
%