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:
Force prompt user to select an entity with SSGE even if there is already selecte
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Force prompt user to select an entity with SSGE even if there is already selecte (Read 389 times)
0 Members and 1 Guest are viewing this topic.
V@no
Newt
Posts: 25
AutoCAD 2023
Force prompt user to select an entity with SSGE even if there is already selecte
«
on:
April 30, 2024, 08:57:07 PM »
I'd like to use SSGET to prompt user to select certain entities (let's say only lines). However if there is already a selection but doesn't pass the filter (a circle selected) SSGET returns nil instead of prompt user to select.
Is there a way force to prompt user without clearing the selection?
Basically, what I'm trying to accomplish is: prompt user so select a single entity (using ":S"). Highlight that entity, prompt user to select second entity but don't allow select first one.
During these prompts I also allow user change options, therefor I'm running SSGET in a loop, however on second "prompt" it automatically returns nil instead of prompting user.
Any ideas how to achieve this?
Thank you.
Code - Auto/Visual Lisp:
[Select]
(
DEFUN
c:test
(
/
loop num filter str ss sss ent1 ent2
)
(
SETQ
loop T
num
0
filter
nil
str
"first"
sss
(
SSADD
)
)
(
WHILE
loop
(
PRINC
(
STRCAT
"
\n
Select "
str
" item: "
)
)
(
SETQ
ss
(
SSGET
"_:S"
filter
)
)
(
print
ss
)
(
IF
(
AND
ss
(
>
(
SSLENGTH
ss
)
0
)
(
=
num
0
)
)
(
PROGN
(
SETQ
ent1
(
ENTGET
(
SSNAME
ss
0
)
)
filter
(
LIST
(
CONS
-
4
"!="
)
(
CAR
ent1
)
)
num
(
1+
num
)
str
"second"
sss
(
SSADD
(
SSNAME
ss
0
)
sss
)
)
)
(
PROGN
(
SETQ
loop
nil
)
(
IF
ss
(
SETQ
ent2
(
SSNAME
ss
0
)
sss
(
SSADD
ss sss
)
)
)
)
)
(
SSSETFIRST
nil
sss
)
)
(
PRINC
"
\n
first item: "
)
(
PRINC
ent1
)
(
PRINC
"
\n
second item: "
)
(
PRINC
ent2
)
(
PRINC
)
)
Logged
ribarm
Gator
Posts: 3306
Marko Ribar, architect
WWW
Re: Force prompt user to select an entity with SSGE even if there is already selecte
«
Reply #1 on:
May 01, 2024, 09:08:21 AM »
Try this mod... But selection of grips were not preserved when selected the same entity and because of that added (GETSTRING) after (SSSETFIRST)...
Code - Auto/Visual Lisp:
[Select]
(
DEFUN
c:seltst
(
/
*error*
loop num str hgl sss ss ent1 ent2
)
(
DEFUN
*error*
(
m
)
(
IF
hgl
(
SETVAR
(
QUOTE
highlight
)
hgl
)
)
(
IF
m
(
PROMPT
m
)
)
(
PRINC
)
)
(
SETQ
loop T
)
(
SETQ
num
0
)
(
SETQ
str
"first"
)
(
SETQ
hgl
(
GETVAR
(
QUOTE
highlight
)
)
)
(
SETVAR
(
QUOTE
highlight
)
1
)
(
SETQ
sss
(
SSADD
)
)
(
WHILE
loop
(
PRINC
(
STRCAT
"
\n
Select "
str
" item : "
)
)
(
IF
(
AND
ent1
(
SSMEMB
ent1 ss
)
)
(
SSDEL
ent1 ss
)
)
(
WHILE
(
OR
(
NOT
ss
)
(
AND
ss
(
=
(
SSLENGTH
ss
)
0
)
)
)
(
SETQ
ss
(
SSGET
"_+.:E:S"
)
)
)
(
COND
(
(
AND
ss
(
=
(
SSLENGTH
ss
)
1
)
(
=
num
0
)
)
(
SETQ
ent1
(
SSNAME
ss
0
)
)
(
SETQ
num
(
1+
num
)
)
(
SETQ
str
"second"
)
(
SSADD
ent1 sss
)
)
(
T
(
SETQ
loop
nil
)
(
IF
(
AND
ss
(
=
(
SSLENGTH
ss
)
1
)
(
EQ
ent1
(
SETQ
ent2
(
SSNAME
ss
0
)
)
)
)
(
PROGN
(
SETQ
loop T
)
(
SSDEL
ent1 ss
)
)
(
IF
(
OR
(
NOT
ss
)
(
AND
ss
(
=
(
SSLENGTH
ss
)
0
)
)
)
(
SETQ
loop T
)
)
)
(
IF
(
AND
ent2
(
NOT
(
EQ
ent1 ent2
)
)
)
(
SSADD
ent2 sss
)
)
)
)
(
SSSETFIRST
nil
sss
)
(
IF
(
OR
(
AND
ent1
(
NOT
ent2
)
)
(
AND
ent1 ent2
(
EQ
ent1 ent2
)
)
)
(
PROGN
(
GETSTRING
"
\n
ENTER TO CONTINUE..."
)
(
SSSETFIRST
)
)
)
)
(
PRINC
"
\n
First item : "
)
(
PRINC
ent1
)
(
PRINC
"
\n
Second item : "
)
(
PRINC
ent2
)
(
*error*
nil
)
)
M.R.
«
Last Edit: May 02, 2024, 02:38:44 AM by ribarm
»
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
ribarm
Gator
Posts: 3306
Marko Ribar, architect
WWW
Re: Force prompt user to select an entity with SSGE even if there is already selecte
«
Reply #2 on:
May 01, 2024, 09:24:52 AM »
Just to add note...
I tested my mod. in BricsCAD and it behaves good, but in AutoCAD it's very buggy...
Sorry, but I may not find apropriate solution for both environments...
Regards...
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
ribarm
Gator
Posts: 3306
Marko Ribar, architect
WWW
Re: Force prompt user to select an entity with SSGE even if there is already selecte
«
Reply #3 on:
May 01, 2024, 10:47:57 AM »
Test it now...
I think that now is good for both and BricsCAD and AutoCAD...
Regards, M.R.
Logged
Marko Ribar, d.i.a.
(graduated engineer of architecture)
M.R. on Youtube
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Force prompt user to select an entity with SSGE even if there is already selecte