Skip to content

Commit

Permalink
update function ids
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaSloboda committed Aug 25, 2023
1 parent aab7269 commit 561aa2b
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 30 deletions.
2 changes: 1 addition & 1 deletion LayoutFunctions/ClassroomLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "cb7dad4e-550c-4d7c-80fa-9b570a38b678",
"id": "e83225ea-a792-45d6-8426-e19ebe00a929",
"name": "Classroom Layout",
"description": "Generate an interior layout for classroom zones.",
"model_output": "Classroom Layout",
Expand Down
20 changes: 13 additions & 7 deletions LayoutFunctions/LayoutFunctionCommon/LayoutStrategies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,14 @@ public static void StandardLayoutOnAllLevels<TLevelElements, TLevelVolume, TSpac
var wallCandidateLines = new List<(Line line, string type)>();
foreach (var room in roomBoundaries)
{
var spaceSettingsValue = defaultValue != null && proxies != null ? OverrideUtilities.MatchApplicableOverride(
overridesBySpaceBoundaryId,
OverrideUtilities.GetSpaceBoundaryProxy(room, roomBoundaries.Proxies(OverrideUtilities.SpaceBoundaryOverrideDependencyName)),
defaultValue,
proxies).Value : default;
var spaceSettingsValue =
defaultValue != null && proxies != null ?
OverrideUtilities.MatchApplicableOverride(
overridesBySpaceBoundaryId,
OverrideUtilities.GetSpaceBoundaryProxy(room, roomBoundaries.Proxies(OverrideUtilities.SpaceBoundaryOverrideDependencyName)),
defaultValue,
proxies).Value :
default;
ProcessRoom<TLevelVolume, TSpaceBoundary, TSpaceSettingsOverrideValueType>(room, outputModel, countSeats, configs, spaceSettingsValue, corridorSegments, levelVolume, wallCandidateLines);
}

