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

Stream structure #156

Merged
merged 4 commits into from
Nov 9, 2023
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
1 change: 1 addition & 0 deletions Structure/StructureByEnvelope/dependencies/Camera.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public Camera(Vector3 @angle, CameraNamedPosition? @namedPosition, CameraProject
this.Projection = @projection;
}


// Empty constructor
public Camera()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public Grid2dElement(Grid2d @grid, IList<GridNode> @gridNodes, IList<string> @uG
this.VGridLines = @vGridLines;
}


// Empty constructor
public Grid2dElement()
: base()
Expand Down
1 change: 1 addition & 0 deletions Structure/StructureByEnvelope/dependencies/GridNode.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public GridNode(Transform @location, string @uGridline, string @vGridline, Syste
this.VGridline = @vGridline;
}


// Empty constructor
public GridNode()
: base()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class LabelConfiguration
{
[JsonConstructor]
public LabelConfiguration(Color @color, Vector3 @offset, string @customText, string @forceVisible, Vector3 @direction)
public LabelConfiguration(Color? @color, Vector3 @offset, string @customText, string @forceVisible, Vector3 @direction)
{
this.Color = @color;
this.Offset = @offset;
Expand All @@ -36,14 +36,15 @@ public LabelConfiguration(Color @color, Vector3 @offset, string @customText, str
this.Direction = @direction;
}


// Empty constructor
public LabelConfiguration()
{
}

/// <summary>The label background color</summary>
[JsonProperty("Color", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public Color Color { get; set; }
public Color? Color { get; set; }

/// <summary>A screen-space offset, in pixels, for the label from the object's bounding box center.</summary>
[JsonProperty("Offset", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public LevelPerimeter(double @area, double @elevation, Polygon @perimeter, Syste
this.Perimeter = @perimeter;
}


// Empty constructor
public LevelPerimeter()
: base()
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,8 +37,10 @@ public LevelVolume(Profile @profile, double @height, double @area, string @build
this.Level = @level;
this.Mass = @mass;
this.PlanView = @planView;
this.Profiles = @profiles;
}


// Empty constructor
public LevelVolume()
: base()
Expand Down Expand Up @@ -73,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; }


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

<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="2.0.0-alpha.23" />
<PackageReference Include="Hypar.Functions" Version="1.6.0" />
<PackageReference Include="Hypar.Elements" Version="2.1.0" />
<PackageReference Include="Hypar.Functions" Version="1.10.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ namespace Structure

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")]

public class StructureInputs : S3Args
public class StructureInputs : ArgsBase

{
[Newtonsoft.Json.JsonConstructor]

public StructureInputs(double @gridXAxisInterval, double @gridYAxisInterval, double @slabEdgeOffset, bool @displayGrid, StructureInputsTypeOfConstruction @typeOfConstruction, StructureInputsColumnType @columnType, StructureInputsGirderType @girderType, StructureInputsBeamType @beamType, double @beamSpacing, bool @createBeamsOnFirstLevel, double @slabThickness, bool @insertColumnsAtExternalEdges, double @maximumNeighborSpan, string bucketName, string uploadsBucket, Dictionary<string, string> modelInputKeys, string gltfKey, string elementsKey, string ifcKey):
base(bucketName, uploadsBucket, modelInputKeys, gltfKey, elementsKey, ifcKey)
public StructureInputs(double @gridXAxisInterval, double @gridYAxisInterval, double @slabEdgeOffset, bool @displayGrid, StructureInputsTypeOfConstruction @typeOfConstruction, StructureInputsColumnType @columnType, StructureInputsGirderType @girderType, StructureInputsBeamType @beamType, double @beamSpacing, bool @createBeamsOnFirstLevel, double @slabThickness, bool @insertColumnsAtExternalEdges, double @maximumNeighborSpan, Dictionary<string, string> modelInputKeys, string gltfKey, string elementsKey, string ifcKey):
base(modelInputKeys, gltfKey, elementsKey, ifcKey)
{
var validator = Validator.Instance.GetFirstValidatorForType<StructureInputs>();
if(validator != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,22 @@ public class StructureOutputs: SystemResults
/// The maximum beam length.
/// </summary>
[JsonProperty("Maximum Beam Length")]
public double MaximumBeamLength {get; set;}


public double MaximumBeamLength { get; set; }

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

}


/// <summary>
/// Construct a StructureOutputs specifying all inputs.
/// </summary>
/// <returns></returns>
[JsonConstructor]
public StructureOutputs(double maximumBeamLength): base()
public StructureOutputs(double maximumBeamLength) : base()
{
this.MaximumBeamLength = maximumBeamLength;

Expand Down
9 changes: 8 additions & 1 deletion Structure/StructureByEnvelope/dependencies/ViewScope.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,20 @@ namespace Elements
public partial class ViewScope : Element
{
[JsonConstructor]
public ViewScope(BBox3 @boundingBox, Camera @camera, bool? @lockRotation, bool? @clipWithBoundingBox, bool? @modal, System.Collections.Generic.IDictionary<string, string> @functionVisibility, IList<object> @actions, System.Guid @id = default, string @name = null)
public ViewScope(BBox3 @boundingBox, Camera @camera, bool? @lockRotation, bool? @clipWithBoundingBox, ViewScopeClippingBehavior? @clippingBehavior, bool? @modal, System.Collections.Generic.IDictionary<string, string> @functionVisibility, IList<object> @actions, System.Guid @id = default, string @name = null)
: base(id, name)
{
this.BoundingBox = @boundingBox;
this.Camera = @camera;
this.LockRotation = @lockRotation;
this.ClipWithBoundingBox = @clipWithBoundingBox;
this.ClippingBehavior = @clippingBehavior;
this.Modal = @modal;
this.FunctionVisibility = @functionVisibility;
this.Actions = @actions;
}


// Empty constructor
public ViewScope()
: base()
Expand All @@ -61,6 +63,11 @@ public ViewScope()
[JsonProperty("Clip With Bounding Box", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool? ClipWithBoundingBox { get; set; }

/// <summary>When clipping with this box, which sides should actually do the clipping? If null, all six sides will be assumed. Front is assumed to be the side facing -Y, Top is the side facing +Z</summary>
[JsonProperty("Clipping Behavior", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]
public ViewScopeClippingBehavior? ClippingBehavior { get; set; }

/// <summary>If true, when the user exits this scope, they'll return to their previous camera settings.</summary>
[JsonProperty("Modal", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool? Modal { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//----------------------
// <auto-generated>
// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org)
// </auto-generated>
//----------------------
using Elements;
using Elements.GeoJSON;
using Elements.Geometry;
using Elements.Geometry.Solids;
using Elements.Spatial;
using Elements.Validators;
using Elements.Serialization.JSON;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using Line = Elements.Geometry.Line;
using Polygon = Elements.Geometry.Polygon;

namespace Elements
{
#pragma warning disable // Disable all warnings

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")]
public enum ViewScopeClippingBehavior
{
[System.Runtime.Serialization.EnumMember(Value = @"All")]
All = 0,

[System.Runtime.Serialization.EnumMember(Value = @"TopAndBottom")]
TopAndBottom = 1,

[System.Runtime.Serialization.EnumMember(Value = @"Top")]
Top = 2,

[System.Runtime.Serialization.EnumMember(Value = @"Bottom")]
Bottom = 3,

[System.Runtime.Serialization.EnumMember(Value = @"FrontAndBack")]
FrontAndBack = 4,

[System.Runtime.Serialization.EnumMember(Value = @"Front")]
Front = 5,

[System.Runtime.Serialization.EnumMember(Value = @"Back")]
Back = 6,

[System.Runtime.Serialization.EnumMember(Value = @"LeftAndRight")]
LeftAndRight = 7,

[System.Runtime.Serialization.EnumMember(Value = @"Left")]
Left = 8,

[System.Runtime.Serialization.EnumMember(Value = @"Right")]
Right = 9,

}
}
1 change: 1 addition & 0 deletions Structure/StructureByEnvelope/hypar.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"name": "Structure",
"description": "Generates a structural frame from a set of Levels and an Envelope.",
"language": "C#",
"stream_model": true,
"model_dependencies": [
{
"autohide": true,
Expand Down
10 changes: 5 additions & 5 deletions Structure/StructureByEnvelope/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<StructureInputs> store;
private UrlModelStore<StructureInputs> store;

public async Task<StructureOutputs> Handler(StructureInputs args, ILambdaContext context)
public async Task<StructureOutputs> Handler(StructureInputs args)
{
// Preload dependencies (if they exist),
// so that they are available during model deserialization.
Expand Down Expand Up @@ -62,10 +61,11 @@ public async Task<StructureOutputs> Handler(StructureInputs args, ILambdaContext

if(this.store == null)
{
this.store = new S3ModelStore<StructureInputs>(RegionEndpoint.GetBySystemName("us-west-1"));
this.store = new UrlModelStore<StructureInputs>();
}


var l = new InvocationWrapper<StructureInputs,StructureOutputs>(store, Structure.Execute);
var l = new InvocationWrapper<StructureInputs,StructureOutputs> (store, Structure.Execute);
var output = await l.InvokeAsync(args);
return output;
}
Expand Down
2 changes: 0 additions & 2 deletions Structure/StructureByEnvelope/test/StructureTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public void StructureTest()
0.1254,
false,
maximumNeighborSpan: 2,
bucketName: "",
uploadsBucket: "",
modelInputKeys: new Dictionary<string, string>(), gltfKey: "", elementsKey: "", ifcKey: "");
var outputs = Structure.Execute(
new Dictionary<string, Model>
Expand Down
Loading