Hi all,
I'm trying to automate the creation of a series of lofted solids starting from surface profiles in Civil3D.
I basically create a series of rectangles (closed polyline) along an alignment and then try to create a lofted solid with them.

Code:
...
align.PointLocation(station, offset, Xright, Yright)align.PointLocation(station, -offset, Xleft, Yleft)
...
strataPoints = strataPoints.OrderBy(Function(x) x.pk).ThenBy(Function(x) x.base).ToList
Dim outputSolids = New Dictionary(Of String, LoftedSolid)
Dim thisSolid = New LoftedSolid()
For j As Integer = 0 To strataPoints.Count - 1
    With strataPoints(j)
    ...
    Dim thisSection As New Polyline3d()
    btr.AppendEntity(thisSection)
    ts.AddNewlyCreatedDBObject(thisSection, True)
    thisSection.Layer = .description
    Dim vertices = New List(Of PolylineVertex3d)
    vertices.Add(New PolylineVertex3d(New Point3d(Xleft, Yleft, top)))
    vertices.Add(New PolylineVertex3d(New Point3d(Xright, Yright, top)))
    vertices.Add(New PolylineVertex3d(New Point3d(Xright, Yright, base)))
    vertices.Add(New PolylineVertex3d(New Point3d(Xleft, Yleft, base)))
    For Each vertex In vertices
        thisSection.AppendVertex(vertex)
        vertex.Dispose()
    Next
    vertices = Nothing
    thisSection.Closed = True
    ...
    thisSolid.sections.Add(thisSection)
    ...
    outputSolids.Add(.ID, thisSolid)
    ...

Dim options = New LoftOptions
Dim guidecurves = New Autodesk.Aec.DatabaseServices.Entity() {}
For Each kvp As KeyValuePair(Of String, LoftedSolid) In outputSolids
...
    Dim sld = New Solid3d
    sld.CreateLoftedSolid(kvp.value.sections.ToArray, guidecurves, Nothing, options)
...
sections are in order of alignment station, so it could create a solid, but it fails with eNonPlanarEntity error.
I tried to search for this error online and it seems that nobody has this problem.

Is there something I'm missing?