AutoCAD 2010/2011/2012

Reply
Active Contributor
weedseed85
Posts: 33
Registered: ‎02-05-2013
Message 1 of 2 (172 Views)
Accepted Solution

Debuging my lisp

172 Views, 1 Replies
02-15-2013 01:13 AM

Dear Autocad / Lisp users, 

 

Could somebody please help me with my lisp.

 

The main goal for the lisp is to correct all colors of the given layers.

And for a few exceptions I want to change the LineType and set them to ByLayer.

 

It works, most of the time. But it always gives errors.

 

Couls somebody please have a look?

 

(defun c:SLC8 ()
	(setq kleur 8)
	(ChangeLayerColor kleur)
	
)
(defun ChangeLayerColor (kleur / sset ename i)
	(vl-load-com)
	(setq i 0)
	(setq sset (ssget "X" '((8 . "AL*"))))
		(if sset
			(repeat (sslength sset)
				(setq ename (ssname sset i))
				(setq i (1+ i))
				(vla-put-color (vlax-ename->vla-object ename) kleur)
			)
		)
	(setvar "cmdecho" 0)
	(command "-layer" "unlock" "*" "")
	(command "layer" "c" "7" "0" "")
	(command "layer" "c" "7" "*AL70----*" "")
	(command "layer" "c" "1" "*AL-----_VLOERPLAAT" "")
	(command "layer" "c" "2" "*AL-----_SPARING" "")
	(command "layer" "c" "1" "*AL_MAATVOERING" "")
	(command "layer" "c" "8" "*AL31----*" "")
	(command "layer" "c" "8" "*AL32----*" "")
	(command "layer" "c" "8" "*AL21----*" "")
	(command "layer" "c" "8" "*AL22----*" "")
	(command "layer" "c" "8" "*AL_31----*" "")
	(command "layer" "c" "8" "*AL_32----*" "")
	(command "layer" "c" "8" "*AL_21----*" "")
	(command "layer" "c" "8" "*AL_22----*" "")
	
	(command "layer" "c" "8" "*AT$1A---_TEKST012" "")
	(command "layer" "c" "8" "*AT$1A---_TEKST018" "")
	(command "layer" "c" "8" "*AT$1A---_TEKST025" "")
	(command "layer" "c" "8" "*AT$1A---_TEKST035" "")
	(command "layer" "c" "8" "*AT$1A---_TEKST050" "")
	(command "layer" "c" "8" "*AT$1A---_TEKST070" "")
	(command "layer" "c" "8" "*AT$1A---_TEKST100" "")
	
	(command "layer" "c" "1" "ATT012*" "")
	(command "layer" "c" "1" "ATT018*" "")
	(command "layer" "c" "2" "ATT025*" "")
	(command "layer" "c" "3" "ATT035*" "")
	(command "layer" "c" "4" "ATT050*" "")
	(command "layer" "c" "5" "ATT070*" "")
	(command "layer" "c" "6" "ATT100*" "")
	
	(command "layer" "c" "254" "00ATT018*" "")
	(command "layer" "c" "254" "00ATT025*" "")
	(command "layer" "c" "254" "00ATT035*" "")
	(command "layer" "c" "254" "00ATT050*" "")
	(command "layer" "c" "254" "00ATT070*" "")
	(command "layer" "c" "254" "00ATT100*" "")
	
	(command "layer" "c" "254" "00KAD018*" "")
	(command "layer" "c" "254" "00KAD025*" "")
	(command "layer" "c" "254" "00KAD035*" "")
	(command "layer" "c" "254" "00KAD050*" "")
	(command "layer" "c" "254" "00KAD070*" "")
	(command "layer" "c" "254" "00KAD100*" "")
	
	(command "layer" "c" "7" "0" "")
	(command "layer" "c" "254" "*BL$2----*" "")
	(command "layer" "c" "1" "*BL$3----*" "")
	(command "layer" "c" "254" "*BL$4----*" "")
	(command "layer" "c" "254" "*BL$5----*" "")
	(command "layer" "c" "254" "*BL$6----*" "")
	(command "layer" "c" "8" "*BL$7----*" "")
	(command "layer" "c" "8" "*BM$7----*" "")
	(command "layer" "c" "7" "*BL$9----*" "")
	(command "layer" "c" "7" "*FL80----" "")
	(command "layer" "c" "8" "*WL905---*" "")
	(command "layer" "c" "8" "*Xref*" "")
	(command "layer" "c" "8" "*BL$8----_TEKST*" "")
	(command "layer" "c" "8" "*BT$8----*" "")
	
	(command "SETBYLAYERMODE" "1" "")
	(command "clayer" "0")

	(command "SETBYLAYERMODE" "99" "")
	(command "layer" "c" "8" "*BL$7----*" "Ltype" "DASHDOT" "*BL$7----*" "")
	(command "._setbylayer" (ssget "X" (list (cons 8 "*BL$7----*"))) "" "yes" "yes")
	
	
	(if (tblsearch "LAYER" "BL$8----")
			(command "layer" "c" "1" "*BL$8----*" "Plot" "No" "BL$8----*" "" "")
	(princ "\nLaag BL$8---- Niet kunnen vinden")
	)
	(princ)

	(if (tblsearch "LAYER" "BL$8----Verdieping")	
			(command "layer" "c" "1" "*BL$8----Verdieping*" "Plot" "No" "*BL$8----Verdieping*" "" "")
	(princ "\nLaag BL$8----Verdieping Niet kunnen vinden")
)
	(princ)

	(if (tblsearch "LAYER" "FL------_BWS30")
		(progn
			(command "._setbylayer" (ssget "X" (list (cons 8 "FL------_BWS30"))) "" "yes" "yes" "")
			(command "layer" "c" "14" "*FL------_BWS30" "")
			(command "_draworder" (ssget "X" (list (cons 8 "FL------_BWS30"))) "" "Front" "")
		)
		(princ "\nLaag FL------_BWS30 Niet kunnen vinden")
	)
	(princ)

	(if (tblsearch "LAYER" "FL------_BWS60")
		(progn
			(command "._setbylayer" (ssget "X" (list (cons 8 "FL------_BWS60"))) "" "yes" "yes" "")
			(command "layer" "c" "90" "*FL------_BWS60" "")
			(command "_draworder" (ssget "X" (list (cons 8 "FL------_BWS60"))) "" "Front" "")
		)
		(princ "\nLaag FL------_BWS60 Niet kunnen vinden")
	)
	(princ)
)
(princ)

 

 

Anny help will be great.

Thanks in advance.

 

Michel

*Expert Elite*
braudpat
Posts: 1,840
Registered: ‎12-15-2006
Message 2 of 2 (154 Views)

Re: Debuging my lisp

02-15-2013 02:51 AM in reply to: weedseed85

 

Hello

 

Please could yo post in THIS forum :

http://forums.autodesk.com/t5/Visual-LISP-AutoLISP-and-General/bd-p/130

 

Bye, Patrice

 

Bye, Pat

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community




Connect with AutoCAD

Twitter

Facebook

Blogs

Pinterest

Youtube