internal variable for units setting (g20/21)?

More
7 years 7 months ago #127722 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.

Please Log in to join the conversation.

More
7 years 7 months ago #127723 by MaHa
#<_metric> - Return 1 if G21 is on, else 0.
#<_imperial> - Return 1 if G20 is on, else 0.

Please Log in to join the conversation.

More
7 years 7 months ago #127724 by IrishMoss
you sir, are awesome.
thank you. :)

Please Log in to join the conversation.

More
7 years 7 months ago #127977 by IrishMoss
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.

Please Log in to join the conversation.

More
7 years 7 months ago #127994 by pl7i92
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

Please Log in to join the conversation.

Time to create page: 0.079 seconds
Powered by Kunena Forum