Returning a "Nil" Variable

Discussion in 'AutoCAD' started by SkintSubby, Oct 1, 2004.

  1. SkintSubby

    SkintSubby Guest

    After the following code. How do I get the lisp to return a dummy variable...i.e 1 if there is no input from the user?

    (setq wallthick (getreal "\nEnter wall thickness of tube:"))

    TIA
     
    SkintSubby, Oct 1, 2004
    #1
  2. SkintSubby

    BillZ Guest

    (setq wallthick (getreal "\nEnter wall thickness of tube:"))
    (if (null wallthick)
    (setq wallthick 1)
    )

    Bill
     
    BillZ, Oct 1, 2004
    #2
  3. SkintSubby

    SkintSubby Guest

    Excellent.

    Thanks a lot.

    M
     
    SkintSubby, Oct 1, 2004
    #3
  4. SkintSubby

    BillZ Guest

    You're welcome.


    Bill
     
    BillZ, Oct 1, 2004
    #4
  5. SkintSubby

    Mario S. Guest

    variable...i.e 1 if there is no input from the user?
    With default...

    ; real number
    (if (not #wallthick)(setq #wallthick 1.0))
    (setq txt (rtos #wallthick ))
    (initget 6 )
    (setq wallthick(getreal (strcat "\nEnter wall thickness of tube: < " txt ">:
    ")))
    (if (not wallthick)(setq wallthick #wallthick))
    (setq #wallthick wallthick)

    Mario S.
     
    Mario S., Oct 2, 2004
    #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.