Skip to content

Commit

Permalink
Add optional panel type inputs to SetRoofPanels method as part of #2795
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraser Greenroyd committed Sep 11, 2023
1 parent d00a707 commit ed3039e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Environment_Engine/Modify/SetRoofPanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ public static partial class Modify

[Description("Modifies a collection of Panels and sets their type to be roof or ceiling if they are the highest panel in the space. If the panel has one connected space then it is deemed to be a roof panel, otherwise it is a ceiling panel")]
[Input("panelsAsSpace", "A collection of Environment Panels that represent a closed space")]
[Input("roofType", "The panel type to define external roof panels. Defaults to 'roof'.")]
[Input("ceilingType", "The panel type to define internal ceiling panels, defined as panels on the horizontal tilt with 2 connected spaces. Defaults to 'ceiling'.")]
[Input("internalFloorType", "The panel type to define internal floors. Defaults to 'FloorInternal'.")]
[Output("panelsAsSpace", "BHoM Environment panels representing a closed space where the roof or ceiling panels have had their type set")]
public static List<Panel> SetRoofPanels(this List<Panel> panelsAsSpace)
[PreviousVersion("6.3", "BH.Engine.Environment.Modify.SetRoofPanels(System.Collections.Generic.List<BH.oM.Environment.Elements.Panel>)")]
public static List<Panel> SetRoofPanels(this List<Panel> panelsAsSpace, PanelType roofType = PanelType.Roof, PanelType ceilingType = PanelType.Ceiling, PanelType internalFloorType = PanelType.FloorInternal)
{
List<Panel> clones = new List<Panel>(panelsAsSpace.Select(x => x.DeepClone<Panel>()).ToList());

Expand All @@ -64,15 +68,15 @@ public static List<Panel> SetRoofPanels(this List<Panel> panelsAsSpace)
foreach (Panel panel in roofPanels)
{
if (panel.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 1)
panel.Type = PanelType.Roof;
panel.Type = roofType;
else if (panel.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 2)
panel.Type = PanelType.Ceiling;
panel.Type = ceilingType;
}

foreach (Panel panel in roofPanels)
{
if (panel.Type == PanelType.Ceiling && panel.MaximumLevel() != maxZ)
panel.Type = PanelType.FloorInternal;
panel.Type = internalFloorType;
}

return clones;
Expand Down

0 comments on commit ed3039e

Please sign in to comment.