Layer Converter
Hello,I am looking for a way to batch convert a lot of drawings from our office standard layers to our client layer standards. Does any one knows an utility to do that in a automated way?Thank YouMarcelo
Comments
-
I use script files for that kind of operation, but I have one for adding or subtracting "880-" to every layer for one client who wants them named that way.Perhaps you could use it modified?
(Defun C:880 ()(SETVAR "CMDECHO" 0)(SETQ A (TBLNEXT "LAYER" T))(while (/= nil a)(setq a (tblnext "layer") b (cdr (assoc 2 a)))(if (/= nil a)(progn(if (= "DEFPOINTS" b)(setq a (tblnext "layer") b (cdr (assoc 2 a))))(if (= "0" b)(setq a (tblnext "layer") b (cdr (assoc 2 a))))(if (= "880-" (substr b 1 4))(command "rename" "la" b (substr b 5 (strlen b)))(command "rename" "la" b (strcat "880-" b)))))))
0 -
I think that it can be modified to my needs.Thank You John!
0 -
Oh, it doesn't batch convert. I used to have some batch routines in DOS, but never worked out how to do them in windows.
0 -
Marcelo,This pdf may be helpful:http://www.widom-assoc.com/AU-CP12-3L.pdf"Changing Hundreds of AutoCAD® Drawings in a Hurry"
0 -
hello
I`m new in Brics scripting.
Can you please little desribe, how does it work? I`m looking for helper like this to rename more than one leyer at once, but found nothing.
I also like to make a script to make some layers. I`like to have a icon to click on it and have some new layers in layer manager ( it`s realy boring to make same layers for every new drawing ;-) ).
If there is some way how to automate it, I`d be glad.
Thak you for an answare
0 -
Dear Jan Haspra,
A script is basically a text file with the extension .scr containing a series of inputs. You can record your own script in Bricscad (check out the tools menu) and that should get you started. Prior to recording a script it is wise to switch cmddia to 0 (=off).
A sample layer script:
layer
new
oldlayer1
new
oldlayer2
rename
layer
oldlayer1
oldlayer1newname
rename
layer
oldlayer2
oldlayer2newname
layer
new
Newlayer1
color
1
Newlayer1
new
Newlayer2
color
2
Newlayer2Notes:
- An empty line in a script is the same as enter. This script ends with 2 empty lines.
- You cannot rename layers that don't exist. So be sure to first create all layers you want to rename.
Regards, Roy.
0 -
Dear Roy Klein Gebbinck
Great examples. Helped a lot. Thak you.
Is there way how to change a part of layer name?
For example: I have a layer named -walls, -windows, -floor ...etc. and I`d like to change "-" for some letter or chain of letters.
There is an script in this thread, but I don`t understand it so much :-(
Thanks for replay
0 -
Dear Jan Haspra,
2 questions:
- Have you been able to run the script?
- Have you tried recording your own scripts and running them?
Regards, Roy.
0 -
Dear Roy
Now I`m able to make script for making new layers by my needs.
And renaming them by your example too.
Script recording working good, but its only record commands I`m writing.
I`d like to try run script from John Gaunt , but I don`t know, how to make it run for my layers.
0 -
Dear Jan Haspra,
John Gaunt's code is not a script but a lisp-program.
This modified lisp should work for you: it wil rename layers -walls, -windows, -floor ...etc. to somePrefix_walls, somePrefix_windows, somePrefix_floor ...etc. Where "somePrefix_" can be any text supplied by you.
To use this lisp do the following:
- Save the code to a text file named RenLA.lsp.
- Put that file somewhere in your searchpath.
- Open a drawing with layers you want to rename.
- Load the lisp by typing:
(load "RenLA.lsp")
Or use the appload command. - To start the function type:
RENLA - Supply some text at the prompt.
Code:
(defun c:RenLA ( / layerPrefix layerEnt layerName )
(setvar "cmdecho" 0)
(setq
layerPrefix (getstring "\nChange - (=first letter) in layername to: ")
layerEnt (tblnext "layer" T)
)
(while layerEnt
(setq layerName (cdr (assoc 2 layerEnt)))
(if (= "-" (substr layerName 1 1))
(command "_.rename" "_layer" layerName (strcat layerPrefix (substr layerName 2)))
)
(setq layerEnt (tblnext "layer"))
)
(setvar "cmdecho" 1)
(princ)
)Regards, Roy.
0 -
Dear Roy
Works PERFECT :-)
Thanks alot. Last question: Is there a way how to load it on a start?
I can`t to find it :-(
Regards, Jan
0 -
Dear Jan,
This depends on your version of BC
BC9:
- Look for on_doc_load.lsp in the support folder. If this file doesn't exist you can create one (it is just a text file).
- You can paste the code at the end of on_doc_load.lsp
- Or you can keep on using the file RenLA.lsp and just put this line at the end of on_doc_load.lsp:
(load "RenLA.lsp")
BC7:
The steps are the same as above but the file to change is icad.lsp instead of on_doc_load.lsp.
Regards, Roy.
0 -
WOW!
God bless internet and its forums :-)
Thanks a lot Roy. Works perfect :-)
Regards Jan
0