select objects on the screen without selection sets

select objects on the screen without selection sets

Anonymous
Not applicable
493 Views
1 Reply
Message 1 of 2

select objects on the screen without selection sets

Anonymous
Not applicable

Hello.

Is it possible to select objects on the screen and perform operations on them without selection sets?

0 Likes
494 Views
1 Reply
Reply (1)
Message 2 of 2

grobnik
Collaborator
Collaborator

Hi @Anonymous see example code below. Active X function is 

ThisDrawing.Utility.GetEntity

 

' Begin the selection
    Dim returnObj As AcadObject
    Dim basePnt As Variant
    
    On Error Resume Next
    
    ' The following example waits for a selection from the user
RETRY:
    ThisDrawing.Utility.GetEntity returnObj, basePnt, "Select an object"
    
    If Err <> 0 Then
        Err.Clear
        MsgBox "Program ended.", , "GetEntity Example"
        Exit Sub
    Else
        returnObj.Update
        MsgBox "The object type is: " & returnObj.EntityName, , "GetEntity Example"
        returnObj.Update
    End If
    
    GoTo RETRY

 

 

This method requires the AutoCAD user to select an object by picking a point on the graphics screen. If an object is picked, it is returned in the first parameter and the second parameter will contain the point picked in WCS coordinates. If the pick point is not on an object the call will fail.

The pick point returned by GetEntity does not necessarily lie on the selected object. The returned point represents the location of the crosshairs at the time of selection. The relationship between this point and the object varies depending on the size of the pickbox and the current zoom scale.

This method can retrieve an object even if it is not visible on the screen or if it is on a frozen layer.

After a successfully selection of the Object the Variable ReturnObj could be checked with

 If Type of returnObj.EntityName Is ..... Then
   DO SOMETHING
 end if
0 Likes