Not to pick nits here, I just want to clear up one little thing.... ;-)
"wkiernan" wrote in message ...
> Note that I have set ss1to nil each time after you're done with it. You
> can only have, I think, 128 selection sets at a time. After that AutoCAD
> starts acting awfully strange. If you create a selection set ss1 and you
> don't later set it to nil, it takes up one of the pool. If you overwrite
> the selection set, e.g.
>
> (setq ss1 (ssget "x" (list (cons 0 "LINE"))))
> (setq ss1 (ssget "x" (list (cons 0 "CIRCLE"))))
>
> you've taken up two of the availble selection sets. So when your program
> is done with a selection set, it's a good idea to "nil it out.
This is not true. The 128 selection sets refers to "open" selection sets.
Once you overwrite a SS the old one is gone......as long as you declare your
ss's as local variables you won't need to set them to nil.
Here are two little lisps that demonstrate this. The first will error out,
the second will not......
(defun c:sstest1 (/ count *error*)
(defun *error* (msg)
(princ (strcat "\nError message: " msg))
(princ (strcat "\nError number: " (itoa (getvar "errno"))))
(princ (strcat "\nCreated " (itoa (1- count)) " selections sets....."))
)
(setq count 0)
(repeat 150
(setq count (1+ count))
(set (read (strcat "ss" (itoa count))) (ssget "x"))
)
)
(defun c:sstest2 (/ sscount ss)
(setq sscount 0)
(repeat 1000
(setq sscount (1+ sscount))
(setq ss (ssget "x"))
)
(princ (strcat "\nCreated " (itoa sscount) " selections sets....."))
(princ)
)
This will clear them back out:
(defun c:ssclear ()
(vl-load-com)
(foreach x (atoms-family 1)
(if (= (type (eval (read x))) 'PICKSET)
(set (read x) nil)
)
)
(vlax-for x (vla-get-selectionsets
(vla-get-activedocument
(vlax-get-acad-object)))
(vla-delete x)
)
(gc)
(princ)
)
HTH,
Jeff