IF / OR QUESTION

Discussion in 'AutoCAD' started by spencer1971, Jul 8, 2004.

  1. spencer1971

    spencer1971 Guest

    I am tyring to write a command that will ask for a point on a drawing and allow the user to either pick a point and the lisp continues or to hit a key to enter an options subroutine.

    (setq SP (getpoint "\nSpecify first corner: or enter <s> to change settings "))
    (----something here i presume------)
    (setq EP (getcorner SP "\nSpecify opposite corner: "))
    (command ".MTEXT" SP "H" TH EP)

    Could anyone point me in the right direction?
     
    spencer1971, Jul 8, 2004
    #1
  2. spencer1971

    Tom Smith Guest

    Look into initget with a list of keywords before the getpoint. Then make the
    subsequent code contingent on the user's response (point or keyword), using
    a cond or if construction.
     
    Tom Smith, Jul 8, 2004
    #2
  3. spencer1971

    rapidcad Guest

    Yah, what Tom said.. Here's an example from a program I modified to allow just such an option. FYI, The "Equal" in the example is not the function equal. It is my keyword to let the user pick "Equal" spacing of the array the program will be doing..

    (setq sset (ssget))
    (setq pt1 (getpoint "\nPick starting point of ARRAY: "))
    (setq pt2 (getpoint pt1 "\nPick end point of ARRAY: "))
    (initget "Equal" 128)
    (setq spacing (getdist "\nPick or enter spacing or [Equal]: "))
    (if (equal spacing "Equal");TEST EXPRESSION
    (progn
    (setq howmany (getint "\nEnter number of SPACES between start and endpoints of array: "))
    (setq spacing (/ (distance pt1 pt2) howmany)));THEN
    );END OF IF
     
    rapidcad, Jul 8, 2004
    #3
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.