Clears the specified
selection set of all items.
VBA : object.Clear
VL : (vla-Clear object)
Items cleared from a
selection set remain in the drawing; they are simply no longer
associated to the selection set.
To clear a subset of the
items in a selection set, use the RemoveItems method.
This method differs from
the Delete method in that it does not remove objects from the drawing.
;In the following sample code, a new selection set is created
;by name if it doesn't already exist. It is merely populated
;by picking objects on the screen and then emptied.
;After completion, the selection set still exists, but is empty.
;This is kind of a silly example, but it shows a way to use the method.
(defun c:al-Clear (/ acadobj doc ssetCollection a flag)
(setq acadobj (vlax-get-acad-object)
doc (vla-get-activedocument acadobj)
;;get hold of the selectionSet Collection
ssetCollection (vla-get-selectionsets doc)
(repeat (setq w (vla-get-count ssetCollection))
(if (= (vla-get-name (vla-item ssetCollection a)) "NEW_SET")
(setq flag T)
(setq a (1+ a))
;;check if the selectionSet already exists - otherwise, create it
(if (null flag)
(setq newSset (vla-add ssetCollection "NEW_SET"))
;;let the user select objects on screen
;;report the number of objects held in selectionSet
" objects were added to the selection set"
;;clear the selectionSet
(list "\nAfter clearing, the selection set now holds "