Re-using Selection Set

Re-using Selection Set

jhoageN5XUG
Participant Participant
242 Views
2 Replies
Message 1 of 3

Re-using Selection Set

jhoageN5XUG
Participant
Participant

I'm working on a LISP that will allow the user to create a selection set.  The LISP will then convert specific layers within that selection set to another designated layer.  I would like to keep referencing ss1 using (ssget "_P") but that only references the most recently created selection set.  

 

I also tried copying the selection set using ssadd later in the program, but that was unsuccessful too. 

(defun c:sslaychange ()
    (vl-load-com) 


(setq ss1(ssget))
(princ)

  
  (if (tblsearch "LAYER" "V-BLDG-OTLN-F")
    (progn
      (setq e (ssget "_P" '((8 . "V-BLDG-OTLN-F"))))

       (command "_.change"e "" "P" "LA" "V-BLDG-OTLN" "")
(princ)
(setq e nil)
    )
  )
;
;
;

  (if (tblsearch "LAYER" "V-WATR-UNDR-F")
    (progn
      (setq e (ssget "_P" '((8 . "V-WATR-UNDR-F"))))

       (command "_.change"e "" "P" "LA" "V-WATR-UNDR-E" "")
(princ)
    )
  )
)
0 Likes
243 Views
2 Replies
Replies (2)
Message 2 of 3

Jeff_M
Consultant
Consultant

@jhoageN5XUG give this a try:

(defun c:sslaychange ( / e ss1)
  (vl-load-com)
  (setq ss1(ssget))

  (if (tblsearch "LAYER" "V-BLDG-OTLN-F")
    (progn
      (sssetfirst nil ss1)
      (setq e (ssget '((8 . "V-BLDG-OTLN-F"))))    
      (command "_.change" e "" "P" "LA" "V-BLDG-OTLN" "")
      )
    )

  (if (tblsearch "LAYER" "V-WATR-UNDR-F")
    (progn
      (sssetfirst nil ss1)
      (setq e (ssget '((8 . "V-WATR-UNDR-F"))))
      (command "_.change" e "" "P" "LA" "V-WATR-UNDR-E" "")
      )
    )
  (princ)
)
Jeff_M, also a frequent Swamper
EESignature
Message 3 of 3

jhoageN5XUG
Participant
Participant

Not quite, I'll keep tweaking to see if I can get it to work.

0 Likes