- /// <summary>
- /// 通过选择点创建边界
- /// </summary>
- public class CreateBound
- {
- /// <summary>
- /// 创建边界,边界对象已加入数据库
- /// </summary>
- /// <returns></returns>
- public static ObjectId MakeBound()
- {
- ObjectId id = new ObjectId();
- PromptPointResult ppr = Tools.Editor.GetPoint("\n请选择内部点: ");
- using (Transaction tr = Tools.Database.TransactionManager.StartTransaction())
- {
- if (ppr.Status != PromptStatus.OK)
- {
- tr.Commit();
- return id;
- }
- try
- {
- DBObjectCollection objs = Tools.Editor.TraceBoundary(ppr.Value, false);
- if (objs.Count == 0)
- {
- tr.Commit();
- return id;
- }
- id = Tools.AddToCurrentSpace(objs[0] as Entity);
- tr.Commit();
- return id;
- }
- catch
- {
- tr.Commit();
- return id;
- }
- }
- }
- }
|