HELP looping convert Bylayer Colour and Ltype

Discussion of other Lisp dialects (Arc, Clojure, AutoLisp, XLISP, etc.)

HELP looping convert Bylayer Colour and Ltype

Postby Micko79 » Thu Nov 03, 2011 5:16 am

Hi all, I am new to Lisp and am having troubles looping the following lisp. I am trying to select objects and then put them on a layer relating to their colour and linetype. For example I want to select an object that has BYLAYER = RED and DASHED and then put it on a layer called 1DASHED. I have got it to run using the following code but because I used NENTSEL I can only pick one object at a time (and it works) I need it to loop to run through every object in an entire drawing but every loop I try I get an error saying VARITYP or something similar (at home now and dont have CAD to regen the error) I looked it up and it means I am refering to a selection set instead of a LIST. Please help looping this. I am desperate.

[code][/code](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" "")

Posts: 3
Joined: Tue Nov 01, 2011 11:25 pm

Return to Other Dialects

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest