/// <summary>
        /// Checks if element should be exported using a variety of different checks.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="allowSeparateOpeningExport">True if IfcOpeningElement is allowed to be exported.</param>
        /// <returns>True if the element should be exported, false otherwise.</returns>
        /// <remarks>There are some inefficiencies here, as we call GetExportInfoFromParameters
        /// in other contexts.  We should attempt to get the value only once.</remarks>
        public static bool ShouldElementBeExported(ExporterIFC exporterIFC, Element element, bool allowSeparateOpeningExport)
        {
            // Allow the ExporterStateManager to say that an element should be exported regardless of settings.
            if (ExporterStateManager.CanExportElementOverride())
            {
                return(true);
            }

            // First, check if the element is set explicitly to be exported or not exported.  This
            // overrides category settings.
            Element          elementType        = element.Document.GetElement(element.GetTypeId());
            IFCExportElement?exportElementState = GetExportElementState(element, elementType);

            if (exportElementState.HasValue)
            {
                return(exportElementState.Value == IFCExportElement.Yes);
            }

            // Check to see if the category should be exported if parameters aren't set.
            // Note that in previous versions, the category override the parameter settings.  This is
            // no longer true.
            if (!ShouldCategoryBeExported(exporterIFC, element, allowSeparateOpeningExport))
            {
                return(false);
            }

            // Check whether the intended Entity type is inside the export exclusion set
            IFCExportInfoPair exportInfo = ExporterUtil.GetIFCExportElementParameterInfo(element, IFCEntityType.IfcRoot);

            return(!ExporterCacheManager.ExportOptionsCache.IsElementInExcludeList(exportInfo.ExportInstance));
        }
Esempio n. 2
0
        /// <summary>
        /// Checks if element should be exported using a variety of different checks.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="allowSeparateOpeningExport">True if IfcOpeningElement is allowed to be exported.</param>
        /// <returns>True if the element should be exported, false otherwise.</returns>
        /// <remarks>There are some inefficiencies here, as we later check IfcExportAs in other contexts.  We should attempt to get the value only once.</remarks>
        public static bool ShouldElementBeExported(ExporterIFC exporterIFC, Element element, bool allowSeparateOpeningExport)
        {
            // Allow the ExporterStateManager to say that an element should be exported regardless of settings.
            if (ExporterStateManager.CanExportElementOverride())
            {
                return(true);
            }

            // Check to see if the category should be exported.  This overrides the IfcExportAs parameter.
            if (!ShouldCategoryBeExported(exporterIFC, element, allowSeparateOpeningExport))
            {
                return(false);
            }

            string elementClassName;

            if (IsIFCExportAsSetToDontExport(element, out elementClassName))
            {
                return(false);
            }

            // Check whether the intended Entity type is inside the export exclusion set
            IFCEntityType elementClassTypeEnum;

            return
                (!Enum.TryParse(elementClassName, out elementClassTypeEnum) ||
                 !ExporterCacheManager.ExportOptionsCache.IsElementInExcludeList(elementClassTypeEnum));
        }
Esempio n. 3
0
        /// <summary>
        /// Checks if element should be exported using a variety of different checks.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="allowSeparateOpeningExport">True if IfcOpeningElement is allowed to be exported.</param>
        /// <returns>True if the element should be exported, false otherwise.</returns>
        /// <remarks>There are some inefficiencies here, as we later check IfcExportAs in other contexts.  We should attempt to get the value only once.</remarks>
        public static bool ShouldElementBeExported(ExporterIFC exporterIFC, Element element, bool allowSeparateOpeningExport)
        {
            // Allow the ExporterStateManager to say that an element should be exported regardless of settings.
            if (ExporterStateManager.CanExportElementOverride())
            {
                return(true);
            }

            // Check to see if the category should be exported.  This overrides the IfcExportAs parameter.
            if (!ShouldCategoryBeExported(exporterIFC, element, allowSeparateOpeningExport))
            {
                return(false);
            }

            string exportAsEntity = "IFCExportAs";
            string elementClassName;

            if (ParameterUtil.GetStringValueFromElementOrSymbol(element, exportAsEntity, out elementClassName) != null)
            {
                string enumTypeValue = string.Empty;
                ExporterUtil.ExportEntityAndPredefinedType(elementClassName, out elementClassName, out enumTypeValue);

                if (CompareAlphaOnly(elementClassName, "DONTEXPORT"))
                {
                    return(false);
                }

                // Check whether the intended Entity type is inside the export exclusion set
                Common.Enums.IFCEntityType elementClassTypeEnum;
                if (Enum.TryParse <Common.Enums.IFCEntityType>(elementClassName, out elementClassTypeEnum))
                {
                    if (ExporterCacheManager.ExportOptionsCache.IsElementInExcludeList(elementClassTypeEnum))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }