How does M73 work in a sub?

More
22 Aug 2018 20:28 #116459 by Elco
Hello,

Writing a sub that can cut a part in a specified direction, I assumed that M73 will restore the former state - including rotation - upon subroutine exit. Since I could not get it right, I made a small test:
; test to see if the Rotation in the current coordinate system is saved with M73

o<rotating> sub
M73
G10 L2 P0 x10y10 R#1 ; rotate some degrees at current position
G90 X5 ; draw a line in relative mode
o<rotating> endsub

; Begin main
G91 G0
x10y10
o<rotating> call [10]
x10y10
o<rotating> call [20]
x10y10
o<rotating> call [30]
x10y10
o<rotating> call [40]
M2

Expecting a star of lines around 10,10
Running this seems that nor the rotation, nor the absolute mode is restored?
What goes wrong here? Using LinuxCNC 2.7.14

Thanks, Elco

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

More
24 Aug 2018 10:19 #116518 by andypugh
linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m73

Seems to suggest that "modal state" includes only units, feed rate, absolute/relative and spindle speed.

You can manually save and restore the rotation using parameters
linuxcnc.org/docs/2.7/html/gcode/overview.html#gcode:parameters

Specifically it looks like #[5210+20*#5220] will return the current rotation in the current coordinate system.

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

More
25 Aug 2018 10:57 #116573 by Elco
Replied by Elco on topic How does M73 work in a sub?
Thanks for the reply. I'll add that to the code.

Elco

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

Time to create page: 0.066 seconds
Powered by Kunena Forum