/// <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> /// Returns all of the active curtain panels for a CurtainGrid. /// </summary> /// <param name="curtainGrid">The CurtainGrid element.</param> /// <returns>The element ids of the active curtain panels.</returns> /// <remarks>CurtainGrid.GetPanelIds() returns the element ids of the curtain panels that are directly contained in the CurtainGrid. /// Some of these panels however, are placeholders for "host" panels. From a user point of view, the host panels are the real panels, /// and should replace these internal panels for export purposes.</remarks> public static ICollection <ElementId> GetVisiblePanelsForGrid(CurtainGrid curtainGrid) { ICollection <ElementId> panelIdsIn = curtainGrid.GetPanelIds(); if (panelIdsIn == null) { return(null); } HashSet <ElementId> visiblePanelIds = new HashSet <ElementId>(); foreach (ElementId panelId in panelIdsIn) { Element element = ExporterCacheManager.Document.GetElement(panelId); if (element == null) { continue; } ElementId hostPanelId = ElementId.InvalidElementId; if (element is Panel) { hostPanelId = (element as Panel).FindHostPanel(); } if (hostPanelId != ElementId.InvalidElementId) { // If the host panel is itself a curtain wall, then we have to recursively collect its element ids. Element hostPanel = ExporterCacheManager.Document.GetElement(hostPanelId); if (IsCurtainSystem(hostPanel)) { CurtainGridSet gridSet = CurtainSystemExporter.GetCurtainGridSet(hostPanel); if (gridSet == null || gridSet.Size == 0) { visiblePanelIds.Add(hostPanelId); } else { ICollection <ElementId> allSubElements = GetSubElements(gridSet); visiblePanelIds.UnionWith(allSubElements); } } else { visiblePanelIds.Add(hostPanelId); } } else { visiblePanelIds.Add(panelId); } } return(visiblePanelIds); }
/// <summary> /// Export non-legacy Curtain Walls and Roofs. /// </summary> /// <param name="exporterIFC">The ExporterIFC object.</param> /// <param name="allSubElements">Collection of elements contained in the host curtain element.</param> /// <param name="element">The element to be exported.</param> /// <param name="productWrapper">The ProductWrapper.</param> private static void ExportBaseWithGrids(ExporterIFC exporterIFC, Element 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) { if (hostElement is Wall) { ExportLegacyCurtainElement(exporterIFC, hostElement as Wall, productWrapper); } return; } if (gridSet.Size == 0) { return; } ICollection <ElementId> allSubElements = GetSubElements(gridSet); ExportBase(exporterIFC, allSubElements, hostElement, productWrapper); }