Product : Engine, Version : 5.1.1.1037, ArticleID : 41023988

HowTo : Get All Entities at a given point

Article41023988
TypeHowTo
ProductEngine
Version5.1.1.1037
Date Added5/30/2005
Submitted bymatjaz jakljevic
Keywords

Subject

Get All Entities at a given point

Summary

How to get All Entities at a given point?

Solution

The general idea is to use "select" method (crossing "C") with a small equality.

Dim equality    As Double
Dim pt          As Variant
Dim selset      As vdSelection


    '''''Ignore the entities in frozen layers
    ''''vdraw.Actions.IgnoreLockLayers = True


    equality = vdraw.PickSize * vdraw.ScreenRender.PixelSize / 2#
    vdraw.Prompt "Select entities at Point :"
    pt = vdraw.Utility.GetPoint
    vdraw.Prompt ""
    If IsEmpty(pt) Then
        MsgBox "Command canceled"
        Exit Sub
    End If
   
    Set selset = vdraw.ActiveDocument.Selections.FindName("myselection")
    If selset Is Nothing Then
        Set selset = vdraw.ActiveDocument.Selections.Add("myselection")
    Else
        selset.RemoveAll
    End If
    selset.Select "C", Array(pt(0) - equality, pt(1) - equality), Array(pt(0) + equality, pt(1) + equality)
   
    MsgBox "Selected : " & selset.Count & " entities."