and I want them all to be renamed automatically to
A00001
A00002
A00003 etc.
Thanks in advance
Mathias Fuerlinger
mfuer...@yahoo.com
Mathias Fuerlinger <mfuer...@studbox.uni-stuttgart.de> posted the
following
>Anyone knows a lisp routine I can rename several layers at once ???
>e.g. I've got 200 layers in numeric format.
>00001
>00002
>00003 etc.
>and I want them all to be renamed automatically to
>A00001
>A00002
>A00003 etc.
Launch the ddrename dialog (ddrename at the command line). Select all the
layers you want to rename by holding the control key and picking each
oneindividually or select the first one in a contiguous list, scroll to the
last one and hold the shift key down while selecting it which will select
all layers between the first and this last one. Note that the "Old name"
edit box reads *varies*.
In the Rename to: edit box enter A* and press the Rename To: button. This
works in R14.01.
As I recall this also used to work at the command line rename/la option as
well but no longer does in R14.
Dennis Shinn
Anatech Systems
Technical support for the construction industry
http://www.anatechsys.com
dsh...@anatechsys.com
425-641-6946
;;;**************
;;; M Nelson for McCoy Inc.
;;; Original creation date: 10.01.98
;;; Major revision 1:
;;; Major revision 2:
;;;
;;; Rename old McCoy layer names (if existing)
;;; and create new layers, assigning color and linetype
;;;----------------------------------------------------------------------
(command "UNDO" "m")
(setq cl-2 (getvar "clayer"))
(setq filedia (getvar "FILEDIA"))
(setq cmdecho (getvar "CMDECHO"))
(setvar "FILEDIA" 0)
(setvar "CMDECHO" 0)
(command "PURGE" "layer" "" "n")
(if
(and (tblsearch "layer" "bb-ccl") (not (tblsearch "layer" "s-grid")))
(command ".RENAME" "layer" "bb-ccl" "s-grid")
(if
(not (tblsearch "layer" "s-grid"))
(command ".LAYER" "n" "s-grid" ""))
)
(if
(and (tblsearch "layer" "bb-col") (not (tblsearch "layer" "s-cols")))
(command ".RENAME" "layer" "bb-col" "s-cols")
(if
(not (tblsearch "layer" "s-cols"))
(command ".LAYER" "n" "s-cols" ""))
)
(if
(and (tblsearch "layer" "bb-core") (not (tblsearch "layer" "s-wall")))
(command ".RENAME" "layer" "bb-core" "s-wall")
(if
(not (tblsearch "layer" "s-wall"))
(command ".LAYER" "n" "s-wall" ""))
)
(if
(and (tblsearch "layer" "bb-gnote") (not (tblsearch "layer"
"a-anno-note")))
(command ".RENAME" "layer" "bb-gnote" "a-anno-note")
(if
(not (tblsearch "layer" "a-anno-note"))
(command ".LAYER" "n" "a-anno-note" ""))
)
(command ".LAYER"
"c" "1" ;red
"i-fnsh-wall,a-furn-atrb,i-gnote,i-mill,f-prot-smok,f-sprn-clhd,f-prot-alrm,
f-prot,i-wall-fire,e-powr-comm"
"c" "2" ;yellow
"s-grid,i-fnsh-flor,i-fnsh-flor-legn,a-furn-pnls-legn,i-glaz,p-fixt,i-wall-p
att,a-furn-area-work,m-hvac-cdff,m-hvac,e-comm"
"c" "3" ;green
"e-exst,e-grid,e-clgn-lite-exit,i-fnsh-revs-1,a-furn-note,a-furn-move,i-door
,e-powr,i-wall-head"
"c" "4" ;cyan
"i-note,s-wall,e-ttlb,e-eqpm-ttlb,i-ttlb,i-fnsh-flor-ttlb,i-ttlb,i-fnsh-ttlb
,i-clng-ttlb,i-door-iden,a-furn-t-ttlb,a-furn-t-pnls-ttlb,a-furn-t-pnls-el-t
tlb,i-elev-detl-ttlb,e-ttlb-2,a-furn-t-move-ttlb"
"c" "5" ;blue
"s-cols,e-eqpm,e-eqpm-legn,i-fnsh-clng,i-fnsh-clng-legn,a-furn-p-powr-t,a-fu
rn-p-powr,i-clng-exst,i-clng-note-2,e-clng-lite-swch,e-clng-lite"
"c" "6" ;magenta
"a-anno-note,a-anno-ttlb,a-anno-nplt,e-new,i-room-iden,i-flor-iden,i-clng-ne
w,e-clng-lite-powr,m-hvac-new,f-prot-new,e-clng-lite-new"
"c" "7" ;white
"e-dims,i-fnsh-dims,a-furn-legn,a-furn-dims,a-furn-pnls-dims,i-dims,i-revs-1
,i-clng-dims,i-clng-revs-1,i-area-work"
"c" "8" ;GREY A&E SCREENIG COLOR (PEN)
"i-clng-gird"
"c" "9" ;grey
"i-elev,i-detl,i-wall"
"c" "11"
"e-legn,e-revs-1"
"c" "12" ;dark red
"a-anno-ttlb,i-wall-new,i-fnsh-note,i-fnsh-legn"
"c" "13"
"s-wall-patt,i-clng-note"
"c" "15"
"i-demo,i-clng-demo,e-demo,f-prot-demo,e-clng-lite-demo"
"c" "44";dark yellow
"m-hvac-demo"
"c" "61"
"a-area-iden"
"c" "91"
"ps-vp01,ps-vp02,ps-vp03,ps-vp04"
"c" "190"
"i-area-iden"
;;;
"lt" "center"
"s-grid"
"lt" "dashdot"
"e-clng-lite-powr"
"lt" "dashed"
"i-area-work,e-demo,i-demo,i-clng-demo,a-furn-area-work,a-furn-p-powr,m-hvac
-demo,f-prot-demo,e-clng-lite-demo"
"")
(setvar "clayer" cl-2)
(setvar "FILEDIA" filedia)
(setvar "CMDECHO" cmdecho)
(princ "\n ")
(princ "\n Layer Procedure Complete...")
(princ "\n Based on the Second Edition AIA CAD Layer Guidelines.")
(princ)
;;;*******************
Mathias Fuerlinger wrote in message
<3666D423...@studbox.uni-stuttgart.de>...
>Anyone knows a lisp routine I can rename several layers at once ???
>e.g. I've got 200 layers in numeric format.
>00001
>00002
>00003 etc.
>
>and I want them all to be renamed automatically to
>A00001
>A00002
>A00003 etc.
>
please don't post to comp.lang.lisp!
this is a autolisp only question. AutoLISP is not lisp!
alt.cad is also not suitable.
the stdlib contains (std-tbl-rename table old new)
see http://xarch.tu-graz.ac.at/autocad/stdlib/html/func8a3p.htm
this may be used in a short program like this:
;;; (not tested)
(defun c:my-layrename ()
(if (not std-tbl) (load "stdlib"))
;; #* means only numbers, see wcmatch
(foreach tbl (std-tbl "LAYER" "#*" STD:TBL-ALL STD:TBL-ALL)
(std-tbl-rename tbl (strcat "A" tbl))))
source at http://xarch.tu-graz.ac.at/autocad/stdlib/
unfortunately we have no regular expression search/replace function yet,
though i'm working on it, using perl-like s///
with such a function (std-search-replace str old new)
we could use something like (std-search-replace str "#*" "A\1")
----------------------------------------------------
a more general tool used for multiple transitions between different
layer standards is the program LAYTRANS from the Autodesk VIP Library,
Q3/98
---
Reini Urban
http://xarch.tu-graz.ac.at/autocad/news/faq/autolisp.html
Reini Urban <rur...@sbox.tu-graz.ac.at> posted the following
>the stdlib contains (std-tbl-rename table old new)
>see http://xarch.tu-graz.ac.at/autocad/stdlib/html/func8a3p.htm
Reini -
For such a simple layer name change as this, concatonating a simple string
to the front of a list of layers, why go to all this trouble. The ddrename
dialog allows works fine and is available directly within AutoCAD.
Appropriate technology dontchaknow.... (grin)
well, for one or two, no problem. but i want to watch you changing 200
layernames with DDRENAME or simplier with RENAME as the poster wanted to do.
I'll have a coffee or two in the meantime until you're finished :)
---
Reini Urban http://xarch.tu-graz.ac.at/home/rurban/
(defun intersect (x y) ;intersection of 2 lists
(cond ((null x) nil)
((member (car x) y) (cons (car x) (intersect (cdr x) y)))
(T (intersect (cdr x) y))))
Reini Urban <rur...@xarch.tu-graz.ac.at> posted the following
>well, for one or two, no problem. but i want to watch you changing 200
>layernames with DDRENAME or simplier with RENAME as the poster wanted to do.
>I'll have a coffee or two in the meantime until you're finished :)
Commad: ddrename
<select all layer names in the layer list>
Rename to: A* <in the rename to edit box>
[press the rename button]
Faster than a half full demi-tasse provided it's not luke-warm.
>well, for one or two, no problem. but i want to watch you changing 200
>layernames with DDRENAME or simplier with RENAME as the poster wanted to
do.
I just changed 999 layer names in 12 seconds with the DDRENAME command. I
used * for the 'Old name' and A* for the 'Rename to' field, and it did
exactly what the original poster requested. :)
--
Owen Wengerd
President, ManuSoft ==> http://www.manusoft.com
VP Americas, CADLock, Inc. ==> http://www.cadlock.com
>Why do you have 999 layers?
Because MAXSORT was set to 1000. :)
>Commad: ddrename
><select all layer names in the layer list>
Don't even need to do that! Just type * in the
'Old name' field, and all will be selected
automatically for you! :-))
"Tom Roper" <to...@jps.net> posted the following
>Why do you have 999 layers?
1,000 would be silly.
oops! didn't know that. thanks a lot!
>Dennis Shinn <h...@anatechsys.com> wrote:
>: For such a simple layer name change as this, concatonating a simple string
>: to the front of a list of layers, why go to all this trouble. The ddrename
>: dialog allows works fine and is available directly within AutoCAD.
>
>well, for one or two, no problem. but i want to watch you changing 200
>layernames with DDRENAME or simplier with RENAME as the poster wanted to do.
>
>I'll have a coffee or two in the meantime until you're finished :)
>
>---
>Reini Urban http://xarch.tu-graz.ac.at/home/rurban/
>(defun intersect (x y) ;intersection of 2 lists
> (cond ((null x) nil)
> ((member (car x) y) (cons (car x) (intersect (cdr x) y)))
> (T (intersect (cdr x) y))))
I didn't catch the original post, but I could use a routine to test
for various user supplied prefixes or suffixes (assuming some default
length of the layer names, such as AIA short standards), which would
then concatenate or rename layers without screwing up properly named
layers, ie. A-A-layername or A-S-layername. Either that or boolean
tests for ddrename, not just DOS wildcard conventions. Also, why
doesn't the layer table include a section for layer description, so
one would know whats on the layer? On another subject, for its cost,
AutoCAD doesn't give much filtering functionality in general. Rolling
your own is all very well, but it wastes time when it should be built
in. How about filtering for line length, angle, etc. within a window?
Also, theres a lot they could learn from Microstation, which is a lot
easier to use out of the box. How about a command history, so you can
scroll back to repeat a caommand of a few commands ago?