Hello Guest it is February 21, 2024, 11:17:55 PM

Author Topic: Subtest again...  (Read 4529 times)

0 Members and 1 Guest are viewing this topic.

Offline Bodini

*
  •  216 216
    • View Profile
Subtest again...
« on: May 29, 2007, 05:49:45 PM »
Noob alert. ::)

I had a look here.http://www.artsoftcontrols.com/forum/index.php?topic=2540.0

OK, i got it, that works.

Now what if you want to run that sub in different locations in the coordinate system?

So take this one... <stolen from that link above>


G20 G40

G00 g90 g43 X-1. Y-1.
z1.
M98 (SUBTEST.TAP)
M30

%


and then add another position, so it looks like this:


G20 G40

G00 g90 g43 X-1. Y-1.
z1.
M98 (SUBTEST.TAP)
X5 Y5
M98 (SUBTEST.TAP)
M30

%


You see that I'm trying to run the sub again at x5 y5... but it doesnt turn out like i'd expect (another box at x5,y5).

What remedies this?

Thanks much.

-Nick

Offline Bodini

*
  •  216 216
    • View Profile
Re: Subtest again...
« Reply #1 on: May 29, 2007, 06:23:20 PM »
In other words, it's like the coordinate system needs to be temporarily reset (or something along those lines) at the insertion point of the sub.  I dont know enough about g-code yet to know what path to take.

thanks,

Nick

Offline Graham Waterworth

*
  • *
  •  2,664 2,664
  • Yorkshire Dales, England
    • View Profile
Re: Subtest again...
« Reply #2 on: May 29, 2007, 11:47:38 PM »
Hi Nick,

You need to offset the datum using G52, like this :-

G20 G40

G00 g90 g43 X-1. Y-1.
z1.
M98 (SUBTEST.TAP)
G52 x5. y5. (datum shift)
M98 (SUBTEST.TAP)
G52 x0 y0 (datum shift cancel)
M30

%

If you run this in Mach it will not show the 2 paths offset, it will draw them on top of each other. The machine will do it right though.

Graham.
Without engineers the world stops

Offline Bodini

*
  •  216 216
    • View Profile
Re: Subtest again...
« Reply #3 on: May 30, 2007, 08:35:04 AM »
Thanks Graham.

One more quiestion... and i only ask instead of doing it because Mach wont display it and I cant get to a machine to see it go right now...

What about adding another random position in the code like:

X13 Y2

would it look like this?


G20 G40

G00 g90 g43 X-1. Y-1.
z1.
M98 (SUBTEST.TAP)
G52 x5. y5. (datum shift)
M98 (SUBTEST.TAP)
G52 x0 y0 (datum shift cancel)

G52 x13. y2. (second datum shift)
M98 (SUBTEST.TAP)
G52 x0 y0 (second datum shift cancel)

M30

%

Thanks,

Nick

Offline Graham Waterworth

*
  • *
  •  2,664 2,664
  • Yorkshire Dales, England
    • View Profile
Re: Subtest again...
« Reply #4 on: May 30, 2007, 03:09:17 PM »
Yes, you can do it as many times as you want.

Graham.
Without engineers the world stops

Offline Bodini

*
  •  216 216
    • View Profile
Re: Subtest again...
« Reply #5 on: May 30, 2007, 03:29:06 PM »
Thanks Graham, just 1 more detail needed (until the next one :D)

What I meant to ask in that last one, but forgot to...

If you go to many locations, does the g52 need to be cancelled between each one?


-Nick

Offline Graham Waterworth

*
  • *
  •  2,664 2,664
  • Yorkshire Dales, England
    • View Profile
Re: Subtest again...
« Reply #6 on: May 31, 2007, 03:21:49 AM »
It is always safer to put the G52 x0 y0 in the code and less confusing when looking for the end of a block.

There are other rules attached to G52 too.

You can not change datum e.g. G54,G55 etc.

G52 must be cancelled before a tool change.

G40,G41,G42 must be within the G52 block.

(This is very bad code)
G52 X100 Y100
G41 X25 P2
Y..
X..
G52 X0 Y0
X10. Y10.
X15.
G40

Graham.
Without engineers the world stops