Node2List Overload Issue - "Multiple targets could match..."

Hello,

I am trying to leverage the ConvexHull function contained within Grasshopper.Kernel.Geometry.

From some other posts, I see that I first need to call Node2List and then feed that into ConvexHull.Solver.ComputeHull().

However, when I feed my list of points into Node2List, I run into this error:

Runtime error (ArgumentTypeException): Multiple targets could match: Node2List(IEnumerable[Node2]), Node2List(IEnumerable[GH_Point]), Node2List(IEnumerable[Point3d])

I’ve done some research and have realized that this is a common issue inherent to IronPython that will crop up from time to time. I have zero knowledge of C#, unfortunately, so I am not able to work around this obstacle.

Referencing other related posts, I thought transitioning syntax from:

pts = Node2List(x)

to:

pts = Node2List.Overloads[IEnumerable[Point3d]](x)

would do the trick, but to no avail.

Can anyone provide any guidance? Thank you in advance.

IronPython_Overload_Issue.gh (3.1 KB)

This old post might help here:

Edit: This would probably work as well:

from Grasshopper.Kernel.Geometry import Node2List 
import Rhino as rc
pt3DList = rc.Collections.Point3dList(inputPointsList)
pts = Node2List(pt3DList)

Or maybe just shove the points into a generic .NET list type.

Thank you, @AndersDeleuran

Forgive my ignorance, but what is the syntax to contain the points within a generic .NET list type?

This should work:

from System.Collections.Generic import List
import Rhino as rc

dotNetPointList = List[rc.Geometry.Point3d](pythonPointList)

Edit: This is a pretty great (if poorly presented) reference for IronPython .NET Integration.

1 Like

@AndersDeleuran

Thank you sir!

@AndersDeleuran

Another question if you have the time - do you know how to use the ConvexHull function to output the hull that corresponds to the actual points (in their plane), instead of the projection of the hull onto XY Plane? Thank you in advance.

James

Edit: I was able to recognize the commonality between x and y coordinates of the original points versus the hull points on the XY plane, so I have a workaround, but if you know of a way to directly obtain the correct polyline, I’d appreciate it!

Hi James, it helps if you upload your current implementation :wink: