Unable to use the setvar function properly in lisp routine

Unable to use the setvar function properly in lisp routine

Anonymous
Not applicable
757 Views
3 Replies
Message 1 of 4

Unable to use the setvar function properly in lisp routine

Anonymous
Not applicable

Please take a look at the code and let me know where does it need modification.

As it is not working the way I intended it to work

what I want to do is

1. get the current layer and store it in a variable

2. set the current layer to "clouds"

3. invoke the "_revcloud" command

4. set the current layer back from the one stored in variable.

 

any help would be appreciated

(defun c:RC()
(setq X (getvar "clayer"))
(setvar "clayer" "CLOUDS")
(command "_revcloud" "" "NO")
(setvar "clayer" X)
(princ)
)
0 Likes
758 Views
3 Replies
Replies (3)
Message 2 of 4

imadHabash
Mentor
Mentor

Hi,

you may try to post your question here >> Click << to find more help from others . 

 

 

Imad Habash

EESignature

0 Likes
Message 3 of 4

tramber
Advisor
Advisor
(defun c:RC()
(setq X (getvar "clayer"))
(setvar "clayer" "axe")
(command "_revcloud" "" pause "_NO")(command)
(setvar "clayer" X)
(princ)
)

Should work better.

The setvar fn is not the problem Smiley Happy


EESignature

Message 4 of 4

Kent1Cooper
Consultant
Consultant

@Anonymous wrote:

....

2. set the current layer to "clouds"

3. invoke the "_revcloud" command

4. set the current layer back from the one stored in variable.

....


Assuming you mean you want to invoke the REVCLOUD command and let the User finish using it before setting the Layer back, the single Enter "" can't represent an indeterminate number of User inputs.  This is the way that is typically handled:

 

(defun c:RC()
(setq X (getvar "clayer"))
(setvar "clayer" "CLOUDS")
(command "_revcloud"); leaves you in the command
(while (> (getvar 'cmdactive) 0) (command pause))
; allows User input until command is completed (setvar "clayer" X); then reset Layer (princ) )

But I'm not sure there's a way to build in the "No" answer about reversing, when you don't know how many inputs will occur before then.

Kent Cooper, AIA
0 Likes