PointClosestObject

Finds the object that is closest to a test point.

Syntax

Rhino.PointClosestObject (arrPoint, strObject)

Rhino.PointClosestObject (arrPoint, arrObjects)

Parameters

arrPoint

Required.  Array.  The 3-D test point.

strObject

Required.  String.  The identifier of a point, point cloud, curve, surface, polysurface, or mesh object to test against.

arrObjects

Required.  Array.  The identifiers of one or more point, point cloud, curve, surface, polysurface, or mesh object to test against.

Returns

Array

An array containing the results of the closest point calculation if successful.  The elements of the array are as follows:

Element

Type

Description

0

String

The identifier of the closest object.

1

Array

The 3-D point that is closest to the closest object.

Null

If not successful, or on error.

Example

Dim arrObjects, arrPoint, arrResults

arrObjects = Rhino.GetObjects("Select target objects for closest point", 63)

If IsArray(arrObjects) Then

arrPoint = Rhino.GetPoint("Test point")

If Not IsNull(arrPoint) Then

arrResults = Rhino.PointClosestObject(arrPoint, arrObjects)

If IsArray(arrResults) Then

  Rhino.Print "Object id: " & CStr(arrResults(0))

  Rhino.AddPoint arrResults(1)

End If

End If

End If

Also See

CurveClosestObject