Just trying to do this inside one drawing, using the COM interops (since there is essentially no .NET functionality for Featurelines). This seems like it should work, and it all does, except for the part to InsertFeaturePoint(s) where it errors with E_FAIL.
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.Civil.Land.DatabaseServices;
using Autodesk.AECC.Interop.Land;
namespace FeaturelineTools
{
public class EditFeatureLine
{
[CommandMethod("CopyFLData")]
public void CopyFLDatacommand()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
Database db = Application.DocumentManager.MdiActiveDocument.Database;
PromptEntityOptions entOpts = new PromptEntityOptions("\nSelect Source Featureline line: ");
entOpts.SetRejectMessage("\n...not an allowed object type, try again.");
entOpts.AddAllowedClass(typeof(FeatureLine), true);
entOpts.AddAllowedClass(typeof(Polyline3d), true);
using (Transaction tr = db.TransactionManager.StartTransaction())
{
PromptEntityResult res = ed.GetEntity(entOpts);
if (res.Status != PromptStatus.OK)
return;
FeatureLine sourceFL = (FeatureLine)tr.GetObject(res.ObjectId, OpenMode.ForRead);
entOpts.Message = "\nSelect Target Featureline: ";
res = ed.GetEntity(entOpts);
if (res.Status != PromptStatus.OK)
return;
FeatureLine targetFL = (FeatureLine)tr.GetObject(res.ObjectId, OpenMode.ForRead);
AeccLandFeatureLine src=(AeccLandFeatureLine)sourceFL.AcadObject;
AeccLandFeatureLine trgt = (AeccLandFeatureLine)targetFL.AcadObject;
double[] trgtelevpts = (double[])trgt.GetPoints(AeccLandFeatureLinePointType.aeccLandFeatureLinePointElevation);
double[] trgtpipts = (double[])trgt.GetPoints(AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI);
double[] srcelevpts = (double[])src.GetPoints(AeccLandFeatureLinePointType.aeccLandFeatureLinePointElevation);
double[] srcpipts = (double[])src.GetPoints(AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI);
double[] trgtstart = new double[3];
trgtstart[0] = trgtpipts[0];
trgtstart[1] = trgtpipts[1];
trgtstart[2] = trgtpipts[2];
int len = trgtpipts.GetLength(0);
double[] trgtend = new double[3];
trgtend[0] = trgtpipts[len - 3];
trgtend[1] = trgtpipts[len - 2];
trgtend[2] = trgtpipts[len - 1];
for (int i = 3; i < (trgtelevpts.GetLength(0) - 3); i = i + 3)
{
double[] pt = new double[3];
pt[0] = trgtelevpts[i];
pt[1] = trgtelevpts[i + 1];
pt[2] = trgtelevpts[i + 2];
trgt.DeleteFeaturePoint((object)pt);
}
for (int i = 3; i < (trgtpipts.GetLength(0) - 3); i = i + 3)
{
double[] pt = new double[3];
pt[0] = trgtpipts[i];
pt[1] = trgtpipts[i + 1];
pt[2] = trgtpipts[i + 2];
trgt.DeleteFeaturePoint((object)pt);
}
trgt.Update();
//the 2 following lines fail, so tried to set each point individually...which also fails with the same error E_FAIL
//trgt.InsertFeaturePoints((object)srcpipts, AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI);
//trgt.InsertFeaturePoints((object)srcelevpts, AeccLandFeatureLinePointType.aeccLandFeatureLinePointElevation);
for (int i = 0; i < srcpipts.GetLength(0); i++)
{
double[] pt = new double[3];
pt[0] = srcpipts[i];
pt[1] = srcpipts[i + 1];
pt[2] = srcpipts[i + 2];
trgt.InsertFeaturePoint((object)pt, AeccLandFeatureLinePointType.aeccLandFeatureLinePointPI);
}
for (int i = 0; i < srcelevpts.GetLength(0); i++)
{
double[] pt = new double[3];
pt[0] = srcelevpts[i];
pt[1] = srcelevpts[i + 1];
pt[2] = srcelevpts[i + 2];
trgt.InsertFeaturePoint((object)pt, AeccLandFeatureLinePointType.aeccLandFeatureLinePointElevation);
}
trgt.DeleteFeaturePoint((object)trgtstart);
trgt.DeleteFeaturePoint((object)trgtend);
tr.Commit();
}
}
}
}