What is IEnumerable[GeometryBase]?

Hi all,

I am trying to make grasshopper component using ghPython. But I get following error
Runtime error (ArgumentTypeException): expected IEnumerable[GeometryBase], got Brep

2Question related to this script.

  1. Why I get above mentioned error even though I set context as GeometryBase?
  2. Are IEnumerable[GeometryBase] and GeometryBase different as data type? Are there any page or document explaining these definition?

My script and setting for each input is following.

Pts: Point3D List Access
Vectors : Vector 3D List Access
context : GeometryBase Item Access
numofBounce int Item Access

def makeRays(Pts,Vectors,context,numofBounce):
for testPt in Pts:
for vec in Vectors:
ray=rc.Geometry.Ray3d(testPt,vec)
intPts=rc.Geometry.Intersect.Intersection.RayShoot(ray,context,numOfBounce)

Hello! IEnumerable refers to an interface of a type of enumerable collection, for example, Lists or Arrays. The RayShoot method expects (for example) a List or Array of GeometryBase, not a single GeometryBase. Even if you only have one GeometryBase, you pass it to RayShoot as a List or Array. So, if my assumptions are correct, context needs to be set to List Access.

2 Likes