Expand All @@ -217,11 +220,14 @@ public static void StandardLayoutOnAllLevels<TLevelElements, TLevelVolume, TSpac
}
foreach (var room in allSpaceBoundaries)
{
var spaceSettingsValue = defaultValue != null && proxies != null ? OverrideUtilities.MatchApplicableOverride(
var spaceSettingsValue =
defaultValue != null && proxies != null ?
OverrideUtilities.MatchApplicableOverride(
overridesBySpaceBoundaryId,
OverrideUtilities.GetSpaceBoundaryProxy(room, allSpaceBoundaries.Proxies(OverrideUtilities.SpaceBoundaryOverrideDependencyName)),
defaultValue,
proxies).Value : default;
proxies).Value :
default;
ProcessRoom<TLevelVolume, TSpaceBoundary, TSpaceSettingsOverrideValueType>(room, outputModel, countSeats, configs, spaceSettingsValue);
}
OverrideUtilities.InstancePositionOverrides(overrides, outputModel);
Expand Down
4 changes: 2 additions & 2 deletions LayoutFunctions/LayoutFunctionCommon/OverrideUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace LayoutFunctionCommon
{
public class OverrideUtilities
{
public static readonly string SpaceBoundaryOverrideDependencyName = "Space Planning Zones";
public static readonly string SpaceBoundaryOverrideName = "Space Settings";
public const string SpaceBoundaryOverrideDependencyName = "Space Planning Zones";
public const string SpaceBoundaryOverrideName = "Space Settings";

public static void InstancePositionOverrides(dynamic overrides, Model model)
{
Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/LoungeLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "f9a40e01-43b9-403e-9e29-0022f72bfecc",
"id": "2586d6e9-8586-42a0-9d49-b80d0d684925",
"name": "Lounge Layout",
"description": "Layout lounge spaces",
"model_output": "Lounge Layout",
Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/MeetingRoomLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "001b14ac-b387-4199-ac0d-575619492847",
"id": "9a574d33-ae1e-4a68-a548-148d65fcf79e",
"name": "Meeting Room Layout",
"description": "Lay out meeting rooms.",
"language": "C#",
Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/OpenCollabLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "30901831-bcfe-4227-b53e-f9bec5f44f96",
"id": "1a57db32-3ac1-4874-a23a-61f160c54604",
"name": "Open Collaboration Layout",
"description": "Lay out Open collaboration spaces.",
"language": "C#",
Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/PantryLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "0632c716-e03f-4682-8434-f79c30160130",
"id": "8115dd28-7ca9-4e91-9117-83f9d5e299da",
"name": "Pantry Layout",
"description": "Layout Pantry spaces",
"language": "C#",
Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/PhoneBoothLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "30b5f0c5-67d7-40d5-bdb6-d86c66d58142",
"id": "6ddde416-c7e7-46cf-8fa0-8c5b1d268dd3",
"name": "Phone Booth Layout",
"model_output": "Phone Booth Layout",
"description": "Lay out phone booths",
Expand Down
1 change: 0 additions & 1 deletion LayoutFunctions/PhoneBoothLayout/src/PhoneBoothLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public static PhoneBoothLayoutOutputs Execute(Dictionary<string, Model> inputMod
var output = new PhoneBoothLayoutOutputs();
var configJson = File.ReadAllText("./PhoneBoothConfigurations.json");
var configs = JsonConvert.DeserializeObject<SpaceConfiguration>(configJson);
FlippedConfigurations.Init(configs);

var wallMat = new Material("Drywall", new Color(0.9, 0.9, 0.9, 1.0), 0.01, 0.01);
var glassMat = new Material("Glass", new Color(0.7, 0.7, 0.7, 0.3), 0.3, 0.6);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace PrivateOfficeLayout
{
public partial class SpaceSettingsValue : ISpaceSettingsOverrideValue
public partial class SpaceSettingsValue : ISpaceSettingsOverrideFlipValue
{
}

Expand Down
4 changes: 1 addition & 3 deletions LayoutFunctions/PrivateOfficeLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/function.json",
"id": "b608e43a-5143-40dc-a1b7-271f2cab7db7",
"id": "94dc146d-a523-412a-989f-dafdacd1ac68",
"name": "Private Office Layout",
"description": "Lay out private offices.",
"model_output": "Private Office Layout",
Expand Down Expand Up @@ -138,8 +138,6 @@
"https://prod-api.hypar.io/schemas/CirculationSegment",
"https://prod-api.hypar.io/schemas/LevelVolume"
],
"content_catalogs": [
],
"outputs": [
{
"unit_type": "none",
Expand Down
1 change: 0 additions & 1 deletion LayoutFunctions/PrivateOfficeLayout/mirrored-catalog.json

This file was deleted.

1 change: 0 additions & 1 deletion LayoutFunctions/PrivateOfficeLayout/mirrored-catalog1.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System;
using Elements.Spatial;
using LayoutFunctionCommon;
using IFC;

namespace PrivateOfficeLayout
{
Expand Down Expand Up @@ -319,7 +318,6 @@ private static ComponentInstance InstantiateLayout(SpaceConfiguration configs, d
{
return null;
}

var baseRectangle = Polygon.Rectangle(selectedConfig.CellBoundary.Min, selectedConfig.CellBoundary.Max);
var rules = selectedConfig.Rules();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\dependencies\PrivateOfficeLayout.Dependencies.csproj" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<ItemGroup>
<None Include="..\PrivateOfficeConfigurations.json" Link="%(Filename)%(Extension)" CopyToOutputDirectory="PreserveNewest" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace ReceptionLayout
{
public partial class SpaceSettingsValue : ISpaceSettingsOverrideValue
public partial class SpaceSettingsValue : ISpaceSettingsOverrideFlipValue
{
}

Expand Down
2 changes: 1 addition & 1 deletion LayoutFunctions/ReceptionLayout/hypar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://hypar.io/Schemas/Function.json",
"id": "63117eb7-b9d0-4be2-851e-385b44c1443a",
"id": "1f36c76c-d506-413b-83b3-9e484522f516",
"name": "Reception Layout",
"description": "Layout Reception spaces",
"model_output": "Reception Layout",
Expand Down
6 changes: 3 additions & 3 deletions LayoutFunctions/ReceptionLayout/src/ReceptionLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static ReceptionLayoutOutputs Execute(Dictionary<string, Model> inputMode
var trimmedGeo = cell.GetTrimmedCellGeometry();
if (!cell.IsTrimmed() && trimmedGeo.Length > 0)
{
var layout = InstantiateLayout(selectedConfigs, width, depth, rect, room.Transform, output.Model, out var seats);
var layout = InstantiateLayout(selectedConfigs, width, depth, rect, room.Transform, out var seats);
LayoutStrategies.SetLevelVolume(layout, levelVolume?.Id);
output.Model.AddElement(layout);
seatsCount += seats;
Expand All @@ -116,7 +116,7 @@ public static ReceptionLayoutOutputs Execute(Dictionary<string, Model> inputMode
var cinchedVertices = rect.Vertices.Select(v => largestTrimmedShape.Vertices.OrderBy(v2 => v2.DistanceTo(v)).First()).ToList();
var cinchedPoly = new Polygon(cinchedVertices);
// output.Model.AddElement(new ModelCurve(cinchedPoly, BuiltInMaterials.ZAxis, levelVolume.Transform));
var layout = InstantiateLayout(selectedConfigs, width, depth, cinchedPoly, room.Transform, output.Model, out var seats);
var layout = InstantiateLayout(selectedConfigs, width, depth, cinchedPoly, room.Transform, out var seats);
LayoutStrategies.SetLevelVolume(layout, levelVolume?.Id);
output.Model.AddElement(layout);
Console.WriteLine("🤷‍♂️ funny shape!!!");
Expand Down Expand Up @@ -212,7 +212,7 @@ private static Line FindEdgeAdjacentToSegments(IEnumerable<Line> edgesToClassify
otherSegments = Enumerable.Range(0, allEdges.Count).Except(new[] { selectedIndex }).Select(i => allEdges[i]);
return minSeg;
}
private static ComponentInstance InstantiateLayout(SpaceConfiguration configs, double width, double length, Polygon rectangle, Transform xform, Model model, out int seatsCount)
private static ComponentInstance InstantiateLayout(SpaceConfiguration configs, double width, double length, Polygon rectangle, Transform xform, out int seatsCount)
{
seatsCount = 0;
ContentConfiguration selectedConfig = null;
Expand Down

0 comments on commit 561aa2b

Please sign in to comment.