Ejemplo n.º 1
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 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));
        }