Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Routine that change specific layer names to specific colors

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
RedMan77
566 Views, 4 Replies

Routine that change specific layer names to specific colors

I am in need of assistance.  Been searching the forums and cant find exactly what I need.  I am seeking a routine that changes specific layer names to specific colors but if one or more layers are not found, the routine wont stop, they are automatically changed to color 8. 

 

I pull backgrounds from a campus vault and the layer names, for the most part are always the same.  I need to changes these specific colors to a variety of 3-4 colors other than 8.  As I prepare the backgrounds I have to set up each one and am hoping this routine will speed things up.  I have had mixed results with drawing standards and action recorder.

 

If its possible to post an example of the start and end of the routine and one or two layers the middle.  I will try and follow and add more layers in the middle of the routine by following the example. Any help would be greatly appreciated.  Thanks in advance.

4 REPLIES 4
Message 2 of 5
Kent1Cooper
in reply to: RedMan77

One way, in simplest terms:

 

(defun C:LCA (); = Layer Color Assignments

  (command "_.layer"

    "_color" 1 "Layer1,Layer17,LayerX"

    "_color" 2 "Layer34,Layer457,LayerY"

    "_color" 3 "Layer2,LayerZ,LayerMickeyMouse"

    "" ; finish Layer command

  ); command

); defun

 

If any of the Layers do not exist, a message will go by saying no Layer by that name was found, but it will carry on anyway.

 

Save that to a file, load it in a drawing with APPLOAD or (load), and type LCA to run it.

Kent Cooper, AIA
Message 3 of 5
Shneuph
in reply to: RedMan77

Have you experiemented with LAYTRANS?  I think it may be able to accomplish what you are looking for.  You can save a singe drawing with all the layer properties set how you want them.  Then in a drawing to modify open layertrans and load the drawing that is how you want layer properties.  Then "map same".  If all other layers you want to be color 8 just change all layers to color 8 before running laytrans.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 4 of 5
RedMan77
in reply to: Kent1Cooper

Thanks.  I know VERY little Autolisp for as long as I have been using AutoCAD.  I was able to piecemeal other commands together with this to make the background easy to use for anyone. Much appreciated.

Message 5 of 5
RedMan77
in reply to: Shneuph

Was playing around with Layer Translator but havent used it much.  I think I will moving forward. Wanted something quick and easy for a few users who can clean a background and start running.  Layer Trans would be too much for some right now.  I am definately going to see how it can benefit us.  Thanks.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost