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

Add warning instead pattern segments error #158

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
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,28 @@ public class FacadeGridByLevelsOutputs: SystemResults
/// The number of unique facade panels.
/// </summary>
[JsonProperty("Unique Panel Count")]
public double UniquePanelCount {get; set;}
public double UniquePanelCount { get; set; }

/// <summary>
/// The total number of facade panels.
/// </summary>
[JsonProperty("Total Panel Count")]
public double TotalPanelCount {get; set;}


public double TotalPanelCount { get; set; }

/// <summary>
/// Construct a FacadeGridByLevelsOutputs with default inputs.
/// This should be used for testing only.
/// </summary>
public FacadeGridByLevelsOutputs() : base()
{

}


/// <summary>
/// Construct a FacadeGridByLevelsOutputs specifying all inputs.
/// </summary>
/// <returns></returns>
[JsonConstructor]
public FacadeGridByLevelsOutputs(double uniquePanelCount, double totalPanelCount): base()
public FacadeGridByLevelsOutputs(double uniquePanelCount, double totalPanelCount) : base()
{
this.UniquePanelCount = uniquePanelCount;
this.TotalPanelCount = totalPanelCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class LevelVolume : GeometricElement
{
[JsonConstructor]
public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, IList<Profile> @profiles, 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.Profile = @profile;
Expand All @@ -37,6 +37,7 @@ public LevelVolume(Profile @profile, double @height, double @area, string @build
this.Level = @level;
this.Mass = @mass;
this.PlanView = @planView;
this.Profiles = @profiles;
}


Expand Down Expand Up @@ -74,6 +75,10 @@ public LevelVolume()
[JsonProperty("Plan View", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Guid? PlanView { get; set; }

/// <summary>Multiple profiles used for a collection of volumes</summary>
[JsonProperty("Profiles", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public IList<Profile> Profiles { get; set; }


}
}
4 changes: 3 additions & 1 deletion Facade/FacadeGrid/FacadeGridByLevels/hypar.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"type": "number",
"$hyparUnitType": "length",
"$hyparStyle": "number",
"minimum": 0.1
"minimum": 0.1,
"multipleOf": 0.01,
"default": 0.5
}
},
"Pattern Mode": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static FacadeGridByLevelsOutputs Execute(Dictionary<string, Model> inputM
}
break;
case FacadeGridByLevelsInputsMode.Pattern:
uGrid.DivideByPattern(input.PatternSettings.PanelWidthPattern, PatternMode(input.PatternSettings.PatternMode), DivisionMode(input.RemainderPosition));
uGrid.DivideByPattern(input.PatternSettings.PanelWidthPattern.Select(wp => Math.Max(wp, 0.1)).ToArray(), PatternMode(input.PatternSettings.PatternMode), DivisionMode(input.RemainderPosition));
break;
}
foreach (var cell in uGrid.Cells)
Expand Down Expand Up @@ -125,6 +125,11 @@ public static FacadeGridByLevelsOutputs Execute(Dictionary<string, Model> inputM

var output = new FacadeGridByLevelsOutputs(basePanels.Count, outputModel.AllElementsOfType<ElementInstance>().Count());
output.Model = outputModel;

if (input.PatternSettings.PanelWidthPattern.Any(wp => wp < 0.1))
{
output.Warnings.Add("Panel Width Pattern values less than 0.1 m will be replaced by the minimum possible value of 0.1 m.");
}
return output;
}

Expand Down
10 changes: 5 additions & 5 deletions Facade/FacadeGrid/FacadeGridByLevels/src/Function.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Edits to this code will be overwritten the next time you run 'hypar init'.
// DO NOT EDIT THIS FILE.

using Amazon;
using Amazon.Lambda.Core;
using Hypar.Functions.Execution;
using Hypar.Functions.Execution.AWS;
Expand All @@ -19,9 +18,9 @@ public class Function
{
// Cache the model store for use by subsequent
// executions of this lambda.
private IModelStore<FacadeGridByLevelsInputs> store;
private UrlModelStore<FacadeGridByLevelsInputs> store;

public async Task<FacadeGridByLevelsOutputs> Handler(FacadeGridByLevelsInputs args, ILambdaContext context)
public async Task<FacadeGridByLevelsOutputs> Handler(FacadeGridByLevelsInputs args)
{
// Preload dependencies (if they exist),
// so that they are available during model deserialization.
Expand Down Expand Up @@ -61,9 +60,10 @@ public async Task<FacadeGridByLevelsOutputs> Handler(FacadeGridByLevelsInputs ar
Console.WriteLine($"Time to load assemblies: {sw.Elapsed.TotalSeconds})");

if(this.store == null)
{
this.store = new UrlModelStore<FacadeGridByLevelsInputs>();
{
this.store = new UrlModelStore<FacadeGridByLevelsInputs>();
}


var l = new InvocationWrapper<FacadeGridByLevelsInputs,FacadeGridByLevelsOutputs> (store, FacadeGridByLevels.Execute);
var output = await l.InvokeAsync(args);
Expand Down
Loading