Delete all hatches on drawing except selected one

Delete all hatches on drawing except selected one

sam_safinia
Advocate Advocate
554 Views
2 Replies
Message 1 of 3

Delete all hatches on drawing except selected one

sam_safinia
Advocate
Advocate

I need  help for this code .  How can I change it to add "Exit -" as a prefix to layer names and not suffix.

 

(defun table (s / d r)                     ; Michael Puckett
  (while
    (setq d (tblnext s (null d)))
    (setq r (cons (cdr (assoc 2 d)) r))
    )
  )

(defun c:dsa (/ add lst xlay)
  (setq lst (cdr (reverse (table "layer"))))
  (setq add "Exist")
  (foreach x lst
    (setq xlay (strcat " - " add))
    (command "_rename" "layer" x xlay)
    )    ; foreach
  (princ)
  )      ; defun

 

Thanks

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

ВeekeeCZ
Consultant
Consultant
Accepted solution

Change this line

(setq xlay (strcat " - " add))

to this one:

 

(setq xlay (strcat add " - " x))

And if you really mean "Exit" instead of "Exist", change also this word in the code...

Message 3 of 3

sam_safinia
Advocate
Advocate

Thanks BeeKeeCZ.

0 Likes