/// <summary>
        /// Exports an element as building element proxy.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        /// <returns>True if exported successfully, false otherwise.</returns>
        public static bool Export(ExporterIFC exporterIFC, Element element,
                                  GeometryElement geometryElement, ProductWrapper productWrapper, IFCExportInfoPair exportType = null)
        {
            bool exported = false;

            if (element == null || geometryElement == null)
            {
                return(exported);
            }

            if (exportType == null)
            {
                exportType = new IFCExportInfoPair(IFCEntityType.IfcBuildingElementProxy, IFCEntityType.IfcBuildingElementProxyType, "NOTDEFINED");
            }

            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                //exported = (ExportBuildingElementProxy(exporterIFC, element, geometryElement, productWrapper, exportType) != null);
                exported = (GenericElementExporter.ExportGenericElement(exporterIFC, element, geometryElement, productWrapper, exportType) != null);
                if (exported)
                {
                    tr.Commit();
                }
            }

            return(exported);
        }
Beispiel #2
0
        /// <summary>
        /// Exports topography surface as IFC site object.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="topoSurface">The TopographySurface object.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void ExportTopographySurface(ExporterIFC exporterIFC, TopographySurface topoSurface, GeometryElement geometryElement, ProductWrapper productWrapper)
        {
            // Skip if the element is already processed and the Site has been created before
            if (!IFCAnyHandleUtil.IsNullOrHasNoValue(ExporterCacheManager.SiteHandle) && !IFCAnyHandleUtil.IsNullOrHasNoValue(ExporterCacheManager.ElementToHandleCache.Find(topoSurface.Id)))
            {
                return;
            }

            string            ifcEnumType;
            IFCExportInfoPair exportType = ExporterUtil.GetExportType(exporterIFC, topoSurface, out ifcEnumType);

            // Check the intended IFC entity or type name is in the exclude list specified in the UI
            Common.Enums.IFCEntityType elementClassTypeEnum;

            if (Enum.TryParse <Common.Enums.IFCEntityType>(exportType.ExportInstance.ToString(), out elementClassTypeEnum) ||
                Enum.TryParse <Common.Enums.IFCEntityType>(exportType.ExportType.ToString(), out elementClassTypeEnum))
            {
                if (ExporterCacheManager.ExportOptionsCache.IsElementInExcludeList(elementClassTypeEnum))
                {
                    return;
                }

                if (elementClassTypeEnum == Common.Enums.IFCEntityType.IfcSite)
                {
                    ExportSiteBase(exporterIFC, topoSurface.Document, topoSurface, geometryElement, productWrapper);
                }
                else
                {
                    // Export Default Site first before exporting the TopographySurface as a generic element
                    ExportDefaultSite(exporterIFC, topoSurface.Document, productWrapper);
                    using (ProductWrapper genElemProductWrapper = ProductWrapper.Create(exporterIFC, true))
                    {
                        GenericElementExporter.ExportGenericElement(exporterIFC, topoSurface, geometryElement, genElemProductWrapper, exportType);
                        ExporterUtil.ExportRelatedProperties(exporterIFC, topoSurface, genElemProductWrapper);
                    }
                    productWrapper.ClearInternalHandleWrapperData(topoSurface.Document.ProjectInformation);
                }
            }
            else
            {
                ExportSiteBase(exporterIFC, null, topoSurface, geometryElement, productWrapper);
            }
        }