×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ACAD 2005 - BATCH LAYER RENAME

ACAD 2005 - BATCH LAYER RENAME

ACAD 2005 - BATCH LAYER RENAME

(OP)
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?

RE: ACAD 2005 - BATCH LAYER RENAME

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

RE: ACAD 2005 - BATCH LAYER RENAME

(OP)
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.

RE: ACAD 2005 - BATCH LAYER RENAME

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

RE: ACAD 2005 - BATCH LAYER RENAME

(OP)
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.

RE: ACAD 2005 - BATCH LAYER RENAME

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources