Author Topic: input options  (Read 1781 times)

0 Members and 1 Guest are viewing this topic.

jsr

  • Guest
input options
« on: September 02, 2012, 03:43:29 AM »
Hi all

When using PLINE command we are prompted to pick points or enter key words for arcs/length etc. How to get the same functionality in LISP programs. For example prompt user to either pick a point or enter some keyword such as 'L', which may trigger some other action.

Thanks.

BlackBox

  • King Gator
  • Posts: 3770
Re: input options
« Reply #1 on: September 02, 2012, 04:10:02 AM »
Consider the INITGET and GETKWORD functions.
"How we think determines what we do, and what we do determines what we get."

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: input options
« Reply #2 on: September 02, 2012, 05:34:22 AM »
Consider the INITGET and GETKWORD functions.
I think you mean initget with getpoint. But the idea is the same  ;)
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

BlackBox

  • King Gator
  • Posts: 3770
Re: input options
« Reply #3 on: September 02, 2012, 02:23:28 PM »
For example prompt user to either pick a point or enter some keyword such as 'L', which may trigger some other action.
Consider the INITGET and GETKWORD functions.
I think you mean initget with getpoint. But the idea is the same  ;)
It may not be the best solution (perhaps GETPOINT with INITGET's arbitrary input bit-code?), but it's the best suggestion I could think of given the specificity of the latter portion of the OP.
"How we think determines what we do, and what we do determines what we get."

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: input options
« Reply #4 on: September 02, 2012, 07:46:07 PM »
That's the quick fix.
Code: [Select]
(defun c:test (/ pt)
  (while
    (progn
      (initget "Arc Close Halfwidth Length Undo Width")
      (setq pt (getpoint "\nSpecify next point or [Arc/Close/Halfwidth/Length/Undo/Width]:"))
      (cond
        ((vl-consp pt) (princ "\nGot at point.") nil) ; exit while loop
        ((= pt "Arc") (print pt)t)
        ((= pt "Close") (print pt)t)
        ((= pt "Halfwidth") (print pt)t)
        ((= pt "Length") (print pt)t)
        ((= pt "Undo") (print pt)t)
        ((= pt "Width") (print pt)t)
        (t (princ "\nInvalid input."))
      )
    )
  )

  (princ)
)
« Last Edit: September 02, 2012, 07:52:20 PM by CAB »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.