Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment_Engine: Intuitive default environmental panel types #3170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 23 additions & 12 deletions Environment_Engine/Create/Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,42 @@
/**** Public Methods ****/
/***************************************************/

[Description("Create a collection of Environment Panels which form a space from a BHoM Boundary Representation (Brep)")]

Check warning on line 46 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L46

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("brep", "A BHoM Boundary Representation to convert into a collection of Environment Panels")]

Check warning on line 47 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L47

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("connectedSpaceName", "A name for the space which these panels are connected to. If no name is provided, a randomised default will be generated")]

Check warning on line 48 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L48

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("angleTolerance", "The angle tolerance for collapsing to polylines used when generating the external edges of the surfaces")]

Check warning on line 49 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L49

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("panelType", "The panel type to assign to the panels, if no input is added roof, floor and wall types are assigned by default")]
[Input("roofType", "The panel type to assign to the panels where the panels are identified as roof. If no input is added roof types are assigned by default.")]
[Input("ceilingType", "The panel type to assign to the panels where the panels are identified as ceiling. If no input is added ceiling types are assigned by default.")]
[Input("internalFloorType", "The panel type to assign to the panels where the panels are identified as internal flooring. If no input is added FloorInternal types are assigned by default.")]
[Input("externalGrounding", "The panel type to assign to the panels where the panels are identified as external grounding. If no input is added SlabOnGrade types are assigned by default.")]
[Input("externalWallType", "The panel type to assign to the panels where the panels are identified as external walls. If no input is added WallExternal types are assigned by default.")]
[Input("internalWallType", "The panel type to assign to the panels where the panels are identified as internal walls. If no input is added WallInternal types are assigned by default.")]
[Output("panelsAsSpace", "A collection of Environment Panels representing a closed space generated from the provided Brep geometry")]

Check warning on line 56 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L56

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static List<Panel> Panels(this BoundaryRepresentation brep, string connectedSpaceName = null, double angleTolerance = BH.oM.Geometry.Tolerance.Angle, PanelType panelType = PanelType.Undefined)
[PreviousVersion("6.3", "BH.Engine.Environment.Create.Panels(BH.oM.Geometry.BoundaryRepresentation, System.String, System.Double, BH.oM.Environment.Elements.PanelType)")]
public static List<Panel> Panels(this BoundaryRepresentation brep, string connectedSpaceName = null, double angleTolerance = BH.oM.Geometry.Tolerance.Angle, PanelType roofType = PanelType.Roof, PanelType ceilingType = PanelType.Ceiling, PanelType internalFloorType = PanelType.FloorInternal, PanelType externalGrounding = PanelType.SlabOnGrade, PanelType externalWallType = PanelType.WallExternal, PanelType internalWallType = PanelType.WallInternal)
albinber marked this conversation as resolved.
Show resolved Hide resolved
{
if(brep == null)
{
BH.Engine.Base.Compute.RecordError("Could not create panels from a null brep.");
return null;
}

return brep.Surfaces.ToList().Panels(connectedSpaceName, angleTolerance, panelType);
return brep.Surfaces.ToList().Panels(connectedSpaceName, angleTolerance, roofType, ceilingType, internalFloorType, externalGrounding, externalWallType, internalWallType);
}

[Description("Create a collection of Environment Panels from a collection of BHoM Surfaces")]

Check warning on line 69 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L69

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("surfaces", "A collection of BHoM surfaces to convert into a Environment Panels. The surfaces should be grouped as a single space as all panels generated from the surfaces will have the same connectedSpaceName")]

Check warning on line 70 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L70

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("connectedSpaceName", "A name for the space which these panels are connected to. If no name is provided, a randomised default will be generated")]

Check warning on line 71 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L71

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("angleTolerance", "The angle tolerance for collapsing to polylines used when generating the external edges of the surfaces")]

Check warning on line 72 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L72

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("panelType", "The panel type to assign to the panels, if no input is added roof, floor and wall types are assigned by default")]
[Input("roofType", "The panel type to assign to the panels where the panels are identified as roof. If no input is added roof types are assigned by default.")]
[Input("ceilingType", "The panel type to assign to the panels where the panels are identified as ceiling. If no input is added ceiling types are assigned by default.")]
[Input("internalFloorType", "The panel type to assign to the panels where the panels are identified as internal flooring. If no input is added FloorInternal types are assigned by default.")]
[Input("externalGrounding", "The panel type to assign to the panels where the panels are identified as external grounding. If no input is added SlabOnGrade types are assigned by default.")]
[Input("externalWallType", "The panel type to assign to the panels where the panels are identified as external walls. If no input is added WallExternal types are assigned by default.")]
[Input("internalWallType", "The panel type to assign to the panels where the panels are identified as internal walls. If no input is added WallInternal types are assigned by default.")]
[Output("panel", "An Environment Panels representing a closed space generated from the provided surfaces")]

