This is a read-only archive of lispforum.com. The forum was locked to new users and posts and is preserved here as static HTML from a database snapshot taken on 2019-09-07.

HELP Looping convert Bylayer colour and linetype

3 posts · 1544 views

Hi all, I am new to Lisp and need help looping this code. I am trying to get the ByLayer properties of Colour and Linetype and then making a new layer. For example Bylarer = RED and DASHED so placing this item on "1DASHED"
Using NENTSEL I can get it to work picking one object at a time but I want it to loop to do the entire drawing at once.
(defun C:QQQ ( / esl laycol )

(while (not (setq esl (nentsel))))   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(setq LayCol (cdr (cadddr (tblsearch "layer"  ( cdr(assoc 8 (entget (car esl)))))) )) 
(setq LayLin (Cdr (cadr (cdddr (tblsearch "layer"  ( cdr(assoc 8 (entget (car esl)))))) )) )
(setq LayName (strcat (rtos LayCol) LayLin))

         (COMMAND "LAYER" "m" LayName "C" laycol LayName "Ltype" LayLin LayName "") 
         (COMMAND "CHPROP" esl "" "LA" LayName "C" "BYLAYER" "LType" "BYLAYER" "") 

)

Last edited by nuntius on , edited 1 time in total. Reason: fixed code block

Re: HELP Looping convert Bylayer colour and linetype

I suspect you want to post in the "Other dialects" subgroup.

Re: HELP Looping convert Bylayer colour and linetype

Cheers Paul. I have reposted there too. hopefully someone can help.