diff --git a/.github/workflows/build-on-PR.yaml b/.github/workflows/build-on-PR.yaml new file mode 100644 index 00000000..837c69e5 --- /dev/null +++ b/.github/workflows/build-on-PR.yaml @@ -0,0 +1,22 @@ +name: Build on PR + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + path: repos/HyparSpace + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: | + 6.0.x + - run: dotnet tool install -g hypar.cli --version 1.6.0 + - run: echo "${HOME}/.dotnet/tools" >> $GITHUB_PATH + - run: + cd repos/HyparSpace; + bash build-all.sh; diff --git a/LayoutFunctions/ClassroomLayout/dependencies/ClassroomLayout.Dependencies.csproj b/LayoutFunctions/ClassroomLayout/dependencies/ClassroomLayout.Dependencies.csproj index 49b3b992..2a7052a9 100644 --- a/LayoutFunctions/ClassroomLayout/dependencies/ClassroomLayout.Dependencies.csproj +++ b/LayoutFunctions/ClassroomLayout/dependencies/ClassroomLayout.Dependencies.csproj @@ -4,7 +4,7 @@ net6.0 - + diff --git a/LayoutFunctions/ClassroomLayout/dependencies/Floor.g.cs b/LayoutFunctions/ClassroomLayout/dependencies/Floor.g.cs deleted file mode 100644 index da4cfb8c..00000000 --- a/LayoutFunctions/ClassroomLayout/dependencies/Floor.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------- -// -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) -// -//---------------------- -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 - - /// Represents an abstract building floor - [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] - public partial class Floor : GeometricElement - { - [JsonConstructor] - public Floor(Profile @profile, double @thickness, System.Guid? @level, 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; - this.Thickness = @thickness; - this.Level = @level; - } - - // Empty constructor - public Floor() - : base() - { - } - - /// The untransformed profile of the floor. - [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Profile Profile { get; set; } - - /// The thickness of the floor. - [JsonProperty("Thickness", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Thickness { get; set; } - - /// The level this floor belongs to - [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid? Level { get; set; } - - - } -} \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/README.md b/LayoutFunctions/CustomLayout/README.md index fcf9b69b..3dae6c35 100644 --- a/LayoutFunctions/CustomLayout/README.md +++ b/LayoutFunctions/CustomLayout/README.md @@ -14,3 +14,7 @@ Create custom space types. |Output Name|Type|Description| |---|---|---| + +
+ +## Additional Information \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/dependencies/CirculationSegment.g.cs b/LayoutFunctions/CustomLayout/dependencies/CirculationSegment.g.cs index 3f5ee835..de3dcd58 100644 --- a/LayoutFunctions/CustomLayout/dependencies/CirculationSegment.g.cs +++ b/LayoutFunctions/CustomLayout/dependencies/CirculationSegment.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -23,15 +23,14 @@ namespace Elements /// Represents a section of a circulation network, such as a corridor. [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class CirculationSegment : Floor { [JsonConstructor] - public CirculationSegment(ThickenedPolyline @geometry, System.Guid @level, Profile @profile, double @thickness, Transform @transform, Material @material, Representation @representation, bool @isElementDefinition, System.Guid @id, string @name) - : base(profile, thickness, transform, material, representation, isElementDefinition, id, name) + public CirculationSegment(ThickenedPolyline @geometry, Profile @profile, double @thickness, System.Guid? @level, Transform @transform, Material @material, Representation @representation, bool @isElementDefinition, System.Guid @id, string @name) + : base(profile, thickness, level, transform, material, representation, isElementDefinition, id, name) { this.Geometry = @geometry; - this.Level = @level; } // Empty constructor @@ -44,10 +43,6 @@ public CirculationSegment() [JsonProperty("Geometry", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ThickenedPolyline Geometry { get; set; } - /// The level this circulation segment belongs to - [JsonProperty("Level", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid Level { get; set; } - } } \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj b/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj index 92589445..c8ddb52d 100644 --- a/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj +++ b/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj @@ -1,18 +1,17 @@ - netcoreapp3.1 + net6.0 - - + - + \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/dependencies/CustomSpaceTypeInputs.g.cs b/LayoutFunctions/CustomLayout/dependencies/CustomSpaceTypeInputs.g.cs index 49850b4c..553067b4 100644 --- a/LayoutFunctions/CustomLayout/dependencies/CustomSpaceTypeInputs.g.cs +++ b/LayoutFunctions/CustomLayout/dependencies/CustomSpaceTypeInputs.g.cs @@ -22,7 +22,7 @@ namespace CustomSpaceType { #pragma warning disable // Disable all warnings - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public class CustomSpaceTypeInputs : S3Args @@ -55,7 +55,7 @@ public CustomSpaceTypeInputs(IList @layouts, Overrides @overrides, stri } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class Layouts @@ -107,7 +107,7 @@ public System.Collections.Generic.IDictionary AdditionalProperti } } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class Overrides @@ -136,7 +136,7 @@ public Overrides(IList @transform) } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class TransformOverride @@ -171,7 +171,7 @@ public TransformOverride(string @id, TransformIdentity @identity, TransformValue } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class TransformIdentity @@ -202,7 +202,7 @@ public TransformIdentity(string @name, TransformIdentityBaseDefinition @baseDefi } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class TransformValue @@ -229,7 +229,7 @@ public TransformValue(Transform @transform) } - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class TransformIdentityBaseDefinition diff --git a/LayoutFunctions/CustomLayout/dependencies/LevelElements.g.cs b/LayoutFunctions/CustomLayout/dependencies/LevelElements.g.cs index 53819459..dd221b85 100644 --- a/LayoutFunctions/CustomLayout/dependencies/LevelElements.g.cs +++ b/LayoutFunctions/CustomLayout/dependencies/LevelElements.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -23,7 +23,7 @@ namespace Elements /// An element containing a collection of Elements that belong to one level. [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class LevelElements : Element { [JsonConstructor] diff --git a/LayoutFunctions/CustomLayout/dependencies/LevelVolume.g.cs b/LayoutFunctions/CustomLayout/dependencies/LevelVolume.g.cs index 09bff563..d3164fe8 100644 --- a/LayoutFunctions/CustomLayout/dependencies/LevelVolume.g.cs +++ b/LayoutFunctions/CustomLayout/dependencies/LevelVolume.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -23,17 +23,20 @@ namespace Elements /// Describes the volume of occupiable space between a level and the next level above it. [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class LevelVolume : GeometricElement { [JsonConstructor] - public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, 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, 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; this.Height = @height; this.Area = @area; this.BuildingName = @buildingName; + this.Level = @level; + this.Mass = @mass; + this.PlanView = @planView; } // Empty constructor @@ -58,6 +61,18 @@ public LevelVolume() [JsonProperty("Building Name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string BuildingName { get; set; } + /// The Level this volume was created from. + [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Guid? Level { get; set; } + + /// The Conceptual Mass this volume was created from. + [JsonProperty("Mass", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Guid? Mass { get; set; } + + /// The default plan view for this level + [JsonProperty("Plan View", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Guid? PlanView { get; set; } + } } \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/dependencies/SpaceBoundary.g.cs b/LayoutFunctions/CustomLayout/dependencies/SpaceBoundary.g.cs index 86c414e9..38a59481 100644 --- a/LayoutFunctions/CustomLayout/dependencies/SpaceBoundary.g.cs +++ b/LayoutFunctions/CustomLayout/dependencies/SpaceBoundary.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -23,11 +23,11 @@ namespace Elements /// A profile with a program assigned to it, and optional internal cell geometry. [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class SpaceBoundary : GeometricElement { [JsonConstructor] - public SpaceBoundary(Profile @boundary, IList @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null) + public SpaceBoundary(Profile @boundary, IList @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @level, System.Guid? @levelLayout, string @hyparSpaceType, 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.Boundary = @boundary; @@ -38,6 +38,9 @@ public SpaceBoundary(Profile @boundary, IList @cells, double @area, dou this.Height = @height; this.ProgramGroup = @programGroup; this.ProgramType = @programType; + this.Level = @level; + this.LevelLayout = @levelLayout; + this.HyparSpaceType = @hyparSpaceType; } // Empty constructor @@ -78,6 +81,17 @@ public SpaceBoundary() [JsonProperty("Program Type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ProgramType { get; set; } + [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Guid? Level { get; set; } + + /// The layout, if any, which generated this space boundary. + [JsonProperty("Level Layout", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public System.Guid? LevelLayout { get; set; } + + /// The hypar-recognized space type name which will be used to determine which layout function to apply. In older space boundaries, this may not be set — fall back to the Name property for this purpose if not provided. + [JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string HyparSpaceType { get; set; } + } } \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/dependencies/ThickenedPolyline.g.cs b/LayoutFunctions/CustomLayout/dependencies/ThickenedPolyline.g.cs index 82308064..01d3fec4 100644 --- a/LayoutFunctions/CustomLayout/dependencies/ThickenedPolyline.g.cs +++ b/LayoutFunctions/CustomLayout/dependencies/ThickenedPolyline.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -23,11 +23,11 @@ namespace Elements /// A polyline that has been thickened into a polygon. [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class ThickenedPolyline { [JsonConstructor] - public ThickenedPolyline(Polyline @polyline, double @width, bool @flip, double @leftWidth, double @rightWidth) + public ThickenedPolyline(Polyline @polyline, double? @width, bool? @flip, double @leftWidth, double @rightWidth) { this.Polyline = @polyline; this.Width = @width; @@ -44,11 +44,11 @@ public ThickenedPolyline() [JsonProperty("polyline", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public Polyline Polyline { get; set; } - [JsonProperty("width", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Width { get; set; } + [JsonProperty("width", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double? Width { get; set; } - [JsonProperty("flip", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public bool Flip { get; set; } + [JsonProperty("flip", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public bool? Flip { get; set; } /// The amount to thicken the polyline on its "left" side, imagining that the polyline is extending away from you. That is, if the polyline starts at (0,0,0) and follows the +Z axis, the left side extends into the -X quadrant. [JsonProperty("leftWidth", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] diff --git a/LayoutFunctions/CustomLayout/global.json b/LayoutFunctions/CustomLayout/global.json index 792591b3..4aef4472 100644 --- a/LayoutFunctions/CustomLayout/global.json +++ b/LayoutFunctions/CustomLayout/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "3.1.100", + "version": "6.0.400", "rollForward": "latestMinor" } } \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/src/CustomSpaceType.cs b/LayoutFunctions/CustomLayout/src/CustomSpaceType.cs index 122bdf71..c742994d 100644 --- a/LayoutFunctions/CustomLayout/src/CustomSpaceType.cs +++ b/LayoutFunctions/CustomLayout/src/CustomSpaceType.cs @@ -76,7 +76,7 @@ public static CustomSpaceTypeOutputs Execute(Dictionary inputMode { Func> postProcess = (Polyline p) => { - var offsets = p.OffsetOnSide(wall.Width, wall.Flip); + var offsets = OffsetThickenedPolyline(wall, p); return offsets.Select((w) => { return new Wall(w, 3, BuiltInMaterials.Default); @@ -95,7 +95,6 @@ public static CustomSpaceTypeOutputs Execute(Dictionary inputMode { spaceTypeDefinitions.Add(layout.SpaceType, new ComponentDefinition(rules, anchors)); } - } // instantiate all component definitions @@ -130,6 +129,25 @@ public static CustomSpaceTypeOutputs Execute(Dictionary inputMode return output; } + public static Polygon[] OffsetThickenedPolyline(ThickenedPolyline wall, Polyline p) + { + Polygon[] offsets = null; + if (wall.Width.HasValue && wall.Flip.HasValue) + { + offsets = p.OffsetOnSide(wall.Width.Value, wall.Flip.Value); + } + else + { + if (wall.LeftWidth > Vector3.EPSILON) + { + p = p.OffsetOpen(-wall.LeftWidth); + } + + offsets = p.OffsetOnSide(wall.LeftWidth + wall.RightWidth, false); + } + return offsets; + } + private static void LayOutAllRoomsOfSpaceType(Model model, IEnumerable levelVolumes, LevelElements lvl, IEnumerable corridorSegments, string spaceTypeName, ComponentDefinition component) { Console.WriteLine($"Laying out {spaceTypeName}"); diff --git a/LayoutFunctions/CustomLayout/src/CustomSpaceType.csproj b/LayoutFunctions/CustomLayout/src/CustomSpaceType.csproj index 9ce3bb16..664a5111 100644 --- a/LayoutFunctions/CustomLayout/src/CustomSpaceType.csproj +++ b/LayoutFunctions/CustomLayout/src/CustomSpaceType.csproj @@ -5,7 +5,7 @@ - netcoreapp3.1 + net6.0 \ No newline at end of file diff --git a/LayoutFunctions/CustomLayout/src/Function.g.cs b/LayoutFunctions/CustomLayout/src/Function.g.cs index ea0729bb..7255f21f 100644 --- a/LayoutFunctions/CustomLayout/src/Function.g.cs +++ b/LayoutFunctions/CustomLayout/src/Function.g.cs @@ -62,7 +62,7 @@ public async Task Handler(CustomSpaceTypeInputs args, IL if(this.store == null) { - this.store = new S3ModelStore(RegionEndpoint.USWest1); + this.store = new S3ModelStore(RegionEndpoint.GetBySystemName("us-west-1")); } var l = new InvocationWrapper(store, CustomSpaceType.Execute); diff --git a/LayoutFunctions/CustomLayout/test/CustomSpaceType.Tests.csproj b/LayoutFunctions/CustomLayout/test/CustomSpaceType.Tests.csproj index 2b1aafff..55f41a46 100644 --- a/LayoutFunctions/CustomLayout/test/CustomSpaceType.Tests.csproj +++ b/LayoutFunctions/CustomLayout/test/CustomSpaceType.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp3.1 + net6.0 false diff --git a/LayoutFunctions/CustomLayout/test/WallOffsetTest.cs b/LayoutFunctions/CustomLayout/test/WallOffsetTest.cs new file mode 100644 index 00000000..1e789792 --- /dev/null +++ b/LayoutFunctions/CustomLayout/test/WallOffsetTest.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Elements; +using Elements.Geometry; +using Elements.Components; +using Newtonsoft.Json; +using Xunit; + +namespace CustomSpaceType.Tests +{ + public class WallOffsetTests + { + [Fact] + public void WallOffsetTest() + { + var polyline = new Polyline(new List() + { + new Vector3(0,0,0), + new Vector3(10,0,0), + new Vector3(10,10,0) + }); + + var tp = new ThickenedPolyline(polyline, 1.0, false, 0.0, 0.0); + var walls = CustomSpaceType.OffsetThickenedPolyline(tp, polyline); + Assert.Equal(2, walls.Count()); + Assert.Equal(4, walls.First().Vertices.Count); + Assert.Equal(4, walls.Last().Vertices.Count); + Assert.Contains(new Vector3(0, -1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(11, -1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(0, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(11, -1, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(11, 10, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(10, 10, 0), walls.Last().Vertices); + + tp = new ThickenedPolyline(polyline, 1.0, true, 0.0, 0.0); + walls = CustomSpaceType.OffsetThickenedPolyline(tp, polyline); + Assert.Contains(new Vector3(0, 1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(9, 1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(0, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(9, 1, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(9, 10, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(10, 10, 0), walls.Last().Vertices); + + tp = new ThickenedPolyline(polyline, null, null, 0.0, 1.0); + walls = CustomSpaceType.OffsetThickenedPolyline(tp, polyline); + Assert.Equal(2, walls.Count()); + Assert.Equal(4, walls.First().Vertices.Count); + Assert.Equal(4, walls.Last().Vertices.Count); + Assert.Contains(new Vector3(0, -1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(11, -1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(0, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(11, -1, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(11, 10, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(10, 10, 0), walls.Last().Vertices); + + tp = new ThickenedPolyline(polyline, null, null, 1.0, 0.0); + walls = CustomSpaceType.OffsetThickenedPolyline(tp, polyline); + Assert.Contains(new Vector3(0, 1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(9, 1, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(0, 0, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10, 0, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(9, 1, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(9, 10, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(10, 10, 0), walls.Last().Vertices); + + tp = new ThickenedPolyline(polyline, null, null, 0.4, 0.6); + walls = CustomSpaceType.OffsetThickenedPolyline(tp, polyline); + Assert.Contains(new Vector3(0, -0.6, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10.6, -0.6, 0), walls.First().Vertices); + Assert.Contains(new Vector3(9.6, 0.4, 0), walls.First().Vertices); + Assert.Contains(new Vector3(0, 0.4, 0), walls.First().Vertices); + Assert.Contains(new Vector3(10.6, -0.6, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(9.6, 0.4, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(10.6, 10, 0), walls.Last().Vertices); + Assert.Contains(new Vector3(9.6, 10, 0), walls.Last().Vertices); + } + } +} \ No newline at end of file diff --git a/LayoutFunctions/DataHall/dependencies/DataHallLayout.Dependencies.csproj b/LayoutFunctions/DataHall/dependencies/DataHallLayout.Dependencies.csproj index 9ba3567f..b1b05cb0 100644 --- a/LayoutFunctions/DataHall/dependencies/DataHallLayout.Dependencies.csproj +++ b/LayoutFunctions/DataHall/dependencies/DataHallLayout.Dependencies.csproj @@ -4,7 +4,7 @@ net6.0 - + \ No newline at end of file diff --git a/LayoutFunctions/Doors/dependencies/Doors.Dependencies.csproj b/LayoutFunctions/Doors/dependencies/Doors.Dependencies.csproj index 87eb558b..c3687664 100644 --- a/LayoutFunctions/Doors/dependencies/Doors.Dependencies.csproj +++ b/LayoutFunctions/Doors/dependencies/Doors.Dependencies.csproj @@ -8,7 +8,7 @@ - + diff --git a/LayoutFunctions/InteriorPartitions/dependencies/InteriorPartitions.Dependencies.csproj b/LayoutFunctions/InteriorPartitions/dependencies/InteriorPartitions.Dependencies.csproj index b9b0306e..f06c67a1 100644 --- a/LayoutFunctions/InteriorPartitions/dependencies/InteriorPartitions.Dependencies.csproj +++ b/LayoutFunctions/InteriorPartitions/dependencies/InteriorPartitions.Dependencies.csproj @@ -7,7 +7,7 @@ - + \ No newline at end of file diff --git a/LayoutFunctions/LayoutFunctionCommon/LayoutFunctionCommon.csproj b/LayoutFunctions/LayoutFunctionCommon/LayoutFunctionCommon.csproj index 9cc87daf..c871f4e3 100644 --- a/LayoutFunctions/LayoutFunctionCommon/LayoutFunctionCommon.csproj +++ b/LayoutFunctions/LayoutFunctionCommon/LayoutFunctionCommon.csproj @@ -17,8 +17,8 @@ - - + + diff --git a/LayoutFunctions/OpenCollabLayout/dependencies/OpenCollaborationLayout.Dependencies.csproj b/LayoutFunctions/OpenCollabLayout/dependencies/OpenCollaborationLayout.Dependencies.csproj index b66a918f..b732073c 100644 --- a/LayoutFunctions/OpenCollabLayout/dependencies/OpenCollaborationLayout.Dependencies.csproj +++ b/LayoutFunctions/OpenCollabLayout/dependencies/OpenCollaborationLayout.Dependencies.csproj @@ -3,7 +3,7 @@ net6.0 - + diff --git a/LayoutFunctions/OpenOfficeLayout/dependencies/OpenOfficeLayout.Dependencies.csproj b/LayoutFunctions/OpenOfficeLayout/dependencies/OpenOfficeLayout.Dependencies.csproj index f60e4fde..9f23804a 100644 --- a/LayoutFunctions/OpenOfficeLayout/dependencies/OpenOfficeLayout.Dependencies.csproj +++ b/LayoutFunctions/OpenOfficeLayout/dependencies/OpenOfficeLayout.Dependencies.csproj @@ -16,7 +16,7 @@ Include="../../../ZonePlanningFunctions/SpacePlanningZones/dependencies/ProgramRequirement.cs" /> --> - + diff --git a/LayoutFunctions/PantryLayout/dependencies/Floor.g.cs b/LayoutFunctions/PantryLayout/dependencies/Floor.g.cs deleted file mode 100644 index da4cfb8c..00000000 --- a/LayoutFunctions/PantryLayout/dependencies/Floor.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------- -// -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) -// -//---------------------- -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 - - /// Represents an abstract building floor - [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] - public partial class Floor : GeometricElement - { - [JsonConstructor] - public Floor(Profile @profile, double @thickness, System.Guid? @level, 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; - this.Thickness = @thickness; - this.Level = @level; - } - - // Empty constructor - public Floor() - : base() - { - } - - /// The untransformed profile of the floor. - [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Profile Profile { get; set; } - - /// The thickness of the floor. - [JsonProperty("Thickness", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Thickness { get; set; } - - /// The level this floor belongs to - [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid? Level { get; set; } - - - } -} \ No newline at end of file diff --git a/LayoutFunctions/PantryLayout/dependencies/PantryLayout.Dependencies.csproj b/LayoutFunctions/PantryLayout/dependencies/PantryLayout.Dependencies.csproj index 443f912a..12d6007d 100644 --- a/LayoutFunctions/PantryLayout/dependencies/PantryLayout.Dependencies.csproj +++ b/LayoutFunctions/PantryLayout/dependencies/PantryLayout.Dependencies.csproj @@ -4,9 +4,9 @@ net6.0 - + - + diff --git a/LayoutFunctions/PhoneBoothLayout/dependencies/Floor.g.cs b/LayoutFunctions/PhoneBoothLayout/dependencies/Floor.g.cs deleted file mode 100644 index da4cfb8c..00000000 --- a/LayoutFunctions/PhoneBoothLayout/dependencies/Floor.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------- -// -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) -// -//---------------------- -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 - - /// Represents an abstract building floor - [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] - public partial class Floor : GeometricElement - { - [JsonConstructor] - public Floor(Profile @profile, double @thickness, System.Guid? @level, 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; - this.Thickness = @thickness; - this.Level = @level; - } - - // Empty constructor - public Floor() - : base() - { - } - - /// The untransformed profile of the floor. - [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Profile Profile { get; set; } - - /// The thickness of the floor. - [JsonProperty("Thickness", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Thickness { get; set; } - - /// The level this floor belongs to - [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid? Level { get; set; } - - - } -} \ No newline at end of file diff --git a/LayoutFunctions/PhoneBoothLayout/dependencies/PhoneBoothLayout.Dependencies.csproj b/LayoutFunctions/PhoneBoothLayout/dependencies/PhoneBoothLayout.Dependencies.csproj index 443f912a..12d6007d 100644 --- a/LayoutFunctions/PhoneBoothLayout/dependencies/PhoneBoothLayout.Dependencies.csproj +++ b/LayoutFunctions/PhoneBoothLayout/dependencies/PhoneBoothLayout.Dependencies.csproj @@ -4,9 +4,9 @@ net6.0 - + - + diff --git a/LayoutFunctions/PlantEntourage/dependencies/Plant.cs b/LayoutFunctions/PlantEntourage/dependencies/Plant.cs index 89eff4c3..87e78a36 100644 --- a/LayoutFunctions/PlantEntourage/dependencies/Plant.cs +++ b/LayoutFunctions/PlantEntourage/dependencies/Plant.cs @@ -10,11 +10,20 @@ namespace Elements { public partial class Plant { + public const double DefaultPlantBaseWidth = 0.5; + public const double DefaultPlantHeight = 1.8; + public const double DefaultPlantBaseLength = 0.5; + public Plant(double @baseLength, double @baseWidth, double @height, Transform transform) : this(@baseWidth, @baseLength, @height, transform, material: new Material("Plant settings material", Colors.Green), name: "Plant settings") { } + public Plant(Transform transform) + : this(DefaultPlantBaseLength, DefaultPlantBaseWidth, DefaultPlantHeight, transform) + { + } + public override void UpdateRepresentations() { Vector3 halfLengthVector = 0.5 * BaseLength * Vector3.XAxis; diff --git a/LayoutFunctions/PlantEntourage/dependencies/PlantEntourageInputs.g.cs b/LayoutFunctions/PlantEntourage/dependencies/PlantEntourageInputs.g.cs index 48ba4e11..c102e484 100644 --- a/LayoutFunctions/PlantEntourage/dependencies/PlantEntourageInputs.g.cs +++ b/LayoutFunctions/PlantEntourage/dependencies/PlantEntourageInputs.g.cs @@ -29,17 +29,18 @@ public class PlantEntourageInputs : S3Args { [Newtonsoft.Json.JsonConstructor] - public PlantEntourageInputs(double @plantDensity, IList @programTypes, string bucketName, string uploadsBucket, Dictionary modelInputKeys, string gltfKey, string elementsKey, string ifcKey): + public PlantEntourageInputs(double @plantDensity, IList @programTypes, Overrides @overrides, string bucketName, string uploadsBucket, Dictionary modelInputKeys, string gltfKey, string elementsKey, string ifcKey): base(bucketName, uploadsBucket, modelInputKeys, gltfKey, elementsKey, ifcKey) { var validator = Validator.Instance.GetFirstValidatorForType(); if(validator != null) { - validator.PreConstruct(new object[]{ @plantDensity, @programTypes}); + validator.PreConstruct(new object[]{ @plantDensity, @programTypes, @overrides}); } this.PlantDensity = @plantDensity; this.ProgramTypes = @programTypes; + this.Overrides = @overrides ?? this.Overrides; if(validator != null) { @@ -56,5 +57,289 @@ public PlantEntourageInputs(double @plantDensity, IList @programTypes, s [Newtonsoft.Json.JsonProperty("Program Types", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public IList ProgramTypes { get; set; } = new List(); + [Newtonsoft.Json.JsonProperty("overrides", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Overrides Overrides { get; set; } = new Overrides(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class Overrides + + { + public Overrides() { } + + [Newtonsoft.Json.JsonConstructor] + public Overrides(OverrideAdditions @additions, OverrideRemovals @removals, IList @plants) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @additions, @removals, @plants}); + } + + this.Additions = @additions ?? this.Additions; + this.Removals = @removals ?? this.Removals; + this.Plants = @plants ?? this.Plants; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("Additions", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public OverrideAdditions Additions { get; set; } = new OverrideAdditions(); + + [Newtonsoft.Json.JsonProperty("Removals", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public OverrideRemovals Removals { get; set; } = new OverrideRemovals(); + + [Newtonsoft.Json.JsonProperty("Plants", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IList Plants { get; set; } = new List(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class OverrideAdditions + + { + public OverrideAdditions() { } + + [Newtonsoft.Json.JsonConstructor] + public OverrideAdditions(IList @plants) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @plants}); + } + + this.Plants = @plants ?? this.Plants; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("Plants", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IList Plants { get; set; } = new List(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class OverrideRemovals + + { + public OverrideRemovals() { } + + [Newtonsoft.Json.JsonConstructor] + public OverrideRemovals(IList @plants) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @plants}); + } + + this.Plants = @plants ?? this.Plants; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("Plants", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public IList Plants { get; set; } = new List(); + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class PlantsOverride + + { + [Newtonsoft.Json.JsonConstructor] + public PlantsOverride(string @id, PlantsIdentity @identity, PlantsValue @value) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @id, @identity, @value}); + } + + this.Id = @id; + this.Identity = @identity; + this.Value = @value; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } + + [Newtonsoft.Json.JsonProperty("Identity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public PlantsIdentity Identity { get; set; } + + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public PlantsValue Value { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class PlantsOverrideAddition + + { + [Newtonsoft.Json.JsonConstructor] + public PlantsOverrideAddition(string @id, PlantsIdentity @identity, PlantsOverrideAdditionValue @value) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @id, @identity, @value}); + } + + this.Id = @id; + this.Identity = @identity; + this.Value = @value; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } + + [Newtonsoft.Json.JsonProperty("Identity", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public PlantsIdentity Identity { get; set; } + + [Newtonsoft.Json.JsonProperty("Value", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public PlantsOverrideAdditionValue Value { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class PlantsOverrideRemoval + + { + [Newtonsoft.Json.JsonConstructor] + public PlantsOverrideRemoval(string @id, PlantsIdentity @identity) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @id, @identity}); + } + + this.Id = @id; + this.Identity = @identity; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string Id { get; set; } + + [Newtonsoft.Json.JsonProperty("Identity", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public PlantsIdentity Identity { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class PlantsIdentity + + { + [Newtonsoft.Json.JsonConstructor] + public PlantsIdentity(Vector3 @originalPosition) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @originalPosition}); + } + + this.OriginalPosition = @originalPosition; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("OriginalPosition", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Vector3 OriginalPosition { get; set; } + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class PlantsValue + + { + [Newtonsoft.Json.JsonConstructor] + public PlantsValue(Transform @transform, string @plantType) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @transform, @plantType}); + } + + this.Transform = @transform; + this.PlantType = @plantType; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("Transform", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Transform Transform { get; set; } + + [Newtonsoft.Json.JsonProperty("PlantType", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public string PlantType { get; set; } = "3D_Flowers_and_vase - 3D_Flowers_and_vase"; + + } + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] + + public partial class PlantsOverrideAdditionValue + + { + [Newtonsoft.Json.JsonConstructor] + public PlantsOverrideAdditionValue(Transform @transform) + { + var validator = Validator.Instance.GetFirstValidatorForType(); + if(validator != null) + { + validator.PreConstruct(new object[]{ @transform}); + } + + this.Transform = @transform; + + if(validator != null) + { + validator.PostConstruct(this); + } + } + + [Newtonsoft.Json.JsonProperty("Transform", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public Transform Transform { get; set; } + } } \ No newline at end of file diff --git a/LayoutFunctions/PlantEntourage/dependencies/PlantsOverride.g.cs b/LayoutFunctions/PlantEntourage/dependencies/PlantsOverride.g.cs new file mode 100644 index 00000000..eac8ff29 --- /dev/null +++ b/LayoutFunctions/PlantEntourage/dependencies/PlantsOverride.g.cs @@ -0,0 +1,153 @@ +using Elements; +using System.Collections.Generic; +using System; +using System.Linq; + +namespace PlantEntourage +{ + /// + /// Override metadata for PlantsOverride + /// + public partial class PlantsOverride : IOverride + { + public static string Name = "Plants"; + public static string Dependency = null; + public static string Context = "[*discriminator=Elements.Plant]"; + public static string Paradigm = "Edit"; + + /// + /// Get the override name for this override. + /// + public string GetName() { + return Name; + } + + public object GetIdentity() { + + return Identity; + } + + } + public static class PlantsOverrideExtensions + { + /// + /// Apply Plants edit overrides to a collection of existing elements + /// + /// The Plants Overrides to apply + /// A collection of existing elements to which to apply the overrides. + /// A function returning a boolean which indicates whether an element is a match for an override's identity. + /// A function to modify a matched element, returning the modified element. + /// The element type this override applies to. Should match the type(s) in the override's context. + /// A collection of elements, including unmodified and modified elements from the supplied collection. + public static List Apply( + this IList overrideData, + IEnumerable existingElements, + Func identityMatch, + Func modifyElement) where T : Element + { + var resultElements = new List(existingElements); + if (overrideData != null) + { + foreach (var overrideValue in overrideData) + { + // Assuming there will only be one match per identity, find the first element that matches. + var matchingElement = existingElements.FirstOrDefault(e => identityMatch(e, overrideValue.Identity)); + // if we found a match, + if (matchingElement != null) + { + // remove the old matching element + resultElements.Remove(matchingElement); + // apply the modification function to it + var modifiedElement = modifyElement(matchingElement, overrideValue); + // set the identity + Identity.AddOverrideIdentity(modifiedElement, overrideValue); + //and re-add it to the collection + resultElements.Add(modifiedElement); + } + } + } + return resultElements; + } + + /// + /// Apply Plants edit overrides to a collection of existing elements + /// + /// A collection of existing elements to which to apply the overrides. + /// The Plants Overrides to apply — typically `input.Overrides.Plants` + /// A function returning a boolean which indicates whether an element is a match for an override's identity. + /// A function to modify a matched element, returning the modified element. + /// The element type this override applies to. Should match the type(s) in the override's context. + /// A collection of elements, including unmodified and modified elements from the supplied collection. + public static void ApplyOverrides( + this List existingElements, + IList overrideData, + Func identityMatch, + Func modifyElement + ) where T : Element + { + var updatedElements = overrideData.Apply(existingElements, identityMatch, modifyElement); + existingElements.Clear(); + existingElements.AddRange(updatedElements); + } + + /// + /// Create elements from add/removeoverrides, and apply any edits. + /// + /// The collection of edit overrides (Overrides.Plants) + /// The collection of add overrides (Overrides.Additions.Plants) + /// The collection of remove overrides (Overrides.Removals.Plants) /// A function returning a boolean which indicates whether an element is a match for an override's identity. + /// A function to create a new element, returning the created element. + /// A function to modify a matched element, returning the modified element. + /// An optional collection of existing elements to which to apply any edit overrides, or remove if remove overrides are found. + /// The element type this override applies to. Should match the type(s) in the override's context. + /// A collection of elements, including new, unmodified, and modified elements from the supplied collection. + public static List CreateElements( + this IList edits, + IList additions, + IList removals, Func createElement, + Func identityMatch, + Func modifyElement, + IEnumerable existingElements = null + ) where T : Element + { + List resultElements = existingElements == null ? new List() : new List(existingElements); + if (removals != null) + { + foreach (var removedElement in removals) + { + var elementToRemove = resultElements.FirstOrDefault(e => identityMatch(e, removedElement.Identity)); + if (elementToRemove != null) + { + resultElements.Remove(elementToRemove); + } + } + } if (additions != null) + { + foreach (var addedElement in additions) + { + var elementToAdd = createElement(addedElement); + resultElements.Add(elementToAdd); + Identity.AddOverrideIdentity(elementToAdd, addedElement); + } + } + if (edits != null) + { + foreach (var editedElement in edits) + { + var elementToEdit = resultElements.FirstOrDefault(e => identityMatch(e, editedElement.Identity)); + if (elementToEdit != null) + { + resultElements.Remove(elementToEdit); + var newElement = modifyElement(elementToEdit, editedElement); + resultElements.Add(newElement); + Identity.AddOverrideIdentity(newElement, editedElement); + } + } + } + return resultElements; + } + + } + + +} \ No newline at end of file diff --git a/LayoutFunctions/PlantEntourage/dependencies/PlantsOverrideAddition.g.cs b/LayoutFunctions/PlantEntourage/dependencies/PlantsOverrideAddition.g.cs new file mode 100644 index 00000000..5c78297c --- /dev/null +++ b/LayoutFunctions/PlantEntourage/dependencies/PlantsOverrideAddition.g.cs @@ -0,0 +1,32 @@ +using Elements; +using System.Collections.Generic; +using System; +using System.Linq; + +namespace PlantEntourage +{ + /// + /// Override metadata for PlantsOverrideAddition + /// + public partial class PlantsOverrideAddition : IOverride + { + public static string Name = "Plants Addition"; + public static string Dependency = null; + public static string Context = "[*discriminator=Elements.Plant]"; + public static string Paradigm = "Edit"; + + /// + /// Get the override name for this override. + /// + public string GetName() { + return Name; + } + + public object GetIdentity() { + + return Identity; + } + + } + +} \ No newline at end of file diff --git a/LayoutFunctions/PlantEntourage/dependencies/PlantsOverrideRemoval.g.cs b/LayoutFunctions/PlantEntourage/dependencies/PlantsOverrideRemoval.g.cs new file mode 100644 index 00000000..f2215c57 --- /dev/null +++ b/LayoutFunctions/PlantEntourage/dependencies/PlantsOverrideRemoval.g.cs @@ -0,0 +1,32 @@ +using Elements; +using System.Collections.Generic; +using System; +using System.Linq; + +namespace PlantEntourage +{ + /// + /// Override metadata for PlantsOverrideRemoval + /// + public partial class PlantsOverrideRemoval : IOverride + { + public static string Name = "Plants Removal"; + public static string Dependency = null; + public static string Context = "[*discriminator=Elements.Plant]"; + public static string Paradigm = "Edit"; + + /// + /// Get the override name for this override. + /// + public string GetName() { + return Name; + } + + public object GetIdentity() { + + return Identity; + } + + } + +} \ No newline at end of file diff --git a/LayoutFunctions/PlantEntourage/hypar.json b/LayoutFunctions/PlantEntourage/hypar.json index 10bec389..482f3fb5 100644 --- a/LayoutFunctions/PlantEntourage/hypar.json +++ b/LayoutFunctions/PlantEntourage/hypar.json @@ -59,6 +59,46 @@ } } }, + "overrides": { + "Plants": { + "context": "[*discriminator=Elements.Plant]", + "identity": { + "OriginalPosition": { + "$ref": "https://schemas.hypar.io/Vector3.json" + } + }, + "schema": { + "Transform": { + "$ref": "https://schemas.hypar.io/Transform.json" + }, + "PlantType": { + "type": "string", + "default": "3D_Flowers_and_vase - 3D_Flowers_and_vase", + "$hyparEnumQuery": { + "query": "[*discriminator=Elements.Plant].AvailablePlantTypes", + "selfDependency": true + } + } + }, + "paradigm": "edit", + "behaviors": { + "add": { + "schema": { + "Transform": { + "$ref": "https://schemas.hypar.io/Transform.json" + } + } + }, + "remove": true + }, + "verbs": { + "add": "Add plant", + "remove": "Delete plant", + "edit": "Edit plant", + "revert": null + } + } + }, "outputs": [], "element_types": [ "https://schemas.hypar.io/SpaceBoundary.json", diff --git a/LayoutFunctions/PlantEntourage/src/PlantEntourage.cs b/LayoutFunctions/PlantEntourage/src/PlantEntourage.cs index 29f0821e..63fd1184 100644 --- a/LayoutFunctions/PlantEntourage/src/PlantEntourage.cs +++ b/LayoutFunctions/PlantEntourage/src/PlantEntourage.cs @@ -9,13 +9,17 @@ public static class PlantEntourage private const string NotAllPlantsPlacedWarningName = "Some plants cannot be placed"; private const string NotAllPlantsPlacedWarningText = "Some plants cannot be placed in a room because of obstacles or low density."; - private const double plantWidth = 0.5; - private const double plantHeight = 1.8; - private const double plantLength = 0.5; + private const double plantWidth = Plant.DefaultPlantBaseWidth; + private const double plantLength = Plant.DefaultPlantBaseLength; private const double gapBetweenPlantAndWall = 0.3; private const double minGapBetweenPlants = plantLength; + private const double originalPositionTolerance = 0.1; + private const string originalPositionKey = "OriginalPosition"; + private const string availablePlantTypesKey = "AvailablePlantTypes"; + private const string plantTypeKey = "PlantType"; + /// /// Puts a plant into each meeting room. /// @@ -43,6 +47,9 @@ public static PlantEntourageOutputs Execute(Dictionary inputModel var programTypes = input.ProgramTypes.ToHashSet(); var spaceBoundaries = siteModel.AllElementsOfType().Where(sp => programTypes.Contains(sp.ProgramType)); + var allPlantElementInstances = new List(); + var allPlantSettings = new List(); + foreach (var spaceBoundary in spaceBoundaries) { Polygon roomPolygon = spaceBoundary.Boundary.Perimeter; @@ -61,13 +68,14 @@ public static PlantEntourageOutputs Execute(Dictionary inputModel output.Model.AddElement(warning); } - foreach (var placement in placementSites) - { - var plantElements = CreatePlantElementsAtPlacementSite(placement); - output.Model.AddElements(plantElements); - } + var plantSettings = placementSites + .Select(placement => CreatePlantSettingsAtPlacementSite(placement)) + .ToList(); + allPlantSettings.AddRange(plantSettings); } + AddPlantsWithOverrides(input, output, allPlantSettings); + return output; } @@ -315,17 +323,22 @@ private static Polygon BBox3ToXYPolygon(BBox3 bBox) return polygon; } - private static Element[] CreatePlantElementsAtPlacementSite(Polygon plantSite) + private static Plant CreatePlantSettingsAtPlacementSite(Polygon plantSite) { - ContentElement plantCE = Plants.DFlowersAndVase3DFlowersAndVase; - BBox3 plantCEBBox = plantCE.BoundingBox; - Vector3 bboxCenter = plantCEBBox.Center(); var segments = plantSite.Segments(); var plantSettingsTransform = new Transform(plantSite.Center(), segments[0].Direction(), segments[1].Direction(), Vector3.ZAxis); - var plantTransform = new Transform(-bboxCenter.X, -bboxCenter.Y, 0).Concatenated(plantSettingsTransform); - var plant = plantCE.CreateInstance(plantTransform, "Plant"); - var plantSettings = new Plant(plantLength, plantWidth, plantHeight, plantSettingsTransform); - return new Element[] { plant, plantSettings }; + return CreatePlantSettingsFromTransform(plantSettingsTransform); + } + + private static Plant CreatePlantSettingsFromTransform(Transform transform) + { + var plant = new Plant(transform); + plant.AdditionalProperties[originalPositionKey] = transform.Origin; + plant.AdditionalProperties[availablePlantTypesKey] = Plants.All.Select(ce => ce.Name).ToList(); + // Put null here instead of the default plant type name because otherwise + // an edit override appears for each Plant Settings after any override. + plant.AdditionalProperties[plantTypeKey] = null; + return plant; } // lengthDir should be unitized first @@ -357,5 +370,67 @@ private static BBox3 GetElementIstanceBBox(ElementInstance obstacleInstance) var transform = obstacleInstance.Transform; return new BBox3(baseDefinition.BoundingBox.Corners().Select(c => transform.OfPoint(c))); } + + private static Plant UpdatePlant(Plant plant, PlantsOverride edit) + { + plant.Transform = edit.Value.Transform ?? plant.Transform; + plant.AdditionalProperties[plantTypeKey] = edit.Value.PlantType ?? plant.AdditionalProperties[plantTypeKey]; + return plant; + } + + private static bool IsMatchingOriginalPosition(Plant plantSettings, Vector3 identityOriginalPosition) + { + if (!plantSettings.AdditionalProperties.TryGetValue(originalPositionKey, out var pos)) + { + return false; + } + + return identityOriginalPosition.IsAlmostEqualTo((Vector3)pos, originalPositionTolerance); + } + + private static ElementInstance CreatePlantElementInstance(Transform transform, ContentElement plantCE) + { + Vector3 offsetFromOrigin = OffsetFromOriginByContentElement(plantCE); + var plantTransform = new Transform(offsetFromOrigin.Negate()).Concatenated(transform); + return plantCE.CreateInstance(plantTransform, "Plant"); + } + + private static Vector3 OffsetFromOriginByContentElement(ContentElement contentElement) + { + BBox3 contentElementBBox = contentElement.BoundingBox; + Vector3 bboxCenter = contentElementBBox.Center(); + return new Vector3(bboxCenter.X, bboxCenter.Y); + } + + private static ElementInstance CreatePlantInstanceFromPlantSettings(Plant plantSettings) + { + var plantTypeName = (string) plantSettings.AdditionalProperties[plantTypeKey]; + var plantCE = GetPlantContentElementByName(plantTypeName); + var instance = CreatePlantElementInstance(plantSettings.Transform, plantCE); + instance.AdditionalProperties[originalPositionKey] = plantSettings.AdditionalProperties[originalPositionKey]; + return instance; + } + + private static ContentElement GetPlantContentElementByName(string name) + { + return Plants.All.Where(ce => ce.Name == name).FirstOrDefault(Plants.DFlowersAndVase3DFlowersAndVase); + } + + private static void AddPlantsWithOverrides(PlantEntourageInputs input, PlantEntourageOutputs output, List plantSettings) + { + var overridenPlantSettings = input.Overrides.Plants.CreateElements( + input.Overrides.Additions.Plants, + input.Overrides.Removals.Plants, + (addition) => CreatePlantSettingsFromTransform(addition.Value.Transform), + (plant, identity) => IsMatchingOriginalPosition(plant, identity.OriginalPosition), + (plant, edit) => UpdatePlant(plant, edit), + plantSettings + ); + + output.Model.AddElements(overridenPlantSettings); + + var instances = overridenPlantSettings.Select(plant => CreatePlantInstanceFromPlantSettings(plant)); + output.Model.AddElements(instances); + } } } \ No newline at end of file diff --git a/LayoutFunctions/PrivateOfficeLayout/dependencies/Floor.g.cs b/LayoutFunctions/PrivateOfficeLayout/dependencies/Floor.g.cs deleted file mode 100644 index da4cfb8c..00000000 --- a/LayoutFunctions/PrivateOfficeLayout/dependencies/Floor.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------- -// -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) -// -//---------------------- -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 - - /// Represents an abstract building floor - [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] - public partial class Floor : GeometricElement - { - [JsonConstructor] - public Floor(Profile @profile, double @thickness, System.Guid? @level, 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; - this.Thickness = @thickness; - this.Level = @level; - } - - // Empty constructor - public Floor() - : base() - { - } - - /// The untransformed profile of the floor. - [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Profile Profile { get; set; } - - /// The thickness of the floor. - [JsonProperty("Thickness", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Thickness { get; set; } - - /// The level this floor belongs to - [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid? Level { get; set; } - - - } -} \ No newline at end of file diff --git a/LayoutFunctions/PrivateOfficeLayout/dependencies/PrivateOfficeLayout.Dependencies.csproj b/LayoutFunctions/PrivateOfficeLayout/dependencies/PrivateOfficeLayout.Dependencies.csproj index 443f912a..1e1650b6 100644 --- a/LayoutFunctions/PrivateOfficeLayout/dependencies/PrivateOfficeLayout.Dependencies.csproj +++ b/LayoutFunctions/PrivateOfficeLayout/dependencies/PrivateOfficeLayout.Dependencies.csproj @@ -1,15 +1,13 @@ - net6.0 - + - + - - + \ No newline at end of file diff --git a/LayoutFunctions/PrivateOfficeLayout/server/PrivateOfficeLayout.Server.csproj b/LayoutFunctions/PrivateOfficeLayout/server/PrivateOfficeLayout.Server.csproj index e15a32d8..c8bcda39 100644 --- a/LayoutFunctions/PrivateOfficeLayout/server/PrivateOfficeLayout.Server.csproj +++ b/LayoutFunctions/PrivateOfficeLayout/server/PrivateOfficeLayout.Server.csproj @@ -9,7 +9,7 @@ - netcoreapp3.1 + net6.0 diff --git a/LayoutFunctions/PrivateOfficeLayout/src/Function.g.cs b/LayoutFunctions/PrivateOfficeLayout/src/Function.g.cs index 283a849c..1f449151 100644 --- a/LayoutFunctions/PrivateOfficeLayout/src/Function.g.cs +++ b/LayoutFunctions/PrivateOfficeLayout/src/Function.g.cs @@ -61,11 +61,11 @@ public async Task Handler(PrivateOfficeLayoutInputs Console.WriteLine($"Time to load assemblies: {sw.Elapsed.TotalSeconds})"); if(this.store == null) - { + { this.store = new S3ModelStore(RegionEndpoint.GetBySystemName("us-west-1")); } - var l = new InvocationWrapper(store, PrivateOfficeLayout.Execute); + var l = new InvocationWrapper (store, PrivateOfficeLayout.Execute); var output = await l.InvokeAsync(args); return output; } diff --git a/LayoutFunctions/PrivateOfficeLayout/src/PrivateOfficeLayout.cs b/LayoutFunctions/PrivateOfficeLayout/src/PrivateOfficeLayout.cs index 5d540854..3dd6ae70 100644 --- a/LayoutFunctions/PrivateOfficeLayout/src/PrivateOfficeLayout.cs +++ b/LayoutFunctions/PrivateOfficeLayout/src/PrivateOfficeLayout.cs @@ -67,10 +67,6 @@ public static PrivateOfficeLayoutOutputs Execute(Dictionary input levelVolumes.FirstOrDefault(l => l.Name == lvl.Name); var wallCandidateLines = new List<(Line line, string type)>(); - if (lvl.Name.Equals("Level 5")) - { - - } foreach (var room in privateOfficeBoundaries) { var config = MatchApplicableOverride(overridesById, GetElementProxy(room, privateOfficeBoundaries.Proxies(SpaceBoundaryDependencyName)), input); @@ -80,7 +76,7 @@ public static PrivateOfficeLayoutOutputs Execute(Dictionary input { WallGeneration.FindWallCandidates(roomBoundary, levelVolume?.Profile, corridorSegments.Union(wallCandidateLines.Where(w => w.type == "Glass-Edge").Select(w => w.line)), out Line orientationGuideEdge); - var relativeRoomTransform = room.Transform.Concatenated(levelVolume.Transform.Inverted()); + var relativeRoomTransform = room.Transform.Concatenated(levelVolume?.Transform.Inverted() ?? new Transform()); var orientationTransform = new Transform(Vector3.Origin, orientationGuideEdge.Direction(), Vector3.ZAxis); orientationTransform.Concatenate(relativeRoomTransform); var boundaryCurves = new List(); @@ -153,7 +149,7 @@ public static PrivateOfficeLayoutOutputs Execute(Dictionary input private static IEnumerable DivideBoundaryAlongVAxis(SpaceBoundary room, LevelVolume levelVolume, List corridorSegments, List<(Line line, string type)> wallCandidateLines, SpaceSettingsOverride config) { - var levelInvertedTransform = levelVolume.Transform.Inverted(); + var levelInvertedTransform = levelVolume?.Transform.Inverted() ?? new Transform(); if (config.Value.OfficeSizing.AutomateOfficeSubdivisions) { var initialWallCandidates = WallGeneration.FindWallCandidates(room, levelVolume?.Profile, corridorSegments, out var orientationGuideEdge) diff --git a/LayoutFunctions/ReceptionLayout/dependencies/Floor.g.cs b/LayoutFunctions/ReceptionLayout/dependencies/Floor.g.cs deleted file mode 100644 index da4cfb8c..00000000 --- a/LayoutFunctions/ReceptionLayout/dependencies/Floor.g.cs +++ /dev/null @@ -1,58 +0,0 @@ -//---------------------- -// -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) -// -//---------------------- -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 - - /// Represents an abstract building floor - [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] - public partial class Floor : GeometricElement - { - [JsonConstructor] - public Floor(Profile @profile, double @thickness, System.Guid? @level, 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; - this.Thickness = @thickness; - this.Level = @level; - } - - // Empty constructor - public Floor() - : base() - { - } - - /// The untransformed profile of the floor. - [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public Profile Profile { get; set; } - - /// The thickness of the floor. - [JsonProperty("Thickness", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Thickness { get; set; } - - /// The level this floor belongs to - [JsonProperty("Level", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public System.Guid? Level { get; set; } - - - } -} \ No newline at end of file diff --git a/LayoutFunctions/ReceptionLayout/dependencies/ReceptionLayout.Dependencies.csproj b/LayoutFunctions/ReceptionLayout/dependencies/ReceptionLayout.Dependencies.csproj index fa2c8f80..634f5d50 100644 --- a/LayoutFunctions/ReceptionLayout/dependencies/ReceptionLayout.Dependencies.csproj +++ b/LayoutFunctions/ReceptionLayout/dependencies/ReceptionLayout.Dependencies.csproj @@ -5,9 +5,9 @@ - + - + diff --git a/Libraries/Elements.ThickenedPolyline/Elements.ThickenedPolyline.csproj b/Libraries/Elements.ThickenedPolyline/Elements.ThickenedPolyline.csproj index 802d9643..78e9df1c 100644 --- a/Libraries/Elements.ThickenedPolyline/Elements.ThickenedPolyline.csproj +++ b/Libraries/Elements.ThickenedPolyline/Elements.ThickenedPolyline.csproj @@ -3,6 +3,6 @@ net6.0 - + \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirements/dependencies/DefineProgramRequirements.Dependencies.csproj b/WorkplaceStrategy/DefineProgramRequirements/dependencies/DefineProgramRequirements.Dependencies.csproj index 9ba3567f..b1b05cb0 100644 --- a/WorkplaceStrategy/DefineProgramRequirements/dependencies/DefineProgramRequirements.Dependencies.csproj +++ b/WorkplaceStrategy/DefineProgramRequirements/dependencies/DefineProgramRequirements.Dependencies.csproj @@ -4,7 +4,7 @@ net6.0 - + \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/README.md b/WorkplaceStrategy/DefineProgramRequirementsMatrix/README.md index bd0f2d5c..c46fdd30 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/README.md +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/README.md @@ -15,3 +15,7 @@ Define a set of program requirements for Hypar Space. |---|---|---| |Total Program Area|Number|The total area of all program requirements.| + +
+ +## Additional Information \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/Adjacency.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/Adjacency.g.cs index 5705005f..18315f19 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/Adjacency.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/Adjacency.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -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 an edge in an adjacency graph. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class Adjacency { - [Newtonsoft.Json.JsonConstructor] + [JsonConstructor] public Adjacency(int @from, int @to, double @weight) { this.From = @from; @@ -38,13 +39,13 @@ public Adjacency() { } - [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("From", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int From { get; set; } - [Newtonsoft.Json.JsonProperty("To", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("To", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int To { get; set; } - [Newtonsoft.Json.JsonProperty("Weight", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Weight", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double Weight { get; set; } diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirements.Dependencies.csproj b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirements.Dependencies.csproj index 2aec2c10..191298d4 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirements.Dependencies.csproj +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirements.Dependencies.csproj @@ -1,12 +1,12 @@ - netcoreapp3.1 + net6.0 - - + + \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsInputs.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsInputs.g.cs index 5c368d12..eafef960 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsInputs.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsInputs.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; @@ -21,45 +22,7 @@ namespace DefineProgramRequirements { #pragma warning disable // Disable all warnings - /// Represents an edge in an adjacency graph. - [Newtonsoft.Json.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 Adjacency - - { - [Newtonsoft.Json.JsonConstructor] - public Adjacency(int @from, int @to, double @weight) - { - var validator = Validator.Instance.GetFirstValidatorForType(); - if(validator != null) - { - validator.PreConstruct(new object[]{ @from, @to, @weight}); - } - - this.From = @from; - this.To = @to; - this.Weight = @weight; - - if(validator != null) - { - validator.PostConstruct(this); - } - } - - [Newtonsoft.Json.JsonProperty("From", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int From { get; set; } - - [Newtonsoft.Json.JsonProperty("To", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public int To { get; set; } - - [Newtonsoft.Json.JsonProperty("Weight", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - public double Weight { get; set; } - - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public class DefineProgramRequirementsInputs : S3Args @@ -86,32 +49,5 @@ public DefineProgramRequirementsInputs(ProgramAdjacencyMatrix @program, string b [Newtonsoft.Json.JsonProperty("Program", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public ProgramAdjacencyMatrix Program { get; set; } - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] - public enum ProgramRequirementCountType - { - [System.Runtime.Serialization.EnumMember(Value = @"Item")] - Item = 0, - - [System.Runtime.Serialization.EnumMember(Value = @"Area Total")] - Area_Total = 1, - - } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] - [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple = true)] - internal class JsonInheritanceAttribute : System.Attribute - { - public JsonInheritanceAttribute(string key, System.Type type) - { - Key = key; - Type = type; - } - - public string Key { get; } - - public System.Type Type { get; } } } \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsOutputs.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsOutputs.g.cs index e9838570..d08ca0de 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsOutputs.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/DefineProgramRequirementsOutputs.g.cs @@ -14,7 +14,7 @@ namespace DefineProgramRequirements { - public class DefineProgramRequirementsOutputs: ResultsBase + public class DefineProgramRequirementsOutputs: SystemResults { /// /// The total area of all program requirements. diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramAdjacencyMatrix.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramAdjacencyMatrix.g.cs index 7ae7d92b..edfe4451 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramAdjacencyMatrix.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramAdjacencyMatrix.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -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 a set of program requirements and their desired adjacencies. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class ProgramAdjacencyMatrix : Element { - [Newtonsoft.Json.JsonConstructor] + [JsonConstructor] public ProgramAdjacencyMatrix(IList @nodes, IList @edges, System.Guid @id = default, string @name = null) : base(id, name) { @@ -39,10 +40,10 @@ public ProgramAdjacencyMatrix() { } - [Newtonsoft.Json.JsonProperty("Nodes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Nodes", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public IList Nodes { get; set; } - [Newtonsoft.Json.JsonProperty("Edges", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Edges", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public IList Edges { get; set; } diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirement.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirement.g.cs index f45d65ea..324e49e9 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirement.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirement.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -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,12 +22,12 @@ namespace Elements #pragma warning disable // Disable all warnings /// Fill out your program requirements. Use "Hypar Space Type" to dictate which function should be used to lay out your space. - [Newtonsoft.Json.JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [JsonConverter(typeof(Elements.Serialization.JSON.JsonInheritanceConverter), "discriminator")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public partial class ProgramRequirement : Element { - [Newtonsoft.Json.JsonConstructor] - public ProgramRequirement(string @programGroup, string @programName, Color @color, double @areaPerSpace, int @spaceCount, double? @width, double? @depth, string @hyparSpaceType, ProgramRequirementCountType @countType, System.Guid @id = default, string @name = null) + [JsonConstructor] + public ProgramRequirement(string @programGroup, string @programName, Color @color, double @areaPerSpace, int @spaceCount, double? @width, double? @depth, string @hyparSpaceType, ProgramRequirementCountType @countType, double @totalArea, System.Guid @id = default, string @name = null) : base(id, name) { this.ProgramGroup = @programGroup; @@ -38,6 +39,7 @@ public ProgramRequirement(string @programGroup, string @programName, Color @colo this.Depth = @depth; this.HyparSpaceType = @hyparSpaceType; this.CountType = @countType; + this.TotalArea = @totalArea; } // Empty constructor @@ -47,36 +49,36 @@ public ProgramRequirement() } /// What group does this program belong to? - [Newtonsoft.Json.JsonProperty("Program Group", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Program Group", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string ProgramGroup { get; set; } /// What display name should be used for this program type? - [Newtonsoft.Json.JsonProperty("Program Name", Required = Newtonsoft.Json.Required.Always)] + [JsonProperty("Program Name", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string ProgramName { get; set; } /// What color should be used to display this space type? - [Newtonsoft.Json.JsonProperty("Color", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Color", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public Color Color { get; set; } /// How much area should be allocated for this space? - [Newtonsoft.Json.JsonProperty("Area per Space", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Area per Space", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double AreaPerSpace { get; set; } /// How many of this space type are required? Leave at 1 for spaces measured in aggregate, like circulation. - [Newtonsoft.Json.JsonProperty("Space Count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonProperty("Space Count", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public int SpaceCount { get; set; } = 1; - /// The width of this space (typically the longer dimension — along the side from which the space is accessed, like a corridor.) - [Newtonsoft.Json.JsonProperty("Width", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + /// Optional. (Typically the longer dimension — along the side from which the space is accessed, like a corridor.) + [JsonProperty("Width", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Width { get; set; } - /// The depth of this space (typically the shorter dimension — perpendicular to the side from which the space is accessed, like a corridor.) - [Newtonsoft.Json.JsonProperty("Depth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + /// Optional. (Typically the shorter dimension — perpendicular to the side from which the space is accessed, like a corridor.) + [JsonProperty("Depth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public double? Depth { get; set; } - /// What program type best matches this one? - [Newtonsoft.Json.JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Always)] + /// Which furniture layout function should be used to lay out this space? + [JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Always)] [System.ComponentModel.DataAnnotations.Required(AllowEmptyStrings = true)] public string HyparSpaceType { get; set; } = "unspecified"; @@ -85,10 +87,14 @@ public ProgramRequirement() /// Use "Item" for individual spaces (e.g. 3 conference rooms), /// "Area Total" for spaces where you only care about the total (e.g. 1000 SF of circulation), and /// "Unit" where you want total area divided by a "unit" size (e.g. this space supports 400 people at 120 SF / person) - [Newtonsoft.Json.JsonProperty("Count Type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + [JsonProperty("Count Type", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + [JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public ProgramRequirementCountType CountType { get; set; } = Elements.ProgramRequirementCountType.Item; + /// The Area per Space times the Space Count + [JsonProperty("Total Area", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] + public double TotalArea { get; set; } + } } \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirementCountType.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirementCountType.g.cs index 565142bd..ff9e2873 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirementCountType.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/dependencies/ProgramRequirementCountType.g.cs @@ -1,6 +1,6 @@ //---------------------- // -// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v12.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v10.1.21.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- using Elements; @@ -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; @@ -20,7 +21,7 @@ namespace Elements { #pragma warning disable // Disable all warnings - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v12.0.0.0)")] + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")] public enum ProgramRequirementCountType { [System.Runtime.Serialization.EnumMember(Value = @"Item")] diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/global.json b/WorkplaceStrategy/DefineProgramRequirementsMatrix/global.json index 792591b3..4aef4472 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/global.json +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "3.1.100", + "version": "6.0.400", "rollForward": "latestMinor" } } \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/DefineProgramRequirements.csproj b/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/DefineProgramRequirements.csproj index af002434..66284cd3 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/DefineProgramRequirements.csproj +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/DefineProgramRequirements.csproj @@ -5,12 +5,12 @@
- - + + - netcoreapp3.1 + net6.0 \ No newline at end of file diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/Function.g.cs b/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/Function.g.cs index cfb7440c..e2ef1b9f 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/Function.g.cs +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/src/Function.g.cs @@ -48,6 +48,7 @@ public async Task Handler(DefineProgramRequire { try { + Console.WriteLine($"Assembly Name: {asm.FullName}"); Assembly.Load(asm); } catch (Exception e) @@ -61,7 +62,7 @@ public async Task Handler(DefineProgramRequire if(this.store == null) { - this.store = new S3ModelStore(RegionEndpoint.USWest1); + this.store = new S3ModelStore(RegionEndpoint.GetBySystemName("us-west-1")); } var l = new InvocationWrapper(store, DefineProgramRequirements.Execute); diff --git a/WorkplaceStrategy/DefineProgramRequirementsMatrix/test/DefineProgramRequirements.Tests.csproj b/WorkplaceStrategy/DefineProgramRequirementsMatrix/test/DefineProgramRequirements.Tests.csproj index 3e5343ce..46808898 100644 --- a/WorkplaceStrategy/DefineProgramRequirementsMatrix/test/DefineProgramRequirements.Tests.csproj +++ b/WorkplaceStrategy/DefineProgramRequirementsMatrix/test/DefineProgramRequirements.Tests.csproj @@ -1,13 +1,13 @@ - netcoreapp3.1 + net6.0 false - + diff --git a/WorkplaceStrategy/WorkplaceMetrics/dependencies/WorkplaceMetrics.Dependencies.csproj b/WorkplaceStrategy/WorkplaceMetrics/dependencies/WorkplaceMetrics.Dependencies.csproj index 471c096c..b1b05cb0 100644 --- a/WorkplaceStrategy/WorkplaceMetrics/dependencies/WorkplaceMetrics.Dependencies.csproj +++ b/WorkplaceStrategy/WorkplaceMetrics/dependencies/WorkplaceMetrics.Dependencies.csproj @@ -4,7 +4,7 @@ net6.0 - + \ No newline at end of file diff --git a/build-all.sh b/build-all.sh new file mode 100644 index 00000000..f1e79c57 --- /dev/null +++ b/build-all.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +# Find all hypar.json files, excluding those in Archive, and store their paths in an array +file_paths=($(find -name 'hypar.json' ! -path '*/Archive/*')) + +# Array to store failed directories +failed_directories=() + +# Iterate through each file path +for file_path in "${file_paths[@]}"; do + # Get the directory containing the hypar.json file + directory=$(dirname "$file_path") + + # Change to the directory + cd "$directory" || exit + + # Run dotnet build + if ! dotnet build; then + # Add the failed directory to the array + failed_directories+=("$directory") + fi + + # Change back to the original directory + cd - || exit +done + +# Check if there are any failed directories +if [ ${#failed_directories[@]} -eq 0 ]; then + echo "All builds successful" +else + echo "Failed directories:" + for failed_directory in "${failed_directories[@]}"; do + echo "$failed_directory" + done + exit 1 +fi \ No newline at end of file