Turn NurbCurves into Curves

Hi everyone,

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.

Any and all help would be appreciated!

assignment 1.gh (21.1 KB)

I would suggest the attached for that type of stuff (bad news: is C# [AFAIK no auto translation to P exists])

Points_InGrid_ToSomething_EntryLevel_V1.gh (118.5 KB)

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.

Thank you Pierre! That worked perfectly.
And thank you about the tip on readability, it makes a lot more sense that way.