From 7c8f676e5cb7fec55bca05c3c676d2b721f5c42f Mon Sep 17 00:00:00 2001 From: Ian Keough Date: Mon, 4 Jul 2022 17:14:05 -0700 Subject: [PATCH] Make the facade go all the way up. --- .../dependencies/Envelope.g.cs | 21 ++++++++++++------- .../FacadeByEnvelope.Dependencies.csproj | 3 ++- .../FacadeByEnvelopeInputs.g.cs | 2 +- .../FacadeByEnvelopeOutputs.g.cs | 4 ++-- .../dependencies/FacadePanel.g.cs | 13 +++++++++--- .../FacadeByEnvelope/dependencies/Level.g.cs | 13 +++++++++--- .../dependencies/LevelPerimeter.g.cs | 17 ++++++++++----- .../FacadeByEnvelope/src/FacadeByEnvelope.cs | 17 +++++++++------ .../src/FacadeByEnvelope.csproj | 5 ----- 9 files changed, 62 insertions(+), 33 deletions(-) rename Facade/FacadeByEnvelope/{src => dependencies}/FacadeByEnvelopeInputs.g.cs (99%) rename Facade/FacadeByEnvelope/{src => dependencies}/FacadeByEnvelopeOutputs.g.cs (92%) diff --git a/Facade/FacadeByEnvelope/dependencies/Envelope.g.cs b/Facade/FacadeByEnvelope/dependencies/Envelope.g.cs index 841cc4d8..a8d037d1 100644 --- a/Facade/FacadeByEnvelope/dependencies/Envelope.g.cs +++ b/Facade/FacadeByEnvelope/dependencies/Envelope.g.cs @@ -10,6 +10,7 @@ using Elements.Spatial; using Elements.Validators; using Elements.Serialization.JSON; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -21,11 +22,11 @@ namespace Elements #pragma warning disable // Disable all warnings /// Represents one part of a building enclosure. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] public partial class Envelope : GeometricElement { - [Newtonsoft.Json.JsonConstructor] + [JsonConstructor] public Envelope(Profile @profile, double @elevation, double @height, Vector3 @direction, double @rotation, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null) : base(transform, material, representation, isElementDefinition, id, name) { @@ -35,27 +36,33 @@ public Envelope(Profile @profile, double @elevation, double @height, Vector3 @di this.Direction = @direction; this.Rotation = @rotation; } + + // Empty constructor + public Envelope() + : base() + { + } /// The id of the profile to extrude. - [Newtonsoft.Json.JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public Profile Profile { get; set; } /// The elevation of the envelope. - [Newtonsoft.Json.JsonProperty("Elevation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Elevation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] public double Elevation { get; set; } /// The height of the envelope. - [Newtonsoft.Json.JsonProperty("Height", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Height", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] public double Height { get; set; } /// The direction in which to extrude. - [Newtonsoft.Json.JsonProperty("Direction", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Direction", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public Vector3 Direction { get; set; } /// The rotation in degrees of the envelope. - [Newtonsoft.Json.JsonProperty("Rotation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Rotation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double Rotation { get; set; } diff --git a/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelope.Dependencies.csproj b/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelope.Dependencies.csproj index 9f7fd01b..a7706ad0 100644 --- a/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelope.Dependencies.csproj +++ b/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelope.Dependencies.csproj @@ -5,7 +5,8 @@ - + + diff --git a/Facade/FacadeByEnvelope/src/FacadeByEnvelopeInputs.g.cs b/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelopeInputs.g.cs similarity index 99% rename from Facade/FacadeByEnvelope/src/FacadeByEnvelopeInputs.g.cs rename to Facade/FacadeByEnvelope/dependencies/FacadeByEnvelopeInputs.g.cs index a6a3002a..78009157 100644 --- a/Facade/FacadeByEnvelope/src/FacadeByEnvelopeInputs.g.cs +++ b/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelopeInputs.g.cs @@ -11,6 +11,7 @@ using Hypar.Functions; using Hypar.Functions.Execution; using Hypar.Functions.Execution.AWS; +using Hypar.Model; using System; using System.Collections.Generic; using System.Linq; @@ -72,6 +73,5 @@ public FacadeByEnvelopeInputs(double @panelWidth, double @glassLeftRightInset, d [System.ComponentModel.DataAnnotations.Range(0D, 2D)] public double GroundFloorSetback { get; set; } = 1D; - } } \ No newline at end of file diff --git a/Facade/FacadeByEnvelope/src/FacadeByEnvelopeOutputs.g.cs b/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelopeOutputs.g.cs similarity index 92% rename from Facade/FacadeByEnvelope/src/FacadeByEnvelopeOutputs.g.cs rename to Facade/FacadeByEnvelope/dependencies/FacadeByEnvelopeOutputs.g.cs index 7460740b..cee54c5f 100644 --- a/Facade/FacadeByEnvelope/src/FacadeByEnvelopeOutputs.g.cs +++ b/Facade/FacadeByEnvelope/dependencies/FacadeByEnvelopeOutputs.g.cs @@ -14,13 +14,13 @@ namespace FacadeByEnvelope { - public class FacadeByEnvelopeOutputs: ResultsBase + public class FacadeByEnvelopeOutputs: SystemResults { /// /// Total facade panels. /// [JsonProperty("Panel Quantity")] - public double PanelQuantity {get;} + public double PanelQuantity {get; set;} diff --git a/Facade/FacadeByEnvelope/dependencies/FacadePanel.g.cs b/Facade/FacadeByEnvelope/dependencies/FacadePanel.g.cs index 97ed89d7..4d43ea46 100644 --- a/Facade/FacadeByEnvelope/dependencies/FacadePanel.g.cs +++ b/Facade/FacadeByEnvelope/dependencies/FacadePanel.g.cs @@ -10,6 +10,7 @@ using Elements.Spatial; using Elements.Validators; using Elements.Serialization.JSON; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -21,19 +22,25 @@ namespace Elements #pragma warning disable // Disable all warnings /// A single panel within a facade. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] public partial class FacadePanel : GeometricElement { - [Newtonsoft.Json.JsonConstructor] + [JsonConstructor] public FacadePanel(double @thickness, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null) : base(transform, material, representation, isElementDefinition, id, name) { this.Thickness = @thickness; } + + // Empty constructor + public FacadePanel() + : base() + { + } /// The total thickness of the panel. - [Newtonsoft.Json.JsonProperty("Thickness", Required = Newtonsoft.Json.Required.Always)] + [JsonProperty("Thickness", Required = Newtonsoft.Json.Required.Always)] public double Thickness { get; set; } diff --git a/Facade/FacadeByEnvelope/dependencies/Level.g.cs b/Facade/FacadeByEnvelope/dependencies/Level.g.cs index 5b814cb2..efb63308 100644 --- a/Facade/FacadeByEnvelope/dependencies/Level.g.cs +++ b/Facade/FacadeByEnvelope/dependencies/Level.g.cs @@ -10,6 +10,7 @@ using Elements.Spatial; using Elements.Validators; using Elements.Serialization.JSON; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -21,19 +22,25 @@ namespace Elements #pragma warning disable // Disable all warnings /// A horizontal planer datum. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] public partial class Level : Element { - [Newtonsoft.Json.JsonConstructor] + [JsonConstructor] public Level(double @elevation, System.Guid @id = default, string @name = null) : base(id, name) { this.Elevation = @elevation; } + + // Empty constructor + public Level() + : base() + { + } /// The elevation of the level. - [Newtonsoft.Json.JsonProperty("Elevation", Required = Newtonsoft.Json.Required.Always)] + [JsonProperty("Elevation", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] public double Elevation { get; set; } diff --git a/Facade/FacadeByEnvelope/dependencies/LevelPerimeter.g.cs b/Facade/FacadeByEnvelope/dependencies/LevelPerimeter.g.cs index 1218dd3c..5faf6d92 100644 --- a/Facade/FacadeByEnvelope/dependencies/LevelPerimeter.g.cs +++ b/Facade/FacadeByEnvelope/dependencies/LevelPerimeter.g.cs @@ -10,6 +10,7 @@ using Elements.Spatial; using Elements.Validators; using Elements.Serialization.JSON; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -21,11 +22,11 @@ namespace Elements #pragma warning disable // Disable all warnings /// A horizontal planer datum with a perimeter. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] public partial class LevelPerimeter : Element { - [Newtonsoft.Json.JsonConstructor] + [JsonConstructor] public LevelPerimeter(double @area, double @elevation, Polygon @perimeter, System.Guid @id = default, string @name = null) : base(id, name) { @@ -33,19 +34,25 @@ public LevelPerimeter(double @area, double @elevation, Polygon @perimeter, Syste this.Elevation = @elevation; this.Perimeter = @perimeter; } + + // Empty constructor + public LevelPerimeter() + : base() + { + } /// The area of the level perimeter. - [Newtonsoft.Json.JsonProperty("Area", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Area", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] public double Area { get; set; } /// The elevation of the level perimeter. - [Newtonsoft.Json.JsonProperty("Elevation", Required = Newtonsoft.Json.Required.Always)] + [JsonProperty("Elevation", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Range(0D, double.MaxValue)] public double Elevation { get; set; } /// The perimeter of the level perimeter. - [Newtonsoft.Json.JsonProperty("Perimeter", Required = Newtonsoft.Json.Required.AllowNull)] + [JsonProperty("Perimeter", Required = Newtonsoft.Json.Required.AllowNull)] public Polygon Perimeter { get; set; } diff --git a/Facade/FacadeByEnvelope/src/FacadeByEnvelope.cs b/Facade/FacadeByEnvelope/src/FacadeByEnvelope.cs index f4f2cc6e..a3272407 100644 --- a/Facade/FacadeByEnvelope/src/FacadeByEnvelope.cs +++ b/Facade/FacadeByEnvelope/src/FacadeByEnvelope.cs @@ -27,11 +27,11 @@ public int Compare(Level x, Level y) public static class FacadeByEnvelope { private const int Elevation = 10; - private static string ENVELOPE_MODEL_NAME = "Envelope"; - private static string LEVELS_MODEL_NAME = "Levels"; + private static readonly string ENVELOPE_MODEL_NAME = "Envelope"; + private static readonly string LEVELS_MODEL_NAME = "Levels"; - private static Material _glazing = new Material("Glazing", new Color(1.0, 1.0, 1.0, 0.7), 0.8f, 1.0f); - private static Material _nonStandardPanel = new Material(Colors.Orange, 0.0f, 0.0f, false, null, false, Guid.NewGuid(), "Non-standard Panel"); + private static readonly Material _glazing = new Material("Glazing", new Color(1.0, 1.0, 1.0, 0.7), 0.8f, 1.0f); + private static readonly Material _nonStandardPanel = new Material("Non-standard Panel", Colors.Orange, 0.0f, 0.0f); /// /// Adds facade Panels to one or more Masses named 'envelope'. @@ -83,6 +83,11 @@ public static FacadeByEnvelopeOutputs Execute(Dictionary models, envLevels.Insert(0, last); } + if (envLevels.Last().Elevation != envelope.Height) + { + envLevels.Add(new Level(envelope.Height, Guid.NewGuid(), "Roof")); + } + panelCount = PanelLevels(envLevels, boundarySegments, input.PanelWidth, @@ -217,12 +222,12 @@ private static void PanelGroundFloor(double bottomElevation, grid2d.V.DivideByCount(2); foreach (var sep in grid2d.GetCellSeparators(GridDirection.U)) { - var mullion = new Beam((Line)sep, Polygon.Rectangle(0.05, 0.05), BuiltInMaterials.Black); + var mullion = new Beam((Line)sep, Polygon.Rectangle(0.05, 0.05), material: BuiltInMaterials.Black); model.AddElement(mullion); } foreach (var sep in grid2d.GetCellSeparators(GridDirection.V)) { - var mullion = new Beam((Line)sep, Polygon.Rectangle(0.05, 0.05), BuiltInMaterials.Black); + var mullion = new Beam((Line)sep, Polygon.Rectangle(0.05, 0.05), material: BuiltInMaterials.Black); model.AddElement(mullion); } var panel = new Panel(new Polygon(new[]{ diff --git a/Facade/FacadeByEnvelope/src/FacadeByEnvelope.csproj b/Facade/FacadeByEnvelope/src/FacadeByEnvelope.csproj index a74ed48a..18daae38 100644 --- a/Facade/FacadeByEnvelope/src/FacadeByEnvelope.csproj +++ b/Facade/FacadeByEnvelope/src/FacadeByEnvelope.csproj @@ -4,11 +4,6 @@ - - - - - netcoreapp3.1