Multiple commands for single lisp

Discussion in 'AutoCAD' started by smjgsmith, Jan 17, 2005.

  1. smjgsmith

    smjgsmith Guest

    I'm trying to work out the best way to have multiple commands to start a single layer creation routine.

    The following is what I have for a single layer for a 0.25 continuous line. At the moment I have repeated this for each layer I have and it turns into a nightmare to try to manage.

    What I would prefer is to be able to type 1L, 1H, 1C etc. at the command line and for it all to go to one lisp to create the layer.

    (defun C:1L ()
    (setq olecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (command "Layer" "M" "1L" "c" "6"
    "" "l" "CONTINUOUS" "" "lw"
    "0.18" "" ""
    )
    (setvar "cmdecho" olecho)
    (command "LINE")
    (princ)
    )

    Thanks for any help

    Simon
     
    smjgsmith, Jan 17, 2005
    #1
  2. Can you be more specific....Do you always finish your routine with the command LINE ???You can included many "defun c:" in one lsp file if you want.

    Simon


    Message was edited by: masterbike360
     
    masterbike360, Jan 17, 2005
    #2
  3. smjgsmith

    Tom Smith Guest

    It would also help if you would describe what you're trying to achieve and
    why. A lot of different methods have been discussed for bringing a group of
    standard layers into a drawing. Doing this one layer at a time, with one
    command per layer, would surely seem to be a nightmare.
     
    Tom Smith, Jan 17, 2005
    #3
  4. smjgsmith

    Josh Guest

    (defun smjg:createlayer (lname)
    (command "Layer" "M" lname "c" "6"
    "" "l" "CONTINUOUS" "" "lw"
    "0.18" "" ""
    )
    (princ)
    )

    (defun C:1L ()
    (setq olecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (smjg:createlayer "1L")
    (setvar "cmdecho" olecho)
    (command "LINE")
    (princ)
    )

    (defun C:1H ()
    ....
    (smjg:createlayer "1H")
    ....

    etc...

    line. At the moment I have repeated this for each layer I have and it turns
    into a nightmare to try to manage.
    line and for it all to go to one lisp to create the layer.
     
    Josh, Jan 17, 2005
    #4
  5. smjgsmith

    smjgsmith Guest

    Hi Tom,

    What I'm trying to achieve is some standard commands for different layer standards I have to use.

    I have different clients that have different standards. I would like to be able to type 1L for a 0.25 continuous line and depending on which profile I'm using it will set the relevant layer to current. It could be layer 025 CONT or 1L or CONT2 depending on the client. At least then I've only got to remember the one command for a 0.25 line.

    Hope that clears things up.
     
    smjgsmith, Jan 17, 2005
    #5
  6. smjgsmith

    smjgsmith Guest

    It doesn't have to start the line command. My thought was to set the layer current.

    When you say you can have more than one "defun c:" does that mean that I could have 1L, 1D, 1C and then have the one lisp create a 0.25 layer with a linetype as referenced by the second character. ie. 1L=continuous, 1D=dashed, 1C=center
     
    smjgsmith, Jan 17, 2005
    #6
  7. smjgsmith

    smjgsmith Guest

    Thanks for the reply Josh.

    What I'm trying to avoid is having to have the following for each and every layer:-

    (defun C:1L ()
    (setq olecho (getvar "cmdecho"))
    (setvar "cmdecho" 0)
    (smjg:createlayer "1L")
    (setvar "cmdecho" olecho)
    (command "LINE")
    (princ)
    )
     
    smjgsmith, Jan 17, 2005
    #7
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.