Exemple #1
0
        /// <summary>
        /// Exports a roof element to the appropriate IFC entity.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="roof">The roof element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void Export(ExporterIFC exporterIFC, RoofBase roof, ref GeometryElement geometryElement, ProductWrapper productWrapper)
        {
            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                // export parts or not
                bool exportParts         = PartExporter.CanExportParts(roof);
                bool exportAsCurtainRoof = CurtainSystemExporter.IsCurtainSystem(roof);

                // if there is only a single part that we can get from the roof geometry, we will not create the aggregation with IfcSlab, but directly export the IfcRoof
                bool exportAsSingleGeometry = false;
                if (productWrapper != null && !ExporterCacheManager.ExportOptionsCache.ExportAsOlderThanIFC4)
                {
                    exportAsSingleGeometry = IFCAnyHandleUtil.IsNullOrHasNoValue(productWrapper.GetAnElement());
                }

                if (exportParts)
                {
                    if (!PartExporter.CanExportElementInPartExport(roof, roof.LevelId, false))
                    {
                        return;
                    }
                    ExportRoofAsParts(exporterIFC, roof, geometryElement, productWrapper); // Right now, only flat roof could have parts.
                }
                else if (exportAsCurtainRoof)
                {
                    CurtainSystemExporter.ExportCurtainRoof(exporterIFC, roof, productWrapper);
                }
                else
                {
                    string            ifcEnumType;
                    IFCExportInfoPair roofExportType = ExporterUtil.GetProductExportType(exporterIFC, roof, out ifcEnumType);

                    if (roofExportType.ExportInstance != IFCEntityType.IfcRoof)
                    {
                        ExportRoof(exporterIFC, roof, ref geometryElement, productWrapper, exportAsSingleGeometry);
                    }
                    else
                    {
                        IFCAnyHandle roofHnd = ExportRoofOrFloorAsContainer(exporterIFC, roof,
                                                                            geometryElement, productWrapper);
                        if (IFCAnyHandleUtil.IsNullOrHasNoValue(roofHnd))
                        {
                            ExportRoof(exporterIFC, roof, ref geometryElement, productWrapper, exportAsSingleGeometry);
                        }
                    }

                    // call for host objects; curtain roofs excused from call (no material information)
                    if (!ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                    {
                        HostObjectExporter.ExportHostObjectMaterials(exporterIFC, roof, productWrapper.GetAnElement(),
                                                                     geometryElement, productWrapper, ElementId.InvalidElementId, IFCLayerSetDirection.Axis3, null, null);
                    }
                }
                tr.Commit();
            }
        }
Exemple #2
0
        /// <summary>
        /// Exports a roof element to the appropriate IFC entity.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="roof">The roof element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void Export(ExporterIFC exporterIFC, RoofBase roof, GeometryElement geometryElement, ProductWrapper productWrapper)
        {
            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                // export parts or not
                bool exportParts         = PartExporter.CanExportParts(roof);
                bool exportAsCurtainRoof = CurtainSystemExporter.IsCurtainSystem(roof);

                if (exportParts)
                {
                    if (!PartExporter.CanExportElementInPartExport(roof, roof.LevelId, false))
                    {
                        return;
                    }
                    ExportRoofAsParts(exporterIFC, roof, geometryElement, productWrapper); // Right now, only flat roof could have parts.
                }
                else if (exportAsCurtainRoof)
                {
                    CurtainSystemExporter.ExportCurtainRoof(exporterIFC, roof, productWrapper);
                }
                else
                {
                    IFCAnyHandle roofHnd = ExportRoofOrFloorAsContainer(exporterIFC, roof,
                                                                        geometryElement, productWrapper);
                    if (IFCAnyHandleUtil.IsNullOrHasNoValue(roofHnd))
                    {
                        ExportRoof(exporterIFC, roof, geometryElement, productWrapper);
                    }

                    // call for host objects; curtain roofs excused from call (no material information)
                    if (!ExporterCacheManager.ExportOptionsCache.ExportAs4ReferenceView)
                    {
                        HostObjectExporter.ExportHostObjectMaterials(exporterIFC, roof, productWrapper.GetAnElement(),
                                                                     geometryElement, productWrapper, ElementId.InvalidElementId, IFCLayerSetDirection.Axis3, null, null);
                    }
                }
                tr.Commit();
            }
        }