Jump to content

create and send elements to layers according to color


pizarro

Recommended Posts

Here's a quick one:

(defun c:foo (/ a b c)
  ;; RJP » 2019-02-23
  (if (setq c (ssget ":L"))
    (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex c)))
      (cond ((setq a (cdr (assoc 62 (entget x))))
	     (setq b (tblobjname "layer" (itoa a)))
	     (entmod (append (entget x) (list (cons 8 (itoa a)) (cons 62 256))))
	     (or b (entmod (append (entget (tblobjname "layer" (itoa a))) (list (cons 62 a)))))
	    )
      )
    )
  )
  (princ)
)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...