Error...Somewhere

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

  1. Big 'D'

    Big 'D' Guest

    This routine is selecting a line and asking whether or not the user wants to add a break symbol. But I have an error somewhere in the section below and cannot find it. Can someone please help?
    Thank you,
    D

    (initget "Yes No")
    (setq breakanswer (getkword "\nDo you want a break [Yes/No] <Yes>: "))
    (if (/= breakanswer "No")
    (....do break....)
    )
     
    Big 'D', May 14, 2004
    #1
  2. Big 'D'

    ECCAD Guest

    (if (and (/= breakanswer "N")(/= breakanswer "No"))
    .......
    Or possible problem in the
    (...do break...) section ?

    Bob
     
    ECCAD, May 14, 2004
    #2
  3. Big 'D'

    Jürg Menzi Guest

    Big 'D'

    The snippet works for me...

    Cheers
     
    Jürg Menzi, May 14, 2004
    #3
  4. Big 'D'

    Tim Badger Guest

    Big 'D'... I would change the code just a bit. The reason would be to let
    the user respond with a Y,y,N or n instead of having to enter the complete
    words "Yes" or "No". I would also make sure the could only enter what I
    wanted. Here is an example

    (initget 1 "Y y N n")
    (if(equal (getkword "Do you want a break (Y)es or (N)o ?...") "Y")
    ... do what ever ...
    )

    hope this helped

    Tim Badger



    to add a break symbol. But I have an error somewhere in the section below
    and cannot find it. Can someone please help?
     
    Tim Badger, May 14, 2004
    #4
  5. Tim,

    Your advice is incorrect.

    Try the original code, using just "y" or "n".


    --
    R. Robert Bell


    Big 'D'... I would change the code just a bit. The reason would be to let
    the user respond with a Y,y,N or n instead of having to enter the complete
    words "Yes" or "No". I would also make sure the could only enter what I
    wanted. Here is an example

    (initget 1 "Y y N n")
    (if(equal (getkword "Do you want a break (Y)es or (N)o ?...") "Y")
    ... do what ever ...
    )

    hope this helped

    Tim Badger



    to add a break symbol. But I have an error somewhere in the section below
    and cannot find it. Can someone please help?
     
    R. Robert Bell, May 14, 2004
    #5
  6. You can also do it without needing "initget" to spell out choices, and let
    the user answer in upper or lower case anyway, by forcing their response to
    uppercase to make a comparison:

    (setq breakanswer (strcase (getstring "\nDo you want a break [Y/N]? <Y>:
    "))) ...<user input>
    (if (/= breakanswer "N")
    ( ...do break... )

    That would do the break if they answered anything [including Enter] other
    than an "N", and they could give type the N either in uppercase or
    lowercase. If they do want the break, they could hit Enter, or an upper or
    lowercase Y, or for that matter type in their mother's maiden name or
    something.

    Kent Cooper, AIA


    to add a break symbol. But I have an error somewhere in the section below
    and cannot find it. Can someone please help?
     
    Kent Cooper, AIA, May 14, 2004
    #6
  7. Big 'D'

    Tim Badger Guest

    Ok, I feel stupid. Always done it the other. Thanks for pointing it out to
    me.

     
    Tim Badger, May 14, 2004
    #7
  8. No harm, no foul! ;^)

    --
    R. Robert Bell


    Ok, I feel stupid. Always done it the other. Thanks for pointing it out to
    me.
     
    R. Robert Bell, May 14, 2004
    #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.