Autocad Lisp Question (simple)

Discussion of Common Lisp
Post Reply
Canuck7783
Posts: 1
Joined: Mon Jul 28, 2014 12:47 pm

Autocad Lisp Question (simple)

Post by Canuck7783 » Mon Jul 28, 2014 12:53 pm

I had the lisp below running on autocad 2002 with no problems. I put it on a machine that is running Autocad 2014 and I have one small problem. When I was on autocad 2002 I could select an object line and then run my lisp program (WW) and it would change to the correct layer "PART". On the autocad 2014 machine, it won't let me do it. I have to run the lisp program first, it then asks me to select the object layer you want to change and then it changes to the correct layer. I already messed around with the "Pickfirst" option and that isn't it. Is there something wrong with my coding that I'm not seeing. Thank you


LISP Program -
; ---------------------------PART LISP--------------------------
; CHANGES A SELECTED OBJECTS LAYER TO LAYER "PART"
; ----------------------------------------------------------------


(Defun C:WW (/ SS CNT LAY)

(setvar "cmdecho" 0)
(if (not (tblsearch "LAYER" "hidden"))
(command "Layer" "N" "PART" "C" "green" "PART" "LT" "continuous" "PART" "" ""))

(if (not (setq SS (ssget "i")))
(progn
(prompt "\nSelect objects to be CHANGED to layer PART: ")
(setq SS (ssget))
)
)

(if SS
(command "_.change" SS "" "_p" "_la" "PART" "")
(if (= (sslength SS) 1)
(prompt (strcat "\nOne object changed to layer "PART"))
(prompt (strcat "\n" (itoa (sslength SS)) "objects changed to layer "PART")
)
)
)

(setvar "cmdecho" 1)

(princ)
)

pjstirling
Posts: 166
Joined: Sun Nov 28, 2010 4:21 pm

Re: Autocad Lisp Question (simple)

Post by pjstirling » Thu Jul 31, 2014 5:32 am

Erm, why are you asking this in the common-lisp forum and not the Other Dialects (which explicitly list autolisp)?

Post Reply