Exemple #1
0
        /// <summary>
        /// Creates window 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 window.
        /// </param>
        /// <param name="description">
        /// The description.
        /// </param>
        /// <returns>
        /// The list of handles created.
        /// </returns>
        public static IList <IFCAnyHandle> CreateWindowPanelProperties(ExporterIFC exporterIFC,
                                                                       Element familyInstance, string description)
        {
            IList <IFCAnyHandle> panels = new List <IFCAnyHandle>();
            IFCFile      file           = exporterIFC.GetFile();
            IFCAnyHandle ownerHistory   = exporterIFC.GetOwnerHistoryHandle();

            double lengthScale = exporterIFC.LinearScale;

            const int maxPanels = 1000;  // arbitrary large number to prevent infinite loops.

            for (int panelNumber = 1; panelNumber < maxPanels; panelNumber++)
            {
                string frameDepthCurrString     = "FrameDepth" + panelNumber.ToString();
                string frameThicknessCurrString = "FrameThickness" + panelNumber.ToString();

                IFCWindowPanelOperation panelOperation = GetIFCWindowPanelOperation("", familyInstance, panelNumber);
                IFCWindowPanelPosition  panelPosition  = GetIFCWindowPanelPosition("", familyInstance, panelNumber);
                if (panelOperation == IFCWindowPanelOperation.NotDefined && panelPosition == IFCWindowPanelPosition.NotDefined)
                {
                    break;
                }

                double?frameDepth     = null;
                double?frameThickness = null;

                double value1, value2;
                if (((ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, frameDepthCurrString, out value1) != null) ||
                     ((panelNumber == 1) && (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FrameDepth", out value1) != null))) &&
                    ((ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, frameThicknessCurrString, out value2) != null) ||
                     ((panelNumber == 1) && (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FrameThickness", out value2) != null))))
                {
                    frameDepth     = value1 * lengthScale;
                    frameThickness = value2 * lengthScale;
                }

                string panelGUID = GUIDUtil.CreateGUID();
                string panelName = NamingUtil.GetIFCNamePlusIndex(familyInstance, panelNumber);
                panels.Add(IFCInstanceExporter.CreateWindowPanelProperties(file, panelGUID, ownerHistory,
                                                                           panelName, description, panelOperation, panelPosition, frameDepth, frameThickness, null));
            }
            return(panels);
        }
Exemple #2
0
        /// <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;

            // both of these must be defined (or not defined)
            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningDepth", out value1) &&
                ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "LiningThickness", out value2))
            {
                liningDepthOpt     = value1;
                liningThicknessOpt = value2;
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "TransomThickness", out value1))
            {
                transomThicknessOpt = value1;
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FirstTransomOffset", out value1))
            {
                firstTransomOffsetOpt = value1;
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "SecondTransomOffset", out value1))
            {
                secondTransomOffsetOpt = value1;
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "MullionThickness", out value1))
            {
                mullionThicknessOpt = value1;
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "FirstMullionOffset", out value1))
            {
                firstMullionOffsetOpt = value1;
            }

            if (ParameterUtil.GetDoubleValueFromElementOrSymbol(familyInstance, "SecondMullionOffset", out value1))
            {
                secondMullionOffsetOpt = value1;
            }

            string windowLiningGUID = ExporterIFCUtils.CreateGUID();
            string windowLiningName = exporterIFC.GetName();

            return(IFCInstanceExporter.CreateWindowLiningProperties(file, windowLiningGUID, ownerHistory,
                                                                    windowLiningName, description, liningDepthOpt, liningThicknessOpt, transomThicknessOpt, mullionThicknessOpt,
                                                                    firstTransomOffsetOpt, secondTransomOffsetOpt, firstMullionOffsetOpt, secondMullionOffsetOpt, null));
        }
Exemple #3
0
        /// <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));
        }