Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for wall types #67

Merged
merged 3 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class LevelVolume : GeometricElement
{
[JsonConstructor]
public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, IList<Profile> @profiles, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
: base(transform, material, representation, isElementDefinition, id, name)
{
this.Profile = @profile;
Expand All @@ -37,6 +37,7 @@ public LevelVolume(Profile @profile, double @height, double @area, string @build
this.Level = @level;
this.Mass = @mass;
this.PlanView = @planView;
this.Profiles = @profiles;
}


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

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


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class SpaceBoundary : GeometricElement
{
[JsonConstructor]
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, 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)
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, System.Guid? @level, System.Guid? @levelLayout, string @hyparSpaceType, string @defaultWallType, 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;
Expand All @@ -42,6 +42,7 @@ public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, dou
this.Level = @level;
this.LevelLayout = @levelLayout;
this.HyparSpaceType = @hyparSpaceType;
this.DefaultWallType = @defaultWallType;
}


Expand Down Expand Up @@ -97,6 +98,10 @@ public SpaceBoundary()
[JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HyparSpaceType { get; set; }

/// <summary>What wall type should generally be created for this space type? This may get overridden later on for a specific wall.</summary>
[JsonProperty("Default Wall Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string DefaultWallType { get; set; }


}
}
1 change: 1 addition & 0 deletions LayoutFunctions/ClassroomLayout/hypar.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
],
"input_schema": {
"type": "object",
"$hyparDeprecated": true,
"properties": {
"Create Walls": {
"type": "boolean",
Expand Down
7 changes: 6 additions & 1 deletion LayoutFunctions/DataHall/dependencies/SpaceBoundary.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class SpaceBoundary : GeometricElement
{
[JsonConstructor]
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, 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)
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, System.Guid? @level, System.Guid? @levelLayout, string @hyparSpaceType, string @defaultWallType, 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;
Expand All @@ -42,6 +42,7 @@ public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, dou
this.Level = @level;
this.LevelLayout = @levelLayout;
this.HyparSpaceType = @hyparSpaceType;
this.DefaultWallType = @defaultWallType;
}


Expand Down Expand Up @@ -97,6 +98,10 @@ public SpaceBoundary()
[JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HyparSpaceType { get; set; }

/// <summary>What wall type should generally be created for this space type? This may get overridden later on for a specific wall.</summary>
[JsonProperty("Default Wall Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string DefaultWallType { get; set; }


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class SpaceBoundary : GeometricElement
{
[JsonConstructor]
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, 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)
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, System.Guid? @level, System.Guid? @levelLayout, string @hyparSpaceType, string @defaultWallType, 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;
Expand All @@ -42,6 +42,7 @@ public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, dou
this.Level = @level;
this.LevelLayout = @levelLayout;
this.HyparSpaceType = @hyparSpaceType;
this.DefaultWallType = @defaultWallType;
}


Expand Down Expand Up @@ -97,6 +98,10 @@ public SpaceBoundary()
[JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HyparSpaceType { get; set; }

/// <summary>What wall type should generally be created for this space type? This may get overridden later on for a specific wall.</summary>
[JsonProperty("Default Wall Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string DefaultWallType { get; set; }


}
}
4 changes: 3 additions & 1 deletion LayoutFunctions/LayoutFunctionCommon/ISpaceBoundary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Elements
{
public interface ISpaceBoundary
public interface ISpaceBoundary
{
string Name { get; set; }
Profile Boundary { get; set; }
Expand All @@ -19,6 +19,8 @@ public interface ISpaceBoundary
[JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HyparSpaceType { get; set; }

public string DefaultWallType { get; set; }

}

}
2 changes: 2 additions & 0 deletions LayoutFunctions/LayoutFunctionCommon/RoomEdge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public string Type

public double Length => Line.Length();
public Vector3 Direction => Line.Direction();

public bool? PrimaryEntryEdge { get; set; }
}

public static class RoomEdgeExtensions
Expand Down
17 changes: 10 additions & 7 deletions LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
Line = s.TransformedLine(room.Transform),
Thickness = thicknesses?.ElementAtOrDefault(i)
}), corridorSegments, levelProfile, out var wallCandidates);
orientationGuideEdge.Type = "Glass";
orientationGuideEdge.Type = room.DefaultWallType ?? "Glass";
orientationGuideEdge.PrimaryEntryEdge = true;
wallCandidateLines.Add(orientationGuideEdge);
if (levelProfile != null)
{
Expand Down Expand Up @@ -74,7 +75,8 @@
var orientationGuideEdges = SortEdgesByPrimaryAccess(allSegments, corridorSegments, levelProfile, 0.3);
foreach (var orientationGuideEdge in orientationGuideEdges)
{
orientationGuideEdge.Line.Type = "Glass";
orientationGuideEdge.Line.Type = room.DefaultWallType ?? "Glass";
orientationGuideEdge.Line.PrimaryEntryEdge = true;
var wallCandidateLines = new List<RoomEdge>
{
orientationGuideEdge.Line
Expand Down Expand Up @@ -106,7 +108,7 @@
public static List<RoomEdge> DeduplicateWallLines(List<InteriorPartitionCandidate> interiorPartitionCandidates)
{
return interiorPartitionCandidates.SelectMany(i => i.WallCandidateLines).Where(l => l.Type != null && interiorPartitionTypePriority.Keys.Contains(l.Type)).ToList();
var resultCandidates = new List<RoomEdge>();

Check warning on line 111 in LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs

View workflow job for this annotation

GitHub Actions / build

Unreachable code detected

Check warning on line 111 in LayoutFunctions/LayoutFunctionCommon/WallGeneration.cs

View workflow job for this annotation

GitHub Actions / build

Unreachable code detected
var typedLines = interiorPartitionCandidates.SelectMany(c => c.WallCandidateLines)
.Where(l => l.Type != null && interiorPartitionTypePriority.Keys.Contains(l.Type));
var collinearLinesGroups = GroupCollinearLines(typedLines);
Expand Down Expand Up @@ -539,7 +541,7 @@
}).ToList();
}

public static List<RoomEdge> PartitionsAndGlazingCandidatesFromGrid(List<RoomEdge> wallCandidateLines, Grid2d grid, Profile levelBoundary)
public static List<RoomEdge> PartitionsAndGlazingCandidatesFromGrid(List<RoomEdge> wallCandidateLines, Grid2d grid, ISpaceBoundary room)
{
var wallCandidatesOut = new List<RoomEdge>();
try
Expand Down Expand Up @@ -583,11 +585,12 @@
if (trimmedGeo.Count() > 0)
{
var segments = trimmedGeo.OfType<Polygon>().SelectMany(g => g.Segments()).Select(GetRoomEdgeFromLine);
var glassSegment = FindEdgeAdjacentToSegments(segments, glassLines, out var otherEdges);
if (glassSegment != null)
var entrySegment = FindEdgeAdjacentToSegments(segments, glassLines, out var otherEdges);
if (entrySegment != null)
{
glassSegment.Type = "Glass";
wallCandidatesOut.Add(glassSegment);
entrySegment.Type = room.DefaultWallType ?? "Glass";
entrySegment.PrimaryEntryEdge = true;
wallCandidatesOut.Add(entrySegment);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion LayoutFunctions/LoungeLayout/dependencies/LevelVolume.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class LevelVolume : GeometricElement
{
[JsonConstructor]
public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
public LevelVolume(Profile @profile, double @height, double @area, string @buildingName, System.Guid? @level, System.Guid? @mass, System.Guid? @planView, IList<Profile> @profiles, Transform @transform = null, Material @material = null, Representation @representation = null, bool @isElementDefinition = false, System.Guid @id = default, string @name = null)
: base(transform, material, representation, isElementDefinition, id, name)
{
this.Profile = @profile;
Expand All @@ -37,6 +37,7 @@ public LevelVolume(Profile @profile, double @height, double @area, string @build
this.Level = @level;
this.Mass = @mass;
this.PlanView = @planView;
this.Profiles = @profiles;
}


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

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


}
}
7 changes: 6 additions & 1 deletion LayoutFunctions/LoungeLayout/dependencies/SpaceBoundary.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class SpaceBoundary : GeometricElement
{
[JsonConstructor]
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, 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)
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, System.Guid? @level, System.Guid? @levelLayout, string @hyparSpaceType, string @defaultWallType, 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;
Expand All @@ -42,6 +42,7 @@ public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, dou
this.Level = @level;
this.LevelLayout = @levelLayout;
this.HyparSpaceType = @hyparSpaceType;
this.DefaultWallType = @defaultWallType;
}


Expand Down Expand Up @@ -97,6 +98,10 @@ public SpaceBoundary()
[JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HyparSpaceType { get; set; }

/// <summary>What wall type should generally be created for this space type? This may get overridden later on for a specific wall.</summary>
[JsonProperty("Default Wall Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string DefaultWallType { get; set; }


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


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

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


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace Elements
public partial class SpaceBoundary : GeometricElement
{
[JsonConstructor]
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, 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)
public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, double? @length, double? @depth, double @height, string @programGroup, string @programType, System.Guid? @programRequirement, System.Guid? @level, System.Guid? @levelLayout, string @hyparSpaceType, string @defaultWallType, 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;
Expand All @@ -42,6 +42,7 @@ public SpaceBoundary(Profile @boundary, IList<Polygon> @cells, double @area, dou
this.Level = @level;
this.LevelLayout = @levelLayout;
this.HyparSpaceType = @hyparSpaceType;
this.DefaultWallType = @defaultWallType;
}


Expand Down Expand Up @@ -97,6 +98,10 @@ public SpaceBoundary()
[JsonProperty("Hypar Space Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string HyparSpaceType { get; set; }

/// <summary>What wall type should generally be created for this space type? This may get overridden later on for a specific wall.</summary>
[JsonProperty("Default Wall Type", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public string DefaultWallType { get; set; }


}
}
Loading
Loading