/// <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;
}