IndexOutOfRangeException can't get the range of point list

I’m using Butterfly and creating a blockage ratio calculator in python, but when I connect the block_pts in the script show me the following error

Runtime error (IndexOutOfRangeException): Index was outside the bounds of the array.

line 17, in CreateTunnelBox, “”
line 47, in script

What can I do to make the python script recognize the list of 8 points I get from Butterfly?

Hi, there are two things you need to check.

  1. right click WTpoints slot and see if it is set to List access. If it is set to Item access, Then it is detected as a single element, not as a list.
  2. chek if the number of elements in WTpoints are 7. (or I assume it is a corner points of a box, in that case the number of elements in WT points should be 6. It that’s the case, the line 17 needss to be ptEnd = pts[5] (remember, indices start from 0, so the 6th element is 5.)

Thanks! it work, but now I have this error:

don’t know what is the problem, the geo is a brep created with gh components


will help you understand what’s going on.

starts with this

Array[Curve]((<Rhino.Geometry.PolylineCurve object at 0x0000000000000828 [Rhino.Geometry.PolylineCurve]>, <Rhino.Geometry.PolylineCurve object at 0x0000000000000829 [Rhino.Geometry.PolylineCurve]>, <Rhino.Geometry.PolylineCurve object at 0x000000000000082A [Rhino.Geometry.PolylineCurve]>, <Rhino.Geometry.PolylineCurve object at 0x000000000000082B [Rhino.Geometry.PolylineCurve]>, <Rhino.Geometry.PolylineCurve object at 0x000000000000082C [Rhino.Geometry.PolylineCurve]>))

then change to nurbs

Array[Curve]((<Rhino.Geometry.NurbsCurve object at 0x000000000000082D [Rhino.Geometry.NurbsCurve]>, <Rhino.Geometry.NurbsCurve object at 0x000000000000082E [Rhino.Geometry.NurbsCurve]>, <Rhino.Geometry.NurbsCurve object at 0x000000000000082F [Rhino.Geometry.NurbsCurve]>, <Rhino.Geometry.NurbsCurve object at 0x0000000000000830 [Rhino.Geometry.NurbsCurve]>, <Rhino.Geometry.NurbsCurve object at 0x0000000000000831 [Rhino.Geometry.NurbsCurve]>))

type is always array curve.

maybe it’s not possible to take area from the curves?

Hi, if the input is a curve, then AreaMassProperties only works when the curve is closed planar.

in the definition i end up with rg.Curve.JoinCurves(result) for both TunnelCrv and BldgCrv (520.5 KB)
this is the file im using, if you want to see it