123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
-
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using Autodesk.Revit.Attributes;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.UI;
- using SAGA.DotNetUtils.Others;
- using SAGA.GplotDrawData;
- using SAGA.GplotDrawData.View;
- using SAGA.GplotManage.RelationManager;
- using SAGA.GplotRelationComputerManage;
- using SAGA.Models;
- using SAGA.RevitUtils.Extends;
- namespace SAGA.GplotManage
- {
- /// <summary>
- /// 空间计算--平面
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class SpaceComputerGraph : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- //if (!MessageShowBase.Confirm("确定要执行拓扑计算命令吗"))
- //{
- // return Result.Succeeded;
- //}
- /*
- * 交互逻辑:
- * 1、缓存结果不存在,直接计算
- * 2、缓存结果存在,且没有过期,直接显示
- * 3、缓存结果存在,且数据过去,弹出提示框,用户选择是否重新计算
- */
- var state = SpaceComputerDataUtil.ComputeFileState();
- if (state==CacheFileState.Miss)
- {
- SpaceComputerHandler.ComputerAllRelations();
- }
- else if(state == CacheFileState.Expire)
- {
- if (MessageShowBase.ConfirmYesNo("您是否要重新计算?"))
- {
- SpaceComputerHandler.ComputerAllRelations();
- }
- }
- var win = new WinDrawSpace_Web(GplotShowType.ViewPlan);//
- win.Show();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 空间计算--立面
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class SpaceComputerVGraph : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- //if (!MessageShowBase.Confirm("确定要执行拓扑计算命令吗"))
- //{
- // return Result.Succeeded;
- //}
- var state = SpaceComputerDataUtil.ComputeFileState();
- if (state == CacheFileState.Miss)
- {
- SpaceComputerHandler.ComputerAllRelations();
- }
- else if (state == CacheFileState.Expire)
- {
- if (MessageShowBase.ConfirmYesNo("您是否要重新计算?"))
- {
- SpaceComputerHandler.ComputerAllRelations();
- }
- }
- var win = new WinDrawSpace_Web(GplotShowType.VerticalPlan);
- win.Show();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 水系统
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ChillWaterLoopComputerSupplyGraph : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- //if (!MessageShowBase.Confirm("确定要执行拓扑计算命令吗"))
- //{
- // return Result.Succeeded;
- //}
- var state = SystemComputerHandler.ComputeFileState();
- if (state == CacheFileState.Miss)
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- else if (state == CacheFileState.Expire)
- {
- if (MessageShowBase.ConfirmYesNo("您是否要重新计算?"))
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- }
- WinSystem floorWin = new WinSystem(GplotShowType.ViewPlan);
- floorWin.Show();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 系统平面信息
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ChillWaterLoopComputerBackGraph : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- //if (!MessageShowBase.Confirm("确定要执行拓扑计算命令吗"))
- //{
- // return Result.Succeeded;
- //}
- var state = SystemComputerHandler.ComputeFileState();
- if (state == CacheFileState.Miss)
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- else if (state == CacheFileState.Expire)
- {
- if (MessageShowBase.ConfirmYesNo("您是否要重新计算?"))
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- }
- WinSystem floorWin = new WinSystem(GplotShowType.ViewPlan);
- floorWin.Show();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 系统立面信息
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ChillWaterLoopComputerVGraph : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- //if (!MessageShowBase.Confirm("确定要执行拓扑计算命令吗"))
- //{
- // return Result.Succeeded;
- //}
- var state = SystemComputerHandler.ComputeFileState();
- if (state == CacheFileState.Miss)
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- else if (state == CacheFileState.Expire)
- {
- if (MessageShowBase.ConfirmYesNo("您是否要重新计算?"))
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- }
- WinSystem verticalWin = new WinSystem(GplotShowType.VerticalPlan);
- verticalWin.Show();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 机房信息
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class ChillWaterLoopRoom : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- //if (!MessageShowBase.Confirm("确定要执行拓扑计算命令吗"))
- //{
- // return Result.Succeeded;
- //}
- var state = SystemComputerHandler.ComputeFileState();
- if (state == CacheFileState.Miss)
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- else if (state == CacheFileState.Expire)
- {
- if (MessageShowBase.ConfirmYesNo("您是否要重新计算?"))
- {
- SystemComputerHandler.ComputerAllRelations();
- }
- }
- WinMachineRoom room = new WinMachineRoom();
- room.Show();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
- /// <summary>
- /// 拓扑图上传测试
- /// </summary>
- [Transaction(TransactionMode.Manual)]
- [Regeneration(RegenerationOption.Manual)]
- public class GraphUploadTest : ExternalCommand
- {
- public override Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
- {
- WinComputeRelations win = new WinComputeRelations();
- win.ShowDialog();
- return Result.Succeeded;
- }
- public override bool IsCommandAvailable(UIApplication applicationData, CategorySet selectedCategories)
- {
- return true;
- }
- }
-
- }
|