Perhaps something like this will give you some ideas :
Note this is proof of concept, without error checking etc.
[CommandMethod("DrawPline")]
public void TestDrawPline()
{
Document doc = AcadApp.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
Point2dCollection point2Ds = new Point2dCollection()
{
new Point2d(216, 230),
new Point2d(478, 230),
new Point2d(478, 85),
new Point2d(216, 84)
};
using (var tr = db.TransactionManager.StartTransaction())
{
// Open Model space for write
var dbBlockTable = (BlockTable)tr.GetObject(
db.BlockTableId, OpenMode.ForRead);
var msBlockTableRecord = (BlockTableRecord)tr.GetObject(
dbBlockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite);
var pline = DrawPolyline(point2Ds, 0);
pline.Closed = true;
msBlockTableRecord.AppendEntity(pline);
tr.AddNewlyCreatedDBObject(pline, true);
tr.Commit();
}
}
public static Polyline DrawPolyline(Point2dCollection pts, double width)
{
var pline = new Polyline();
pline.SetDatabaseDefaults();
for (int i = 0; i < pts.Count; i++)
{
pline.AddVertexAt(i, pts[i], 0, width, width);
}
return pline;
}

Regards,
// Called Kerry or kdub in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub
NZST UTC+12 : class keyThumper<T> : Lazy<T>; another Swamper