| | |
| | | using Autodesk.Revit.DB; |
| | | using HStation.RevitDev.RevitDataExport.Utility; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace HStation.RevitDev.RevitDataExport.Service |
| | | { |
| | | public class RevitMepCategoryService |
| | | { |
| | | public static Dictionary<string, List<Element>> GroupElements(IEnumerable<Element> systemElems) |
| | | { |
| | | var result = new Dictionary<string, List<Element>>(); |
| | | var parsers = ParserManager.Instance.Parsers; |
| | | foreach (Element elem in systemElems) |
| | | { |
| | | bool pass = false; |
| | | foreach (var parser in parsers) |
| | | { |
| | | if (parser.IsPass(elem)) |
| | | { |
| | | pass = true; |
| | | var key = parser.GetParserName(); |
| | | if (!result.ContainsKey(key)) |
| | | { |
| | | result.Add(key, new List<Element>()); |
| | | } |
| | | if (!result[key].Any(x=>x.Id.IntegerValue == elem.Id.IntegerValue)) |
| | | { |
| | | result[key].Add(elem); |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if (!pass) |
| | | { |
| | | //加入其它构件类型 |
| | | if (!result.ContainsKey("其他")) |
| | | { |
| | | result.Add("其他", new List<Element>()); |
| | | } |
| | | result["其他"].Add(elem); |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | using Autodesk.Revit.DB;
|
| | | using HStation.Model;
|
| | | using HStation.RevitDev.Model.ModelEnum;
|
| | | using HStation.RevitDev.RevitDataExport.Common;
|
| | | using HStation.RevitDev.RevitDataExport.Entity;
|
| | | using HStation.RevitDev.RevitDataExport.Utility;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Collections.ObjectModel;
|
| | | using System.Diagnostics;
|
| | | using System.IO;
|
| | | using System.Linq;
|
| | |
|
| | | namespace HStation.RevitDev.RevitDataExport.Service
|
| | | {
|
| | | public class RevitMepCategoryService
|
| | | {
|
| | | public static Dictionary<string, List<Element>> GroupElements(IEnumerable<Element> systemElems)
|
| | | {
|
| | | var result = new Dictionary<string, List<Element>>();
|
| | | var parsers = ParserManager.Instance.Parsers;
|
| | | foreach (Element elem in systemElems)
|
| | | {
|
| | | bool pass = false;
|
| | | foreach (var parser in parsers)
|
| | | {
|
| | | if (parser.IsPass(elem))
|
| | | {
|
| | | pass = true;
|
| | | var key = parser.GetParserName();
|
| | | if (!result.ContainsKey(key))
|
| | | {
|
| | | result.Add(key, new List<Element>());
|
| | | }
|
| | | if (!result[key].Any(x => x.Id.IntegerValue == elem.Id.IntegerValue))
|
| | | {
|
| | | result[key].Add(elem);
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (!pass)
|
| | | {
|
| | | //加入其它构件类型
|
| | | if (!result.ContainsKey("其他"))
|
| | | {
|
| | | result.Add("其他", new List<Element>());
|
| | | }
|
| | | result["其他"].Add(elem);
|
| | | }
|
| | | }
|
| | | return result;
|
| | | }
|
| | |
|
| | | public static void AddToCache(Element elem)
|
| | | {
|
| | | var parsers = ParserManager.Instance.Parsers;
|
| | | bool pass = false;
|
| | | var id = elem.Id.IntegerValue.ToString();
|
| | | foreach (var parser in parsers)
|
| | | {
|
| | | if (parser.IsPass(elem))
|
| | | {
|
| | | var revitType = parser.GetRevitType();
|
| | | pass = true;
|
| | |
|
| | | //把新增构件加入到缓存中
|
| | | GlobalResource.RevitModels.Add(elem, revitType);
|
| | | break;
|
| | | }
|
| | | }
|
| | | if (!pass)
|
| | | {
|
| | | //把新增构件加入到缓存[其他]中
|
| | | GlobalResource.RevitModels.Add(elem, RevitType.RFT_Others);
|
| | | }
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|