/// <summary> /// Creates a handle representing an IfcSpace and assigns it to the file. /// </summary> /// <param name="file">The file.</param> /// <param name="guid">The GUID.</param> /// <param name="ownerHistory">The owner history.</param> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="objectType">The object type.</param> /// <param name="objectPlacement">The object placement.</param> /// <param name="representation">The representation object.</param> /// <param name="longName">The long name.</param> /// <param name="compositionType">The composition type.</param> /// <param name="internalOrExternal">Specify if it is an exterior space (i.e. part of the outer space) or an interior space.</param> /// <param name="elevation">The elevation with flooring measurement.</param> /// <returns>The handle.</returns> public static IFCAnyHandle CreateSpace(IFCFile file, string guid, IFCAnyHandle ownerHistory, string name, string description, string objectType, IFCAnyHandle objectPlacement, IFCAnyHandle representation, string longName, IFCElementComposition compositionType, IFCInternalOrExternal internalOrExternal, double? elevation) { ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType); IFCAnyHandle space = CreateInstance(file, IFCEntityType.IfcSpace); if (ExporterCacheManager.ExportOptionsCache.ExportAs4) { // In IFC4 the position of the attribute is replaced with PreDefinedType IFCAnyHandleUtil.SetAttribute(space, "PreDefinedType", IFC4.IFCSpaceType.SPACE); } else { // set this attribute only when it is exported to format PRIOR to IFC4. The attribute has been removed/replaced in IFC4 and the property is moved to property set Pset_SpaceCommon.IsExternal IFCAnyHandleUtil.SetAttribute(space, "InteriorOrExteriorSpace", internalOrExternal); } IFCAnyHandleUtil.SetAttribute(space, "ElevationWithFlooring", elevation); SetSpatialStructureElement(space, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType); return space; }
/// <summary> /// Constructs a SpaceBoundary object. /// </summary> /// <param name="spatialElementId"> /// The spatial element id. /// </param> /// <param name="buildingElementId"> /// The building element id. /// </param> /// <param name="levelId"> /// The level element id. /// </param> /// <param name="connectionGeometry"> /// The connection geometry handle. /// </param> /// <param name="type"> /// The type of the space boundary. /// </param> /// <param name="isExternal"> /// Indicates if the space boundary is external or not. /// </param> public SpaceBoundary(ElementId spatialElementId, ElementId buildingElementId, ElementId levelId, IFCAnyHandle connectionGeometry, IFCPhysicalOrVirtual type, IFCInternalOrExternal internalOrExternal) { this.m_SpatialElementId = spatialElementId; this.m_BuildingElementId = buildingElementId; this.m_ConnectionGeometry = connectionGeometry; this.m_Type = type; this.m_internalOrExternal = internalOrExternal; this.m_LevelId = levelId; }
/// <summary> /// Constructs a SpaceBoundary object. /// </summary> /// <param name="name">The optional name of the space boundary.</param> /// <param name="spatialElementId">The spatial element id.</param> /// <param name="buildingElementId">The building element id.</param> /// <param name="levelId">The level element id.</param> /// <param name="connectionGeometry">The connection geometry handle.</param> /// <param name="type">The type of the space boundary.</param> /// <param name="isExternal">Indicates if the space boundary is external or not.</param> public SpaceBoundary(string name, ElementId spatialElementId, ElementId buildingElementId, ElementId levelId, IFCAnyHandle connectionGeometry, IFCPhysicalOrVirtual type, IFCInternalOrExternal internalOrExternal) { Name = name; SpatialElementId = spatialElementId; BuildingElementId = buildingElementId; ConnectionGeometryHandle = connectionGeometry; SpaceBoundaryType = type; InternalOrExternal = internalOrExternal; LevelId = levelId; }
/// <summary> /// Constructs a SpaceBoundary object. /// </summary> /// <param name="spatialElementId"> /// The spatial element id. /// </param> /// <param name="buildingElementId"> /// The building element id. /// </param> /// <param name="levelId"> /// The level element id. /// </param> /// <param name="connectionGeometry"> /// The connection geometry handle. /// </param> /// <param name="type"> /// The type of the space boundary. /// </param> /// <param name="isExternal"> /// Indicates if the space boundary is external or not. /// </param> public SpaceBoundary(ElementId spatialElementId, ElementId buildingElementId, ElementId levelId, IFCAnyHandle connectionGeometry, IFCPhysicalOrVirtual type, IFCInternalOrExternal internalOrExternal) { this.m_SpatialElementId = spatialElementId; this.m_BuildingElementId = buildingElementId; this.m_ConnectionGeometry = connectionGeometry; this.m_Type = type; this.m_internalOrExternal = internalOrExternal; this.m_LevelId = levelId; }
/// <summary> /// Creates an IfcRelSpaceBoundary and assigns it to the file. /// </summary> /// <param name="file">The file.</param> /// <param name="guid">The GUID.</param> /// <param name="ownerHistory">The owner history.</param> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="relatingSpace">The relating space handle.</param> /// <param name="relatedBuildingElement">The related building element.</param> /// <param name="connectionGeometry">The connection geometry.</param> /// <param name="physicalOrVirtual">The space boundary type, physical or virtual.</param> /// <param name="internalOrExternal">Internal or external.</param> /// <returns>The handle.</returns> public static IFCAnyHandle CreateRelSpaceBoundary(IFCFile file, string guid, IFCAnyHandle ownerHistory, string name, string description, IFCAnyHandle relatingSpace, IFCAnyHandle relatedBuildingElement, IFCAnyHandle connectionGeometry, IFCPhysicalOrVirtual physicalOrVirtual, IFCInternalOrExternal internalOrExternal) { ValidateRelConnects(guid, ownerHistory, name, description); IFCAnyHandleUtil.ValidateSubTypeOf(relatingSpace, false, IFCEntityType.IfcSpace); IFCAnyHandleUtil.ValidateSubTypeOf(relatedBuildingElement, true, IFCEntityType.IfcElement); IFCAnyHandleUtil.ValidateSubTypeOf(connectionGeometry, true, IFCEntityType.IfcConnectionGeometry); IFCAnyHandle relSpaceBoundary = CreateInstance(file, IFCEntityType.IfcRelSpaceBoundary); IFCAnyHandleUtil.SetAttribute(relSpaceBoundary, "RelatingSpace", relatingSpace); IFCAnyHandleUtil.SetAttribute(relSpaceBoundary, "RelatedBuildingElement", relatedBuildingElement); IFCAnyHandleUtil.SetAttribute(relSpaceBoundary, "ConnectionGeometry", connectionGeometry); IFCAnyHandleUtil.SetAttribute(relSpaceBoundary, "PhysicalOrVirtualBoundary", physicalOrVirtual); IFCAnyHandleUtil.SetAttribute(relSpaceBoundary, "InternalOrExternalBoundary", internalOrExternal); SetRelConnects(relSpaceBoundary, guid, ownerHistory, name, description); return relSpaceBoundary; }
/// <summary> /// Exports a generic family instance as IFC instance. /// </summary> /// <param name="type">The export type.</param> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="familyInstance">The element.</param> /// <param name="wrapper">The ProductWrapper.</param> /// <param name="setter">The PlacementSetter.</param> /// <param name="extraParams">The extrusion creation data.</param> /// <param name="instanceGUID">The guid.</param> /// <param name="ownerHistory">The owner history handle.</param> /// <param name="instanceName">The name.</param> /// <param name="instanceDescription">The description.</param> /// <param name="instanceObjectType">The object type.</param> /// <param name="productRepresentation">The representation handle.</param> /// <param name="instanceTag">The tag for the entity, usually based on the element id.</param> /// <param name="ifcEnumType">The predefined type/shape type, if any, for the object.</param> /// <param name="overrideLocalPlacement">The local placement to use instead of the one in the placement setter, if appropriate.</param> /// <returns>The handle.</returns> public static IFCAnyHandle ExportGenericInstance(IFCExportInfoPair type, ExporterIFC exporterIFC, Element familyInstance, ProductWrapper wrapper, PlacementSetter setter, IFCExtrusionCreationData extraParams, string instanceGUID, IFCAnyHandle ownerHistory, IFCAnyHandle productRepresentation, string ifcEnumType, IFCAnyHandle overrideLocalPlacement) { IFCFile file = exporterIFC.GetFile(); Document doc = familyInstance.Document; bool isRoomRelated = IsRoomRelated(type); bool isChildInContainer = familyInstance.AssemblyInstanceId != ElementId.InvalidElementId; IFCAnyHandle localPlacementToUse = setter.LocalPlacement; ElementId roomId = ElementId.InvalidElementId; if (isRoomRelated) { roomId = setter.UpdateRoomRelativeCoordinates(familyInstance, out localPlacementToUse); } //should remove the create method where there is no use of this handle for API methods //some places uses the return value of ExportGenericInstance as input parameter for API methods IFCAnyHandle instanceHandle = null; switch (type.ExportInstance) { case IFCEntityType.IfcBeam: { string preDefinedType = string.IsNullOrWhiteSpace(type.ValidatedPredefinedType) ? "BEAM" : type.ValidatedPredefinedType; instanceHandle = IFCInstanceExporter.CreateBeam(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, preDefinedType); break; } case IFCEntityType.IfcColumn: { string preDefinedType = string.IsNullOrWhiteSpace(type.ValidatedPredefinedType) ? "COLUMN" : type.ValidatedPredefinedType; instanceHandle = IFCInstanceExporter.CreateColumn(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, preDefinedType); break; } case IFCEntityType.IfcCurtainWall: { instanceHandle = IFCInstanceExporter.CreateCurtainWall(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, type.ValidatedPredefinedType); break; } case IFCEntityType.IfcMember: { string preDefinedType = string.IsNullOrWhiteSpace(type.ValidatedPredefinedType) ? "BRACE" : type.ValidatedPredefinedType; instanceHandle = IFCInstanceExporter.CreateMember(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, preDefinedType); // Register the members's IFC handle for later use by truss export. ExporterCacheManager.ElementToHandleCache.Register(familyInstance.Id, instanceHandle); break; } case IFCEntityType.IfcPlate: { IFCAnyHandle localPlacement = localPlacementToUse; if (overrideLocalPlacement != null) { isChildInContainer = true; localPlacement = overrideLocalPlacement; } string preDefinedType = string.IsNullOrWhiteSpace(type.ValidatedPredefinedType) ? "NOTDEFINED" : type.ValidatedPredefinedType; instanceHandle = IFCInstanceExporter.CreatePlate(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacement, productRepresentation, preDefinedType); break; } case IFCEntityType.IfcMechanicalFastener: { double?nominalDiameter = null; double?nominalLength = null; double nominalDiameterVal, nominalLengthVal; if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "NominalDiameter", out nominalDiameterVal) != null) { nominalDiameter = UnitUtil.ScaleLength(nominalDiameterVal); } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "NominalLength", out nominalLengthVal) != null) { nominalLength = UnitUtil.ScaleLength(nominalLengthVal); } string preDefinedType = string.IsNullOrWhiteSpace(type.ValidatedPredefinedType) ? "NOTDEFINED" : type.ValidatedPredefinedType; instanceHandle = IFCInstanceExporter.CreateMechanicalFastener(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, nominalDiameter, nominalLength, preDefinedType); break; } case IFCEntityType.IfcRailing: { //string strEnumType; //IFCExportInfoPair exportAs = ExporterUtil.GetExportType(exporterIFC, familyInstance, out strEnumType); //if (ExporterCacheManager.ExportOptionsCache.ExportAs4) //{ // instanceHandle = IFCInstanceExporter.CreateRailing(exporterIFC, familyInstance, instanceGUID, ownerHistory, // localPlacementToUse, productRepresentation, GetPreDefinedType<Toolkit.IFC4.IFCRailingType>(familyInstance, strEnumType).ToString()); //} //else //{ // instanceHandle = IFCInstanceExporter.CreateRailing(exporterIFC, familyInstance, instanceGUID, ownerHistory, // localPlacementToUse, productRepresentation, GetPreDefinedType<Toolkit.IFCRailingType>(familyInstance, strEnumType).ToString()); //} string preDefinedType = string.IsNullOrWhiteSpace(type.ValidatedPredefinedType) ? "NOTDEFINED" : type.ValidatedPredefinedType; instanceHandle = IFCInstanceExporter.CreateRailing(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, preDefinedType); break; } case IFCEntityType.IfcSpace: { IFCInternalOrExternal internalOrExternal = CategoryUtil.IsElementExternal(familyInstance) ? IFCInternalOrExternal.External : IFCInternalOrExternal.Internal; instanceHandle = IFCInstanceExporter.CreateSpace(exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation, IFCElementComposition.Element, internalOrExternal); break; } default: { // !!! These entities are deprecated in IFC4 and will be made abstract in the next version. // It is still kept as it is because if we generate an IfcBuildingElementProxy, teh connectivity will be lost if (ExporterCacheManager.ExportOptionsCache.ExportAs4 && (type.ExportInstance == IFCEntityType.IfcDistributionElement || type.ExportInstance == IFCEntityType.IfcEnergyConversionDevice || type.ExportInstance == IFCEntityType.IfcFlowController || type.ExportInstance == IFCEntityType.IfcFlowFitting || type.ExportInstance == IFCEntityType.IfcFlowMovingDevice || type.ExportInstance == IFCEntityType.IfcFlowSegment || type.ExportInstance == IFCEntityType.IfcFlowStorageDevice || type.ExportInstance == IFCEntityType.IfcFlowTerminal || type.ExportInstance == IFCEntityType.IfcFlowTreatmentDevice)) { instanceHandle = IFCInstanceExporter.CreateGenericIFCEntity(type, exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation); } else { if (type.ExportInstance != IFCEntityType.UnKnown) { instanceHandle = IFCInstanceExporter.CreateGenericIFCEntity(type, exporterIFC, familyInstance, instanceGUID, ownerHistory, localPlacementToUse, productRepresentation); } } break; } } if (!IFCAnyHandleUtil.IsNullOrHasNoValue(instanceHandle)) { bool containedInSpace = (roomId != ElementId.InvalidElementId); bool associateToLevel = containedInSpace ? false : !isChildInContainer; wrapper.AddElement(familyInstance, instanceHandle, setter, extraParams, associateToLevel); if (containedInSpace) { ExporterCacheManager.SpaceInfoCache.RelateToSpace(roomId, instanceHandle); } } return(instanceHandle); }
/// <summary> /// Creates a handle representing an IfcSpace and assigns it to the file. /// </summary> /// <param name="file">The file.</param> /// <param name="guid">The GUID.</param> /// <param name="ownerHistory">The owner history.</param> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="objectType">The object type.</param> /// <param name="objectPlacement">The object placement.</param> /// <param name="representation">The representation object.</param> /// <param name="longName">The long name.</param> /// <param name="compositionType">The composition type.</param> /// <param name="internalOrExternal">Specify if it is an exterior space (i.e. part of the outer space) or an interior space.</param> /// <param name="elevation">The elevation with flooring measurement.</param> /// <returns>The handle.</returns> public static IFCAnyHandle CreateSpace(IFCFile file, string guid, IFCAnyHandle ownerHistory, string name, string description, string objectType, IFCAnyHandle objectPlacement, IFCAnyHandle representation, string longName, IFCElementComposition compositionType, IFCInternalOrExternal internalOrExternal, double? elevation) { ValidateSpatialStructureElement(guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType); IFCAnyHandle space = CreateInstance(file, IFCEntityType.IfcSpace); IFCAnyHandleUtil.SetAttribute(space, "InteriorOrExteriorSpace", internalOrExternal); IFCAnyHandleUtil.SetAttribute(space, "ElevationWithFlooring", elevation); SetSpatialStructureElement(space, guid, ownerHistory, name, description, objectType, objectPlacement, representation, longName, compositionType); return space; }
/// <summary> /// Exports a generic family instance as IFC instance. /// </summary> /// <param name="type">The export type.</param> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="familyInstance">The element.</param> /// <param name="wrapper">The ProductWrapper.</param> /// <param name="setter">The PlacementSetter.</param> /// <param name="extraParams">The extrusion creation data.</param> /// <param name="instanceGUID">The guid.</param> /// <param name="ownerHistory">The owner history handle.</param> /// <param name="instanceName">The name.</param> /// <param name="instanceDescription">The description.</param> /// <param name="instanceObjectType">The object type.</param> /// <param name="productRepresentation">The representation handle.</param> /// <param name="instanceTag">The tag for the entity, usually based on the element id.</param> /// <param name="ifcEnumType">The predefined type/shape type, if any, for the object.</param> /// <param name="overrideLocalPlacement">The local placement to use instead of the one in the placement setter, if appropriate.</param> /// <returns>The handle.</returns> public static IFCAnyHandle ExportGenericInstance(IFCExportType type, ExporterIFC exporterIFC, Element familyInstance, ProductWrapper wrapper, PlacementSetter setter, IFCExtrusionCreationData extraParams, string instanceGUID, IFCAnyHandle ownerHistory, string instanceName, string instanceDescription, string instanceObjectType, IFCAnyHandle productRepresentation, string instanceTag, string ifcEnumType, IFCAnyHandle overrideLocalPlacement) { IFCFile file = exporterIFC.GetFile(); Document doc = familyInstance.Document; bool isRoomRelated = IsRoomRelated(type); bool isChildInContainer = familyInstance.AssemblyInstanceId != ElementId.InvalidElementId; IFCAnyHandle localPlacementToUse = setter.LocalPlacement; ElementId roomId = ElementId.InvalidElementId; if (isRoomRelated) { roomId = setter.UpdateRoomRelativeCoordinates(familyInstance, out localPlacementToUse); } //should remove the create method where there is no use of this handle for API methods //some places uses the return value of ExportGenericInstance as input parameter for API methods IFCAnyHandle instanceHandle = null; switch (type) { case IFCExportType.IfcBeam: case IFCExportType.IfcBeamType: { string preDefinedType = string.IsNullOrWhiteSpace(ifcEnumType) ? "BEAM" : ifcEnumType; instanceHandle = IFCInstanceExporter.CreateBeam(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, preDefinedType); break; } case IFCExportType.IfcColumn: case IFCExportType.IfcColumnType: { string preDefinedType = string.IsNullOrWhiteSpace(ifcEnumType) ? "COLUMN" : ifcEnumType; instanceHandle = IFCInstanceExporter.CreateColumn(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, preDefinedType); break; } case IFCExportType.IfcCurtainWall: case IFCExportType.IfcCurtainWallType: { instanceHandle = IFCInstanceExporter.CreateCurtainWall(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); break; } case IFCExportType.IfcMember: case IFCExportType.IfcMemberType: { string preDefinedType = string.IsNullOrWhiteSpace(ifcEnumType) ? "BRACE" : ifcEnumType; instanceHandle = IFCInstanceExporter.CreateMember(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, preDefinedType); // Register the members's IFC handle for later use by truss export. ExporterCacheManager.ElementToHandleCache.Register(familyInstance.Id, instanceHandle); break; } case IFCExportType.IfcPlate: case IFCExportType.IfcPlateType: { IFCAnyHandle localPlacement = localPlacementToUse; if (overrideLocalPlacement != null) { isChildInContainer = true; localPlacement = overrideLocalPlacement; } string preDefinedType = string.IsNullOrWhiteSpace(ifcEnumType) ? "NOTDEFINED" : ifcEnumType; instanceHandle = IFCInstanceExporter.CreatePlate(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacement, productRepresentation, instanceTag, preDefinedType); break; } case IFCExportType.IfcDiscreteAccessoryType: { instanceHandle = IFCInstanceExporter.CreateDiscreteAccessory(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); break; } case IFCExportType.IfcDistributionControlElement: { instanceHandle = IFCInstanceExporter.CreateDistributionControlElement(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, null); break; } case IFCExportType.IfcDistributionFlowElement: { instanceHandle = IFCInstanceExporter.CreateDistributionFlowElement(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); break; } case IFCExportType.IfcDistributionChamberElement: case IFCExportType.IfcDistributionChamberElementType: { instanceHandle = IFCInstanceExporter.CreateGenericIFCEntity(Common.Enums.IFCEntityType.IfcDistributionChamberElement, file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); break; } case IFCExportType.IfcFastenerType: { instanceHandle = IFCInstanceExporter.CreateFastener(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); break; } case IFCExportType.IfcMechanicalFastenerType: { double?nominalDiameter = null; double?nominalLength = null; double nominalDiameterVal, nominalLengthVal; if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "NominalDiameter", out nominalDiameterVal) != null) { nominalDiameter = UnitUtil.ScaleLength(nominalDiameterVal); } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "NominalLength", out nominalLengthVal) != null) { nominalLength = UnitUtil.ScaleLength(nominalLengthVal); } string preDefinedType = string.IsNullOrWhiteSpace(ifcEnumType) ? "NOTDEFINED" : ifcEnumType; instanceHandle = IFCInstanceExporter.CreateMechanicalFastener(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, nominalDiameter, nominalLength, preDefinedType); break; } case IFCExportType.IfcRailingType: { string strEnumType; IFCExportType exportAs = ExporterUtil.GetExportType(exporterIFC, familyInstance, out strEnumType); if (ExporterCacheManager.ExportOptionsCache.ExportAs4) { instanceHandle = IFCInstanceExporter.CreateRailing(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, GetPreDefinedType <Toolkit.IFC4.IFCRailingType>(familyInstance, strEnumType).ToString()); } else { instanceHandle = IFCInstanceExporter.CreateRailing(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, GetPreDefinedType <Toolkit.IFCRailingType>(familyInstance, strEnumType).ToString()); } break; } case IFCExportType.IfcSpace: { string instanceLongName = NamingUtil.GetLongNameOverride(familyInstance, NamingUtil.GetLongNameOverride(familyInstance, instanceName)); IFCInternalOrExternal internalOrExternal = CategoryUtil.IsElementExternal(familyInstance) ? IFCInternalOrExternal.External : IFCInternalOrExternal.Internal; instanceHandle = IFCInstanceExporter.CreateSpace(file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceLongName, IFCElementComposition.Element, internalOrExternal, null); break; } default: { if (ExporterCacheManager.ExportOptionsCache.ExportAs4 && (type == IFCExportType.IfcDistributionElement || type == IFCExportType.IfcEnergyConversionDevice || type == IFCExportType.IfcFlowController || type == IFCExportType.IfcFlowFitting || type == IFCExportType.IfcFlowMovingDevice || type == IFCExportType.IfcFlowSegment || type == IFCExportType.IfcFlowStorageDevice || type == IFCExportType.IfcFlowTerminal || type == IFCExportType.IfcFlowTreatmentDevice)) { // for IFC4, there are several entities that are valid in IFC2x3 but now have been made abstract or deprecated, so cannot be created. Create proxy instead. //instanceHandle = IFCInstanceExporter.CreateBuildingElementProxy(file, instanceGUID, ownerHistory, // instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag, // Toolkit.IFC4.IFCBuildingElementProxyType.USERDEFINED.ToString()); Common.Enums.IFCEntityType exportEntity = Common.Enums.IFCEntityType.UnKnown; if (Enum.TryParse(type.ToString(), out exportEntity)) { instanceHandle = IFCInstanceExporter.CreateGenericIFCEntity(exportEntity, file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); } } else if ((type == IFCExportType.IfcPile) || (type == IFCExportType.IfcFurnishingElement) || IsFurnishingElementSubType(type) || (type == IFCExportType.IfcEnergyConversionDevice) || IsEnergyConversionDeviceSubType(type) || (type == IFCExportType.IfcFlowFitting) || IsFlowFittingSubType(type) || (type == IFCExportType.IfcFlowMovingDevice) || IsFlowMovingDeviceSubType(type) || (type == IFCExportType.IfcFlowSegment) || IsFlowSegmentSubType(type) || (type == IFCExportType.IfcFlowStorageDevice) || IsFlowStorageDeviceSubType(type) || (type == IFCExportType.IfcFlowTerminal) || IsFlowTerminalSubType(type) || (type == IFCExportType.IfcFlowTreatmentDevice) || IsFlowTreatmentDeviceSubType(type) || (type == IFCExportType.IfcFlowController) || IsFlowControllerSubType(type) || (type == IFCExportType.IfcDistributionFlowElement) || IsDistributionFlowElementSubType(type) || (type == IFCExportType.IfcDistributionControlElement) || IsDistributionControlElementSubType(type) || (type == IFCExportType.IfcBuildingElementProxy) || (type == IFCExportType.IfcBuildingElementProxyType)) { string exportEntityStr = type.ToString(); Common.Enums.IFCEntityType exportEntity = Common.Enums.IFCEntityType.UnKnown; if (String.Compare(exportEntityStr.Substring(exportEntityStr.Length - 4), "Type", true) == 0) { exportEntityStr = exportEntityStr.Substring(0, (exportEntityStr.Length - 4)); } if (!Enum.TryParse(exportEntityStr, out exportEntity)) { // This is a special case. IFC2x3 has IfcFlowElement for the instance, and both IfcElectricHeaterType and IfcSpaceHeaterType. // IFC4 has IfcSpaceHeater and IfcSpaceHeaterType. // Since IfcElectricHeater doesn't exist in IFC4, TryParse will fail. For the instance only, we will map it to IfcSpaceHeater, // which will in turn be redirected to IfcFlowElement for IFC2x3, if necessary. if (type == IFCExportType.IfcElectricHeaterType) { exportEntity = Common.Enums.IFCEntityType.IfcSpaceHeater; } else { exportEntity = Common.Enums.IFCEntityType.UnKnown; } } if (exportEntity != Common.Enums.IFCEntityType.UnKnown) { instanceHandle = IFCInstanceExporter.CreateGenericIFCEntity(exportEntity, file, instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceTag); } } break; } } if (!IFCAnyHandleUtil.IsNullOrHasNoValue(instanceHandle)) { bool containedInSpace = (roomId != ElementId.InvalidElementId); bool associateToLevel = containedInSpace ? false : !isChildInContainer; wrapper.AddElement(familyInstance, instanceHandle, setter, extraParams, associateToLevel); if (containedInSpace) { ExporterCacheManager.SpaceInfoCache.RelateToSpace(roomId, instanceHandle); } } return(instanceHandle); }