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

Make the facade go all the way up. #109

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 14 additions & 7 deletions Facade/FacadeByEnvelope/dependencies/Envelope.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,11 +22,11 @@ namespace Elements
#pragma warning disable // Disable all warnings

/// <summary>Represents one part of a building enclosure.</summary>
[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)
{
Expand All @@ -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()
{
}

/// <summary>The id of the profile to extrude.</summary>
[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; }

/// <summary>The elevation of the envelope.</summary>
[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; }

/// <summary>The height of the envelope.</summary>
[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; }

/// <summary>The direction in which to extrude.</summary>
[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; }

/// <summary>The rotation in degrees of the envelope.</summary>
[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; }


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="0.8.0" />
<PackageReference Include="Hypar.Elements" Version="1.0.2" />
<PackageReference Include="Hypar.Functions" Version="1.1.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -72,6 +73,5 @@ public FacadeByEnvelopeInputs(double @panelWidth, double @glassLeftRightInset, d
[System.ComponentModel.DataAnnotations.Range(0D, 2D)]
public double GroundFloorSetback { get; set; } = 1D;


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@

namespace FacadeByEnvelope
{
public class FacadeByEnvelopeOutputs: ResultsBase
public class FacadeByEnvelopeOutputs: SystemResults
{
/// <summary>
/// Total facade panels.
/// </summary>
[JsonProperty("Panel Quantity")]
public double PanelQuantity {get;}
public double PanelQuantity {get; set;}



Expand Down
13 changes: 10 additions & 3 deletions Facade/FacadeByEnvelope/dependencies/FacadePanel.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,19 +22,25 @@ namespace Elements
#pragma warning disable // Disable all warnings

/// <summary>A single panel within a facade.</summary>
[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()
{
}

/// <summary>The total thickness of the panel.</summary>
[Newtonsoft.Json.JsonProperty("Thickness", Required = Newtonsoft.Json.Required.Always)]
[JsonProperty("Thickness", Required = Newtonsoft.Json.Required.Always)]
public double Thickness { get; set; }


Expand Down
13 changes: 10 additions & 3 deletions Facade/FacadeByEnvelope/dependencies/Level.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,19 +22,25 @@ namespace Elements
#pragma warning disable // Disable all warnings

/// <summary>A horizontal planer datum.</summary>
[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()
{
}

/// <summary>The elevation of the level.</summary>
[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; }

Expand Down
17 changes: 12 additions & 5 deletions Facade/FacadeByEnvelope/dependencies/LevelPerimeter.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -21,31 +22,37 @@ namespace Elements
#pragma warning disable // Disable all warnings

/// <summary>A horizontal planer datum with a perimeter.</summary>
[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)
{
this.Area = @area;
this.Elevation = @elevation;
this.Perimeter = @perimeter;
}

// Empty constructor
public LevelPerimeter()
: base()
{
}

/// <summary>The area of the level perimeter.</summary>
[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; }

/// <summary>The elevation of the level perimeter.</summary>
[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; }

/// <summary>The perimeter of the level perimeter.</summary>
[Newtonsoft.Json.JsonProperty("Perimeter", Required = Newtonsoft.Json.Required.AllowNull)]
[JsonProperty("Perimeter", Required = Newtonsoft.Json.Required.AllowNull)]
public Polygon Perimeter { get; set; }


Expand Down
17 changes: 11 additions & 6 deletions Facade/FacadeByEnvelope/src/FacadeByEnvelope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

/// <summary>
/// Adds facade Panels to one or more Masses named 'envelope'.
Expand Down Expand Up @@ -83,6 +83,11 @@ public static FacadeByEnvelopeOutputs Execute(Dictionary<string, Model> models,
envLevels.Insert(0, last);
}

if (envLevels.Last().Elevation != envelope.Height)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the change that matters. At some point we started using Levels to define the height of the facade and because we calculate the floor height by subtracting the next level height from the previous one, we don't get a top level height because we stop the iteration short of the level. We have to calculate the top level height as the distance between the last level and the top of the envelope.

{
envLevels.Add(new Level(envelope.Height, Guid.NewGuid(), "Roof"));
}

panelCount = PanelLevels(envLevels,
boundarySegments,
input.PanelWidth,
Expand Down Expand Up @@ -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[]{
Expand Down
5 changes: 0 additions & 5 deletions Facade/FacadeByEnvelope/src/FacadeByEnvelope.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
<ProjectReference Include="..\dependencies\FacadeByEnvelope.Dependencies.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="0.8.1" />
<PackageReference Include="Hypar.Functions" Version="0.8.2" />
</ItemGroup>

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
Expand Down