2172
« on: March 10, 2007, 05:53:04 AM »
Hi plasticbaldy,
You have 2 options with this problem,
1. You code the sub program with incremental moves only. then move to the start points in the main program and call the sub.
2. You code the sub as normal and use G52 X? y? to offset the datum.
e.g.
Option 1.
(main program)
O0001
G21 G40 G00 G99 G17
S1000 M3
G00 G90 X0 Y0 Z5. (FIRST PART POS)
M98 P0002
G00 X25. Y0 (SECOND PART OFFSET 25MM)
M98 P0002
G00 X25. Y25. (THIRD PART OFFSET 25MM X AND 25MM Y)
M98 P0002
G00 X0 Y25. (FORTH PART OFFSET 25MM Y)
M98 P0002
G00 Z150. M5
M30
(SUB PROGRAM)
O0002
G90 G01 Z- 2. F50. ( ABS MOVE)
G91 X5. F150. (INC MOVES)
Y5.
X-5.
Y-5.
G90 G00 Z5. (ABS MOVE)
M99
Option 2.
(main program)
O0001
G21 G40 G00 G99 G17
S1000 M3
G00 G90 X0 Y0 Z5. (FIRST PART POS)
M98 P0002
G52 X25. Y0 Z0 (SECOND PART OFFSET 25MM)
M98 P0002
G52 X25. Y25. Z0 (THIRD PART OFFSET 25MM X AND 25MM Y)
M98 P0002
G52 X0 Y25. Z0 (FORTH PART OFFSET 25MM Y)
M98 P0002
G00 Z150. M5
M30
(SUB PROGRAM)
O0002
G01 Z- 2. F50.
X5. F150.
Y5.
X0
Y0
G00 Z5.
G52 X0 Y0 Z0 (CANCEL OFFSET SHIFT)
M99
The one Brett showed you is close but not quite what you want but a good guide on how to call subs.
Graham.