Check warning on line 79 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L79

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static List<Panel> Panels(this List<ISurface> surfaces, string connectedSpaceName = null, double angleTolerance = BH.oM.Geometry.Tolerance.Angle, PanelType panelType = PanelType.Undefined)
[PreviousVersion("6.3", "BH.Engine.Environment.Create.Panels(System.Collections.Generic.List<BH.oM.Geometry.ISurface>, System.String, System.Double, BH.oM.Environment.Elements.PanelType)")]
public static List<Panel> Panels(this List<ISurface> surfaces, string connectedSpaceName = null, double angleTolerance = BH.oM.Geometry.Tolerance.Angle, PanelType roofType = PanelType.Roof, PanelType ceilingType = PanelType.Ceiling, PanelType internalFloorType = PanelType.FloorInternal, PanelType externalGrounding = PanelType.SlabOnGrade, PanelType externalWallType = PanelType.WallExternal, PanelType internalWallType = PanelType.WallInternal)
albinber marked this conversation as resolved.
Show resolved Hide resolved
{
if(surfaces == null)
{
Expand All @@ -77,24 +89,23 @@
if (connectedSpaceName == null)
connectedSpaceName = "auto" + Guid.NewGuid().ToString();

List<Panel> panels = surfaces.Select(x => x.Panel(connectedSpaceName, angleTolerance, panelType)).Where(x => x != null).ToList();
List<Panel> panels = surfaces.Select(x => x.Panel(connectedSpaceName, angleTolerance)).Where(x => x != null).ToList();

panels = panels.SetRoofPanels(roofType, ceilingType, internalFloorType);

if (panelType == PanelType.Undefined)
{
panels = panels.SetRoofPanels();
panels = panels.SetFloorPanels();
panels = panels.SetWallPanels();
}
panels = panels.SetFloorPanels(externalGrounding);

panels = panels.SetWallPanels(externalWallType, internalWallType);

return panels;
}

[Description("Create an Environments Panel from a BHoM Surface")]

Check warning on line 103 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L103

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("surface", "A BHoM surface to convert into an Environment Panel")]

Check warning on line 104 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L104

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("connectedSpaceName", "A name for the space which this panel is connected to. If no name is provided, a randomised default will be generated")]

Check warning on line 105 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L105

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("angleTolerance", "The angle tolerance for collapsing to polylines used when generating the external edges of the surfaces")]

Check warning on line 106 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L106

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Input("panelType", "The panel type to assign to the panel, default type is Undefined")]

Check warning on line 107 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L107

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
[Output("panel", "An Environment Panels representing a closed space generated from the provided Brep geometry")]

Check warning on line 108 in Environment_Engine/Create/Panel.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Create/Panel.cs#L108

