Example #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);
        }
      /// <summary>
      /// Creates an IfcWindowPanelProperties, 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="operationType">The panel operation.</param>
      /// <param name="positionType">The panel position.</param>
      /// <param name="frameDepth">The depth of the frame.</param>
      /// <param name="frameThickness">The thickness of the frame.</param>
      /// <param name="shapeAspectStyle">The shape aspect for the window style.</param>
      /// <returns>The handle.</returns>
      public static IFCAnyHandle CreateWindowPanelProperties(IFCFile file,
          string guid, IFCAnyHandle ownerHistory, string name, string description,
          IFCWindowPanelOperation operationType, IFCWindowPanelPosition positionType,
          double? frameDepth, double? frameThickness, IFCAnyHandle shapeAspectStyle)
      {
         ValidatePropertySetDefinition(guid, ownerHistory, name, description);
         IFCAnyHandleUtil.ValidateSubTypeOf(shapeAspectStyle, true, IFCEntityType.IfcShapeAspect);

         IFCAnyHandle windowPanelProperties = CreateInstance(file, IFCEntityType.IfcWindowPanelProperties);
         IFCAnyHandleUtil.SetAttribute(windowPanelProperties, "OperationType", operationType);
         IFCAnyHandleUtil.SetAttribute(windowPanelProperties, "PanelPosition", positionType);
         IFCAnyHandleUtil.SetAttribute(windowPanelProperties, "FrameDepth", frameDepth);
         IFCAnyHandleUtil.SetAttribute(windowPanelProperties, "FrameThickness", frameThickness);
         IFCAnyHandleUtil.SetAttribute(windowPanelProperties, "ShapeAspectStyle", shapeAspectStyle);
         SetPropertySetDefinition(windowPanelProperties, guid, ownerHistory, name, description);
         return windowPanelProperties;
      }