Example #1
0
        /// <summary>
        /// 结束构件选择
        /// </summary>
        public void FinishElementSelection()
        {
            switch (ListForm.ShowDialogType)
            {
            case ShowDialogType.AddElements_ForDetail:
                if (SelectedElementIds != null && SelectedElementIds.Count > 0)
                {
                    Model.AddElementIds(SelectedNodes[0].NodeCode, SelectedElementIds);
                    Model.Edited();
                }
                //ListForm.ShowDialogType = ShowDialogType.Idle;
                break;

            case ShowDialogType.DeleleElements_ForDetail:
                if (SelectedElementIds != null && SelectedElementIds.Count > 0)
                {
                    Model.DeleteElementIds(SelectedNodes[0].NodeCode, SelectedElementIds);
                    Model.Edited();
                }
                Revit_View_Helper.DeisolateElements(UI_Doc.Document, nameof(SubsidenceMonitor) + nameof(FinishElementSelection), UI_Doc.ActiveView);
                //ListForm.ShowDialogType = ShowDialogType.Idle;
                break;

            default:
                break;
            }
        }
Example #2
0
 /// <summary>
 /// 删除构件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void btn_DeleteComponent_Click(object sender, EventArgs e)
 {
     if (SelectedNodes.Count == 0)
     {
         ShowMessage("警告", "需选中节点");
     }
     else if (SelectedNodes.Count > 1)
     {
         ShowMessage("警告", "需选中单一节点");
     }
     else
     {
         ListForm.ShowDialogType = ShowDialogType.DeleleElements_ForDetail;
         string viewName        = ListForm.ShowDialogType.GetViewName();
         var    view            = Revit_Document_Helper.GetElementByNameAs <View3D>(UI_Doc.Document, viewName);
         var    doc             = UI_Doc.Document;
         var    transactionName = nameof(SubsidenceMonitor) + nameof(btn_AddComponent_Click);
         if (view == null)
         {
             bool isSuccess = DealWithTransaction(viewName, doc, transactionName, () =>
             {
                 view = Revit_Document_Helper.Create3DView(doc, viewName);
             });
             if (!isSuccess)
             {
                 return;
             }
         }
         UI_Doc.ActiveView = view;
         var elementIds = Model.GetElementIdsByTNode(SelectedNodes[0], UI_Doc.Document);
         Revit_View_Helper.IsolateElements(UI_Doc.Document, nameof(SubsidenceMonitor) + nameof(btn_DeleteComponent_Click), UI_Doc.Document.ActiveView, elementIds);
         this.DialogResult = DialogResult.Retry;
         this.Close();
         ListForm.DialogResult = DialogResult.Retry;
         ListForm.Close();
     }
 }