lisp for changing layer names

claudio

Usenet Archive
Joined
Sep 26, 2001
Messages
14
Reaction score
0
is there a lisp program for modifiying parts of layer names, say changing the "FLR" in a layer name to just "F"? thanks, c
 
Try this

Peter Jamtgaard

(defun C:LAYSUB (/ LAY OBJ STR1 STR2)
(setq STR1 (getstring "\nEnter string to replace: ")
STR2 (getstring "\nEnter replacement string: ")
)
(vlax-for OBJ
(vla-get-layers
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(setq LAY (vla-get-name OBJ)
LAY (vl-string-subst STR2 STR1 LAY)
)
(if (not (tblsearch "LAYER" LAY))
(vl-catch-all-apply
'vla-put-name (list OBJ LAY)
)
)
)
(prin1)
)
is there a lisp program for modifiying parts of layer names, say changing the "FLR" in a layer name to just "F"? thanks, c
 
If the FLR is at the beginning or end of the layer name, just use the RENAME command. For example if FLR is prefix, specify *FLR as old name and *F as new name.

If it's in the middle or at random locations - there are lisps that have been posted in the last few days here, just search this NG
 

Latest threads

Back
Top