PDA

View Full Version : Changing Pen Settings



mpemberton
2004-10-19, 08:55 PM
Our Company is going to switch pen settings as soon as we install AutoCAD 2005. I need to figure out a way of switching everyone of our basic details from one color to a different color, with out naming any layer names. Because every one of our drawings has different layering names. I really want to write a lisp or script then make a AutoCAD shortcut switch to automate this process in one step.

Can anyone help me?????

Example:

"Every"
Color 6 change to 3
Color 5 change to 15
Color 4 change to 11

mjfarrell
2004-10-19, 09:10 PM
I'm pretty sure you could set up the Cad Manager tools
Standards checker to do this,
OR for the old drawing create a Legacy.CTB
file
the plots the colors as you desire

so in the CTB it is set as

Color 6 plot as 3
Color 5 plot as 15
Color 4 plot as 11

And then you only change the CTB file used to plot them not
their original content at all.

Mike.Perry
2004-10-19, 09:36 PM
Hi

Check out the following Submission # EX001119 by Debra Denton on the AUGI Exchange Page (hopefully should get you going in the right direction) -

AUGI Exchange Search Page (http://www.augi.com/exchange/search.asp?page=415)

Have a good one, Mike

mpemberton
2004-10-20, 01:46 AM
i can't create another .ctb file because there will be alot of times that i will need to plot new floor plans with old details on the same sheet. We are going to be using Arch. Desktop and Building Systems, which are all 3D versions of AutoCAD. I would like to fix all of the old stuff we use all the time to update everything now, rather than fixing stuff over the next couple years.

i need a way of opening a drawing, changing one color to another (over and over), save & close.


Thanks for all the help.
i found some really cool things in the attached web page.

RobertB
2004-10-20, 01:47 PM
Have you considered the Standards Checker?

mpemberton
2004-10-20, 02:55 PM
Looking at the Standards Checker, it seems to involved into Layer names. Every Detail we have has a different layer name or scheme. i need a way of by-passing names and filter colors to change to another.

I will still look into the Checker for more possibilities....
Thank You,

mpemberton
2004-10-27, 08:21 PM
It seems this would be a common problem with all "Cad" firms. Expecially going from a 2D AutoCAD to Arch. Desktop. No one want to modify this software adapting their own layers and pensettings. i have searched the web and found some really useful things. Just not what i need now.

Can anyone help me.!

kennet.sjoberg
2004-10-27, 10:45 PM
Hi mpemberton !

Here is a lisp program for You that will change the layer color,
but it do not change objects or block colored by object.


(defun c:ChangeLayerColor ( / LayerDxf LayerName LayerColor )

;;; subroutine that do the work
(defun DoChangeLayerColor ( LayerName LayerColor / )
(setq LayerColor
(cond
((= LayerColor 6 ) 3 ) ;; 6 magenta => 3 green
((= LayerColor 5 ) 15 ) ;; 5 blue => 15 brown
((= LayerColor 4 ) 11 ) ;; 4 cyan => 11 pink
(t nil)
)
)
(command "._-layer" "Color" LayerColor LayerName "" )
)

;;; main program
(command "_.UNDO" "BEgin" )
(setq LayerDxf (tblnext "LAYER" T ) ) ; take the first layer
(setq LayerName (cdr (assoc 2 LayerDxf )) )
(setq LayerColor (cdr (assoc 62 LayerDxf )) )
(if (or (= LayerColor 6 )(= LayerColor 5 )(= LayerColor 4 ) )
(DoChangeLayerColor LayerName LayerColor )
( )
)

(while (setq LayerDxf (tblnext "LAYER" nil ) ) ; take all next layer
(setq LayerName (cdr (assoc 2 LayerDxf )) )
(setq LayerColor (cdr (assoc 62 LayerDxf )) )
(if (or (= LayerColor 6 )(= LayerColor 5 )(= LayerColor 4 ) )
(DoChangeLayerColor LayerName LayerColor )
( )
)
)
(command "._UNDO" "End" )
(princ "\nCommand: You can undo with : \nCommand: U" )
(princ)
)

: Happy Computing !

kennet

CAB2k
2004-10-28, 12:18 AM
You could automate this routine.

(defun c:lc (/ en1 chk olst nlst bnm cde blst lyr lyrc col llist olderr
lc_errtrap)

(defun lc_errtrap (s)
(if (/= s "Function cancelled")
(princ (strcat "\nError: " s))
)
(command "UNDO" "EN")
(setq *error* olderr)
(princ)
); defun
;;================================
;; Start
;;================================
(setq olderr *error*
*error* lc_errtrap
)

(setvar "ERRNO" 0)
(setq en1 nil)
(setq
nestsel nentsel ; interesting way to evoke a command. CAB
nestprompt
"\nEnter <N>o nesting or select nested object on Layer to change : "
)
(command "UNDO" "BE")
(while (and (= (getvar "ERRNO") 0) (not en1))
(initget "N")
(setq en1 (nestsel nestprompt)); get the selection
(if en1
(cond
((= en1 "N") ; toggle methods, No nesting to get Nested
(if (= nestsel entsel)
(setq
nestsel nentsel
nestprompt
"\nEnter <N>o nesting or select nested object on Layer to change : "
)
(setq
nestsel entsel
nestprompt
"\nEnter <N>ested to get Nested or select Object on Layer to Change : "
)
)
(setq en1 nil)
); end cond

((= (type en1) 'list)
;;;----------------------
;;;swiped this from ET's xlist.lsp 7-12-01
(setq inest (length (last en1)))
;;The next if statement handles block within blocks.
;; iNest = 1 means no nesting. since (nentsel) goes all the
;; way to the root AutoCAD object we have to traverse back up to the top
;; level of the nesting to get a block name.
(if (and (> inest 1) (= 'ename (type (car (last en1)))))
(setq nlst (entget (nth (- inest 2) (last en1))))
;;else last last our way back up to the top block definition
(setq nlst (entget (car en1)))
;;then pull the list from the standard nentsel call.
)
;;;----------------------
(setq chk (car (last en1)))
(setq olst (entget (car en1)))
(if (and (= (type chk) (quote ename)) (> inest 1))
(progn
(if (not nlst)
(setq nlst (entget (car (last en1))))
)
(setq bnm (cdr (assoc 2 nlst)))
(setq blst (tblsearch "BLOCK" bnm))
(setq cde (cdr (assoc 70 blst)))
(cond ((= cde 0) (setq flist nlst))
((= cde 2) (setq flist olst))
((= cde 44) (setq flist olst))
((= cde 48) (setq flist nlst))
((= cde 50) (setq flist nlst))
((= cde 36) (setq flist olst))
)
)
(setq flist olst)
)
(setq lyr (cdr (assoc 8 flist)))
(setq lyrc (cdr (assoc 62 (tblsearch "LAYER" lyr))))
(princ
(strcat "\n\nSelecting Color for Layer " lyr " .......\n")
)
(setq col (acad_colordlg (abs lyrc) nil))
(if (not col)
(exit)
(progn
(setq llist (entget (tblobjname "LAYER" lyr)))
(setq llist (subst (cons 62 col) (assoc 62 llist) llist))
(entmod llist)
)
)
(setvar "ERRNO" 0)
(setq en1 nil)
); end cond
(t (princ)); end cond
); end cond stmt
(if (= (getvar "ERRNO") 7)
(setvar "ERRNO" 0)
)

)
)
(command "UNDO" "EN")
(setq *error* olderr)
(princ)
)

kennet.sjoberg
2004-10-28, 05:49 AM
Hi mpemberton, do You have to redefine Your blocks ?

: ) Happy Computing !

kennet

mpemberton
2004-11-02, 08:42 PM
Thank You Both. I have been using "ab2draft's" the last two days. And will keep using it. This works great and is such a time saver. But the one that Kent wrote is perfect for the application I need it for. Thank You both so much.

I can't believe that this isn't as big of an issue as it is. I couldn't find anything on the Web on switching pen settings or colors. I know I can't be the first person who has had this problem. Do you think Autodesk will provide a "converter" in the future, as much as they are pressing Arch. Desktop and Building Systems.


Thank You (both),

Matt P.