diff --git a/SpaceConfigurationFromModel/.gitignore b/SpaceConfigurationFromModel/.gitignore
new file mode 100644
index 00000000..f1d4f671
--- /dev/null
+++ b/SpaceConfigurationFromModel/.gitignore
@@ -0,0 +1,9 @@
+
+bin/
+obj/
+*.glb
+output.json
+input.json
+.vs/
+server/
+test/Generated/
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/README.md b/SpaceConfigurationFromModel/README.md
new file mode 100644
index 00000000..cdbde213
--- /dev/null
+++ b/SpaceConfigurationFromModel/README.md
@@ -0,0 +1,24 @@
+
+
+# SpaceConfiguration from Model
+
+The SpaceConfigurationFromModel function.
+
+|Input Name|Type|Description|
+|---|---|---|
+|Program|[
+ "string",
+ "null"
+]||
+|Model File|https://prod-api.hypar.io/schemas/InputData||
+
+
+
+
+|Output Name|Type|Description|
+|---|---|---|
+
+
+
+
+## Additional Information
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/SpaceConfigurationFromModel.sln b/SpaceConfigurationFromModel/SpaceConfigurationFromModel.sln
new file mode 100644
index 00000000..03ac227e
--- /dev/null
+++ b/SpaceConfigurationFromModel/SpaceConfigurationFromModel.sln
@@ -0,0 +1,34 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceConfigurationFromModel", "src\SpaceConfigurationFromModel.csproj", "{523F6178-B262-4D00-82EE-64DBC360E91B}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceConfigurationFromModel.Dependencies", "dependencies\SpaceConfigurationFromModel.Dependencies.csproj", "{DD190A45-1532-4C7A-9433-F0FB30A53D48}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceConfigurationFromModel.Tests", "test\SpaceConfigurationFromModel.Tests.csproj", "{6E7331E9-FA62-498B-BA08-91887C97B3AD}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {523F6178-B262-4D00-82EE-64DBC360E91B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {523F6178-B262-4D00-82EE-64DBC360E91B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {523F6178-B262-4D00-82EE-64DBC360E91B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {523F6178-B262-4D00-82EE-64DBC360E91B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {DD190A45-1532-4C7A-9433-F0FB30A53D48}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {DD190A45-1532-4C7A-9433-F0FB30A53D48}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {DD190A45-1532-4C7A-9433-F0FB30A53D48}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {DD190A45-1532-4C7A-9433-F0FB30A53D48}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6E7331E9-FA62-498B-BA08-91887C97B3AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E7331E9-FA62-498B-BA08-91887C97B3AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E7331E9-FA62-498B-BA08-91887C97B3AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E7331E9-FA62-498B-BA08-91887C97B3AD}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/SpaceConfigurationFromModel/dependencies/CirculationSegment.cs b/SpaceConfigurationFromModel/dependencies/CirculationSegment.cs
new file mode 100644
index 00000000..8fc4cbef
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/CirculationSegment.cs
@@ -0,0 +1,12 @@
+using Elements;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using Elements.Geometry;
+namespace Elements
+{
+ public partial class CirculationSegment : ICirculationSegment
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/CirculationSegment.g.cs b/SpaceConfigurationFromModel/dependencies/CirculationSegment.g.cs
new file mode 100644
index 00000000..de3dcd58
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/CirculationSegment.g.cs
@@ -0,0 +1,48 @@
+//----------------------
+//
+// 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 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 v13.0.0.0)")]
+ public partial class CirculationSegment : Floor
+ {
+ [JsonConstructor]
+ 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;
+ }
+
+ // Empty constructor
+ public CirculationSegment()
+ : base()
+ {
+ }
+
+ /// The geometry of this circulation segment
+ [JsonProperty("Geometry", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public ThickenedPolyline Geometry { get; set; }
+
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/LevelElements.cs b/SpaceConfigurationFromModel/dependencies/LevelElements.cs
new file mode 100644
index 00000000..954ca012
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/LevelElements.cs
@@ -0,0 +1,6 @@
+namespace Elements
+{
+ public partial class LevelElements : Element, ILevelElements
+ {
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/LevelElements.g.cs b/SpaceConfigurationFromModel/dependencies/LevelElements.g.cs
new file mode 100644
index 00000000..dd221b85
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/LevelElements.g.cs
@@ -0,0 +1,53 @@
+//----------------------
+//
+// 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
+
+ /// 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 v13.0.0.0)")]
+ public partial class LevelElements : Element
+ {
+ [JsonConstructor]
+ public LevelElements(IList @elements, System.Guid @level, System.Guid @id = default, string @name = null)
+ : base(id, name)
+ {
+ this.Elements = @elements;
+ this.Level = @level;
+ }
+
+ // Empty constructor
+ public LevelElements()
+ : base()
+ {
+ }
+
+ /// The list of elements.
+ [JsonProperty("Elements", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public IList Elements { get; set; }
+
+ /// The Level element this set of elements is associated with
+ [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/SpaceConfigurationFromModel/dependencies/LevelVolume.cs b/SpaceConfigurationFromModel/dependencies/LevelVolume.cs
new file mode 100644
index 00000000..eee25b01
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/LevelVolume.cs
@@ -0,0 +1,12 @@
+using Elements;
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using Elements.Geometry;
+namespace Elements
+{
+ public partial class LevelVolume : ILevelVolume
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/LevelVolume.g.cs b/SpaceConfigurationFromModel/dependencies/LevelVolume.g.cs
new file mode 100644
index 00000000..d3164fe8
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/LevelVolume.g.cs
@@ -0,0 +1,78 @@
+//----------------------
+//
+// 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
+
+ /// 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 v13.0.0.0)")]
+ public partial class LevelVolume : GeometricElement
+ {
+ [JsonConstructor]
+ public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
+ : 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
+ public LevelVolume()
+ : base()
+ {
+ }
+
+ /// The profile of the level Volume
+ [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public Profile Profile { get; set; }
+
+ /// The floor-to-floor height of this level
+ [JsonProperty("Height", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double Height { get; set; }
+
+ /// The area of the level's profile.
+ [JsonProperty("Area", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double Area { get; set; }
+
+ /// The name of the building or mass this level belongs to (optional)
+ [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/SpaceConfigurationFromModel/dependencies/ServiceCore.g.cs b/SpaceConfigurationFromModel/dependencies/ServiceCore.g.cs
new file mode 100644
index 00000000..4e67c4b2
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/ServiceCore.g.cs
@@ -0,0 +1,63 @@
+//----------------------
+//
+// 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 a building service core.
+ [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 ServiceCore : GeometricElement
+ {
+ [JsonConstructor]
+ public ServiceCore(Profile @profile, double @elevation, double @height, Vector3 @centroid, 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.Elevation = @elevation;
+ this.Height = @height;
+ this.Centroid = @centroid;
+ }
+
+ // Empty constructor
+ public ServiceCore()
+ : base()
+ {
+ }
+
+ /// The profile of this Core
+ [JsonProperty("Profile", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public Profile Profile { get; set; }
+
+ /// The elevation of the core.
+ [JsonProperty("Elevation", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double Elevation { get; set; }
+
+ /// The height of the core.
+ [JsonProperty("Height", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double Height { get; set; }
+
+ /// A reference location for the centroid of the Core's profile.
+ [JsonProperty("Centroid", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public Vector3 Centroid { get; set; }
+
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/SpaceBoundary.cs b/SpaceConfigurationFromModel/dependencies/SpaceBoundary.cs
new file mode 100644
index 00000000..ed244d1f
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/SpaceBoundary.cs
@@ -0,0 +1,9 @@
+using Elements.Geometry;
+namespace Elements
+{
+ public partial class SpaceBoundary : GeometricElement, ISpaceBoundary
+ {
+ public Vector3? ParentCentroid { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/SpaceBoundary.g.cs b/SpaceConfigurationFromModel/dependencies/SpaceBoundary.g.cs
new file mode 100644
index 00000000..38a59481
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/SpaceBoundary.g.cs
@@ -0,0 +1,97 @@
+//----------------------
+//
+// 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
+
+ /// 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 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, 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;
+ this.Cells = @cells;
+ this.Area = @area;
+ this.Length = @length;
+ this.Depth = @depth;
+ this.Height = @height;
+ this.ProgramGroup = @programGroup;
+ this.ProgramType = @programType;
+ this.Level = @level;
+ this.LevelLayout = @levelLayout;
+ this.HyparSpaceType = @hyparSpaceType;
+ }
+
+ // Empty constructor
+ public SpaceBoundary()
+ : base()
+ {
+ }
+
+ /// The boundary of the space
+ [JsonProperty("Boundary", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public Profile Boundary { get; set; }
+
+ /// Component cells making up the boundary
+ [JsonProperty("Cells", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public IList Cells { get; set; }
+
+ /// The area of the boundary
+ [JsonProperty("Area", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double Area { get; set; }
+
+ /// The rough length of this space boundary, parallel to the accessible edge
+ [JsonProperty("Length", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double? Length { get; set; }
+
+ /// The rough depth of the space boundary, perpendicular to the accessible edge
+ [JsonProperty("Depth", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double? Depth { get; set; }
+
+ /// The height of this space boundary
+ [JsonProperty("Height", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double Height { get; set; }
+
+ /// A program grouping, like a department.
+ [JsonProperty("Program Group", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string ProgramGroup { get; set; }
+
+ /// The name of the program type assigned to this space (like "Open Office" or "Meeting Room")
+ [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/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModel.Dependencies.csproj b/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModel.Dependencies.csproj
new file mode 100644
index 00000000..3d763458
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModel.Dependencies.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModelInputs.g.cs b/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModelInputs.g.cs
new file mode 100644
index 00000000..d9d98faa
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModelInputs.g.cs
@@ -0,0 +1,57 @@
+// This code was generated by Hypar.
+// Edits to this code will be overwritten the next time you run 'hypar init'.
+// DO NOT EDIT THIS FILE.
+
+using Elements;
+using Elements.GeoJSON;
+using Elements.Geometry;
+using Elements.Geometry.Solids;
+using Elements.Validators;
+using Elements.Serialization.JSON;
+using Hypar.Functions;
+using Hypar.Functions.Execution;
+using Hypar.Functions.Execution.AWS;
+using Hypar.Model;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Line = Elements.Geometry.Line;
+using Polygon = Elements.Geometry.Polygon;
+
+namespace SpaceConfigurationFromModel
+{
+ #pragma warning disable // Disable all warnings
+
+ [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.1.21.0 (Newtonsoft.Json v13.0.0.0)")]
+
+ public class SpaceConfigurationFromModelInputs : S3Args
+
+ {
+ [Newtonsoft.Json.JsonConstructor]
+
+ public SpaceConfigurationFromModelInputs(string @program, InputData @modelFile, 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[]{ @program, @modelFile});
+ }
+
+ this.Program = @program;
+ this.ModelFile = @modelFile;
+
+ if(validator != null)
+ {
+ validator.PostConstruct(this);
+ }
+ }
+
+ [Newtonsoft.Json.JsonProperty("Program", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public string Program { get; set; }
+
+ [Newtonsoft.Json.JsonProperty("Model File", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public InputData ModelFile { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModelOutputs.g.cs b/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModelOutputs.g.cs
new file mode 100644
index 00000000..adc9e1ee
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/SpaceConfigurationFromModelOutputs.g.cs
@@ -0,0 +1,32 @@
+// This code was generated by Hypar.
+// Edits to this code will be overwritten the next time you run 'hypar init'.
+// DO NOT EDIT THIS FILE.
+
+using Elements;
+using Elements.GeoJSON;
+using Elements.Geometry;
+using Hypar.Functions;
+using Hypar.Functions.Execution;
+using Hypar.Functions.Execution.AWS;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Converters;
+using System.Collections.Generic;
+
+namespace SpaceConfigurationFromModel
+{
+ public class SpaceConfigurationFromModelOutputs: SystemResults
+ {
+
+
+ ///
+ /// Construct a SpaceConfigurationFromModelOutputs with default inputs.
+ /// This should be used for testing only.
+ ///
+ public SpaceConfigurationFromModelOutputs() : base()
+ {
+
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/dependencies/ThickenedPolyline.g.cs b/SpaceConfigurationFromModel/dependencies/ThickenedPolyline.g.cs
new file mode 100644
index 00000000..01d3fec4
--- /dev/null
+++ b/SpaceConfigurationFromModel/dependencies/ThickenedPolyline.g.cs
@@ -0,0 +1,63 @@
+//----------------------
+//
+// 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
+
+ /// 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 v13.0.0.0)")]
+ public partial class ThickenedPolyline
+ {
+ [JsonConstructor]
+ public ThickenedPolyline(Polyline @polyline, double? @width, bool? @flip, double @leftWidth, double @rightWidth)
+ {
+ this.Polyline = @polyline;
+ this.Width = @width;
+ this.Flip = @flip;
+ this.LeftWidth = @leftWidth;
+ this.RightWidth = @rightWidth;
+ }
+
+ // Empty constructor
+ 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.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double? Width { 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)]
+ public double LeftWidth { get; set; }
+
+ /// The amount to thicken the polyline on its "right" 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 right side extends into the +X quadrant.
+ [JsonProperty("rightWidth", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
+ public double RightWidth { get; set; }
+
+
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/global.json b/SpaceConfigurationFromModel/global.json
new file mode 100644
index 00000000..4aef4472
--- /dev/null
+++ b/SpaceConfigurationFromModel/global.json
@@ -0,0 +1,7 @@
+
+{
+ "sdk": {
+ "version": "6.0.400",
+ "rollForward": "latestMinor"
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/hypar.json b/SpaceConfigurationFromModel/hypar.json
new file mode 100644
index 00000000..40b2cb90
--- /dev/null
+++ b/SpaceConfigurationFromModel/hypar.json
@@ -0,0 +1,67 @@
+{
+ "$schema": "https://hypar.io/Schemas/Function.json",
+ "id": "6dd14308-bb80-481d-a8ae-46d8869b6f1a",
+ "name": "SpaceConfiguration from Model",
+ "description": "The SpaceConfigurationFromModel function.",
+ "language": "C#",
+ "model_dependencies": [
+ {
+ "autohide": false,
+ "name": "Program Requirements",
+ "optional": false
+ },
+ {
+ "autohide": false,
+ "name": "Space Planning Zones",
+ "optional": false
+ },
+ {
+ "autohide": false,
+ "name": "Circulation",
+ "optional": true
+ },
+ {
+ "autohide": false,
+ "name": "Levels",
+ "optional": true
+ },
+ {
+ "autohide": false,
+ "name": "Conceptual Mass",
+ "optional": true
+ }
+ ],
+ "input_schema": {
+ "type": "object",
+ "properties": {
+ "Program": {
+ "type": [
+ "string",
+ "null"
+ ],
+ "$hyparEnumQuery": {
+ "dependency": "Program Requirements",
+ "query": "[*discriminator=Elements.ProgramRequirement].Qualified Program Name"
+ }
+ },
+ "Model File": {
+ "$ref": "https://prod-api.hypar.io/schemas/InputData",
+ "$hyparOrder": 1,
+ "$hyparFileTypes": [
+ "json"
+ ]
+ }
+ }
+ },
+ "outputs": [],
+ "element_types": [
+ "https://prod-api.hypar.io/schemas/SpaceBoundary",
+ "https://prod-api.hypar.io/schemas/LevelElements",
+ "https://prod-api.hypar.io/schemas/CirculationSegment",
+ "https://prod-api.hypar.io/schemas/LevelVolume",
+ "https://prod-api.hypar.io/schemas/ServiceCore"
+ ],
+ "repository_url": "https://github.com/hypar-io/function",
+ "last_updated": "0001-01-01T00:00:00",
+ "cli_version": "1.6.0"
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/src/Function.g.cs b/SpaceConfigurationFromModel/src/Function.g.cs
new file mode 100644
index 00000000..2ae160d0
--- /dev/null
+++ b/SpaceConfigurationFromModel/src/Function.g.cs
@@ -0,0 +1,73 @@
+// This code was generated by Hypar.
+// Edits to this code will be overwritten the next time you run 'hypar init'.
+// DO NOT EDIT THIS FILE.
+
+using Amazon;
+using Amazon.Lambda.Core;
+using Hypar.Functions.Execution;
+using Hypar.Functions.Execution.AWS;
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Threading.Tasks;
+
+[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
+namespace SpaceConfigurationFromModel
+{
+ public class Function
+ {
+ // Cache the model store for use by subsequent
+ // executions of this lambda.
+ private IModelStore store;
+
+ public async Task Handler(SpaceConfigurationFromModelInputs args, ILambdaContext context)
+ {
+ // Preload dependencies (if they exist),
+ // so that they are available during model deserialization.
+
+ var sw = System.Diagnostics.Stopwatch.StartNew();
+ var asmLocation = this.GetType().Assembly.Location;
+ var asmDir = Path.GetDirectoryName(asmLocation);
+
+ // Explicitly load the dependencies project, it might have types
+ // that aren't used in the function but are necessary for correct
+ // deserialization.
+ var asmName = Path.GetFileNameWithoutExtension(asmLocation);
+ var depPath = Path.Combine(asmDir, $"{asmName}.Dependencies.dll");
+ if(File.Exists(depPath))
+ {
+ Console.WriteLine($"Loading dependencies assembly from: {depPath}...");
+ Assembly.LoadFrom(depPath);
+ Console.WriteLine("Dependencies assembly loaded.");
+ }
+
+ // Load all reference assemblies.
+ Console.WriteLine($"Loading all referenced assemblies.");
+ foreach (var asm in this.GetType().Assembly.GetReferencedAssemblies())
+ {
+ try
+ {
+ Console.WriteLine($"Assembly Name: {asm.FullName}");
+ Assembly.Load(asm);
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine($"Failed to load {asm.FullName}");
+ Console.WriteLine(e.Message);
+ }
+ }
+ sw.Stop();
+ 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, SpaceConfigurationFromModel.Execute);
+ var output = await l.InvokeAsync(args);
+ return output;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/src/SpaceConfigurationFromModel.cs b/SpaceConfigurationFromModel/src/SpaceConfigurationFromModel.cs
new file mode 100644
index 00000000..f5af89a5
--- /dev/null
+++ b/SpaceConfigurationFromModel/src/SpaceConfigurationFromModel.cs
@@ -0,0 +1,100 @@
+using Elements;
+using Elements.Components;
+using Elements.Geometry;
+using LayoutFunctionCommon;
+using static Elements.Components.ContentConfiguration;
+
+namespace SpaceConfigurationFromModel
+{
+ public static class SpaceConfigurationFromModel
+ {
+ private class SpaceConfigurationFromModelLayoutGeneration : LayoutGeneration
+ {
+ private readonly SpaceConfiguration spaceConfig;
+
+ internal SpaceConfigurationFromModelLayoutGeneration(SpaceConfiguration spaceConfig)
+ {
+ this.spaceConfig = spaceConfig;
+ }
+
+ protected override SpaceConfiguration DeserializeConfigJson(string configJson)
+ {
+ return spaceConfig;
+ }
+ }
+
+ ///
+ /// The SpaceConfigurationFromModel function.
+ ///
+ /// The input model.
+ /// The arguments to the execution.
+ /// A SpaceConfigurationFromModelOutputs instance containing computed results and the model with any new elements.
+ public static SpaceConfigurationFromModelOutputs Execute(Dictionary inputModels, SpaceConfigurationFromModelInputs input)
+ {
+ Elements.Serialization.glTF.GltfExtensions.UseReferencedContentExtension = true;
+ var output = new SpaceConfigurationFromModelOutputs();
+ if (string.IsNullOrWhiteSpace(input?.ModelFile?.LocalFilePath))
+ {
+ return output;
+ }
+ Model model;
+ try
+ {
+ var json = File.ReadAllText(input.ModelFile.LocalFilePath);
+ model = Model.FromJson(json, out var modelLoadErrors);
+ }
+ catch
+ {
+ output.Warnings.Add("Can't load model from input file.");
+ return output;
+ }
+
+ var elementInstances = model.AllElementsOfType();
+ var spaceConfiguration = new SpaceConfiguration();
+ foreach (var space in model.AllElementsOfType())
+ {
+ var bbox = new BBox3(space.Boundary);
+ var boundaryDefinition = new BoundaryDefinition()
+ {
+ Min = new Vector3(),
+ Max = new Vector3(bbox.XSize, bbox.YSize)
+ };
+ var contentItems = CreateContentItems(elementInstances, space, boundaryDefinition);
+ var contentConfiguration = new ContentConfiguration
+ {
+ ContentItems = contentItems,
+ CellBoundary = boundaryDefinition
+ };
+
+ spaceConfiguration.Add(space.Name, contentConfiguration);
+ }
+
+ var programName = input.Program ?? "Open Office";
+ var layoutGeneration = new SpaceConfigurationFromModelLayoutGeneration(spaceConfiguration);
+ var result = layoutGeneration.StandardLayoutOnAllLevels(programName, inputModels, null, false, null, input.ModelFile.LocalFilePath);
+ output.Model = result.OutputModel;
+ return output;
+ }
+
+ private static List CreateContentItems(IEnumerable elementInstances, SpaceBoundary space, BoundaryDefinition boundaryDefinition)
+ {
+ var bbox = new BBox3(space.Boundary);
+ var t = new Transform(bbox.Min).Inverted();
+ var contentItems = new List();
+ var spaceElementInstances = elementInstances.Where(ei => space.Boundary.Contains(ei.Transform.Origin));
+ foreach (var elementInstance in spaceElementInstances)
+ {
+ var contentItem = new ContentItem()
+ {
+ Anchor = new Vector3(boundaryDefinition.Width / 2, boundaryDefinition.Depth / 2),
+ Url = (elementInstance.BaseDefinition as ContentElement)?.GltfLocation,
+ Name = elementInstance.Name,
+ Transform = elementInstance.Transform.Concatenated(t)
+ };
+ contentItems.Add(contentItem);
+ }
+
+ return contentItems;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/src/SpaceConfigurationFromModel.csproj b/SpaceConfigurationFromModel/src/SpaceConfigurationFromModel.csproj
new file mode 100644
index 00000000..0afd42b5
--- /dev/null
+++ b/SpaceConfigurationFromModel/src/SpaceConfigurationFromModel.csproj
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ net6.0
+ enable
+ enable
+
+
+
diff --git a/SpaceConfigurationFromModel/test/FunctionTest.g.cs b/SpaceConfigurationFromModel/test/FunctionTest.g.cs
new file mode 100644
index 00000000..13dfa95e
--- /dev/null
+++ b/SpaceConfigurationFromModel/test/FunctionTest.g.cs
@@ -0,0 +1,24 @@
+// This code was generated by Hypar.
+// Edits to this code will be overwritten the next time you run 'hypar init'.
+// DO NOT EDIT THIS FILE.
+
+using Xunit;
+using System.IO;
+using System.Reflection;
+using System.Threading.Tasks;
+using Xunit.Abstractions;
+using System;
+using System.Collections.Generic;
+
+namespace SpaceConfigurationFromModel.Tests
+{
+ public class FunctionTests
+ {
+ private readonly ITestOutputHelper output;
+
+ public FunctionTests(ITestOutputHelper output)
+ {
+ this.output = output;
+ }
+ }
+}
\ No newline at end of file
diff --git a/SpaceConfigurationFromModel/test/SpaceConfigurationFromModel.Tests.csproj b/SpaceConfigurationFromModel/test/SpaceConfigurationFromModel.Tests.csproj
new file mode 100644
index 00000000..9f5e7aef
--- /dev/null
+++ b/SpaceConfigurationFromModel/test/SpaceConfigurationFromModel.Tests.csproj
@@ -0,0 +1,28 @@
+
+
+
+ net6.0
+ enable
+ enable
+
+ false
+
+
+
+
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+ all
+
+
+
+
+
+
+
+
diff --git a/SpaceConfigurationFromModel/test/Usings.cs b/SpaceConfigurationFromModel/test/Usings.cs
new file mode 100644
index 00000000..8c927eb7
--- /dev/null
+++ b/SpaceConfigurationFromModel/test/Usings.cs
@@ -0,0 +1 @@
+global using Xunit;
\ No newline at end of file