I have created a list of points from which I have created some lines using rg.Curve.CreateInterpolatedCurve - from these I would like to make a loft. However, the rg.Brep.CreateFromLoft asks as its first argument for just a curve, not a NurbCurve which is what the CreateInterpolatedCurve is returning.
Is there a way to switch my NurbCurve into a regular Curve? I have tried using rg.NurbsCurve.GetCurveParameterFromNurbsFormParameter but I still get NurbCurves.
I could use rs.AddLoftSrf() but I later need to convert it into a Mesh and I cant with this method.
The error message you are seeing (Expected IEnumerable[Curve], got list) is misleading, since a list of NurbsCurves will actually convert just fine to an IEnumerable[Curve]. The issue is with the type of the next arguments you are passing to CreateFromLoft (see its documentation). Here’s a snippet that will fix your error:
# Make a loft
loft_breps = rg.Brep.CreateFromLoft(
sinlines,
rg.Point3d.Unset,
rg.Point3d.Unset,
rg.LoftType.Normal,
False
)
To explicitly convert the curve list, you could use this:
import System
curves = System.Array[rg.Curve](sinlines)
Small tip to help make your code more readable: you can rename the outputs of the GHPython component by right-clicking on them. That helps prevent lines like d = segments, h = sines, etc.