Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

ACAD 2005 - BATCH LAYER RENAME 1

Status
Not open for further replies.

SeanSweeney

Civil/Environmental
Joined
Mar 16, 2005
Messages
173
Location
NO
I have used the _laytrans command in autocad which works fine but is there a command or routine which will change the names of layers by adding or subtracting or replacing text strings of layers globally?
 
RENAME may do what you want, but are you looking to do a bunch of layers at once?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
A whole bunch, so Rename is not quite up to it. I was thinking more of a lsp routine to change all layers to include say:

K--DI--

text on the front of the layer name.
 
Here is one from the AfraLISP site...

This routine will place a Prefix in front of all Layer names ;and rename them.
Of course, it will not rename Layer "0" or "Defpoints".

(prompt "\nType ChLayName to run.........")
(defun C:ChLayName ( / acadDocument theLayers layName pre)
(vl-load-com)
(setq pre (getstring "\nEnter Layer Prefix : "))
(setq acadDocument (vla-get-activedocument (vlax-get-acad-object)))
(setq theLayers (vla-get-layers acadDocument))
(vlax-map-collection theLayers 'layer-mod)
(princ)
);defun

(defun layer-mod (theLayer)
(setq layName (vlax-get-property theLayer 'Name))
(if (not (member layName '("0" "Defpoints")))
(vla-put-Name thelayer (strcat pre layName))
) ;if
);defun
(princ)

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Borgunit - you are either clever or very clever - now which is it.

Thanks for making my day. I just got the train to work which was the wrong train and forgot to change because my book is rather good (Aurther and George by Julian Barnes), and then missed the next train as I began the long walk (its minus 10 and a metre of snow).

But that routine makes up for it. Cheers.
 
I was told in school. "The key is not to know everything, but to know where to look".

"Everybody is ignorant, only on different subjects." — Will Rogers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top