calling subroutine from G54, G55, G56, but it acts weird

More
11 months 1 week ago #339013 by johnbump
I touch off G54, X=0, Y=0, Z=0.  Then I run my program, which uses G10 to set up work offsets, in theory every 30mm away from G54, each calling the same subroutine.  (Kinda weird subroutine: I'm trying to cut t-slots in the edge of oak and it tears out, so I'm finessing the toolbit into the wood.)

What I'm seeing is that I set all three axes at 0, then it switches to G55, and I very strongly think the G10 offset should read G10 L20 P2 X-30 Y0 Z0.  If I do that, it runs to X-30, Y0, Z3.  In all the subsequent, identical, work offsets, it also runs to Z3.
If I touch off X0 Y0 Z0 in G54, and then instead do, as the below program shows, G10 L20 P2 X-30 Y0 Z3, it runs perfectly.
I do not understand where three millimeters in Z is coming from, when both X and Y work exactly as I expected.
Is there a secret stateful variable somewhere I need to reset?

For that matter, is there a better way to do this?  This is my first time trying work offsets.  I've always previously either used a cam program or written multiple sites by hand as a single file without a subprogram, but I thought it would be fun to try learning work offsets.

Thanks for any advice.  LinuxCNC, version 2.9.6.

G17 G21 G40 G49 G80 G90
M08
G54
M05
M09M6 T1
G10 L20 P1 X0 Y0 Z0
G10 L20 P2 X-30 Y0 Z3
G10 L20 P3 X-60 Y0 Z3
G10 L20 P4 X-90 Y0 Z3
G10 L20 P5 X-120 Y0 Z3
G10 L20 P6 X-150 Y0 Z3

o199 sub

G0 X2 Y-20
G1 Z-8 F20
G1 Y-12 F10
G0 Y-20
G0 X3.237
G1 Y-12 F10
G1 y-20 F40
G0 x-3.237
G1 y0 F10
g2 x0 Y3.237 R3.237
g2 x3.237 Y0 R3.237
g1 y-20
g0 z2
o199 endsub

G55
o199 call
G56
o199 call
G57
o199 call
G58
o199 call
G59
o199 call

G0 Z10
G54 G0 X0 Y0

M2
 

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago - 11 months 1 week ago #339063 by Aciera

If I touch off X0 Y0 Z0 in G54, and then instead do, as the below program shows, G10 L20 P2 X-30 Y0 Z3, it runs perfectly.


touching off in G54 will actually run 'g10 l20 p1 z0' which will set the z-offset value in G54 such that the axis position is equal to zero. This is the value you would need in the other offset systems as well. Which I guess is 3.
Last edit: 11 months 1 week ago by Aciera.

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #339179 by johnbump
I wasn't good with my phrasing. I touch off G54, and explicitly set G10 L20 P1 X0 Y0 Z0 to force G54 (I may not need to do this? because it's what automatically happens when I touch off if I have the popup set to G54?), but don't ever use that except for touchoff/part location. (I *think* this is how I should be doing this?) Then I subsequently set up G10 P2, G10 P3, and so forth, and only machine at the work offsets referenced by those.

Please Log in or Create an account to join the conversation.

More
11 months 1 week ago #339187 by Aciera
'P0' will set the currently active offsets, while 'P1','P2' ... will set the values of a particular offset system.
You could also stay in G54 and use different G52 offsets.

Please Log in or Create an account to join the conversation.

More
11 months 4 days ago #339359 by johnbump
I will go read some more about G52, thanks!

Please Log in or Create an account to join the conversation.

More
10 months 6 days ago #340547 by tlightus
sorry if this is the wrong place to post this but it seemed appropriate.
i think i found a bug with subroutine calls

Conditions:

set up a pyvcp button to call an MDI_COMMAND

Set fixgure offsets for G54, G55

remain in G55 X0 Y0 and issue:

MDI_COMMAND = G0 G90 G54 X0 Y0

and that will work fine

Go back to G55 active offset at X0 Y0 and change the command to call a subroutine

MDI_COMMAND = o<work_zero> call

will fail not executing the subroutine command and sit at G55 zero

i tested this in both axis and flexgui with the exact same results

####### SUBROUTINE #######
o<work_zero> sub
G90 G54 G0 X0 Y0
o<work_zero> endsub

m2
#######

if you are still in G55 at X0 Y0 and issue

G0 G90 G54 X0 Y0 from the mdi command line it will go to G54 X0 Y0 also

Please Log in or Create an account to join the conversation.

Time to create page: 0.093 seconds
Powered by Kunena Forum