Create sequencial layers automatically

Discussion in 'AutoCAD' started by Anonymous, Feb 7, 2007.

  1. Anonymous

    Anonymous Guest

    Hi,

    I need to create about 500 layers and I'd rather not do it manually.
    They need to have a specific name with a unique sequencial number in
    the name. Also, the colors need to alternate between about 4 colors.
    Is there such a free lisp tool or one that I can buy? TIA.
     
    Anonymous, Feb 7, 2007
    #1
  2. Anonymous

    rod cohen Guest

    rod cohen, Feb 7, 2007
    #2
  3. Anonymous

    strawberry Guest

    Or just write one yourself. It might look something like this:

    (setq count 1)
    (while (< count 11)(setq pad (+ count 1000))
    (setq newlayer (strcat "mylayer" (itoa pad)))
    (command "layer" "make" newlayer "" "" "" "" "")
    (setq count (1+ count)))

    I think there's an error there somewhere - but lisp really isn't my
    forte.
     
    strawberry, Feb 7, 2007
    #3
  4. Anonymous

    Mason Guest

    There are loads of them on the online CAD magazines.
    Hi,

    I need to create about 500 layers and I'd rather not do it manually.
    They need to have a specific name with a unique sequencial number in
    the name. Also, the colors need to alternate between about 4 colors.
    Is there such a free lisp tool or one that I can buy? TIA.
     
    Mason, Feb 8, 2007
    #4
  5. Anonymous

    Anonymous Guest

    On Thu, 8 Feb 2007 01:35:26 -0000, "Mason" <AT THE NEWS GROUP

    I spent 2 hours today looking for them. I found none. You mind
    telling me where you know the where abouts?
     
    Anonymous, Feb 8, 2007
    #5
  6. Anonymous

    strawberry Guest

    2 hours! I don't know about 'loads of them' but a two-minute search
    over at cadalyst.com pulled up this description:

    ;;;CADALYST 05/04 Tip1951: ARCHLAYERS.LSP Layer List (c) 2004
    Theodorus Winata

    ;;; Command name: ALA
    ;;; The command generates Architectural layers.
    ;;; To meet your drawings layering names, edit
    ;;; ARCHLAYERS.csv.

    Haven't tried it but it sounds like it could do what you want.
     
    strawberry, Feb 8, 2007
    #6
  7. Anonymous

    v-las Guest



    give me ur email and i'll try to send you an lsp that i modify. it
    creates 500 layers with 4 colors but the colors changes alternately
    only at every 125 layers
     
    v-las, Feb 8, 2007
    #7
  8. Anonymous

    Anonymous Guest



    Thanx!
     
    Anonymous, Feb 8, 2007
    #8
  9. Anonymous

    Boll Weevil Guest

    Strawberry,

    I downloaded ACHLAYERS.LSP and I can't wait to try it out! If I can create the
    layers in Xcel and bring them into Autocad, that would be perfect!! Thank
    you!!!!!!!!!!!!!!!!!!!!!!!!!
     
    Boll Weevil, Feb 9, 2007
    #9
  10. Anonymous

    Anonymous Guest

    1. Add the contents of the ARCHLAYER.LSP into your acad2006.lsp file.
    2. Create a Xcel sheet with the following info:

    column 1 - layer name plus 0001 and so on
    column 2 - color
    1 red 5 blue
    2 yellow 6 magenta
    3 green 7 white
    4 cyan
    column 3 - the linetype (use CN for Continuous)
    column 4 - the status of the plot style (just put Y)

    Example: | test001 | 1 | CN | Y |

    3. Create new sequencial layer name in Xcel by selecting your first
    layer name in column one and then dragging downward the bottom right
    corner of the cell. This will automatically create the new sequencial
    layer name.

    4. Save the file as a NEWLAYERS.CSV file.

    Example:
    test0001,1,CN,Y
    test0002,2,CN,Y
    test0003,3,CN,Y
    test0004,4,CN,Y
    test0005,6,CN,Y
    test0006,1,CN,Y
    test0007,2,CN,Y
    test0008,3,CN,Y
    test0009,4,CN,Y
    test0010,6,CN,Y

    5. Get rid of hidden character in the Xcel file and as the final CSV
    file. Open the NEWLAYERS.CSV file with Microsoft Word. Select all
    the text and then paste it into Note Pad and save the file as
    ARCHLAYERS.csv into your autocad support directory(ex: C:\Program
    Files\Autocad 2006\support).

    6. Import the new layers. In autocad, issue the command:
    Command: ala
    Architectural Layers Loaded...!
    If you made a mistake in your CSV file, you will get the options
    prompt instead.

    If you have other layers in the drawing, this tool will only add the
    new layers into the drawing.

    -----------------------------------------------------------------------------------

    ;;;CADALYST 05/04 Tip1951: ARCHLAYERS.LSP Layer List
    ;;; (c) 2004 Theodorus Winata
    ;;;
    ;;;
    ;;; Command name: ALA
    ;;; The command generates Architectural layers.
    ;;; To meet your drawings layering names, edit
    ;;; ARCHLAYERS.csv.
    ;;;
    ;;;
    ;;; Developed by Theodorus Winata
    ;;; March 2003
    ;;; 1024-89 Avenue SW
    ;;; Calgary, AB. T2V 0W4
    ;;; CANADA
    ;;;
    ;;;
    (defun C:ALA (/ CHAR CME CNT COL LAY LLS LTP PLT RGM RLI)
    (defun *error* (msg) (princ msg))
    (setq CME (getvar "CMDECHO")
    RGM (getvar "REGENMODE")
    CNT 0
    LLS (findfile "ARCHLAYERS.csv")
    LAY ""
    COL ""
    LTP ""
    PLT ""
    );;setq
    (setvar "CMDECHO" 0) (setvar "REGENMODE" 0)
    (if LLS
    (setq LLS (open LLS "R"))
    (alert "\nLayers List not found!")
    );;if
    (if LLS
    (while (setq RLI (read-line LLS))
    (setq CNT 1
    CHAR t
    );;setq
    (while CHAR
    (setq CHAR (substr RLI CNT 1))
    (if (/= CHAR ",")
    (setq LAY (strcat LAY CHAR))
    (setq CHAR nil)
    );;if
    (setq CNT (1+ CNT))
    );;while
    (setq CHAR t)
    (while CHAR
    (setq CHAR (substr RLI CNT 1))
    (if (/= CHAR ",")
    (setq COL (strcat COL CHAR))
    (setq CHAR nil)
    );;if
    (setq CNT (1+ CNT))
    );;while
    (setq CHAR t)
    (while CHAR
    (setq CHAR (substr RLI CNT 1))
    (if (not (or (= CHAR ",") (= CHAR "")))
    (setq LTP (strcat LTP CHAR))
    (setq CHAR nil)
    );;if
    (setq CNT (1+ CNT))
    );;while
    (setq CHAR t)
    (while CHAR
    (setq CHAR (substr RLI CNT 1))
    (if (not (or (= CHAR ",") (= CHAR "")))
    (setq PLT (strcat PLT CHAR))
    (setq CHAR nil)
    );;if
    (setq CNT (1+ CNT))
    );;while
    (if (= LTP "CN")
    (setq LTP "Continuous")
    );;if
    (if (= PLT "Y")
    (setq PLT "Plot")
    );;if
    (command ".-layer" "make" LAY "color" COL
    LAY "ltype" LTP LAY "P" PLT LAY "")
    (setq LAY "" COL "" LTP "" PLT "")
    );;while
    );; if LLS
    (command "-layer" "set" "0" "")
    (close LLS)
    (setvar "CMDECHO" CME) (setvar "REGENMODE" RGM)
    (princ "\t\tArchitectural Layers Loaded...!")
    (princ)
    );;C:ALA
     
    Anonymous, Feb 9, 2007
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.