Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Restore GETVAR after program

3 REPLIES 3
Reply
Message 1 of 4
Takuwind
170 Views, 3 Replies

Restore GETVAR after program

Can anyone point me to the old post that describes how to retain GETVAR info on a "toggle", i.e. 0 or 1?

It was the one where I think the person subtracted 1 and was able to restore after the program finished. It was an elegant way to do it, but I have had no luck in finding it again.

In this case, I want to set CMDDIA and FILEDIA to 0 and restore them to exactly what they were before.
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Takuwind

Something like this?

(setvar "filedia" (- 1 (getvar "filedia")))

--
Autodesk Discussion Group Facilitator


wrote in message news:5471895@discussion.autodesk.com...
Can anyone point me to the old post that describes how to retain GETVAR info
on a "toggle", i.e. 0 or 1?

It was the one where I think the person subtracted 1 and was able to restore
after the program finished. It was an elegant way to do it, but I have had
no luck in finding it again.

In this case, I want to set CMDDIA and FILEDIA to 0 and restore them to
exactly what they were before.
Message 3 of 4
Takuwind
in reply to: Takuwind

My memory is a bit sketchy... but that looks familiar.
However that is a toggle only.

Maybe I just need to
setq the original value from getvar,
setvar to "0" then
setvar the original value at the end...

Just thought i saw a sexier way to do it in the past...

In case you are wondering, I need it this way because I will end up running this rountine in one of two situations:
1) In a normal setting - any old dwg open - where CMDDIA and FILEDIA should be set to 1 already
2) Within a Hurricane script where CMDDIA and FILEDIA are set to 0 at beginning of batch.

Using a toggle in situation #2 will jack up the rest of the batch run.

Thanks!
Message 4 of 4
Anonymous
in reply to: Takuwind

I posted something a little bit ago on this subject, ``error trapping'', or
``variable restoration'' Do a serch for my name and you should find it
fairly easily (I havent posted much on this server.).

But if a direct toggle is what you want... Hows these?

(setvar "FILEDIA" (boole 6 (getvar "FILEDIA") 1)) ;; use XOR
(setvar "FILEDIA" (abs (1- (getvar "FILEDIA")))) ;; Use some math


wrote in message news:5471900@discussion.autodesk.com...
My memory is a bit sketchy... but that looks familiar.
However that is a toggle only.

Maybe I just need to
setq the original value from getvar,
setvar to "0" then
setvar the original value at the end...

Just thought i saw a sexier way to do it in the past...

In case you are wondering, I need it this way because I will end up running
this rountine in one of two situations:
1) In a normal setting - any old dwg open - where CMDDIA and FILEDIA should
be set to 1 already
2) Within a Hurricane script where CMDDIA and FILEDIA are set to 0 at
beginning of batch.

Using a toggle in situation #2 will jack up the rest of the batch run.

Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost