What do you mean with join points? Just draw polylines?
using acApp = Autodesk.AutoCAD.ApplicationServices.Application;
using Autodesk.AutoCAD.Geometry;
//......
private void MyPolyLine()
{
var doc = acApp.DocumentManager.MdiActiveDocument;
var db = doc.Database;
var ed = doc.Editor;
using (DocumentLock docloc = doc.LockDocument())
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
Polyline path = DrawRect(width, height);
//BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead);
BlockTableRecord curSpace = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
curSpace.AppendEntity(path);
tr.AddNewlyCreatedDBObject(path, true);
}
}
}
private Polyline DrawRect(double width, double height)
{
var pline = new Polyline(4);
var pt = Point2d.Origin;
pline.AddVertexAt(0, pt, 0.0, 0.0, 0.0); //Start
pt += new Vector2d(0, height);
pline.AddVertexAt(1, pt, 0.0, 0.0, 0.0);
pt += new Vector2d(width, 0.0);
pline.AddVertexAt(2, pt, 0.0, 0.0, 0.0);
pt += new Vector2d(0.0, -height);
pline.AddVertexAt(3, pt, 0.0, 0.0, 0.0);
pline.Closed = true;
return pline;
}