123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- using DrawData;
- using System;
- using System.Linq;
- using Autodesk.Revit.Attributes;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.UI;
- using SAGA.GplotDrawData;
- using SAGA.GplotRelationComputerManage.PumpEnd;
- using SAGA.RevitUtils;
- using SAGA.RevitUtils.Extends;
- using MainWindow = SAGA.GplotDrawData.MainWindow;
- namespace SAGA.GplotRelationComputerManage
- {
- /// <summary>
- /// 供水管 回水管拓扑图
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class SupplyHydronicTopoGraph : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- base.Execute(commandData, ref message, elements);
- using (Transaction trans = new Transaction(ExternalDataWrapper.Current.Doc, "读取风管系统"))
- {
- trans.Start();
- try
- {
- DuctTerminalBll.DrawPipePlane();
- trans.Commit();
- }
- catch (Exception e)
- {
- trans.RollBack();
- MessageShow.Show(e);
- }
- }
- return Result.Succeeded;
- }
- }
- /// <summary>
- /// 配电关系图--配电柜与配电柜
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class DistributionRelationshipCommand : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- #region 核心
- try
- {
- DistributionRelationshipHandler handler = new DistributionRelationshipHandler();
- var re = handler.GetViewData(new PowerComputerContext());
- if (re[0].Childrens.Any())
- {
- WinEquipmentRelation_Web window =
- new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
- window.Title = "配电拓扑图:配电柜--配电柜";
- window.Show();
- }
- }
- catch (Exception ex)
- {
- MessageShow.Show(ex);
- }
- #endregion
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
-
- }
- /// <summary>
- /// 配电关系图--配电柜与配电设备
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class DistributionEqRelationshipCommand : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- #region 核心处理
- EquipPowerRelationshipHandler handler = new EquipPowerRelationshipHandler();
- var re = handler.GetViewData(new PowerComputerContext());
- if (re[0].Childrens.Any())
- {
- WinEquipmentRelation_Web window =
- new WinEquipmentRelation_Web(re[0].Childrens, re[1].Childrens);
- window.Title = "配电拓扑图:配电柜--末端";
- window.Show();
- }
- #endregion
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 对象受控关系
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class BelongEqRelationshipCommand : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- #region 核心处理
- ObjectControlRelationshipHandler handler = new ObjectControlRelationshipHandler();
- var re = handler.GetViewData(new PowerComputerContext());
- if (re[0].Childrens.Any())
- {
- WinControlRelation_Web window =
- new WinControlRelation_Web(re[0].Childrens, re[1].Childrens);
- window.Title = "对象受控关系图";
- window.Show();
- }
- #endregion
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 空间关系查看
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class SpaceViewCommand : ExternalCommand
- {
- public SpaceViewCommand()
- {
- IsShowNoDocument = true;
- }
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- try
- {
- var win = new WinDrawSpace();
- win.ShowDialog();
- }
- catch (Exception e)
- {
- MessageShow.Show(e);
- }
- return Result.Succeeded;
- }
- }
- }
|