using (Transaction tr = doc.TransactionManager.StartTransaction())
{
Curve curve2 = (Curve)tr.GetObject(objId2, OpenMode.ForRead);
BlockTableRecord containerBlock = (BlockTableRecord)tr.GetObject(curve2.OwnerId, OpenMode.ForWrite);
Polyline2d testCurve2 = (curve2 as Polyline).ConvertTo(false);
containerBlock.AppendEntity(testCurve2);
tr.AddNewlyCreatedDBObject(testCurve2, true);
Curve projCurve2 = testCurve2.GetOrthoProjectedCurve(new Plane(0, 0, 1, 0));
containerBlock.AppendEntity(projCurve2);
tr.AddNewlyCreatedDBObject(projCurve2, true);
tr.Commit();
return true;
}