I am trying to find the closest point to a curvefrom a collection of points using the Curve.ClosestPoints method as given in the RhinoCommon API library, i.e.
Curve.ClosestPoints Method (IEnumerable, Point3d, Point3d, Int32)
Using the following code:
import Rhino.Geometry as rg
from System.Collections.Generic import List
centerPointCloud = rg.PointCloud(iPoints)
geomBaseList = Listrg.GeometryBase
for i in range(0,len(iLines)-1):
par = iLines[i].ClosestPoints(centerPointCloud)
I get an error:
Runtime error (InvalidCastException): Error in IEnumeratorOfTWrapper.Current. Could not cast: Rhino.Geometry.GeometryBase in Rhino.Geometry.PointCloudItem
line 6, in script
I am not able to identify as to where I am making the mistake, have gone through all the discussion topics and still haven’t been able to solve this.