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:
setvar not working before a command call
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: setvar not working before a command call (Read 900 times)
0 Members and 1 Guest are viewing this topic.
steve.carson
Newt
Posts: 108
setvar not working before a command call
«
on:
June 30, 2023, 01:03:53 PM »
Hi Everybody,
I am trying to set commandpreview to 0 prior to running the matchprop command.
For some reason, this isn't changing commandpreview:
Code - Auto/Visual Lisp:
[Select]
(
defun
c:mp
(
/
OldCP
)
(
setq
OldCP
(
getvar
"CommandPreview"
)
)
(
setvar
"CommandPreview"
0
)
(
command
"_matchprop"
)
(
setvar
"CommandPreview"
OldCP
)
(
princ
)
)
Any thoughts on why this might be?
Thanks,
Steve
Logged
BIGAL
Swamp Rat
Posts: 1417
40 + years of using Autocad
Re: setvar not working before a command call
«
Reply #1 on:
June 30, 2023, 11:33:06 PM »
Copy the 1 line (command "_matchprop") to command line and count the number of requests, you have not allowed for them, try using pause.
Code:
[Select]
(command "_matchprop" pause pause "")
Logged
A man who never made a mistake never made anything
steve.carson
Newt
Posts: 108
Re: setvar not working before a command call
«
Reply #2 on:
July 01, 2023, 10:00:02 AM »
Thanks BIGAL, I’ll give it a try on Monday. I imagine I’ll have to go the “while cmdactive pause” route to allow multiple picks before it’s done. I’m just surprised it’s not doing the initial setvar since it’s supposed to happen before the command call.
Logged
steve.carson
Newt
Posts: 108
Re: setvar not working before a command call
«
Reply #3 on:
July 03, 2023, 11:27:14 AM »
That worked, BIGAL, thanks! Here's what I ended up with:
Code - Auto/Visual Lisp:
[Select]
(
defun
c:mp
(
/
OldCP
)
(
setq
OldCP
(
getvar
"CommandPreview"
)
)
(
setvar
"CommandPreview"
0
)
(
princ
"
\n
Select objects: "
)
(
command
"_matchprop"
)
(
while
(
/=
(
getvar
"CMDACTIVE"
)
0
)
(
command
pause
)
)
(
setvar
"CommandPreview"
OldCP
)
(
princ
)
)
Steve
Logged
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
setvar not working before a command call