layer names in external files

Discussion in 'AutoCAD' started by dwane101, Jul 12, 2003.

  1. dwane101

    dwane101 Guest

    im wanting to create a routine (lisp hopefully) that can allow me to have an external file (lets say layer.txt), that i can save default layer names to (ie toilets, vanities, towel rails etc to go on layer "bathroom").at present i can easily make a routine that has the layers hard coded in, but i want some flexiblility in it. question is - can this be done easily??
     
    dwane101, Jul 12, 2003
    #1
  2. dwane101

    PF Guest

    Yes-- many routines use such as an INI file... see if you can borrow ADT
    (architectural desktop), I beleive that's what it does.

    What you need to do is set a value to seek... say, layer name ... then use
    (open ... to get the external file...then use a
    (read-line Statement in your Lisp to read a line...
    continue reading line by line until you reach your layer-name value

    from there... repeat the read-line until you reach the end of specs
    available... each spec on one line and enough to define your layer. you
    could use a special character to speed the read-line loop until the
    layername is reached... see partial INI format below.

    (if (= "**" readline-value )(read-line)
    (if (/= readline-value layername-value)
    [ ... go to setup layer routine ... which would also close the INI
    file ]
    )
    )

    setup layer routine would handle all lines from ** to **... and close INI
    file before processing next layer-name

    **
    layer_name1
    color##1
    linetype1
    lineweight1
    **
    layer_name2
    color##2
    linetype2
    lineweight2
    **
     
    PF, Jul 13, 2003
    #2
  3. dwane101

    Guest Guest

    What about a simple script file?



    No additional programming required,



    and can be use in Autocad and LT.



    Like (modify the names to suit):





    layer make "1" color 1 "" LW 0.18 ""



    layer make "2" color 2 "" LW 0.25 ""



    layer make "3" color 3 "" LW 0.35 ""



    layer make "4" color 4 "" LW 0.50 ""



    layer make "5" color 5 "" LW 0.70 ""



    layer make "6" color 6 "" LW 1.00 ""



    layer make "7" color 7 "" LW 0.05 ""



    layer make "8" color 8 "" LW 0.00 ""



    layer make "9" color 9 "" LW 0.09 ""





     



    "dwane101" <> wrote in message news:...

    im wanting to create a routine (lisp hopefully) that can allow me to have an external file (lets say layer.txt), that i can save default layer names to (ie toilets, vanities, towel rails etc to go on layer "bathroom").at present i can easily make a routine that has the layers hard coded in, but i want some flexiblility in it. question is - can this be done easily??
     
    Guest, Jul 13, 2003
    #3
  4. dwane101

    Doug Broad Guest

    Yes, it can be done easily.  A lisp file can read such a text file



    and set up the layers like you want.



     



    What you ask is really the function of template files however.



    Set up the layers as you want in a new drawing and save it



    as a template.  Each time you start a new drawing, use that



    template.



    "dwane101" <> wrote in message news:...

    im wanting to create a routine (lisp hopefully) that can allow me to have an external file (lets say layer.txt), that i can save default layer names to (ie toilets, vanities, towel rails etc to go on layer "bathroom").at present i can easily make a routine that has the layers hard coded in, but i want some flexiblility in it. question is - can this be done easily??
     
    Doug Broad, Jul 14, 2003
    #4
  5. dwane101

    lts Guest

    I use templates for different dwgs (ie: foundataion, conduit, structural, etc) that each use their own layers. When I need a certain layer, or group of layers, I open the templates in design center and drag and drop them into my dwg. That way I don't have unused layers just sitting around.
     
    lts, Jul 21, 2003
    #5
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.