|
@@ -32,34 +32,34 @@ namespace RevitToJBim.ComponentParse
|
|
|
/// </summary>
|
|
|
public class ParseCore
|
|
|
{
|
|
|
- //获取可用的解析类
|
|
|
- public static List<ParseBase> GetUseParsers()
|
|
|
+ //获取可用的解析类
|
|
|
+ public static List<ParseBase> GetUseParsers()
|
|
|
+ {
|
|
|
+ List<ParseBase> result = new List<ParseBase>();
|
|
|
+ Assembly assembly = Assembly.GetCallingAssembly();
|
|
|
+ Type[] types = assembly.GetTypes();
|
|
|
+ foreach (var type in types)
|
|
|
{
|
|
|
- List<ParseBase> result = new List<ParseBase>();
|
|
|
- Assembly assembly = Assembly.GetCallingAssembly();
|
|
|
- Type[] types = assembly.GetTypes();
|
|
|
- foreach (var type in types)
|
|
|
+ if (typeof(ParseBase).IsAssignableFrom(type))
|
|
|
{
|
|
|
- if (typeof(ParseBase).IsAssignableFrom (type))
|
|
|
- {
|
|
|
- if (type.IsAbstract || type.IsGenericTypeDefinition)
|
|
|
- continue;
|
|
|
- var attribute = type.GetCustomAttribute<UsableParseAttribute>();
|
|
|
- if (attribute == null)
|
|
|
- continue;
|
|
|
- var construstor = type.GetConstructor(Type.EmptyTypes);
|
|
|
- if (construstor == null)
|
|
|
- continue;
|
|
|
- if (construstor.Invoke(null) is ParseBase parse)
|
|
|
- result.Add(parse);
|
|
|
+ if (type.IsAbstract || type.IsGenericTypeDefinition)
|
|
|
+ continue;
|
|
|
+ var attribute = type.GetCustomAttribute<UsableParseAttribute>();
|
|
|
+ if (attribute == null)
|
|
|
+ continue;
|
|
|
+ var construstor = type.GetConstructor(Type.EmptyTypes);
|
|
|
+ if (construstor == null)
|
|
|
+ continue;
|
|
|
+ if (construstor.Invoke(null) is ParseBase parse)
|
|
|
+ result.Add(parse);
|
|
|
|
|
|
- }
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
|
|
|
- return result;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
-
|
|
|
public static void AttachObject(ComponentObject bimObj, ElementWrapper wrapper)
|
|
|
{
|
|
|
bimObj.SourceId = wrapper.SourceId;
|
|
@@ -67,21 +67,9 @@ namespace RevitToJBim.ComponentParse
|
|
|
}
|
|
|
public static JConnector CreateConnector(Autodesk.Revit.DB.Connector connector)
|
|
|
{
|
|
|
- var result= new JConnector();
|
|
|
+ var result = new JConnector();
|
|
|
result.SourceId = RevitIdGenerator.GetConnectorId(connector);
|
|
|
- switch (connector.Domain)
|
|
|
- {
|
|
|
- case Domain.DomainHvac:
|
|
|
- {
|
|
|
- result.Domain = ConnectorDomain.DomainHvac.ToString();
|
|
|
- break;
|
|
|
- }
|
|
|
- case Domain.DomainPiping:
|
|
|
- {
|
|
|
- result.Domain = ConnectorDomain.DomainPiping.ToString();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
+ result.Domain = connector.Domain.ToString();
|
|
|
result.IsConnected = connector.IsConnected;
|
|
|
result.Description = connector.Description;
|
|
|
result.Origin = BimConvert.ConvertToXYZ(connector.Origin);
|
|
@@ -104,7 +92,7 @@ namespace RevitToJBim.ComponentParse
|
|
|
/// <param name="element"></param>
|
|
|
/// <param name="connectors"></param>
|
|
|
/// <returns></returns>
|
|
|
- public static ElementOneToManyRel GetConnectorRels(Element element,List<Autodesk.Revit.DB.Connector> connectors)
|
|
|
+ public static ElementOneToManyRel GetConnectorRels(Element element, List<Autodesk.Revit.DB.Connector> connectors)
|
|
|
{
|
|
|
ElementOneToManyRel relMany = new ElementOneToManyRel(element.Id.ToString()) { RelatedObjects = new List<string>() };
|
|
|
relMany.SetElementType(TypeDefinition.Property_ConnectedIds);
|