123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /*-------------------------------------------------------------------------
- * 功能描述:SystemComputerHandler
- * 作者:xulisong
- * 创建时间: 2019/1/17 9:42:03
- * 版本号:v1.0
- * -------------------------------------------------------------------------*/
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SAGA.MBI.Tools;
- namespace SAGA.GplotRelationComputerManage
- {
- public class SystemComputerHandler
- {
- /// <summary>
- /// 根据上下文计算系统数据
- /// </summary>
- /// <param name="context"></param>
- public void Computer(SystemComputerContext context)
- {
- List<string> testFiles = new List<string>();
- testFiles.Add("Fl420105000119b7c08edcee11e8a553abe8a598be93.rvt");
- testFiles.Add("Fl4201050001d4f1ea8fdce711e8a55335c5dd75d7b3.rvt");
- var fileInfos = RevitModelPath.GetAllRevitFiles();
- foreach (var fileInfo in fileInfos)
- {
- if (File.Exists(fileInfo))
- {
- //if (testFiles.All(f => !fileInfo.Contains(f)))
- //{
- // continue;
- //}
- FloorSystemItem floorItems = context.FloorItems.GetItem(fileInfo);
- floorItems.Parse(context);
- floorItems.Document.CloseDocSimple();
- }
- }
- context.SaveComputerData();
- }
-
- /// <summary>
- /// 根据输入系统类型计算系统数据
- /// </summary>
- /// <param name="relationTypes"></param>
- public void Computer(List<string> relationTypes)
- {
- SystemComputerContext context = new SystemComputerContext();
- context.Relations.AddRange(relationTypes);
- Computer(context);
- }
- /// <summary>
- /// 计算没有被缓存或者缓存过期的数据
- /// </summary>
- /// <param name="relationTypes"></param>
- public void ComputerWidthCache(List<string> relationTypes)
- {
- if (relationTypes == null || !relationTypes.Any())
- return;
- var useRelationTypes = RelationTypeUtil.NeedResetRelationTypes(relationTypes);
- if(!useRelationTypes.Any())
- {
- return;
- }
- Computer(useRelationTypes);
- }
- }
- }
|