I think we need more information.
I'm sorry .. I am trying to explain the isse as precisely as I can but I am obviously falling short
Why use the ' select ' command?
I'd prefer not, in fact the only reason I was using it at all was to keep from having to iterate through thousands of objects moving them from one selection set to another.
What is the final code supposed to do?
The final code should allow the user to specify an arbitrary return value while prompting to select objects for a selection set
I've put together an example working outline of code to return a selection set using some of the ideas we have talked about here.
(defun test ( / ans sset filter)
(setq filter '((0 . "LINE")))
(setq ans (ssgetEx "Apples Bananas Oranges" filter))
(cond
((= ans "Apples")(setq sset (ssget "_X" '((0 . "LINE")(8 . "APPLES")))))
((= ans "Bananas")(setq sset (ssget "_X" '((0 . "LINE")(8 . "BANANAS")))))
((= ans "Oranges")(setq sset (ssget "_X" '((0 . "LINE")(8 . "ORANGES")))))
((or (= ans nil)(= (type ans) 'PICKSET))(setq sset (getmore ans filter)))
)
sset
)
(defun ssgetEx ( options filter / tmp initstr selOpt opCorner rVal prmpt sset)
(setq initstr options)
(while (/= tmp options)
(setq tmp options)
(setq options (vl-string-subst "/" " " tmp))
)
(setq prmpt (strcat "\nSelect Objects ["options"]: "))
(initget initstr)
(setq rVal (getpoint prmpt))
(if (= (type rVal) 'LIST)
(progn
(setq opCorner (getcorner rVal "Select opposite corner: "))
(if (< (car opCorner)(car rVal))
(setq selOpt "_C")
(setq selOpt "_W")
)
(setq sset (ssget selOpt rVal opCorner filter ))
)
(setq sset rVal)
)
sset
)
(defun getmore ( baseset filter / sset )
(setq sset (ssget filter))
(if (and baseset sset)
(cond
((<= (sslength baseset)(sslength sset))(while (> (sslength baseset) 0)
(setq sset (ssadd (ssname baseset 0) sset))
(setq baseset (ssdel (ssname baseset 0) baseset))
))
((> (sslength baseset)(sslength sset))(while (> (sslength sset) 0)
(setq baseset (ssadd (ssname sset 0) baseset))
(setq sset (ssdel (ssname sset 0) sset))
)(setq sset baseset))
)
)
sset
)
Maybe we can go about this a different way. You can select items, add them to a list, highlight them to mimic a selection set option.
I have not added the highlight option, because it will require a forced regen or at very least a re-iteration through the selection set.
Hopefully you can see what I am trying to accomplish. There will be some pre-built filters. In this example, I used lines that are on layers "Apples" "Bananas" or "Oranges" ... or just lines in particular if the user is selecting them.
As you can see, the original input creates a selection set that must be iterated through to combine it with the additional objects selected.
I originally used "select" as a method to keep from having to do that (i.e. to build a single selection set), plus it had the additional effect of highlighting all the selected objects.
One of the things I can live with, but I don't like is that in newer versions of AutoCAD, the selection window is not drawn with the color background and window highlights as is with ssget.