autolisp: Control returns to "Command: "

Discussion in 'AutoCAD' started by e2, Sep 15, 2003.

  1. e2

    e2 Guest

    Hey, I'm starting out autolisp and I can't figure out what I'm doing
    wrong here. After completing the "line" command the "Command: " prompt
    pops up (in the autocad console) and stops my "getstring" from executing
    properly. Why is program control returned to the command prompt and
    how do I stop it?



    Relevant parts of my code
    ----------------------------


    (defun C:E_SYSTEM ()
    (setq e_thing_type (getstring "Make what? [DOOR]\n"))
    (cond ((= e_thing_type "DOOR") (E_MKDOOR))
    )
    )


    (defun E_MKDOOR (/ door_pnt dev_num door_lbl) ;Make Complete Door
    (setq door_pnt (getpoint "Select Door Connection Point:\n"))
    (setq door_lbl (getstring "Door label:\n"))
    (setq dev_num (getreal "Number of devices:\n"))
    (progn
    (command "line"
    door_pnt
    (polar door_pnt (* pi 1.5) (* 1.5 dev_num))
    )

    (while
    (cond (
    (not (= 0 dev_num))
    (
    (E_DOOR_DEV (polar door_pnt (* pi 1.5) (* 1.5 dev_num)))
    (setq dev_num (- dev_num 1))
    )
    )
    ((= 0 dev_num) (alert "door complete!"))
    )

    )
    )

    )

    (defun E_DOOR_DEV (door_dev_pnt) ;Make A Door Device
    (setq e_door_dev_type (getstring "Type of Device: [CR,EL,ES,ML,C,M,PS]"))
    (cond
    ((= door_dev_type "CR")
    (alert "holy crap, made it")
    ;(E_RECTDEV door_dev_pnt "CR")
    )
    ((= door_dev_type "EL")
    (E_RECTDEV door_dev_pnt "EL")
    )
    ((= door_dev_type "ES")
    (E_RECTDEV door_dev_pnt "ES")
    )
    ((= door_dev_type "ML")
    (E_RECTDEV door_dev_pnt "C")
    )
    ((= door_dev_type "M")
    (E_RECTDEV door_dev_pnt "M")
    )
    ((= door_dev_type "C")
    (E_CIRDEV door_dev_pnt "C")
    )
    ((= door_dev_type "PS")
    (E_RECTDEV door_dev_pnt "PS")
    )
    )
    )


    (defun E_RECTDEV (rct_pnt rct_txt) ; Rectangular device
    (command "rectangle"
    "0,-.5"
    "1.5,.5"
    )
    (command "move"
    (entlast)
    ""
    "0,0"
    rct_pnt
    )
    (command "text"
    ".3,-.2"
    ".5"
    "0"
    rct_txt
    ""
    )
    (command "move"
    (entlast)
    ""
    "0,0"
    rct_pnt
    )
    )

    (defun E_CIRDEV (cir_pnt cir_txt) ; Rectangular device
    (command "circle"
    ".5,0"
    ".75"
    )
    (command "move"
    (entlast)
    ""
    "0,0"
    rct_pnt
    )
    (command "text"
    ".1,-1"
    ".5"
    "0"
    cir_txt
    ""
    )
    (command "move"
    (entlast)
    ""
    "0,0"
    rct_pnt
    )
    )


    -------------------------
    end code
    ---------------------
    Output in autocad:
    --------------------

    Command: appload
    riser.lsp successfully loaded.
    Command:
    Command:
    Command: e_system
    Make what? [DOOR]
    DOOR
    Select Door Connection Point:
    Door label:
    bleh
    Number of devices:
    3
    line Specify first point:
    Specify next point or [Undo]
    Specify next point or [Undo]
    Command: Type of Device: [CR,EL,ES,ML,C,M,PS]*Cancel*
    ; error: Function cancelled
    Command:


    Thanks for any help,
     
    e2, Sep 15, 2003
    #1
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.