/// <summary> /// Creates a shape representation or appends existing ones to original representation. /// </summary> /// <remarks> /// This function has two modes. /// If originalShapeRepresentation has no value, then this function will create a new ShapeRepresentation handle. /// If originalShapeRepresentation has a value, then it is expected to be an aggregation of representations, and the new representation /// will be appended to the end of the list. /// </remarks> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="categoryId"> /// The category id. /// </param> /// <param name="contextOfItems"> /// The context for which the different subtypes of representation are valid. /// </param> /// <param name="identifierOpt"> /// The identifier for the representation. /// </param> /// <param name="representationTypeOpt"> /// The type handle for the representation. /// </param> /// <param name="items"> /// Collection of geometric representation items that are defined for this representation. /// </param> /// <param name="originalShapeRepresentation"> /// The original shape representation. /// </param> /// <returns> /// The handle. /// </returns> public static IFCAnyHandle CreateOrAppendShapeRepresentation(ExporterIFC exporterIFC, ElementId categoryId, IFCAnyHandle contextOfItems, IFCLabel identifierOpt, IFCLabel representationTypeOpt, HashSet<IFCAnyHandle> items, IFCAnyHandle originalShapeRepresentation) { if (originalShapeRepresentation.HasValue) { IFCGeometryUtils.AddItemsToShape(originalShapeRepresentation, items); return originalShapeRepresentation; } return CreateShapeRepresentation(exporterIFC, categoryId, contextOfItems, identifierOpt, representationTypeOpt, items); }
/// <summary> /// Exports IFC type base implementation. /// </summary> /// <param name="file">The IFC file.</param> /// <param name="type">The export type.</param> /// <param name="ifcEnumType">The string value represents the IFC type.</param> /// <param name="guid">The guid.</param> /// <param name="ownerHistory">The owner history handle.</param> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="applicableOccurrence">The optional data type of the entity.</param> /// <param name="propertySets">The property sets.</param> /// <param name="representationMapList">List of representations.</param> /// <param name="elemId">The element id label.</param> /// <param name="typeName">The IFCPlacementSetter.</param> /// <param name="instance">The family instance.</param> /// <param name="symbol">The element type.</param> /// <returns>The handle.</returns> private static IFCAnyHandle ExportGenericTypeBase(IFCFile file, IFCExportType type, string ifcEnumType, IFCLabel guid, IFCAnyHandle ownerHistory, IFCLabel name, IFCLabel description, IFCLabel applicableOccurrence, HashSet<IFCAnyHandle> propertySets, IList<IFCAnyHandle> representationMapList, IFCLabel elemId, IFCLabel typeName, Element instance, ElementType symbol) { switch (type) { case IFCExportType.ExportActuatorType: return file.CreateActuatorType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportAirTerminalBoxType: return file.CreateAirTerminalBoxType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportAirTerminalType: return file.CreateAirTerminalType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportAirToAirHeatRecoveryType: return file.CreateAirToAirHeatRecoveryType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportAlarmType: return file.CreateAlarmType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportBoilerType: return file.CreateBoilerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCableCarrierFittingType: return file.CreateCableCarrierFittingType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCableCarrierSegmentType: return file.CreateCableCarrierSegmentType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCableSegmentType: return file.CreateCableSegmentType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportChillerType: return file.CreateChillerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCoilType: return file.CreateCoilType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCompressorType: return file.CreateCompressorType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCondenserType: return file.CreateCondenserType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportControllerType: return file.CreateControllerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCooledBeamType: return file.CreateCooledBeamType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportCoolingTowerType: return file.CreateCoolingTowerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportDamperType: return file.CreateDamperType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportDistributionChamberElementType: return file.CreateDistributionChamberElementType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportDuctFittingType: return file.CreateDuctFittingType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportDuctSegmentType: return file.CreateDuctSegmentType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportDuctSilencerType: return file.CreateDuctSilencerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportElectricApplianceType: return file.CreateElectricApplianceType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportElectricFlowStorageDeviceType: return file.CreateElectricFlowStorageDeviceType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportElectricGeneratorType: return file.CreateElectricGeneratorType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportElectricHeaterType: return file.CreateElectricHeaterType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportElectricMotorType: return file.CreateElectricMotorType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportElectricTimeControlType: return file.CreateElectricTimeControlType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportEvaporativeCoolerType: return file.CreateEvaporativeCoolerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportEvaporatorType: return file.CreateEvaporatorType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportFanType: return file.CreateFanType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportFilterType: return file.CreateFilterType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportFireSuppressionTerminalType: return file.CreateFireSuppressionTerminalType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportFlowInstrumentType: return file.CreateFlowInstrumentType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportFlowMeterType: return file.CreateFlowMeterType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportFurnitureType: return file.CreateFurnitureType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportGasTerminalType: return file.CreateGasTerminalType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportHeatExchangerType: return file.CreateHeatExchangerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportHumidifierType: return file.CreateHumidifierType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportJunctionBoxType: return file.CreateJunctionBoxType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportLampType: return file.CreateLampType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportLightFixtureType: return file.CreateLightFixtureType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportMemberType: return file.CreateMemberType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportMotorConnectionType: return file.CreateMotorConnectionType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportOutletType: return file.CreateOutletType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportPlateType: return file.CreatePlateType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportPipeFittingType: return file.CreatePipeFittingType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportPipeSegmentType: return file.CreatePipeSegmentType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportProtectiveDeviceType: return file.CreateProtectiveDeviceType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportPumpType: return file.CreatePumpType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportSanitaryTerminalType: return file.CreateSanitaryTerminalType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportSensorType: return file.CreateSensorType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportSpaceHeaterType: return file.CreateSpaceHeaterType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportStackTerminalType: return file.CreateStackTerminalType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportSwitchingDeviceType: return file.CreateSwitchingDeviceType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportTankType: return file.CreateTankType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportTransformerType: return file.CreateTransformerType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportTransportElementType: return file.CreateTransportElementType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportTubeBundleType: return file.CreateTubeBundleType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportUnitaryEquipmentType: return file.CreateUnitaryEquipmentType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportValveType: return file.CreateValveType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); case IFCExportType.ExportWasteTerminalType: return file.CreateWasteTerminalType(ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemId, typeName, instance, symbol); default: return IFCAnyHandle.Create(); } }
/// <summary> /// Creates a shape representation and register it to shape representation layer. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="categoryId"> /// The category id. /// </param> /// <param name="contextOfItems"> /// The context for which the different subtypes of representation are valid. /// </param> /// <param name="identifierOpt"> /// The identifier for the representation. /// </param> /// <param name="representationTypeOpt"> /// The type handle for the representation. /// </param> /// <param name="items"> /// Collection of geometric representation items that are defined for this representation. /// </param> /// <returns> /// The handle. /// </returns> public static IFCAnyHandle CreateShapeRepresentation(ExporterIFC exporterIFC, ElementId categoryId, IFCAnyHandle contextOfItems, IFCLabel identifierOpt, IFCLabel representationTypeOpt, HashSet<IFCAnyHandle> items) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle newShapeRepresentation = file.CreateShapeRepresentation(contextOfItems, identifierOpt, representationTypeOpt, items); if (!newShapeRepresentation.HasValue) return newShapeRepresentation; // We are using the DWG export layer table to correctly map category to DWG layer for the // IfcPresentationLayerAsssignment. exporterIFC.RegisterShapeForPresentationLayer(categoryId, newShapeRepresentation); return newShapeRepresentation; }
/// <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 IFCProductWrapper.</param> /// <param name="setter">The IFCPlacementSetter.</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="instanceElemId">The element id label.</param> /// <returns>The handle.</returns> public static IFCAnyHandle ExportGenericInstance(IFCExportType type, ExporterIFC exporterIFC, Element familyInstance, IFCProductWrapper wrapper, IFCPlacementSetter setter, IFCExtrusionCreationData extraParams, IFCLabel instanceGUID, IFCAnyHandle ownerHistory, IFCLabel instanceName, IFCLabel instanceDescription, IFCLabel instanceObjectType, IFCAnyHandle productRepresentation, IFCLabel instanceElemId) { IFCFile file = exporterIFC.GetFile(); Document doc = familyInstance.Document; bool isRoomRelated = IsRoomRelated(type); IFCAnyHandle localPlacementToUse = setter.GetPlacement(); ElementId roomId = ElementId.InvalidElementId; if (isRoomRelated) { roomId = setter.UpdateRoomRelativeCoordinates(familyInstance, out localPlacementToUse); } IFCAnyHandle instanceHandle = IFCAnyHandle.Create(); switch (type) { case IFCExportType.ExportColumnType: { instanceHandle = file.CreateColumn(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); break; } case IFCExportType.ExportMemberType: { instanceHandle = file.CreateMember(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); break; } case IFCExportType.ExportPlateType: { instanceHandle = file.CreatePlate(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); break; } default: { if (IsFurnishingElementSubType(type)) { instanceHandle = file.CreateFurnishingElement(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsDistributionFlowElementSubType(type)) { instanceHandle = file.CreateDistributionFlowElement(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsEnergyConversionDeviceSubType(type)) { instanceHandle = file.CreateEnergyConversionDevice(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowFittingSubType(type)) { instanceHandle = file.CreateFlowFitting(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowMovingDeviceSubType(type)) { instanceHandle = file.CreateFlowMovingDevice(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowSegmentSubType(type)) { instanceHandle = file.CreateFlowSegment(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowStorageDeviceSubType(type)) { instanceHandle = file.CreateFlowStorageDevice(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowTerminalSubType(type)) { instanceHandle = file.CreateFlowTerminal(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowTreatmentDeviceSubType(type)) { instanceHandle = file.CreateFlowTreatmentDevice(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } else if (IsFlowControllerSubType(type)) { instanceHandle = file.CreateFlowController(instanceGUID, ownerHistory, instanceName, instanceDescription, instanceObjectType, localPlacementToUse, productRepresentation, instanceElemId); } break; } } if (instanceHandle.HasValue) { if (roomId == ElementId.InvalidElementId) { wrapper.AddElement(instanceHandle, setter, extraParams, true); } else { exporterIFC.RelateSpatialElement(roomId, instanceHandle); wrapper.AddElement(instanceHandle, setter, extraParams, false); } } return instanceHandle; }
/// <summary> /// Exports IFC type. /// </summary> /// <remarks> /// This method will override the default value of the elemId label for certain element types, and then pass it on /// to the generic routine. /// </remarks> /// <param name="file">The IFC file.</param> /// <param name="type">The export type.</param> /// <param name="ifcEnumType">The string value represents the IFC type.</param> /// <param name="guid">The guid.</param> /// <param name="ownerHistory">The owner history handle.</param> /// <param name="name">The name.</param> /// <param name="description">The description.</param> /// <param name="applicableOccurrence">The optional data type of the entity.</param> /// <param name="propertySets">The property sets.</param> /// <param name="representationMapList">List of representations.</param> /// <param name="elemId">The element id label.</param> /// <param name="typeName">The IFCPlacementSetter.</param> /// <param name="instance">The family instance.</param> /// <param name="symbol">The element type.</param> /// <returns>The handle.</returns> public static IFCAnyHandle ExportGenericType(IFCFile file, IFCExportType type, string ifcEnumType, IFCLabel guid, IFCAnyHandle ownerHistory, IFCLabel name, IFCLabel description, IFCLabel applicableOccurrence, HashSet<IFCAnyHandle> propertySets, IList<IFCAnyHandle> representationMapList, IFCLabel elemId, IFCLabel typeName, Element instance, ElementType symbol) { IFCLabel elemIdToUse = elemId; switch (type) { case IFCExportType.ExportFurnitureType: case IFCExportType.ExportMemberType: case IFCExportType.ExportPlateType: { elemIdToUse = NamingUtil.CreateIFCElementId(instance); break; } } return ExportGenericTypeBase(file, type, ifcEnumType, guid, ownerHistory, name, description, applicableOccurrence, propertySets, representationMapList, elemIdToUse, typeName, instance, symbol); }
/// <summary> /// Gets override object type from element. /// </summary> /// <param name="element"> /// The element. /// </param> /// <param name="originalValue"> /// The original value. /// </param> /// <returns> /// The IFCLabel contains the object type string value. /// </returns> public static IFCLabel GetObjectTypeOverride(Element element, IFCLabel originalValue) { string nameOverride = "ObjectTypeOverride"; return GetOverrideStringValue(element, nameOverride, originalValue); }
/// <summary> /// Gets override description from element. /// </summary> /// <param name="element"> /// The element. /// </param> /// <param name="originalValue"> /// The original value. /// </param> /// <returns> /// The IFCLabel contains the description string value. /// </returns> public static IFCLabel GetDescriptionOverride(Element element, IFCLabel originalValue) { string nameOverride = "IfcDescription"; return GetOverrideStringValue(element, nameOverride, originalValue); }
/// <summary> /// Gets override string value from element parameter. /// </summary> /// <param name="element"> /// The element. /// </param> /// <param name="parameterName"> /// The parameter name. /// </param> /// <param name="originalValue"> /// The original value. /// </param> /// <returns> /// The IFCLabel contains the string value. /// </returns> public static IFCLabel GetOverrideStringValue(Element element, string parameterName, IFCLabel originalValue) { string strValue; // get the IFC Name Override if (element != null) { if (ParameterUtil.GetStringValueFromElement(element, parameterName, out strValue)) { return IFCLabel.Create(strValue); } } return originalValue; }
/// <summary> /// Creates window panel properties. /// </summary> /// <parameter name="exporterIFC"> /// The ExporterIFC object. /// </parameter> /// <parameter name="doorWindowInfo"> /// The IFCDoorWindowInfo object. /// </parameter> /// <parameter name="familyInstance"> /// The family instance of a window. /// </parameter> /// <parameter name="description"> /// The description. /// </parameter> /// <returns> /// The list of handles created. /// </returns> public static IList<IFCAnyHandle> CreateWindowPanelProperties(ExporterIFC exporterIFC, Element familyInstance, IFCLabel description) { IList<IFCAnyHandle> panels = new List<IFCAnyHandle>(); IFCFile file = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle(); const int maxPanels = 1000; // arbitrary large number to prevent infinite loops. for (int panelNum = 1; panelNum < maxPanels; panelNum++) { string frameDepthCurrString = "FrameDepth" + panelNum.ToString(); string frameThicknessCurrString = "FrameThickness" + panelNum.ToString(); string panelOperation = GetIFCWindowPanelOperation("", familyInstance, panelNum); string panelPosition = GetIFCWindowPanelPosition("", familyInstance, panelNum); if (panelOperation == "NotDefined" && panelPosition == "NotDefined") break; IFCMeasureValue frameDepthOpt = IFCMeasureValue.Create(); IFCMeasureValue frameThicknessOpt = IFCMeasureValue.Create(); IFCAnyHandle shapeAspectStyleOpt = IFCAnyHandle.Create(); double value1, value2; if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, frameDepthCurrString, out value1) || ((panelNum == 1) && (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FrameDepth", out value1)))) && (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, frameThicknessCurrString, out value2) || ((panelNum == 1) && (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FrameThickness", out value2))))) { frameDepthOpt = IFCMeasureValue.Create(value1); frameThicknessOpt = IFCMeasureValue.Create(value2); } IFCLabel panelGUID = IFCLabel.CreateGUID(); IFCLabel panelName = NamingUtil.CreateIFCName(exporterIFC, panelNum); panels.Add(file.CreateWindowPanelProperties(panelGUID, ownerHistory, panelName, description, panelOperation, panelPosition, frameDepthOpt, frameThicknessOpt, shapeAspectStyleOpt)); } return panels; }
/// <summary> /// Creates window panel position. /// </summary> /// <parameter name="exporterIFC"> /// The ExporterIFC object. /// </parameter> /// <parameter name="familyInstance"> /// The family instance of a window. /// </parameter> /// <parameter name="description"> /// The description. /// </parameter> /// <returns> /// The handle created. /// </returns> public static IFCAnyHandle CreateWindowLiningProperties(ExporterIFC exporterIFC, Element familyInstance, IFCLabel description) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle(); IFCMeasureValue liningDepthOpt = IFCMeasureValue.Create(); IFCMeasureValue liningThicknessOpt = IFCMeasureValue.Create(); IFCMeasureValue transomThicknessOpt = IFCMeasureValue.Create(); IFCMeasureValue mullionThicknessOpt = IFCMeasureValue.Create(); IFCMeasureValue firstTransomOffsetOpt = IFCMeasureValue.Create(); IFCMeasureValue secondTransomOffsetOpt = IFCMeasureValue.Create(); IFCMeasureValue firstMullionOffsetOpt = IFCMeasureValue.Create(); IFCMeasureValue secondMullionOffsetOpt = IFCMeasureValue.Create(); IFCAnyHandle shapeAspectStyleOpt = IFCAnyHandle.Create(); double value1 = 0.0; double value2 = 0.0; // both of these must be defined (or not defined) if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningDepth", out value1) && ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningThickness", out value2)) { liningDepthOpt = IFCMeasureValue.Create(value1); liningThicknessOpt = IFCMeasureValue.Create(value2); } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "TransomThickness", out value1)) transomThicknessOpt = IFCMeasureValue.Create(value1); if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FirstTransomOffset", out value1)) firstTransomOffsetOpt = IFCMeasureValue.Create(value1); if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "SecondTransomOffset", out value1)) secondTransomOffsetOpt = IFCMeasureValue.Create(value1); if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "MullionThickness", out value1)) mullionThicknessOpt = IFCMeasureValue.Create(value1); if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FirstMullionOffset", out value1)) firstMullionOffsetOpt = IFCMeasureValue.Create(value1); if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "SecondMullionOffset", out value1)) secondMullionOffsetOpt = IFCMeasureValue.Create(value1); IFCLabel windowLiningGUID = IFCLabel.CreateGUID(); IFCLabel windowLiningName = NamingUtil.CreateIFCName(exporterIFC, -1); return file.CreateWindowLiningProperties(windowLiningGUID, ownerHistory, windowLiningName, description, liningDepthOpt, liningThicknessOpt, transomThicknessOpt, mullionThicknessOpt, firstTransomOffsetOpt, secondTransomOffsetOpt, firstMullionOffsetOpt, secondMullionOffsetOpt, shapeAspectStyleOpt); }