Finds the object that is closest to a test point.
rhinoscriptsyntax.PointClosestObject(point, object_ids)
rhinoscript.pointvector.PointClosestObject(point, object_ids)
point |
Required. List of 3 numbers or Point3d. The 3-D test point. |
object_ids |
Required. String, Guid, or list of Strings or Guids. The identifiers of one or more point, point cloud, curve, surface, polysurface, or mesh objects to test against. |
Tuple |
A tuple of two values containing the results of the closest point calculation if successful. The elements are as follows:
|
|||||||||
None |
If not successful, or on error. |
import rhinoscriptsyntax as rs
objs = rs.GetObjects("Select target objects for closest point", 63)
if objs:
point = rs.GetPoint("Test point")
if point:
results = rs.PointClosestObject(point, objs)
if results:
print "Object id:", results[0]
rs.AddPoint( results[1] )