Code Red > AutoLISP (Vanilla / Visual)

I'd like to change the default value of this lisp.

(1/1)

asami486:
I'd like to change this lisp.
(Thank you VVA. eco 1.1)
Its default value is "No" (when I just push the SPACE KEY).
But I wanna change the value to "Yes"
(then it'll remove the objects except a boundary created by the lisp)

kdub_nz:

Try something like this :

Firstly, you need to understand that hitting ENTER or SPACEBAR on a getkword does not return any of the options
... it actually returns NIL


--- Code - Auto/Visual Lisp: --- (initget "Yes No")(setq result (getkword  "\nDelete objects? [Yes/No] <Yes> : ") ) SPACE or RETURN ==>nily or Y          ==> "Yes"n or N          ==> "No"apples          ==> Invalid option keyword ... try again 
Then you need to write some code to catch the nil result, or a correct one


--- Code - Auto/Visual Lisp: --- (initget "Yes No")       (setq keyword (getkword "\nDelete objects? [Yes/No] <Yes> : "))       (if (or (not keyword) (= keyword "Yes"))         (alert "Proceed to delete")       ) 

Once you are sure of your code replace the existing in the source :


--- Code - Auto/Visual Lisp: ---              (if pl                (progn (initget "Yes No")                       (setq                         keyword (getkword "\nDelete objects? [Yes/No] <Yes> : ")                       )                       (if (or (not keyword) (= keyword "Yes"))                         (mapcar '(lambda (x)                                    (if (vlax-write-enabled-p x)                                      (vla-erase x)                                    )                                  )                                 obj                         )                       )                )                ;; else                (princ "\nIt was not possible to construct a contour")              ) ;_ end of if  

Grrr1337:
Check Lee Mac's tutorial about prompting with default option.
This is always a huge help when using getkword.

JohnK:
Check out my version of the "RRB Default Method" (`my version' is just a very small improvement I did while standing on RRB's shoulders).

https://www.theswamp.org/index.php?topic=39042.msg442290#msg442290

CAB:
More fun.  8)

-----------   keyword examples  -------------
http://www.theswamp.org/index.php?topic=15173.0
http://www.theswamp.org/index.php?topic=6992.0
http://www.theswamp.org/index.php?topic=15173.0
http://www.theswamp.org/index.php?topic=6992.msg93574#msg93574

Navigation

[0] Message Index

Go to full version