Layer Creation

Discussion in 'AutoCAD' started by KLYPH, Apr 1, 2005.

  1. KLYPH

    KLYPH Guest

    A long time ago, my office wrote a lisp file which handles layers. For instance, if I type "cstn" it creates a layer "-NPLT-CONSTRUCTION" which has a color of "4" and a linetype of "Dashed2". If the layer already exists, it makes it current. The script reads "(defun c:cstn () (LAYSET "-NPLT-CONSTRUCTION" "4" "Dashed2")) Well, that was before we knew you could make a layer "non-plot." The "-layer" command shows a "Plot" option that offers a "Plot/No plot" option. When I try to add this to the end of the above lisp as "P" "N", I get the message "; error: too many arguments." Does this mean I can't make the layer a non-plot layer at its creation? Or am I just doing it wrong? Any help will be appreciated. Read Ya Later -KLYPH
     
    KLYPH, Apr 1, 2005
    #1
  2. KLYPH

    Jeff Mishler Guest

    It means your lisp (layset) needs to be revised to allow for the plot/noplot
    option. However, doing so may require ALL of your little stub calls like
    this one to be modified to use the new (layset). Although, the (layset)
    function maybe modified to check the value of the color you supply, in this
    case 4, and if you provide a negative color number then create the layer as
    a no plot.....just make sure that the (layset) function converts the color
    to a positve or it will create the layer in the OFF state.
     
    Jeff Mishler, Apr 1, 2005
    #2
  3. the routine LAYSET just accept 3 aguments, the layer name, color and
    linetype, try to add the
    new argument for the non plot property, but if you do this, all the
    functions that make a call to layset, must have this aditional argument.

    You can try another aproach with the -layer command

    (defun c:cstn () (command "-layer" "make" "-NPLT-CONSTRUCTION"
    "color""4""""Ltype" "Dashed2""" "plot" """n" "")(princ))
     
    Marco Jacinto, Apr 1, 2005
    #3
  4. KLYPH

    KLYPH Guest

    That works. Thanks. Read Ya Later -KLYPH
     
    KLYPH, Apr 4, 2005
    #4
  5. KLYPH

    KLYPH Guest

    One more question. When I load the file that contains the above lisp, the computer screen states:
    Command: _appload Layers.lsp successfully loaded.
    Command:
    Loading Layers.lsp....
    Error: malformed list on input"

    Well, as scarey as that sounds, the newly loaded lisps all work. Of course, I still wish to solve whatever causes the error. Any ideas? Read Ya Later -KLYPH
     
    KLYPH, Apr 4, 2005
    #5
  6. KLYPH

    ZZZZzzzz4 Guest

    Because of you lisp file is not valid, use Vlisp to correct you file,
     
    ZZZZzzzz4, Apr 5, 2005
    #6
  7. KLYPH

    KLYPH Guest

    Dear ZZZZzzzz4, thanks for your reply. I never knew of Vlisp. I had always double-clicked on it while in Explorer, which brings the lisp up in Notepad, which is black-&-white. The color groups in the Vlisp sure make it more readable. Again thanks. I am going to explore the features of Vlisp.
    The line in the lisp file was originally: (defun c:cstn () (LAYSET "-NPLT-CONSTRUCTION" "4" "DASHED2"))
    I changed it to: (defun c:cstn () (command "-layer""make""-NPLT-CONSTRUCTION""C""250""""L""DASHED2""""P""N""
    """)(princ)) and got the error message. Do you see the error? The lisp does work. The Error message is scarey.
    Any help is appreciated. Read Ya Later -KLYPH
     
    KLYPH, Apr 5, 2005
    #7
  8. KLYPH

    KLYPH Guest

    Dear ZZZZzzzz4, again thanks for pointing out the Vlisp command. The lisp file was about 200 lines lone. I found a typo on about line 175. Fixed it. No more Error messages.
    Again, thanks. Read Ya Later -Cliff
     
    KLYPH, Apr 5, 2005
    #8
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.