- Posts: 18
- Thank you received: 0
calling subroutine from G54, G55, G56, but it acts weird
11 months 1 week ago #339013
by johnbump
calling subroutine from G54, G55, G56, but it acts weird was created 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
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 to join the conversation.
11 months 1 week ago #339063
by Aciera
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.
Replied by Aciera on topic calling subroutine from G54, G55, G56, but it acts weird
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.
Please Log in to join the conversation.
11 months 6 days ago #339179
by johnbump
Replied by johnbump on topic calling subroutine from G54, G55, G56, but it acts weird
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 to join the conversation.
11 months 6 days ago #339187
by Aciera
Replied by Aciera on topic calling subroutine from G54, G55, G56, but it acts weird
'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.
You could also stay in G54 and use different G52 offsets.
Please Log in to join the conversation.
11 months 3 days ago #339359
by johnbump
Replied by johnbump on topic calling subroutine from G54, G55, G56, but it acts weird
I will go read some more about G52, thanks!
Please Log in to join the conversation.
10 months 4 days ago #340547
by tlightus
Replied by tlightus on topic calling subroutine from G54, G55, G56, but it acts weird
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
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 to join the conversation.
10 months 4 days ago #340557
by MaHa
Replied by MaHa on topic calling subroutine from G54, G55, G56, but it acts weird
I was just working on a mdi command, so it was easy to have a look at this in FlexGui.
Starting with G0G55X0Y0
Then pressing the button with MDI command
and it goes to G0G54X0Y0
the subroutine:
o<work_zero> sub
G90 G54 G0 X0 Y0
o<work_zero> endsub [1]
M2
Starting with G0G55X0Y0
Attachment not found
Then pressing the button with MDI command
Attachment not found
and it goes to G0G54X0Y0
Attachment not found
the subroutine:
o<work_zero> sub
G90 G54 G0 X0 Y0
o<work_zero> endsub [1]
M2
Please Log in to join the conversation.
10 months 4 days ago #340559
by tlightus
Replied by tlightus on topic calling subroutine from G54, G55, G56, but it acts weird
thank you for testing. i have been getting a very different result but will go back and see if it was something i was doing wrong.
Please Log in to join the conversation.
10 months 3 days ago #340586
by tlightus
Replied by tlightus on topic calling subroutine from G54, G55, G56, but it acts weird
i did notice you use machine zero as the G54 offset. try setting it off that and run the test.
Please Log in to join the conversation.
10 months 3 days ago #340595
by MaHa
Replied by MaHa on topic calling subroutine from G54, G55, G56, but it acts weird
Today i tested with axis, made an entry in ini:
[HALUI]
MDI_COMMAND = O<work_zero> call
and had this button in glade in postgui.hal
net tb gladevcp.tb.tog halui.mdi-command-00
The subroutine as before, and the result as before. MDI G0G55X0Y0, when press the button it moves to G0G54X0Y0
[HALUI]
MDI_COMMAND = O<work_zero> call
and had this button in glade in postgui.hal
net tb gladevcp.tb.tog halui.mdi-command-00
The subroutine as before, and the result as before. MDI G0G55X0Y0, when press the button it moves to G0G54X0Y0
Attachment not found
Attachment not found
Please Log in to join the conversation.
Time to create page: 0.106 seconds
