Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
I'd like to change the default value of this lisp.
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: I'd like to change the default value of this lisp. (Read 1792 times)
0 Members and 1 Guest are viewing this topic.
asami486
Guest
I'd like to change the default value of this lisp.
«
on:
January 21, 2017, 12:25:58 AM »
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)
Logged
kdub_nz
Mesozoic keyThumper
SuperMod
Water Moccasin
Posts: 2141
class keyThumper<T>:ILazy<T>
Re: I'd like to change the default value of this lisp.
«
Reply #1 on:
January 21, 2017, 01:27:34 AM »
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:
[Select]
(
initget
"Yes No"
)
(
setq
result
(
getkword
"
\n
Delete objects? [Yes/No] <Yes> : "
)
)
SPACE
or
RETURN
==>
nil
y
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:
[Select]
(
initget
"Yes No"
)
(
setq
keyword
(
getkword
"
\n
Delete 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:
[Select]
(
if
pl
(
progn
(
initget
"Yes No"
)
(
setq
keyword
(
getkword
"
\n
Delete 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
"
\n
It was not possible to construct a contour"
)
)
;_ end of if
Logged
Called Kerry in my other life
Retired; but they dragged me back in !
I live at UTC + 13.00
---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.
Grrr1337
Swamp Rat
Posts: 812
WWW
Re: I'd like to change the default value of this lisp.
«
Reply #2 on:
January 21, 2017, 03:47:10 PM »
Check Lee Mac's tutorial about
prompting with default option
.
This is always a huge help when using
getkword
.
Logged
(apply ''((a b c)(a b c))
'(
(( f L ) (apply 'strcat (f L)))
(( L ) (if L (cons (chr (car L)) (f (cdr L)))))
(72 101 108 108 111 32 87 111 114 108 100)
)
)
vevo.bg
JohnK
Administrator
Seagull
Posts: 10651
Re: I'd like to change the default value of this lisp.
«
Reply #3 on:
January 23, 2017, 09:03:02 AM »
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
Logged
TheSwamp.org
(serving the CAD community since 2003)
Member location map - Add yourself
Donate to TheSwamp.org
CAB
Global Moderator
Seagull
Posts: 10401
Re: I'd like to change the default value of this lisp.
«
Reply #4 on:
January 25, 2017, 07:52:09 AM »
More fun.
----------- 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
Logged
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.
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
I'd like to change the default value of this lisp.