Simple osnap code problem

Simple osnap code problem

Anonymous
Not applicable
615 Views
4 Replies
Message 1 of 5

Simple osnap code problem

Anonymous
Not applicable

I'm trying to modify a lisp program I have to make it turn off my osnap (F3), then finish the move command, then turn back on my osnap (F3)

 

The section of code is this

 

 

(setvar 'osmode 16384)


(command "move" "P" "")


(setvar 'osmode 641)

 

 

What this section of code does is keep the osnap on.

If I remove the line (setvar 'osmode 641) then this section of code will turn off my osnap and finish out the move command, but then I have to reset my osnap settings again .

 

 

I just want this section of code to toggle off my osnap,  finish out the move command,  then toggle back on my osnap.

 

What should the code look like to do this?

 

Thanks

0 Likes
Accepted solutions (1)
616 Views
4 Replies
Replies (4)
Message 2 of 5

scot-65
Advisor
Advisor

Perhaps look at something like this?

 

 
; Note: Where OSMODE requires turning off, 16384 added to value, which
;  supresses OSMODE and the user can turn back on via status line toggle,
;  if needed.
;
;inside *error*:
; (if (> (getvar "OSMODE") 16384)
;  (setvar "OSMODE" (- (getvar "OSMODE") 16384)) );if
;set:
; (setvar "OSMODE" (+ (getvar "OSMODE") 16384)) ;toggles setting
;reset:
; (if (> (getvar "OSMODE") 16384)
;  (setvar "OSMODE" (- (getvar "OSMODE") 16384)) );if

I wrote this inside our company's MNL for future programmer's reference...

 

???

 


Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 5

jdiala
Advocate
Advocate
(setvar 'osmode 16384)
(command "move" "P" "")
(while (> 0 (getvar 'cmdactive))
(command pause)
)
(setvar 'osmode 641)

You can also create an error function as scot-65 suggested.

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Very simple solution is to change osnap just temporary using "_none" osnap in front of user's input:

 

(command "_.MOVE" "_P" "" "_none" PAUSE "_none" PAUSE)

 

...or if you don't know how many unser's input you gonna need:

 

(command "_.MOVE" "_P" "") 
(while (> (getvar 'CMDACTIVE) 0) (command "_none" PAUSE))

There is need to set something back or put it in the error function in the both cases.

0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks BeekeeCZ, that did the trick.

0 Likes