GHPython: What is IEnumerable<int> edgeIndices?

I have a fillet that is failing frequently and want to try to get it working within a GHpython script so I can control the tolerance etc.

I keep getting an error about it expecting an IEnumerable but getting a list.
I am inputting the indexes of the edges so it is a list of integers. If it isn’t a list of integers could you please explain what an IEnumerable is and how to input it into this function.

I am using the Rhino Common API and trying to implement the following method:
API Reference
CreateFilletEdges(Brep brep, IEnumerable edgeIndices, IEnumerable startRadii, IEnumerable endRadii, BlendType blendType, RailType railType, double tolerance)

IEnumerable is an interface whose purpose is to provide a way to iterate over a collection. It is one of the most basic and widely used collection interfaces in .NET and implemented by pretty much every collection type (arrays, lists, hashsets, dictionaries, bags, … you name it). Any class which implements an IEnumerable can be used inside a foreach loop in C# (I do not know what the equivalent keyword is in Python).

If you have a list of integers, you should be able to use it in a function call which expects an IEnumerable.

I think you’ll have to post your code because the error as described doesn’t make a lot of sense to me.

Sometimes RhinoCommon methods expect you to pass it an explicit datatype/container. In this case you could probably wrap your Python list in a .NET Array like so:

from System import Array
dotNetIntegers = Array[int](pythonIntegers)
1 Like

Thanks, I tried that but wasn’t sure how to add the integers from the list of curve indexes (“Curves_In” in the project)

I’ve uploaded the file, the code I have at the moment has got rid of the errors but the fillet isn’t completing :frowning: (38.8 KB)

The lengths of the input arrays, (Radius_In and Curves_In) need to be the same length.

Type: System.Collections.Generic.IEnumerable
An array of starting fillet, chamfer, or blend radaii, one for each edge index.

If you are using the same radii for each edge, you could use a longest list component before the Radius_In param. (make sure that Radius_In is set to List Access)

Of course, you could do that inside your code as well, but for example’s sake, here is a working version.
(Note, Rhino 6, which also has a native fillet edge component. Was that the one that you were experiencing failures with?)

import Rhino
from System import Array

IElist = Array[int](Curves_In)
IErad = Array[float](Radius_In)

tol = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance

Blend = Rhino.Geometry.BlendType.Blend
Chamfer = Rhino.Geometry.BlendType.Chamfer
Fillet = Rhino.Geometry.BlendType.Fillet

DistanceBetweenRails = Rhino.Geometry.RailType.DistanceBetweenRails
DistanceFromEdge = Rhino.Geometry.RailType.DistanceFromEdge
RollingBall = Rhino.Geometry.RailType.RollingBall

Brep_Out = Rhino.Geometry.Brep.CreateFilletEdges(Brep_In, IElist, IErad, IErad, Fillet, DistanceBetweenRails, tol)
1 Like

Thanks, seeing that makes a lot more sense!
I realized it was way easier to take a step back before the extrusion, extract the face from the brep, rebuild it and then perform the fillet with the simple gh component :slight_smile: