Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

C# ClosestIndexInList Method Error

$
0
0

Hi all,

I have a cloud of points and a given point called B. I want to find the closest point from the cloud to point B.

Like @DavidRutten suggested here I am trying to use the method:
Point3dList.ClosestIndex Method
https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Collections_Point3dList_ClosestIndex.htm

My code:

Point3d FirstPoint = iPoints[iPoints.ClosestIndexInList(iStartPoint)];
a = FirstPoint;

For some reason I get this error:

  1. Error (CS1061): ‘System.Collections.Generic.List<Rhino.Geometry.Point3d>’ does not contain a definition for ‘ClosestIndexInList’ and no extension method ‘ClosestIndexInList’ accepting a first argument of type ‘System.Collections.Generic.List<Rhino.Geometry.Point3d>’ could be found (are you missing a using directive or an assembly reference?) (line 58)

Which basically says, that data type List has not method called ClosestIndexInList. And that it does not take as an input the data type List. Which makes no sense:

  1. Because ClosestIndexInList IS a List method
  2. Because I never passed a List type as an input of ClosestIndexInList I passed in a Point3d type.

You can clearly see that ‘iStartPoint’ is a Point3d type!

6 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles