/// <summary> /// Creates window panel position. /// </summary> /// <param name="exporterIFC"> /// The ExporterIFC object. /// </param> /// <param name="familyInstance"> /// The family instance of a window. /// </param> /// <param name="description"> /// The description. /// </param> /// <returns> /// The handle created. /// </returns> public static IFCAnyHandle CreateWindowLiningProperties(ExporterIFC exporterIFC, Element familyInstance, string description) { IFCFile file = exporterIFC.GetFile(); IFCAnyHandle ownerHistory = exporterIFC.GetOwnerHistoryHandle(); double?liningDepthOpt = null; double?liningThicknessOpt = null; double?transomThicknessOpt = null; double?mullionThicknessOpt = null; double?firstTransomOffsetOpt = null; double?secondTransomOffsetOpt = null; double?firstMullionOffsetOpt = null; double?secondMullionOffsetOpt = null; double value1 = 0.0; double value2 = 0.0; double scale = exporterIFC.LinearScale; // both of these must be defined (or not defined) if ((ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningDepth", out value1) != null) && (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningThickness", out value2) != null)) { liningDepthOpt = value1 * scale; liningThicknessOpt = value2 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "TransomThickness", out value1) != null) { transomThicknessOpt = value1 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FirstTransomOffset", out value1) != null) { firstTransomOffsetOpt = value1 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "SecondTransomOffset", out value1) != null) { secondTransomOffsetOpt = value1 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "MullionThickness", out value1) != null) { mullionThicknessOpt = value1 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FirstMullionOffset", out value1) != null) { firstMullionOffsetOpt = value1 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "SecondMullionOffset", out value1) != null) { secondMullionOffsetOpt = value1 * scale; } string windowLiningGUID = GUIDUtil.CreateGUID(); string windowLiningName = NamingUtil.GetIFCName(familyInstance); return(IFCInstanceExporter.CreateWindowLiningProperties(file, windowLiningGUID, ownerHistory, windowLiningName, description, liningDepthOpt, liningThicknessOpt, transomThicknessOpt, mullionThicknessOpt, firstTransomOffsetOpt, secondTransomOffsetOpt, firstMullionOffsetOpt, secondMullionOffsetOpt, 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) != null); if (!foundDepth && (panelNumber == 1)) { foundDepth = (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "PanelDepth", out value1) != null); } bool foundWidth = (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, panelWidthCurrString, out value2) != null); if (!foundWidth && (panelNumber == 1)) { foundWidth = (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "PanelWidth", out value2) != null); } if (foundDepth && foundWidth) { double lengthScale = exporterIFC.LinearScale; panelDepthList.Add(value1 * lengthScale); // Make sure value is in [0,1] range. if (value2 < 0.0) { value2 = 0.0; } else if (value2 > 1.0) { value2 = 1.0; } panelWidthList.Add(value2); } else { panelDepthList.Add(null); panelWidthList.Add(null); } } string baseDoorPanelName = NamingUtil.GetIFCName(familyInstance); for (int panelIndex = 0; (panelIndex < panelNumber - 1); panelIndex++) { double?currentPanelWidth = null; if (panelWidthList[panelIndex].HasValue) { currentPanelWidth = (double)panelWidthList[panelIndex]; } string doorPanelName = baseDoorPanelName; string doorPanelGUID = GUIDUtil.CreateGUID(); IFCAnyHandle doorPanel = IFCInstanceExporter.CreateDoorPanelProperties(file, doorPanelGUID, ownerHistory, doorPanelName, null, panelDepthList[panelIndex], panelOperationList[panelIndex], currentPanelWidth, panelPositionList[panelIndex], null); doorPanels.Add(doorPanel); } return(doorPanels); }
/// <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; double scale = exporterIFC.LinearScale; // 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) != null) && (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "LiningThickness", out value2) != null)) { liningDepthOpt = value1 * scale; liningThicknessOpt = value2 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningOffset", out value1) != null) { liningOffsetOpt = value1 * scale; } // 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) != null) && (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "ThresholdThickness", out value2) != null)) { thresholdDepthOpt = value1 * scale; thresholdThicknessOpt = value2 * scale; } if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "ThreshholdOffset", out value1) != null) { liningOffsetOpt = value1 * scale; } // 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) != null) && (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "TransomThickness", out value2) != null)) { transomOffsetOpt = value1 * scale; transomThicknessOpt = value2 * scale; } // 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) != null) && (ParameterUtil.GetPositiveDoubleValueFromElementOrSymbol(familyInstance, "CasingThickness", out value2) != null)) { casingDepthOpt = value1 * scale; casingThicknessOpt = value2 * scale; } string doorLiningGUID = GUIDUtil.CreateSubElementGUID(familyInstance, (int)IFCDoorSubElements.DoorLining); string doorLiningName = NamingUtil.GetIFCName(familyInstance); return(IFCInstanceExporter.CreateDoorLiningProperties(file, doorLiningGUID, ownerHistory, doorLiningName, null, liningDepthOpt, liningThicknessOpt, thresholdDepthOpt, thresholdThicknessOpt, transomThicknessOpt, transomOffsetOpt, liningOffsetOpt, thresholdOffsetOpt, casingThicknessOpt, casingDepthOpt, null)); }