Runtime error (ArgumentTypeException): expected IEnumerable[Curve], got list

Hello
I just want to make loft by two sets of rectangle.
But as title say, expected IEnumerable[Curve], got list even through I have declared like this. How to fix?
200418_loft.gh (7.1 KB)

Rectangles are not Curves (or does Python make that conversion automatically?)

1 Like

base_crvs = [RecListA, RecListB]

is a list of lists. I think the following should work:

recList = []
recList.append(RecA.ToNurbsCurve())
recList.append(RecB.ToNurbsCurve())
surface = rg.Brep.CreateFromLoft(recList, start=None, end=None, loftType=0, closed=False)
1 Like

thank you
I modified code but output shows Runtime error (MissingMemberException): ‘Guid’ object has no attribute ‘ToNurbsCurve’

This code means rectangle convert to NurbsCurve right?

Thank you
Maybe not automatically

As for conversion,
when I changed three points,it works.

first,make input to enter rectangle list.
Second,changed type hint as curve
Third, use rs AddLoftSurf method different to CreateFromLoft

but
what I want really is realize converting rectangle to curve and loft by the curves in coding.

You have 3 different options:

1- rhinoscriptsyntax:

import rhinoscriptsyntax as rs
rec_a = rs.AddRectangle([0,0,0], 10,10)
rec_b = rs.AddRectangle([0,0,10],10,10)
a = rs.AddLoftSrf([rec_a, rec_b])

2- Rhinocommon:

from System.Collections.Generic import *
import Rhino.Geometry as rg
rec_a = rg.Rectangle3d(rg.Plane.WorldXY, 10,10)
rec_b = rg.Rectangle3d(rg.Plane(rg.Point3d(0,0,10), rg.Vector3d.ZAxis), 10, 10)
curves = List[rg.Curve]([rec_a.ToNurbsCurve(), rec_b.ToNurbsCurve()])
a = rg.Brep.CreateFromLoft(curves, rg.Point3d.Unset, rg.Point3d.Unset, rg.LoftType.Normal, False)

3- Both

from System.Collections.Generic import *
import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
rec_a = rs.AddRectangle([0,0,0], 10,10)
rec_b = rs.AddRectangle([0,0,10],10,10)
curves = List[rg.Curve]([rs.coercecurve(rec_a), rs.coercecurve(rec_b)])
a = rg.Brep.CreateFromLoft(curves, rg.Point3d.Unset, rg.Point3d.Unset, rg.LoftType.Normal, False)

Loft.gh (14.5 KB)

3 Likes

Thank you! it works!

        curves = List[rg.Curve]([rec_a.ToNurbsCurve(), rec_b.ToNurbsCurve()])

I know what you mean by converting rec_a rec_b to nurbs, but I’d like to know where you learn how to write this.

There are developer documentation, samples and other resources at https://developer.rhino3d.com

1 Like