Hi,
I think this is due to the way you build your Polyline3d. Appending a vertex to a database resident polyline requires the the vertex to be explicitly closed:
from arxmgd.chm doc file:
"This function appends the PolylineVertex3d object pointed to by vertexToAppend to the vertex list of the polyline and establishes the polyline as the vertex's owner. In addition, if the polyline is resident within an Database, the vertex will be added to the same database. If the polyline is not database-resident, when it is added to a database the vertex will be added as well.
If the polyline is database-resident, then the appended vertex must be explicitly closed by the calling application after the AppendVertex() call returns. If the polyline is not database-resident, then there is no need to close the vertex since it has not been added to the database yet."
This way, using the overloaded Polyline3d constructor, seems to work (note I reverse cross sections and guides LoftProfiles)
using (Transaction tr = db.TransactionManager.StartTransaction())
{
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
Polyline3d p1 = new Polyline3d(
Poly3dType.SimplePoly,
new Point3dCollection(new[] { new Point3d(0, 0, 0), new Point3d(0, 6, 0) }),
false);
p1.ColorIndex = 1;
btr.AppendEntity(p1);
tr.AddNewlyCreatedDBObject(p1, true);
Polyline3d p2 = new Polyline3d(
Poly3dType.SimplePoly,
new Point3dCollection(new[] { new Point3d(6, 0, 0), new Point3d(6, 6, 0) }),
false);
p2.ColorIndex = 1;
btr.AppendEntity(p2);
tr.AddNewlyCreatedDBObject(p2, true);
Polyline3d p3 = new Polyline3d(
Poly3dType.SimplePoly,
new Point3dCollection(new[] { new Point3d(0, 6, 0), new Point3d(2, 6, 2), new Point3d(4, 6, 3), new Point3d(6, 6, 0) }),
false);
btr.AppendEntity(p3);
tr.AddNewlyCreatedDBObject(p3, true);
Polyline3d p4 = new Polyline3d(
Poly3dType.SimplePoly,
new Point3dCollection(new[] { new Point3d(0, 0, 0), new Point3d(3, 0, 2), new Point3d(6, 0, 0) }),
false);
btr.AppendEntity(p4);
tr.AddNewlyCreatedDBObject(p4, true);
var lp1 = new LoftProfile(p1);
LoftProfile[] prf1 = new LoftProfile[] { new LoftProfile(p1), new LoftProfile(p2) };
LoftProfile[] prf2 = new LoftProfile[] { new LoftProfile(p3), new LoftProfile(p4) };
Autodesk.AutoCAD.DatabaseServices.Surface.CreateLoftedSurface(prf2, prf1, null, new LoftOptions(), true);
tr.Commit();
}