12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- /* ==============================================================================
- * 功能描述:计算管道关系
- * 创 建 者:SAGACLOUD
- * 创建日期:2017/9/1 16:56:23
- * ==============================================================================*/
- using System;
- using SAGA.GplotRelationComputerManage.PumpEnd;
- using SAGA.RevitUtils.Extends;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using Autodesk.Revit.DB.Plumbing;
- using Autodesk.Revit.DB;
- using SAGA.MBI.Tools;
- using SAGA.RevitUtils;
- namespace SAGA.GplotRelationComputerManage
- {
- public class ComputerPipes
- {
- public static void Computer()
- {
- //打开所有楼层数据
- PipeCalcContext context = new PipeCalcContext();
- var fileInfos = RevitModelPath.GetAllRevitFiles();
- foreach (var fileInfo in fileInfos)
- {
- if (File.Exists(fileInfo))
- {
- var uiApp = ExternalDataWrapper.Current.UiApp.Application;
- var doc = uiApp.OpenDocumentFile(fileInfo);
- if (doc == null)
- continue;
- try
- {
- new ExternalDataWrapper(doc);
- List<Pipe> verticalPipes = new List<Pipe>();
- //计算水管
- DuctTerminalBll.DrawPipePlane(false, verticalPipes);
- #region 立管处理
- ComputerVerticalPipe computerPipes = new ComputerVerticalPipe(doc);
- //立管处理,分楼层存储
- var usePlan = doc.GetViewPlan().Where(p => p.Name.Contains("-saga"))?.FirstOrDefault();
- var currentLevel = usePlan?.GenLevel;
- if (usePlan == null)
- {
- currentLevel = verticalPipes.FirstOrDefault()?.ReferenceLevel;
- }
- //楼层必须要有,管道不一定要有
- if (currentLevel != null)
- {
- computerPipes.ComputerVerticalPipes(currentLevel, verticalPipes, context);
- }
- #endregion
- //计算风管
- DuctTerminalBll.DrawDuct();
- }
- catch (System.Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- finally
- {
- doc.CloseDocSimple();
- }
- }
- }
- ComputerVerticalPipe.Computer(context);
- }
- }
- }
|