To go along with the previous post which adds a Prefix to layer names, this one allows you to add a suffix to layer names.
Here’s How:
- RL2 <enter> to start
- Enter text string to be added to the end of the layer names (My example was -2011 to show what layers were drawn in 2011)
;This routine will place a Suffix at the end of all Layer names and rename them.
;Of course, it will not rename Layer "0" or "Defpoints".
(prompt "\nType RL2 to run.........")
(defun C:RL2 ( / acadDocument theLayers layName pre)
(vl-load-com)
(setq pre (getstring "\nEnter Layer Suffix : "))
(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 layName pre))
) ;if
);defun
(princ)

