Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Layer manipulation by script

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
415 Views, 4 Replies

Layer manipulation by script

Anyone have a script that will allow me to append specified text to layer names, then cahnge all layers to a certain color???

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

Does it need to be a Script per se?  An AutoLisp routine could do that easily.  [In case that's what you mean, be aware that "Script" has a specific and different meaning in AutoCAD.]  I'm not sure about a Script, but possibly.

 

Append the same specified text to all Layer names, or only some?  If only some, how would they be selected?

 

For the color part, in command-line usage an asterisk will get you all Layer names, to apply the same color to in one color option.  IN Script format:

 

_.-Layer

_color

YourDesiredColor

*

 

 

with an additional blank line [second Enter after the asterisk] to complete the Layer command.  The same can be done in command-macro format to put into a menu button somewhere, or AutoLisp format, depending on what you really need.

Kent Cooper, AIA
Message 3 of 5
Anonymous
in reply to: Kent1Cooper

so we have several packages that go out. the name is always changing. the client requires us to make sure we append the correct package name to all new scope layers (Will be wblocked out into a new drawing) then select all and append the required info, then all those layers need to be changed to magenta.

 

 

Message 4 of 5
Anonymous
in reply to: Anonymous

think i am meaning an Autolisp routine, i can run when i get these autocad files.

Message 5 of 5
Kent1Cooper
in reply to: Anonymous

Something like should get you started:

 

(defun C:WHATEVER ()

  (foreach layer '("Layer1" "Layer2" "LayerA" "LayerB" "LayerWho" "LayerWhat")

    (command

      "_.layer" "_color" 6 layer ""

      "_.rename" "_layer" layer (strcat layer "YourPackageName")

    ); command

  ); foreach

); defun

Kent Cooper, AIA

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report