Documentation attribute should end with grammatically correct punctuation (., !, or ?) - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/AttributeHasEndingPunctuation
public static Panel Panel(this ISurface surface, string connectedSpaceName = null, double angleTolerance = BH.oM.Geometry.Tolerance.Angle, PanelType panelType = PanelType.Undefined)
{
if(surface.GetType() == typeof(NurbsSurface))
Expand Down
13 changes: 7 additions & 6 deletions Environment_Engine/Modify/SetFloorPanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
/**** Public Methods ****/
/***************************************************/

[Description("Modifies a collection of Panels and sets their type to be slab on grade or internal floor if they are the lowest panel in the space. If the panel has one connected space then it is deemed to be a slab on grade panel, otherwise it is an internal floor panel")]
[Input("panelsAsSpace", "A collection of Environment Panels that represent a closed space")]
[Output("panelsAsSpace", "BHoM Environment panels representing a closed space where the slab on grade or internal floor panels have had their type set")]
public static List<Panel> SetFloorPanels(this List<Panel> panelsAsSpace)
[Description("Modifies a collection of Panels and sets their type to be slab on grade or internal floor if they are the lowest panel in the space. If the panel has one connected space then it is deemed to be a slab on grade panel, otherwise it is an internal floor panel.")]
[Input("panelsAsSpace", "A collection of Environment Panels that represent a closed space.")]
[Output("panelsAsSpace", "BHoM Environment panels representing a closed space where the slab on grade or internal floor panels have had their type set.")]
[PreviousVersion("6.3", "BH.Engine.Environment.Modify.SetFloorPanels(System.Collections.Generic.List<BH.oM.Environment.Elements.Panel>)")]
public static List<Panel> SetFloorPanels(this List<Panel> panelsAsSpace, PanelType internalFloorType = PanelType.FloorInternal, PanelType externalGrounding = PanelType.SlabOnGrade)

Check warning on line 47 in Environment_Engine/Modify/SetFloorPanels.cs

View check run for this annotation

BHoMBot-CI / code-compliance

Environment_Engine/Modify/SetFloorPanels.cs#L47

Modify methods should return void, or their return type should be different to the input type of their first parameter - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/ModifyReturnsDifferentType

Check warning on line 47 in Environment_Engine/Modify/SetFloorPanels.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Modify/SetFloorPanels.cs#L47

Input parameter requires a matching Input attribute - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/IsInputAttributePresent Input parameter requires a matching Input attribute - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/IsInputAttributePresent
{
List<Panel> clones = new List<Panel>(panelsAsSpace.Select(x => x.DeepClone<Panel>()).ToList());

Expand All @@ -66,9 +67,9 @@
foreach (Panel panel in floorPanels)
{
if (panel.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 1)
panel.Type = PanelType.SlabOnGrade;
panel.Type = externalGrounding;
else if (panel.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 2)
panel.Type = PanelType.FloorInternal;
panel.Type = internalFloorType;
}


Expand Down
18 changes: 11 additions & 7 deletions Environment_Engine/Modify/SetRoofPanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
/**** Public Methods ****/
/***************************************************/

[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")]
[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)
[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.")]
[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)

Check warning on line 50 in Environment_Engine/Modify/SetRoofPanels.cs

View check run for this annotation

BHoMBot-CI / code-compliance

Environment_Engine/Modify/SetRoofPanels.cs#L50

Modify methods should return void, or their return type should be different to the input type of their first parameter - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/ModifyReturnsDifferentType
{
List<Panel> clones = new List<Panel>(panelsAsSpace.Select(x => x.DeepClone<Panel>()).ToList());

Expand All @@ -64,15 +68,15 @@
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
13 changes: 7 additions & 6 deletions Environment_Engine/Modify/SetWallPanels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
/**** Public Methods ****/
/***************************************************/

[Description("Modifies a collection of Panels and sets their type to be interior or exterior wall if they have a tilt of 90 degrees. If the panel has one connected space then it is deemed to be an internal wall panel, otherwise it is an external wall panel")]
[Input("panelsAsSpace", "A collection of Environment Panels that represent a closed space")]
[Output("panelsAsSpace", "BHoM Environment panels representing a closed space where the internal or external wall panels have had their type set")]
public static List<Panel> SetWallPanels(this List<Panel> panelsAsSpace)
[Description("Modifies a collection of Panels and sets their type to be interior or exterior wall if they have a tilt of 90 degrees. If the panel has one connected space then it is deemed to be an internal wall panel, otherwise it is an external wall panel.")]
[Input("panelsAsSpace", "A collection of Environment Panels that represent a closed space.")]
[Output("panelsAsSpace", "BHoM Environment panels representing a closed space where the internal or external wall panels have had their type set.")]
[PreviousVersion("6.3", "BH.Engine.Environment.Modify.SetWallPanels(System.Collections.Generic.List<BH.oM.Environment.Elements.Panel>)")]
public static List<Panel> SetWallPanels(this List<Panel> panelsAsSpace, PanelType externalWallType = PanelType.WallExternal, PanelType internalWallType = PanelType.WallInternal)

Check warning on line 47 in Environment_Engine/Modify/SetWallPanels.cs

View check run for this annotation

BHoMBot-CI / code-compliance

Environment_Engine/Modify/SetWallPanels.cs#L47

Modify methods should return void, or their return type should be different to the input type of their first parameter - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/ModifyReturnsDifferentType

Check warning on line 47 in Environment_Engine/Modify/SetWallPanels.cs

View check run for this annotation

BHoMBot-CI / documentation-compliance

Environment_Engine/Modify/SetWallPanels.cs#L47

Input parameter requires a matching Input attribute - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/IsInputAttributePresent Input parameter requires a matching Input attribute - For more information see https://bhom.xyz/documentation/DevOps/Code%20Compliance%20and%20CI/Compliance%20Checks/IsInputAttributePresent
{
List<Panel> clones = new List<Panel>(panelsAsSpace.Select(x => x.DeepClone<Panel>()).ToList());

Expand All @@ -66,9 +67,9 @@
foreach (Panel panel in wallPanels)
{
if (panel.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 1)
panel.Type = PanelType.WallExternal;
panel.Type = externalWallType;
else if (panel.ConnectedSpaces.Where(x => x != "-1").ToList().Count == 2)
panel.Type = PanelType.WallInternal;
panel.Type = internalWallType;
}

return clones;
Expand Down