All Cadcorp SIS API Methods

OpenClosestItem Method

Description

Opens the item closest to a 3D position, within a specified search radius, making it the current open Item.

Syntax

Visual Basic
Public Function OpenClosestItem( _
   ByVal x As Double, _
   ByVal y As Double, _
   ByVal z As Double, _
   ByVal r As Double, _
   ByVal stat As String, _
   ByVal filter As String _
) As Integer

Parameters

x
The x coordinate of the position to search from.
 
y
The y coordinate of the position to search from.
 
z
The z coordinate of the position to search from.
 
r
The search radius, in XY units.
 
stat
The status of Items to be included in the search.
"I"   All Items.
"V"   Visible, Hittable and Editable Items.
"H"   Hittable and Editable Items.
"E"   Editable Items only.
 
filter
Optionally specifies a named Filter which Items must pass to be included in the search.

Remarks

It is important to know that OpenClosestItem will either require Lat and Lon or X and Y as input depending on the axis type of the current CRS. This can be found by evaluating the GetAxesType function.

You may have to experiment with the search radius to ensure that items are selected in a timely manner.

Available: GEO D OD OM OV SISpy

Group:

Example

        Dim

dX AsDouble
        Dim dY AsDouble
        Dim dZ AsDouble

Dim iAxis AsInteger = sis.GetAxesType()

        If iAxis = 0 Then

            dX = SIS.GetFlt(SIS_OT_CURITEM, 0, "_ox#")
            dY = SIS.GetFlt(SIS_OT_CURITEM, 0, "_oy#")
            dZ = SIS.GetFlt(SIS_OT_CURITEM, 0, "_oz#")

        EndIf

        If iAxis = 1 Then

            dX = SIS.GetFlt(SIS_OT_CURITEM, 0, "_oLon#")
            dY = SIS.GetFlt(SIS_OT_CURITEM, 0, "_oLat#")
            dZ = SIS.GetFlt(SIS_OT_CURITEM, 0, "_oz#")

        EndIf

sis.OpenClosestItem (dX, dY, dZ, dRad, "I", "NamedFilter")