AutoCAD 2007/2008/2009

AutoCAD 2007/2008/2009

Reply
Valued Contributor
jonjon107
Posts: 100
Registered: ‎04-12-2005
Message 1 of 6 (108 Views)

Layer Lisp Color Book Trouble

108 Views, 5 Replies
08-02-2006 08:02 AM
I have a lisp routine that makes all of the standard layers for a division of my company. it used to work well until now. i have added some "colorbook" colors to the new layers and when the lisp routine gets to that part it gives an error, stops and asks for "Truecolor/COlorbook". how do i get it to automatically make the color and continue? the following are a "good string" (one with a normal color that works and a "bad one" (the one with the colorbook color that doesn't work)
good - (blayer "ACID WASTE - TEXT" "7" "continuous" "default" "p")
bad - (blayer "BOILER FEED WATER" "DIC 161" "continuous" "default" "p")

also i have inserted the lisp that the previous one uses.

(defun blayer (name color ltype lwgt plot)
(if (tblsearch "LAYER" name) ;If NAME exists
(command "_.LAYER" "_S" name "") ;then set it current
(progn ;Otherwise...
(setq regen (getvar "REGENMODE"))
(setvar "REGENMODE" 0)
(command "_.LAYER" "_M" name) ;Create & set it current
(if color (command "_C" color name)) ;Set color if specified
(if ltype (command "_LT" ltype name)) ;Set ltype if specified
(if lwgt (command "_LW" lwgt name)) ;Set lwght if specified
(if plot (command "_P" plot name)) ;set plot if specified
(command "") ;End layer command
(setvar "REGENMODE" regen)
);progn
);if
(princ)
);defun
;;;*


any help with this would be greatly appreciated
*A+P
Message 2 of 6 (108 Views)

Re: Layer Lisp Color Book Trouble

08-02-2006 09:45 AM in reply to: jonjon107
When it comes to assigning color book colors to layers, you have to add some
additional parameters. Just follow the command line prompts by
typing -LAYER (command is preceded with a hyphen).

After you enter _C, you have to enter a _Col to tell AutoCAD you want to
specify a Colorbook. Then enter the color book name. In your case the name
is DIC COLOR GUIDE(R).
Then you enter "DIC 161"

Paul

wrote in message news:5256252@discussion.autodesk.com...
I have a lisp routine that makes all of the standard layers for a division
of my company. it used to work well until now. i have added some "colorbook"
colors to the new layers and when the lisp routine gets to that part it
gives an error, stops and asks for "Truecolor/COlorbook". how do i get it to
automatically make the color and continue? the following are a "good string"
(one with a normal color that works and a "bad one" (the one with the
colorbook color that doesn't work)
good - (blayer "ACID WASTE - TEXT" "7" "continuous" "default" "p")
bad - (blayer "BOILER FEED WATER" "DIC 161" "continuous" "default" "p")

also i have inserted the lisp that the previous one uses.

(defun blayer (name color ltype lwgt plot)
(if (tblsearch "LAYER" name) ;If NAME exists
(command "_.LAYER" "_S" name "") ;then set it current
(progn ;Otherwise...
(setq regen (getvar "REGENMODE"))
(setvar "REGENMODE" 0)
(command "_.LAYER" "_M" name) ;Create & set it current
(if color (command "_C" color name)) ;Set color if specified
(if ltype (command "_LT" ltype name)) ;Set ltype if specified
(if lwgt (command "_LW" lwgt name)) ;Set lwght if specified
(if plot (command "_P" plot name)) ;set plot if specified
(command "") ;End layer command
(setvar "REGENMODE" regen)
);progn
);if
(princ)
);defun
;;;*


any help with this would be greatly appreciated
Valued Contributor
jonjon107
Posts: 100
Registered: ‎04-12-2005
Message 3 of 6 (108 Views)

Re: Layer Lisp Color Book Trouble

08-02-2006 10:54 AM in reply to: jonjon107
I still don't completely understand. i'm not well versed in lisp.
*A+P
Message 4 of 6 (108 Views)

Re: Layer Lisp Color Book Trouble

08-02-2006 01:31 PM in reply to: jonjon107
As a quick answer to your lisp request, below is a revised function called
blayerc which only works when you want to specify colorbook
colors...enjoy....

(blayerc "BOILER FEED WATER" "DIC COLOR GUIDE(R)" "DIC 161" "continuous"
"default" "p")


(defun blayerc (name colorbook color ltype lwgt plot)
(if (tblsearch "LAYER" name) ;If NAME exists
(command "_.LAYER" "_S" name "") ;then set it current
(progn ;Otherwise...
(setq regen (getvar "REGENMODE"))
(setvar "REGENMODE" 0)
(command "_.LAYER" "_M" name) ;Create & set it current
(if color (command "_C" "_Col" colorbook color name)) ;Set color if
specified
(if ltype (command "_LT" ltype name)) ;Set ltype if specified
(if lwgt (command "_LW" lwgt name)) ;Set lwght if specified
(if plot (command "_P" plot name)) ;set plot if specified
(command "") ;End layer command
(setvar "REGENMODE" regen)
);progn
);if
(princ)
);defun
;;;*

wrote in message news:5256622@discussion.autodesk.com...
I still don't completely understand. i'm not well versed in lisp.
Valued Contributor
jonjon107
Posts: 100
Registered: ‎04-12-2005
Message 5 of 6 (108 Views)

Re: Layer Lisp Color Book Trouble

08-03-2006 06:23 AM in reply to: jonjon107
So this won't work for layers with both color books and standard autocad colors?
*A+P
Message 6 of 6 (108 Views)

Re: Layer Lisp Color Book Trouble

08-03-2006 09:06 AM in reply to: jonjon107
No.

Paul

wrote in message news:5257604@discussion.autodesk.com...
So this won't work for layers with both color books and standard autocad
colors?
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 or visit the Installation and Licensing Forum to get help installing your software.