/// <summary> /// Gets export type from IFC class name. /// </summary> /// <param name="originalIFCClassName">The IFC class name.</param> /// <returns>The export type.</returns> public static IFCExportInfoPair GetExportTypeFromClassName(String originalIFCClassName) { IFCExportInfoPair exportInfoPair = new IFCExportInfoPair(); string cleanIFCClassName = originalIFCClassName.Trim(); if (cleanIFCClassName.StartsWith("Ifc", true, null)) { // Here we try to catch any possible types that are missing above by checking both the class name or the type name // Unless there is any special treatment needed most of the above check can be done here string clName = cleanIFCClassName.Substring(cleanIFCClassName.Length - 4, 4).Equals("Type", StringComparison.CurrentCultureIgnoreCase) ? cleanIFCClassName.Substring(0, cleanIFCClassName.Length - 4) : cleanIFCClassName; // Deal with small number of IFC2x3/IFC4 types that have changed in a hardwired way. if (ExporterCacheManager.ExportOptionsCache.ExportAsOlderThanIFC4) { if (string.Compare(clName, "IfcBurner", true) == 0) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcGasTerminalType); } else if (string.Compare(clName, "IfcElectricDistributionBoard", true) == 0) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcElectricDistributionPoint); } else { exportInfoPair.SetValueWithPair(clName); } } else { if (string.Compare(clName, "IfcGasTerminal", true) == 0) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcBurnerType); } else if (string.Compare(clName, "IfcElectricDistributionPoint", true) == 0) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcElectricDistributionBoardType); } else if (string.Compare(clName, "IfcElectricHeater", true) == 0) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcSpaceHeaterType); } else { exportInfoPair.SetValueWithPair(clName); } } if (exportInfoPair.ExportInstance == IFCEntityType.UnKnown) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcBuildingElementProxy); } } exportInfoPair.ValidatedPredefinedType = IFCValidateEntry.GetValidIFCPredefinedType("NOTDEFINED", exportInfoPair.ExportType.ToString()); return(exportInfoPair); }
/// <summary> /// Gets export type from IFC class name. /// </summary> /// <param name="originalIFCClassName">The IFC class name.</param> /// <returns>The export type.</returns> public static IFCExportInfoPair GetExportTypeFromClassName(String originalIFCClassName) { IFCExportInfoPair exportInfoPair = new IFCExportInfoPair(); string cleanIFCClassName = originalIFCClassName.Trim().ToUpper(); if (cleanIFCClassName.StartsWith("IFC")) { // Here we try to catch any possible types that are missing above by checking both the class name or the type name // Unless there is any special treatment needed most of the above check can be done here string clName = cleanIFCClassName.Substring(cleanIFCClassName.Length - 4, 4).Equals("Type", StringComparison.CurrentCultureIgnoreCase) ? cleanIFCClassName.Substring(0, cleanIFCClassName.Length - 4) : cleanIFCClassName; // Deal with small number of IFC2x3/IFC4 types that have changed in a hardwired way. if (ExporterCacheManager.ExportOptionsCache.ExportAsOlderThanIFC4) { if (PreIFC4Remap.TryGetValue(clName, out IFCEntityType ifcEntityType)) exportInfoPair.SetValueWithPair(ifcEntityType); else exportInfoPair.SetValueWithPair(clName); } else { if (IFC4Remap.TryGetValue(clName, out IFCEntityType ifcEntityType)) exportInfoPair.SetValueWithPair(ifcEntityType); else exportInfoPair.SetValueWithPair(clName); } if (exportInfoPair.ExportInstance == IFCEntityType.UnKnown) exportInfoPair.SetValueWithPair(IFCEntityType.IfcBuildingElementProxy); } exportInfoPair.ValidatedPredefinedType = IFCValidateEntry.GetValidIFCPredefinedType("NOTDEFINED", exportInfoPair.ExportType.ToString()); return exportInfoPair; }
/// <summary> /// Gets export type from category id. /// </summary> /// <param name="categoryId">The category id.</param> /// <param name="ifcEnumType">The string value represents the IFC type.</param> /// <returns>The export type.</returns> public static IFCExportInfoPair GetExportTypeFromCategoryId(ElementId categoryId, out string ifcEnumType) { IFCExportInfoPair exportInfoPair = new IFCExportInfoPair(); ifcEnumType = "NOTDEFINED"; if (categoryId == new ElementId(BuiltInCategory.OST_Cornices)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcBeam, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Ceilings)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcCovering, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_CurtainWallPanels)) { ifcEnumType = "CURTAIN_PANEL"; exportInfoPair.SetValueWithPair(IFCEntityType.IfcPlate, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Doors)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcDoor, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Furniture)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcFurniture, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Floors)) { ifcEnumType = "FLOOR"; exportInfoPair.SetValueWithPair(IFCEntityType.IfcSlab, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_IOSModelGroups)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcGroup, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Mass)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcBuildingElementProxy, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_CurtainWallMullions)) { ifcEnumType = "MULLION"; exportInfoPair.SetValueWithPair(IFCEntityType.IfcMember, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Railings)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcRailing, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Ramps)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcRamp, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Roofs)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcRoof, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Site)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcSite, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Stairs)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcStair, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Walls)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcWall, ifcEnumType); } else if (categoryId == new ElementId(BuiltInCategory.OST_Windows)) { exportInfoPair.SetValueWithPair(IFCEntityType.IfcWindow, ifcEnumType); } return(exportInfoPair); }