/// <summary> /// Provides a unified interface to get the curtain grids associated with an element. /// </summary> /// <param name="element">The host element.</param> /// <returns>A CurtainGridSet with 0 or more CurtainGrids, or null if invalid.</returns> public static CurtainGridSet GetCurtainGridSet(Element element) { CurtainGridSet curtainGridSet = null; if (element is Wall) { Wall wall = element as Wall; if (!CurtainSystemExporter.IsLegacyCurtainWall(wall)) { CurtainGrid curtainGrid = wall.CurtainGrid; curtainGridSet = new CurtainGridSet(); if (curtainGrid != null) { curtainGridSet.Insert(curtainGrid); } } } else if (element is FootPrintRoof) { FootPrintRoof footPrintRoof = element as FootPrintRoof; curtainGridSet = footPrintRoof.CurtainGrids; } else if (element is ExtrusionRoof) { ExtrusionRoof extrusionRoof = element as ExtrusionRoof; curtainGridSet = extrusionRoof.CurtainGrids; } else if (element is CurtainSystem) { CurtainSystem curtainSystem = element as CurtainSystem; curtainGridSet = curtainSystem.CurtainGrids; } return(curtainGridSet); }
/// <summary> /// Exports a curtain wall to IFC curtain wall. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="hostElement">The host object element to be exported.</param> /// <param name="productWrapper">The ProductWrapper.</param> public static void ExportWall(ExporterIFC exporterIFC, Wall hostElement, ProductWrapper productWrapper) { // Don't export the Curtain Wall itself, which has no useful geometry; instead export all of the GReps of the // mullions and panels. CurtainGridSet gridSet = CurtainSystemExporter.GetCurtainGridSet(hostElement); if (gridSet == null) { ExportLegacyCurtainElement(exporterIFC, hostElement, productWrapper); return; } if (gridSet.Size == 0) { return; } HashSet <ElementId> allSubElements = new HashSet <ElementId>(); foreach (CurtainGrid grid in gridSet) { allSubElements.UnionWith(GetVisiblePanelsForGrid(grid)); allSubElements.UnionWith(grid.GetMullionIds()); } ExportBase(exporterIFC, allSubElements, hostElement, productWrapper); }
/// <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(); } }