| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- /* ==============================================================================
- * 功能描述:计算管道关系
- * 创 建 者:SAGACLOUD
- * 创建日期:2017/9/1 16:56:23
- * ==============================================================================*/
- using SAGA.GplotRelationComputerManage.PumpEnd;
- using SAGA.RevitUtils.Extends;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using Autodesk.Revit.DB.Plumbing;
- using Autodesk.Revit.DB;
- namespace SAGA.GplotRelationComputerManage
- {
- public class ComputerPipes
- {
- public static void Computer()
- {
- //记录立管
- //List<Pipe> verticalPipe = new List<Pipe>();
- Dictionary<Level, List<Pipe>> dicVerticalPipes = new Dictionary<Level, List<Pipe>>();
- //打开所有楼层数据
- // var fileInfos = RevitModelPath.GetAllRevitFiles();//.Where(t=>Regex.IsMatch(t, "Fl1101080003e883286bb63d11e8b92a092227bd993a"));//B2
- var fileInfos = RevitModelPath.GetAllRevitFiles();//.Where(t=>Regex.IsMatch(t, "ee2c4"));//Test
- foreach (var fileInfo in fileInfos)
- {
- if (File.Exists(fileInfo))
- {
- var uiApp = ExternalDataWrapper.Current.UiApp.Application;
- var doc = uiApp.OpenDocumentFile(fileInfo);
- new ExternalDataWrapper(doc);
-
- List<Pipe> verticalPipe = new List<Pipe>();
- //计算水管
- DuctTerminalBll.DrawPipePlane(false, verticalPipe);
- #region 立管处理
- //立管处理,分楼层存储
- var usePlan = doc.GetViewPlan().Where(p => p.Name.Contains("-saga"))?.FirstOrDefault();
- var currentLevel = usePlan?.GenLevel;
- if (usePlan == null)
- {
- currentLevel = verticalPipe.FirstOrDefault()?.ReferenceLevel;
- }
- //楼层必须要有,管道不一定要有
- if (currentLevel != null)
- {
- dicVerticalPipes.Add(currentLevel, verticalPipe);
- }
- #endregion
- //计算风管
- DuctTerminalBll.DrawDuct();
- }
- }
-
- //计算立管
- //if(ExternalDataWrapper.Current?.Doc==null)return;
- //var levels =ExternalDataWrapper.Current.Doc.GetLevels();
- var pipeComputer = new ComputerVerticalPipe();
- pipeComputer.Computer(dicVerticalPipes);
- }
-
- }
- }
|