SelectOnScreen Method (ActiveX)

Prompts the user to pick an object from the screen.

Supported platforms: Windows only

Signature

VBA:

object.SelectOnScreen [FilterType, FilterData]
object

Type: SelectionSet

The object this method applies to.

FilterType

Access: Input-only; optional

Type: Variant

A DXF group code specifying the type of filter to use.

FilterData

Access: Input-only; optional

Type: Variant

The value to filter on.

Return Value (RetVal)

No return value.

Remarks

This method supports the filtering mechanism.

AutoCAD's default prompt for picking an object will be used automatically.

For more selection mode options, see the Select, SelectByPolygon, and SelectAtPoint methods.

Examples

VBA:

Sub Example_SelectOnScreen()
    ' This example adds objects to a selection set by prompting the user
    ' to select ones to add.
    
    AppActivate ThisDrawing.Application.Caption
    
    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("TEST_SSET")
    
    ' Add objects to a selection set by prompting user to select on the screen
    ssetObj.SelectOnScreen
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_SelectOnScreen()
    ;; This example adds objects to a selection set by prompting the user
    ;; to select ones to add.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "TEST_SSET"))
    
    ;; Add objects to a selection set by prompting user to select on the screen
    (vla-SelectOnScreen ssetObj)
    
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Delete ssetObj)
)