| | |
| | | using HStation.RevitDev.Model.ModelEnum;
|
| | | using HStation.RevitDev.RevitDataExport.Common;
|
| | | using HStation.RevitDev.RevitDataExport.Entity;
|
| | | using HStation.RevitDev.RevitDataExport.Parser;
|
| | | using System;
|
| | | using System.Reflection;
|
| | |
|
| | |
| | |
|
| | | public static Type GetElementModelType(this RevitType revitType)
|
| | | {
|
| | | var exportTypes = revitType.GetType().Assembly.GetExportedTypes();
|
| | | var exportTypes = Assembly.GetExecutingAssembly().GetExportedTypes();
|
| | | foreach (var type in exportTypes)
|
| | | {
|
| | | if (!type.IsSubclassOf(typeof(ModelBase))) { continue; }
|
| | |
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static BaseParser CreateModelParser(this RevitType revitType)
|
| | | {
|
| | | var types = Assembly.GetExecutingAssembly().GetTypes();
|
| | | foreach (var type in types) |
| | | {
|
| | | if (!type.IsSubclassOf(typeof(BaseParser))) { continue; }
|
| | | var attr = type.GetCustomAttribute<RevitTypeAttribute>();
|
| | |
|
| | | if (attr == null) { continue; }
|
| | | if (attr.m_revitType != revitType) { continue; }
|
| | |
|
| | | BaseParser parser = Activator.CreateInstance(type) as BaseParser;
|
| | | if (parser == null) { continue; }
|
| | |
|
| | | return parser;
|
| | | }
|
| | | return null;
|
| | | }
|
| | | }
|
| | | }
|