/// <summary>
/// 向當前操作的空間(ModelSpace/PaperSpace)中添加圖元
/// </summary>
/// <param name="ent"></param>
/// <returns></returns>
public ObjectId InsertEnt(Entity ent)
{
ObjectId id;
Database db = HostApplicationServices.WorkingDatabase;
using (Transaction tran = db.TransactionManager.StartTransaction())
{
BlockTableRecord modelspace = tran.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
id = modelspace.AppendEntity(ent);
tran.AddNewlyCreatedDBObject(ent, true);
tran.Commit();
}
return id;
}