Over the weekend, I was working on a "quick" personal project in AutoLISP, and I wanted to include pickable keywords. The problem was, I had forgotten the syntax for setting those up, and it took me longer than it should have to both realize the problem I was having was due to improper syntax and to find the correct syntax. To save myself time when that happens the next time (and, I suspect, it will), I am documenting the proper syntax here. I had remembered that the keywords needed to be enclosed in square brackets, but forgotten about separating them with forward slashes. I wrote a quick test function, to verify that the problem was in fact with the GETxxx function message formatting; here is the final, corrected code with the correct syntax:
(defun C:TestKW ( / sKW) (initget 1 "Alpha Beta Delta") (setq sKW (getkword "\nChose a keyword [Alpha / Beta / Delta]: ")) (prompt (strcat "\nKeyword selected is -->" sKW "<-- ")) (prin1) ) ;_ C:TestKW.
No comments:
Post a Comment