今天把所有的AddToModelSpace和AddToPaperSpace修改成了AddToCurrentSpace.
近日发现一个问题,我测试时没有问题,但是用户在用的时候说没有看到新的文字出现,我是到处找问题,最后才发现问题出现在AddToModelSpace这一句了。
public static ObjectIdCollection AddToCurrentSpace(this Database db, params Entity[] ents)
{
ObjectIdCollection ids = new ObjectIdCollection();
var trans = db.TransactionManager;
BlockTableRecord btr = (BlockTableRecord)trans.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);
foreach (var ent in ents)
{
ids.Add(btr.AppendEntity(ent));
trans.AddNewlyCreatedDBObject(ent, true);
}
btr.DowngradeOpen();
return ids;
}