Article | 41024109 |
Type | HowTo |
Product | Engine |
Version | 5.1.1.1038 |
Date Added | 9/29/2005 |
Submitted by | Hans Leirvik |
Keywords |
This article explains how to get the nearest entity to a given point.
Dim pt As Variant Dim npt As Variant Dim fig As vdFigure Dim tmpPick As Integer tmpPick = VDPro1.PickSize VDPro1.PickSize = 2000 pt = VDPro1.Utility.GetPoint VDPro1.Utility.getOsnapPoint pt, 0, VdProlib5.VdOsnapNearest, npt VDPro1.PickSize = 1 If Not IsEmpty(npt) Then Set fig = VDPro1.ActiveDocument.GetEntityFromPOINT(npt) If Not (fig Is Nothing) Then dist = VDPro1.Utility.geomDistance(pt, npt) fig.HighLight = VdHightLightDot fig.Invalidate MsgBox "Found : " & fig.Handle & " in " & CStr(dist) & " D.U." End If End If VDPro1.PickSize = tmpPick