Example #1
0
        /// <summary>
        /// Exports a staircase to IfcStair.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The stairs element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void Export(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement, ProductWrapper productWrapper)
        {
            string ifcEnumType = CategoryUtil.GetIFCEnumTypeName(exporterIFC, element);
            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                if (element is Stairs)
                {
                    Stairs stair = element as Stairs;
                    int numFlights = stair.NumberOfStories;
                    if (numFlights > 0)
                    {
                        ExportStairsAsContainer(exporterIFC, ifcEnumType, stair, geometryElement, numFlights, productWrapper);
                        if (IFCAnyHandleUtil.IsNullOrHasNoValue(productWrapper.GetAnElement()))
                            ExportStairAsSingleGeometry(exporterIFC, ifcEnumType, element, geometryElement, numFlights, productWrapper);
                    }
                }
                else if (IsLegacyStairs(element))
                {
                    ExportLegacyStairOrRampAsContainer(exporterIFC, ifcEnumType, element, geometryElement, true, productWrapper);
                    if (IFCAnyHandleUtil.IsNullOrHasNoValue(productWrapper.GetAnElement()))
                    {
                        double defaultHeight = GetDefaultHeightForLegacyStair(exporterIFC.LinearScale);
                        int numFlights = GetNumFlightsForLegacyStair(exporterIFC, element, defaultHeight);
                        if (numFlights > 0)
                            ExportStairAsSingleGeometry(exporterIFC, ifcEnumType, element, geometryElement, numFlights, productWrapper);
                    }
                }
                else
                {
                    ExportStairAsSingleGeometry(exporterIFC, ifcEnumType, element, geometryElement, 1, productWrapper);
                }

                PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, element, productWrapper);
                tr.Commit();
            }
        }
        /// <summary>
        /// Exports a wall swepp.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="wallSweep">The WallSwepp.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void Export(ExporterIFC exporterIFC, WallSweep wallSweep, GeometryElement geometryElement, ProductWrapper productWrapper)
        {
            WallSweepInfo wallSweepInfo = wallSweep.GetWallSweepInfo();
            //Reveals are exported as openings with wall exporter.
            if (wallSweepInfo.WallSweepType == WallSweepType.Reveal)
                return;

            if (!ProxyElementExporter.Export(exporterIFC, wallSweep, geometryElement, productWrapper))
                return;

            HostObjectExporter.ExportHostObjectMaterials(exporterIFC, wallSweep, productWrapper.GetAnElement(),
                geometryElement, productWrapper,
                ElementId.InvalidElementId, Toolkit.IFCLayerSetDirection.Axis2);
        }
        /// <summary>
        /// Exports a roof to IfcRoof.
        /// </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.Level.Id, 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 = ExporterUtil.GetIFCTypeFromExportTable(exporterIFC, roof);
                    
                    IFCAnyHandle roofHnd = ExporterIFCUtils.ExportRoofAsContainer(exporterIFC, ifcEnumType, roof, 
                        geometryElement, productWrapper.ToNative());
                    if (IFCAnyHandleUtil.IsNullOrHasNoValue(roofHnd))
                        ExportRoof(exporterIFC, ifcEnumType, roof, geometryElement, productWrapper);

                    // call for host objects; curtain roofs excused from call (no material information)
                    HostObjectExporter.ExportHostObjectMaterials(exporterIFC, roof, productWrapper.GetAnElement(),
                        geometryElement, productWrapper, ElementId.InvalidElementId, IFCLayerSetDirection.Axis3, null);
                }
                tr.Commit();
            }
        }
        /// <summary>
        /// Exports a ramp to IfcRamp.
        /// </summary>
        /// <param name="exporterIFC">The ExporterIFC object.</param>
        /// <param name="element">The ramp element.</param>
        /// <param name="geometryElement">The geometry element.</param>
        /// <param name="productWrapper">The ProductWrapper.</param>
        public static void Export(ExporterIFC exporterIFC, Element element, GeometryElement geometryElement, ProductWrapper productWrapper)
        {
            string ifcEnumType = ExporterUtil.GetIFCTypeFromExportTable(exporterIFC, element);
            IFCFile file = exporterIFC.GetFile();

            using (IFCTransaction tr = new IFCTransaction(file))
            {
                if (!(element is FamilyInstance))
                {
                    StairsExporter.ExportLegacyStairOrRampAsContainer(exporterIFC, ifcEnumType, element, geometryElement, productWrapper);
                    if (IFCAnyHandleUtil.IsNullOrHasNoValue(productWrapper.GetAnElement()))
                    {
                        int numFlights = GetNumFlightsForRamp(exporterIFC, element);
                        if (numFlights > 0)
                            ExportRamp(exporterIFC, ifcEnumType, element, geometryElement, numFlights, productWrapper);
                    }
                }
                else
                {
                    ExportRamp(exporterIFC, ifcEnumType, element, geometryElement, 1, productWrapper);
                }

                tr.Commit();
            }
        }