Hello Guest it is March 28, 2024, 10:22:51 PM

Author Topic: Repetering code and change Zero  (Read 1976 times)

0 Members and 1 Guest are viewing this topic.

Repetering code and change Zero
« on: November 11, 2016, 07:02:54 AM »
Hi, Im new to this so any help is welcome!

I have a pice I want to mill trough a block several times, so first I want to do the original at x0y0z0

Then I want to change in the code to a new Zero, x100y100z0 to do a copy, after doing this 7 times in X I want to do it 3 times in Y making in total 21 pieces.

So basicly I want to en up with three "rows" and seven "columns" of milled pieces. Some thinking below:





G00 G49 G40.1 G17 G80 G50 G90
G21
For i = 0 to 6 X
For j =0 to 2 y
Go to x0,y0
Move x,y zero point
X = x + i*150
Y= y + j * 200 
set to g54 new 0 position

PROGRAMCODE


NEXT j Y
next i X
G00 Z6.0000
M5 M9
M30

Online Graham Waterworth

*
  • *
  •  2,668 2,668
  • Yorkshire Dales, England
    • View Profile
Re: Repetering code and change Zero
« Reply #1 on: November 23, 2016, 03:13:54 PM »
There are lots of ways you can do this but G52 is by far the best as it sets a local datum.  You can put your pocket code in a sub and then set the G52 ********* Yxx and call the sub again if there are lots you can increment the G52 with #values.

Search G52 on here for lots of examples.
Without engineers the world stops
Re: Repetering code and change Zero
« Reply #2 on: November 23, 2016, 04:27:16 PM »
Hi

This is how I have solved it:


G00 G49 G40.1 G17 G80 G50 G90
G21
M6 T0
M03 S20000


(Program 1)
G52 x0
M98 P1
(Program 2)
G52 x200
M98 P1
(Program 3)
G52 x400
M98 P1
(Program 4)
G52 x600
M98 P1
(Program 5)
G52 x800
M98 P1
M5 M9
M30 (engine off)


O1

MAIN PROGRAM


M99 (Sub end)