They will (eventually) contain layer names that have had previous
>drawing names prefixed in front of the original layers, with those $'s >in front.
>My problem is when I import them into another sw pkg the names are too
>long - my limit there is 16 chars.
>Is there any way I can do this renaming a bit automated in ACAD
>instead of editing them all individually?
Here is a LISP routine I wrote several years ago. It allows you to change the>drawing names prefixed in front of the original layers, with those $'s >in front.
>My problem is when I import them into another sw pkg the names are too
>long - my limit there is 16 chars.
>Is there any way I can do this renaming a bit automated in ACAD
>instead of editing them all individually?
START string of all layers. If you want to "trim" the layers, you enter your
start string, with NO replacement string. Example:
Orignal Layer name
TheirDrawing$$YourDrawing
Enter the Start String:
TheirDrawing$$
Enter nothing for replacement string:
End result layer name:
YourDrawing
Load it and run it with the command "RenLyr".
Hope it works for you!
ps: you can even do this with Blocks (another routine I wrote)
;; Prog to change the start name of Layers
;; with User Selection sets
;; Written by Bruce Feuchuk - Vancouver, BC - Canada
; //////////////////////////////////
; LOOP to get Remaining Layer Names
; in Data Base (minus first Layer)
; /////////////////////////////////
(defun otherlyr ( )
(while
(setq lyrnam (tblnext "layer"))
(progn
(setq lyrnn (cdr(assoc 2 lyrnam)))
(renamlyr) ; goto Rename Layer loop
);progn
);while
); defun
; ///////////////////////
; LOOP to Rename Layers
; ///////////////////////
(defun renamlyr ( )
; Layer name minus Old string (length of Old String)
(setq lyrminus (substr lyrnn (+ 1 oslen) ))
; Get the Start of Layer Name (length of Old String)
(setq lyrstart (substr lyrnn 1 oslen))
; ************************************************************
; Test for Match of Start of Layer Name vs. Old String
; and Change Layer Name with New String if True
; ************************************************************
(setq newlyrnam (strcat ns lyrminus))
(if (= lyrstart os)
(command "rename" "la" lyrnn newlyrnam)
); if
); defun
; ~~~~~~~~~~~~~
; *** START ***
; ~~~~~~~~~~~~~
(DEFUN C:RenLyr ( / lyrnn lyrnam os osl ns nsl oslen lyrminus lyrstart )
(setvar "cmdecho" 1)
; User to Enter Old/New Strings (converted into UpperCase)
(setq osl (strlen (setq os (strcase
(getstring t "\nEnter -OLD- Layer START string to Change: ")))))
(setq nsl (strlen (setq ns (strcase
(getstring t "\nEnter -NEW- Layer START string to Change: ")))))
(setq oslen (strlen os)) ; Get Old String length
; find First Layer Name in Data Base
(setq lyrnam (tblnext "layer" "T"))
(setq lyrnn (cdr(assoc 2 lyrnam)))
(renamlyr) ; goto Rename Layer loop
(otherlyr) ; goto Other Layers Loop
(princ)
);defun