/// <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 IFCProductWrapper.</param> public static void Export(ExporterIFC exporterIFC, RoofBase roof, GeometryElement geometryElement, IFCProductWrapper productWrapper) { IFCFile file = exporterIFC.GetFile(); using (IFCTransaction tr = new IFCTransaction(file)) { // export parts or not bool exportParts = PartExporter.CanExportParts(roof); bool exportAsExtrusionCurtainRoof = false; bool exportAsFootprintCurtainRoof = false; if (roof is ExtrusionRoof) { ExtrusionRoof extrusionRoof = roof as ExtrusionRoof; exportAsExtrusionCurtainRoof = ((extrusionRoof.CurtainGrids != null) && (extrusionRoof.CurtainGrids.Size != 0)); } else if (roof is FootPrintRoof) { FootPrintRoof footprintRoof = roof as FootPrintRoof; exportAsFootprintCurtainRoof = ((footprintRoof.CurtainGrids != null) && (footprintRoof.CurtainGrids.Size != 0)); } 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 (exportAsExtrusionCurtainRoof) { CurtainSystemExporter.ExportExtrusionRoof(exporterIFC, roof as ExtrusionRoof, productWrapper); } else if (exportAsFootprintCurtainRoof) { CurtainSystemExporter.ExportFootPrintRoof(exporterIFC, roof as FootPrintRoof, productWrapper); } else { string ifcEnumType = CategoryUtil.GetIFCEnumTypeName(exporterIFC, roof); IFCAnyHandle roofHnd = ExporterIFCUtils.ExportRoofAsContainer(exporterIFC, ifcEnumType, roof, geometryElement, productWrapper); if (IFCAnyHandleUtil.IsNullOrHasNoValue(roofHnd)) { ExportRoof(exporterIFC, ifcEnumType, roof, geometryElement, productWrapper); } PropertyUtil.CreateInternalRevitPropertySets(exporterIFC, roof, 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); } tr.Commit(); } }
/// <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(); } }