internal variable for units setting (g20/21)?
04 Mar 2019 19:41 #127722
by IrishMoss
internal variable for units setting (g20/21)? was created by IrishMoss
This is probably a silly question, but I'll ask anyway.
Is there any internal variable that stores the current units setting that a program is running in?
I'm asking because i'm creating a custom toolchange-probe subroutine, and I'm using some inch values (my machine also defaults to inches), so my subroutine issues a G20(just to be safe). If the calling file is running under G21, then I'd set back to G21 before exiting the subroutine, if not, then leave it at inches.
It's not critical, since i can add the line manually since i'm editing the file anyway, more of a little nice-to-have, to make the code a little cleaner.
thanks.
Is there any internal variable that stores the current units setting that a program is running in?
I'm asking because i'm creating a custom toolchange-probe subroutine, and I'm using some inch values (my machine also defaults to inches), so my subroutine issues a G20(just to be safe). If the calling file is running under G21, then I'd set back to G21 before exiting the subroutine, if not, then leave it at inches.
It's not critical, since i can add the line manually since i'm editing the file anyway, more of a little nice-to-have, to make the code a little cleaner.
thanks.
Please Log in or Create an account to join the conversation.
04 Mar 2019 19:45 #127723
by MaHa
Replied by MaHa on topic internal variable for units setting (g20/21)?
#<_metric> - Return 1 if G21 is on, else 0.
#<_imperial> - Return 1 if G20 is on, else 0.
#<_imperial> - Return 1 if G20 is on, else 0.
The following user(s) said Thank You: IrishMoss
Please Log in or Create an account to join the conversation.
04 Mar 2019 19:49 #127724
by IrishMoss
Replied by IrishMoss on topic internal variable for units setting (g20/21)?
you sir, are awesome.
thank you.
thank you.
Please Log in or Create an account to join the conversation.
07 Mar 2019 14:04 #127977
by IrishMoss
Replied by IrishMoss on topic internal variable for units setting (g20/21)?
just found an even more elegant way. M73
Haven't tested it yet, but it sounds like it will do exactly what I want. Save state, and return to original settings at the end of the subroutine.
Haven't tested it yet, but it sounds like it will do exactly what I want. Save state, and return to original settings at the end of the subroutine.
Please Log in or Create an account to join the conversation.
07 Mar 2019 16:21 #127994
by pl7i92
Replied by pl7i92 on topic internal variable for units setting (g20/21)?
a subroutine shoudt always be filled with the mashine units
if it is presented to a libary like here in the Forum
First line #UNITS in ****
so people using it can detact
or you go for a Factor in First hand so only factor is to set
if it is presented to a libary like here in the Forum
First line #UNITS in ****
so people using it can detact
or you go for a Factor in First hand so only factor is to set
Please Log in or Create an account to join the conversation.
Time to create page: 0.066 seconds