[CommandMethod("AddMline")]
public static void AddMline()
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
Editor ed = doc.Editor;
using (Transaction Tx = db.TransactionManager.StartTransaction())
{
//get the mline style
Mline line = new Mline();
//get the current mline style
line.Style = db.CmlstyleID;
line.Normal = Vector3d.ZAxis;
line.AppendSegment(new Point3d(0, 0, 0));
line.AppendSegment(new Point3d(10, 10, 0));
line.AppendSegment(new Point3d(20, 10, 0));
//open modelpace
ObjectId ModelSpaceId =
SymbolUtilityServices.GetBlockModelSpaceId(db);
BlockTableRecord model = Tx.GetObject(ModelSpaceId,
OpenMode.ForWrite) as BlockTableRecord;
model.AppendEntity(line);
Tx.AddNewlyCreatedDBObject(line, true);
Tx.Commit();
}
}