Returns the 3-D point locations on two objects where they are closest to each other. Note, this function provides similar functionality to that of Rhino's ClosestPt command when used with the Object option.
rhinoscriptsyntax.CurveClosestObject (curve_id, objects)
rhinoscript.curve.CurveClosestObject (curve_id, objects)
curve_id |
Required. String or Guid. The identifier of the curve object to test. |
strObject |
Required. String, Guid, or list of Strings or Guids. The identifiers of point cloud, curve, surface, or polysurface to test against. |
Tuple |
A tuple of three elements 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
filter = rs.filter.curve | rs.filter.pointcloud | rs.filter.surface | rs.filter.polysurface
objects = rs.GetObjects("Select target objects for closest point", filter)
if objects:
curve = rs.GetObject("Select curve")
if curve:
results = rs.CurveClosestObject(curve, objects)
if results:
print "Curve id:", results[0]
rs.AddPoint( results[1] )
rs.AddPoint( results[2] )