Select Method (ActiveX)

Selects objects and places them into a selection set, or selects a cell in a table.

Supported platforms: Windows only

Signature - SelectionSet

VBA:

object.Select Mode [, Point1] [, Point2] [, FilterType, FilterData]
object

Type: SelectionSet

The object this method applies to.

Mode

Access: Input-only

Type: AcSelect enum

  • acSelectionSetWindow
  • acSelectionSetCrossing
  • acSelectionSetPrevious
  • acSelectionSetLast
  • acSelectionSetAll
Point1

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates, or array of coordinates, specifying Point1. See the mode definitions for the proper use of Point1.

Point2

Access: Input-only; optional

Type: Variant (three-element array of doubles)

The 3D WCS coordinates specifying Point2. See the mode definitions for the proper use of Point2.

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.

Signature - Table

VBA:

object.Select wpt, wvwVec, wvwxvec, wxaper, wyaper, allowOutside, resultRowIndex, resultColumnIndex
object

Type: Table

The object this method applies to.

wpt

Access: Input-only

Type: Variant

3D point in WCS specifying the input pick point.

wvwVec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view direction for the hit test.

wvwxvec

Access: Input-only

Type: Variant

3D vector in WCS specifying the view orientation for the hit test.

wxaper

Access: Output-only

Type: Double

Width of aperture box centered at the hit point for the hit test; reserved for future use.

wyaper

Access: Output-only

Type: Double

Height of aperture box centered at the hit point for the hit test; reserved for future use.

allowOutside

Access: Input-only

Type: Boolean

  • True: Pick point outside the table will select a cell.
  • False: Pick point outside the table will not select a cell.
resultRowIndex

Access: Output-only

Type: Long

Row index of the selected cell.

resultColumnIndex

Access: Output-only

Type: Long

Column index of the selected cell.

Return Value (RetVal)

No return value.

Remarks - SelectionSet

This method supports the filtering mechanism.

The following selection modes are available:

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

Remarks - Table

This function selects a cell in the table by specifying a point, viewing direction, and orientation. The row and column index of the selected cell are returned in resultRowIndex and resultColumnIndex.

Examples

VBA:

Sub Example_Select()
    ' This example adds members to a selection set, first by crossing and
    ' then by filtering for circles.
    
    ' Create the selection set
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSET")
    
    ' Add all object to the selection set that lie within a crossing of (28,17,0) and
    ' (-3.3, -3.6,0) 
    Dim mode As Integer
    Dim corner1(0 To 2) As Double
    Dim corner2(0 To 2) As Double
    
    mode = acSelectionSetCrossing
    corner1(0) = 28: corner1(1) = 17: corner1(2) = 0
    corner2(0) = -3.3: corner2(1) = -3.6: corner2(2) = 0
    ssetObj.Select mode, corner1, corner2
    
    ' Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ' (-3.3, -3.6,0) by filtering from the current drawing
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    gpCode(0) = 0
    dataValue(0) = "Circle"
    
    Dim groupCode As Variant, dataCode As Variant
    groupCode = gpCode
    dataCode = dataValue
    
    ssetObj.Select mode, corner1, corner2, groupCode, dataCode
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Select()
    ;; This example adds members to a selection set, first by crossing and
    ;; then by filtering for circles.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))

    ;; Create the selection set
    (setq ssetObj (vla-Add (vla-get-SelectionSets doc) "SSET"))
    
    ;; Add all object to the selection set that lie within a crossing of (28,17,0) and
    ;; (-3.3, -3.6,0)
    (setq mode acSelectionSetCrossing
          corner1 (vlax-3d-point 28 17 0)
          corner2 (vlax-3d-point -3.3 -3.6 0))

    (vla-Select ssetObj mode corner1 corner2)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))
    (vla-Clear ssetObj)
  
    ;; Add all the Circles to the selection set that lie within the crossing of (28,17,0) and
    ;; (-3.3, -3.6,0) by filtering from the current drawing
    (setq gpCode (vlax-make-safearray vlax-vbInteger '(0 . 0)))
    (vlax-safearray-put-element gpCode 0 0)
    (setq dataValue (vlax-make-safearray vlax-vbVariant '(0 . 0)))
    (vlax-safearray-put-element dataValue 0 "Circle")
    
    (vla-Select ssetObj mode corner1 corner2 gpCode dataValue)
    (alert (strcat "Objects selected: " (itoa (vla-get-Count ssetObj))))

    (vla-Delete ssetObj)
)