/// <summary> /// Creates door lining properties. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="familyInstance"> /// The family instance of a door. /// </param> /// <returns> /// The handle created. /// </returns> public static IFCAnyHandle CreateDoorLiningProperties(ExporterIFC exporterIFC, Element familyInstance) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle(); double?liningDepthOpt = null; double?liningThicknessOpt = null; double?thresholdDepthOpt = null; double?thresholdThicknessOpt = null; double?transomThicknessOpt = null; double?transomOffsetOpt = null; double?liningOffsetOpt = null; double?thresholdOffsetOpt = null; double?casingThicknessOpt = null; double?casingDepthOpt = null; double value1, value2; // both of these must be defined, or not defined - if only one is defined, we ignore the values. if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "LiningDepth", out value1)) { if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "LiningThickness", out value2)) { liningDepthOpt = value1; liningThicknessOpt = value2; } } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningOffset", out value1)) { liningOffsetOpt = value1; } // both of these must be defined, or not defined - if only one is defined, we ignore the values. if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "ThresholdDepth", out value1)) { if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "ThresholdThickness", out value2)) { thresholdDepthOpt = value1; thresholdThicknessOpt = value2; } } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "ThreshholdOffset", out value1)) { liningOffsetOpt = value1; } // both of these must be defined, or not defined - if only one is defined, we ignore the values. if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "TransomOffset", out value1)) { if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "TransomThickness", out value2)) { transomOffsetOpt = value1; transomThicknessOpt = value2; } } // both of these must be defined, or not defined - if only one is defined, we ignore the values. if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "CasingDepth", out value1)) { if (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "CasingThickness", out value2)) { casingDepthOpt = value1; casingThicknessOpt = value2; } } string doorLiningGUID = ExporterIFCUtils.CreateSubElementGUID(familyInstance, (int)IFCDoorSubElements.DoorLining); string doorLiningName = exporterIFC.GetName(); return(IFCInstanceExporter.CreateDoorLiningProperties(file, doorLiningGUID, ownerHistory, doorLiningName, null, liningDepthOpt, liningThicknessOpt, thresholdDepthOpt, thresholdThicknessOpt, transomThicknessOpt, transomOffsetOpt, liningOffsetOpt, thresholdOffsetOpt, casingThicknessOpt, casingDepthOpt, null)); }
/// <summary> /// Creates door panel properties. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="doorWindowInfo"> /// The IFCDoorWindowInfo object. /// </param> /// <param name="familyInstance"> /// The family instance of a door. /// </param> /// <returns> /// The list of handles created. /// </returns> public static IList <IFCAnyHandle> CreateDoorPanelProperties(ExporterIFC exporterIFC, IFCDoorWindowInfo doorWindowInfo, Element familyInstance) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle(); IList <IFCAnyHandle> doorPanels = new List <IFCAnyHandle>(); IList <double?> panelDepthList = new List <double?>(); IList <double?> panelWidthList = new List <double?>(); IList <IFCDoorPanelOperation> panelOperationList = new List <IFCDoorPanelOperation>(); IList <IFCDoorPanelPosition> panelPositionList = new List <IFCDoorPanelPosition>(); int panelNumber = 1; const int maxPanels = 64; // arbitrary large number to prevent infinite loops. for (; panelNumber < maxPanels; panelNumber++) { string panelDepthCurrString = "PanelDepth" + panelNumber.ToString(); string panelWidthCurrString = "PanelWidth" + panelNumber.ToString(); // We will always have at least one panel definition as long as the panelOperation is not // NotDefined. panelOperationList.Add(GetPanelOperationFromDoorStyleOperation(doorWindowInfo.DoorOperationType)); // If the panel operation is defined we'll allow no panel position for the 1st panel. IFCDoorPanelPosition?panelPosition = GetIFCDoorPanelPosition("", familyInstance, panelNumber); if (panelPosition == null) { if (panelNumber == 1) { panelPosition = GetIFCDoorPanelPosition("", familyInstance, -1); } if ((panelPosition == null) && (panelNumber > 1)) { panelPositionList.Add(IFCDoorPanelPosition.NotDefined); break; } } if (doorWindowInfo.IsFlippedInX ^ doorWindowInfo.IsFlippedInY) { panelPosition = ReverseDoorPanelPosition(panelPosition); } panelPositionList.Add(panelPosition != null ? (IFCDoorPanelPosition)panelPosition : IFCDoorPanelPosition.NotDefined); double value1 = 0.0, value2 = 0.0; bool foundDepth = ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, panelDepthCurrString, out value1); if (!foundDepth && (panelNumber == 1)) { foundDepth = ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "PanelDepth", out value1); } bool foundWidth = ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, panelWidthCurrString, out value2); if (!foundWidth && (panelNumber == 1)) { foundWidth = ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "PanelWidth", out value2); } if (foundDepth && foundWidth) { panelDepthList.Add(value1); panelWidthList.Add(value2); } else { panelDepthList.Add(null); panelWidthList.Add(null); } } // calculate panelWidths double totalPanelWidth = 0.0; for (int panelIndex = 0; (panelIndex < panelNumber - 1); panelIndex++) { if (panelDepthList[panelIndex] == null || MathUtil.IsAlmostZero((double)panelDepthList[panelIndex]) || panelWidthList[panelIndex] == null || MathUtil.IsAlmostZero((double)panelWidthList[panelIndex])) { totalPanelWidth = 0.0; break; } totalPanelWidth += (double)panelWidthList[panelIndex]; } if (!MathUtil.IsAlmostZero(totalPanelWidth)) { for (int panelIndex = 0; (panelIndex < panelNumber - 1); panelIndex++) { double?currentPanelWidth = null; if (panelWidthList[panelIndex].HasValue) { currentPanelWidth = (double)panelWidthList[panelIndex] / totalPanelWidth; } string doorPanelGUID = ExporterIFCUtils.CreateGUID(); string doorPanelName = exporterIFC.GetName(); IFCAnyHandle doorPanel = IFCInstanceExporter.CreateDoorPanelProperties(file, doorPanelGUID, ownerHistory, doorPanelName, null, panelDepthList[panelIndex], panelOperationList[panelIndex], currentPanelWidth, panelPositionList[panelIndex], null); doorPanels.Add(doorPanel); } } return(doorPanels); }