lisp help - keeping selection after finishing command

lisp help - keeping selection after finishing command

Anonymous
Not applicable
605 Views
2 Replies
Message 1 of 3

lisp help - keeping selection after finishing command

Anonymous
Not applicable

I am using a pair of simple lisp routines that lock or unlock a single viewport, but when I complete the command, the viewport is not selected anymore and I would like to add to the lisp to make it so the viewport is still selected after it is locked/unlocked. I would also like to know how to do this for a few other lisps if there is some universal "wording". Here is the lisp I am using:

 

;;LOCKS VIEWPORT
(defun c:vc (/ vp1)
(setq vp1 (ssget))
(command "mview" "l" "on" vp1 ""))

 

;;UNLOCKS VIEWPORT
(defun c:vx (/ vp2)
(setq vp2 (ssget))
(command "mview" "l" "off" vp2 ""))

 

Any help or suggestions would be appreciated! New to LISPs, but love to learn!

 

Thanks,

Michael

0 Likes
Accepted solutions (1)
606 Views
2 Replies
Replies (2)
Message 2 of 3

Kent1Cooper
Consultant
Consultant
Accepted solution

The (sssetfirst) function can be used to select/highlight/grip a selection set, so:

 

;;LOCKS VIEWPORT
(defun c:vc (/ vp1)
  (setq vp1 (ssget))
  (command "mview" "l" "on" vp1 "")

  (sssetfirst nil vp1)

)

Kent Cooper, AIA
0 Likes
Message 3 of 3

Anonymous
Not applicable

Oh great! Simple and sound! Tried it and it worked perfectly.

 

Thank you!

Michael

0 Likes