Immediate assistance requested with routine

Discussion in 'AutoCAD' started by Big 'D', May 14, 2004.

  1. Big 'D'

    Big 'D' Guest

    The following is part of a routine I am putting together. It is asking if I want to insert a plug (block plgr). If no, it ignores the insert - if yes it inserts it then loads and runs the C:SYMDATA routine. Everything work with one exception: If I say no - the C:SYMDATA is not ignored. How can I get a no answer to ignore and a yes answer to rune?

    ;;; Prompt for first plug on right
    (initget "Yes No")
    (setq plugloc (getkword "\nDo you want a plug on right side [Y/N] <Yes>: "))
    (if (/= plugloc "No")
    (command "insert" "G:/Acad2000/cadstd/symlib/DC-10/plgr" PAUSE
    "1"
    "1"
    "0"
    "explode"
    "last"
    )

    ; RUN LISP routine "C:SYMDATA" and store the result in RSLT.
    (setq RSLT (C:SYMDATA))

    )

    This bug is holding me up in a serious way. Thank you in advance for responses.
    D
     
    Big 'D', May 14, 2004
    #1
  2. Big 'D'

    Mark Propst Guest

    I want to insert a plug (block plgr). If no, it ignores the insert - if yes
    it inserts it then loads and runs the C:SYMDATA routine. Everything work
    with one exception: If I say no - the C:SYMDATA is not ignored. How can I
    get a no answer to ignore and a yes answer to rune?
     
    Mark Propst, May 14, 2004
    #2
  3. Big 'D'

    Big 'D' Guest

    Thanks for the fast response Mark. What exactly is the progn in two places telling the program?
     
    Big 'D', May 14, 2004
    #3
  4. The progn function allows multiple expressions to appear
    in cases where only one expression is permitted:

    (if <condition> <then> <else>)

    The <then> and <else> arguments to (if) require a single
    expression. If you need to do something complicated in
    either case, which requires multiple expressions, then you
    need to nest them inside of a call to (progn):

    (if <condition>
    (progn
    <then1>
    <then2>
    <then3>
    )
    <else>
    )

    Above, <then1..3> are three expressions that evaluate
    if <condition> is non-nil.

    You might want to consider seeking out some basic LISP
    instructional material (there's plenty of books, and online
    resources available), because it will save you a lot of time
    waiting for answers to questions posted here regarding the
    fundamentals of LISP programming.
     
    Tony Tanzillo, May 14, 2004
    #4
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.