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)))))))
  • I think that it can be modified to my needs.Thank You John!

  • 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.

  • Marcelo,This pdf may be helpful:http://www.widom-assoc.com/AU-CP12-3L.pdf"Changing Hundreds of AutoCAD® Drawings in a Hurry"

  • 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

  • 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
    Newlayer2


    Notes:

    1. An empty line in a script is the same as enter. This script ends with 2 empty lines.
    2. You cannot rename layers that don't exist. So be sure to first create all layers you want to rename.

    Regards, Roy.

  • 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

  • Dear Jan Haspra,

    2 questions:

    1. Have you been able to run the script?
    2. Have you tried recording your own scripts and running them?

    Regards, Roy.

  • 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.

     

  • 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:

    1. Save the code to a text file named RenLA.lsp.
    2. Put that file somewhere in your searchpath.
    3. Open a drawing with layers you want to rename.
    4. Load the lisp by typing:
      (load "RenLA.lsp")
      Or use the appload command.
    5. To start the function type:
      RENLA
    6. 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.

  • 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

  • Dear Jan,

    This depends on your version of BC

    BC9:

    1. 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).
    2. You can paste the code at the end of on_doc_load.lsp
    3. 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.

  • WOW!

    God bless internet and its forums :-)

    Thanks a lot Roy. Works perfect :-)

    Regards Jan

This discussion has been closed.