From 1e66b4cc1183f30ff6add72750f3e9e155ff7f9a Mon Sep 17 00:00:00 2001
From: zhangyuekai <zhangyuekai@126.com>
Date: 星期四, 08 八月 2024 11:55:22 +0800
Subject: [PATCH] 导出模块、族库模块等其他模块开发完成

---
 HStation.RevitDev/RevitDataExport/Service/RevitMepCategoryService.cs |   72 ++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/HStation.RevitDev/RevitDataExport/Service/RevitMepCategoryService.cs b/HStation.RevitDev/RevitDataExport/Service/RevitMepCategoryService.cs
index 35eecb8..3519eba 100644
--- a/HStation.RevitDev/RevitDataExport/Service/RevitMepCategoryService.cs
+++ b/HStation.RevitDev/RevitDataExport/Service/RevitMepCategoryService.cs
@@ -1,13 +1,14 @@
 锘縰sing Autodesk.Revit.DB;
+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;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
 
 namespace HStation.RevitDev.RevitDataExport.Service
 {
@@ -30,7 +31,7 @@
                         {
                             result.Add(key, new List<Element>());
                         }
-                        if (!result[key].Any(x=>x.Id.IntegerValue == elem.Id.IntegerValue))
+                        if (!result[key].Any(x => x.Id.IntegerValue == elem.Id.IntegerValue))
                         {
                             result[key].Add(elem);
                         }
@@ -49,5 +50,68 @@
             }
             return result;
         }
+
+        public static void MatchElement(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;
+                    
+                    //鎶婃柊澧炴瀯浠跺姞鍏ュ埌缂撳瓨涓�
+                    if (!GlobalResource.RevitModels.ContainsKey(revitType))
+                    {
+                        GlobalResource.RevitModels.Add(revitType, new ObservableCollection<ElementModel>());
+                        GlobalResource.RevitModels[revitType].Add(new ElementModel
+                        {
+                            Name = elem.Name,
+                            Id = id,
+                            LinkIds = /*string.Join(",", linkedIds)*/string.Empty
+                        });
+
+                    }
+                    else if (!GlobalResource.RevitModels[revitType].Any(x => x.Id == id))
+                    {
+                        GlobalResource.RevitModels[revitType].Add(new ElementModel
+                        {
+                            Name = elem.Name,
+                            Id = id,
+                            LinkIds = /* string.Join(",", linkedIds)*/string.Empty
+                        });
+                    }
+                    break;
+                }
+            }
+            if (!pass)
+            {
+                //鎶婃柊澧炴瀯浠跺姞鍏ュ埌缂撳瓨涓�
+                if (!GlobalResource.RevitModels.ContainsKey(RevitType.RFT_Others))
+                {
+                    GlobalResource.RevitModels.Add(RevitType.RFT_Others, new ObservableCollection<ElementModel>());
+                    GlobalResource.RevitModels[RevitType.RFT_Others].Add(new ElementModel
+                    {
+                        Name = elem.Name,
+                        Id = id,
+                        LinkIds = /*string.Join(",", linkedIds)*/string.Empty
+                    });
+
+                }
+                else if (!GlobalResource.RevitModels[RevitType.RFT_Others].Any(x => x.Id == id))
+                {
+                    GlobalResource.RevitModels[RevitType.RFT_Others].Add(new ElementModel
+                    {
+                        Name = elem.Name,
+                        Id = id,
+                        LinkIds = /* string.Join(",", linkedIds)*/string.Empty
+                    });
+                }
+            }
+            return;
+        }
     }
 }

--
Gitblit v1.9.3