|
@@ -3,6 +3,7 @@
|
|
|
* 创 建 者:Garrett
|
|
|
* 创建日期:2018/7/11 14:25:22
|
|
|
* ==============================================================================*/
|
|
|
+
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -30,23 +31,37 @@ using WinModeCheckSetting = SAGA.MBI.ToolsData.ModeCheck.WinModeCheckSetting;
|
|
|
|
|
|
namespace SAGA.MBI
|
|
|
{
|
|
|
+
|
|
|
+ #region 工具
|
|
|
/// <summary>
|
|
|
- /// 导出不在空间中的设备
|
|
|
+ /// 批量删除无用的空间
|
|
|
/// </summary>
|
|
|
[Transaction(TransactionMode.Manual)]
|
|
|
[Regeneration(RegenerationOption.Manual)]
|
|
|
- public class ExportEquipNotInSpaceCommand : ExternalCommand
|
|
|
+ public class DeleteZeroSpaceCommand : ExternalCommand
|
|
|
{
|
|
|
public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- var fi = ExternalDataWrapper.Current.UiApp.GetSelectedElement() as FamilyInstance;
|
|
|
- var space = fi.GetReferenceSpace();
|
|
|
- MessageShowBase.Infomation($"设备所在空间Id为{space?.Id}");
|
|
|
- //var tip = MessageShow.Question("确定要执行设备所在空间的检查?\r\n未在空间中的岗位将会被导出的excel中,由建模人员进行检查。");
|
|
|
- //if (tip)
|
|
|
- // CheckEquipInSpace.Export();
|
|
|
+ var doc = ExternalDataWrapper.Current.Doc;
|
|
|
+ using (Transaction trans = new Transaction(doc, "删除"))
|
|
|
+ {
|
|
|
+ trans.Start();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var spaces = doc.GetSpaces().Where(t => t.IsDeleteSpace());
|
|
|
+ doc.Delete(spaces.Select(t => t.Id).ToList());
|
|
|
+ trans.Commit();
|
|
|
+ MessageShowBase.Infomation("删除成功");
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ trans.RollBack();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -55,31 +70,21 @@ namespace SAGA.MBI
|
|
|
}
|
|
|
return Result.Succeeded;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
|
|
|
- /// when a document is open.
|
|
|
- /// </summary>
|
|
|
- public bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
}
|
|
|
/// <summary>
|
|
|
- /// 检查BimID是否重复,多个岗位对应一个模型
|
|
|
+ /// 报告设备所在空间
|
|
|
/// </summary>
|
|
|
[Transaction(TransactionMode.Manual)]
|
|
|
[Regeneration(RegenerationOption.Manual)]
|
|
|
- public class CheckDuplicationBIMIdCommand : ExternalCommand
|
|
|
+ public class ReportEquipInSpaceCommand : ExternalCommand
|
|
|
{
|
|
|
public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
- var tip = MessageShow.Question("确定要执行设备BIMID重复性检查?\r\n未在空间中的岗位将会被导出的excel中。");
|
|
|
- if (tip)
|
|
|
- CheckDuplicationBIMId.CheckAll();
|
|
|
+ var fi = ExternalDataWrapper.Current.UiApp.GetSelectedElement() as FamilyInstance;
|
|
|
+ var space = fi.GetReferenceSpace();
|
|
|
+ MessageShowBase.Infomation($"设备所在空间Id为{space?.Id}");
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -88,17 +93,9 @@ namespace SAGA.MBI
|
|
|
}
|
|
|
return Result.Succeeded;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Onlys show the dialog when a document is open, as Dockable dialogs are only available
|
|
|
- /// when a document is open.
|
|
|
- /// </summary>
|
|
|
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
}
|
|
|
+ #endregion
|
|
|
+
|
|
|
|
|
|
/// <summary>
|
|
|
/// 修正云平台族类型和本地族类型不一致
|
|
@@ -339,7 +336,7 @@ namespace SAGA.MBI
|
|
|
var checkType = CheckType.DataCheck;
|
|
|
var checkItems = CheckOperation.GetCheckItems(checkType);
|
|
|
|
|
|
- WinDataCheckSetting win = new WinDataCheckSetting(checkItems,CheckType.DataCheck);
|
|
|
+ WinDataCheckSetting win = new WinDataCheckSetting(checkItems, CheckType.DataCheck);
|
|
|
if (win.ShowDialog() != true) return Result.Cancelled;
|
|
|
CheckOperation.Execute(checkItems, win.GetCheckContext());
|
|
|
}
|