Skip to content

Commit

Permalink
Merge pull request #75 from hypar-io/set-parent-space
Browse files Browse the repository at this point in the history
Set parent space on generated furniture
  • Loading branch information
andrewheumann authored Dec 1, 2023
2 parents e7cdce0 + 479bf5d commit 86390dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
17 changes: 2 additions & 15 deletions LayoutFunctions/LayoutFunctionCommon/LayoutGeneration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ public virtual LayoutGenerationResult StandardLayoutOnAllLevels(string programTy
var (configInfo, wallCandidates) = SelectTheBestOfPossibleConfigs(possibleConfigs);

var layout = InstantiateLayoutByFit(configInfo, room.Transform);
SetLevelVolume(layout.Instance, levelVolume?.Id);
LayoutStrategies.SetLevelVolume(layout.Instance, levelVolume?.Id);
LayoutStrategies.SetParentSpace(layout.Instance, room.Id);
wallCandidateLines.AddRange(wallCandidates);
outputModel.AddElement(layout.Instance);
seatsCount = CountSeats(layout);
Expand Down Expand Up @@ -289,19 +290,5 @@ protected virtual SeatsCount CountSeats(LayoutInstantiated layoutInstantiated)
{
return new SeatsCount(0, 0, 0, 0);
}

private static void SetLevelVolume(ComponentInstance componentInstance, Guid? levelVolumeId)
{
if (componentInstance != null)
{
foreach (var instance in componentInstance.Instances)
{
if (instance != null)
{
instance.AdditionalProperties["Level"] = levelVolumeId;
}
}
}
}
}
}
15 changes: 15 additions & 0 deletions LayoutFunctions/LayoutFunctionCommon/LayoutStrategies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ private static bool ProcessRoom<TLevelVolume, TSpaceBoundary>(
{
success = true;
SetLevelVolume(layout.Instance, levelVolume?.Id);
SetParentSpace(layout.Instance, room.Id);

wallCandidateLines.AddRange(WallCandidates);

Expand Down Expand Up @@ -849,5 +850,19 @@ public static void SetLevelVolume(ComponentInstance componentInstance, Guid? lev
}
}
}

public static void SetParentSpace(ComponentInstance componentInstance, Guid? parentSpaceId)
{
if (componentInstance != null)
{
foreach (var instance in componentInstance.Instances)
{
if (instance != null)
{
instance.AdditionalProperties["Space"] = parentSpaceId;
}
}
}
}
}
}

0 comments on commit 86390dd

Please sign in to comment.