public static T PickEntity改进<T>(bool clone = false) where T : Entity
{
T t = null;
var peo = new PromptEntityOptions("\n请选择:");
peo.SetRejectMessage($"请选择 {typeof(T).Name} 类型的实体");
peo.AddAllowedClass(typeof(T), false);
PromptEntityResult per = ed.GetEntity(peo);
if (per.Status == PromptStatus.OK)
{
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DBObject obj = tr.GetObject(per.ObjectId, OpenMode.ForRead);
if (obj is T)
{
if (clone) t = obj.Clone() as T;
else t = obj as T;
}
}
}
// if (t == null) throw new System.Exception();
return t;
}
PickEntity改进<T>
最新推荐文章于 2025-05-13 16:13:50 发布