Skip to content

Commit

Permalink
don't need level transform, line is at correct position
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonie-kramer committed Nov 21, 2023
1 parent a9191fb commit fc734a5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Hypar.Elements" Version="2.1.0" />
<PackageReference Include="Hypar.Functions" Version="1.10.0" />
<PackageReference Include="Hypar.Elements.Components" Version="2.1.0" />
<PackageReference Include="Hypar.Elements" Version="2.2.0-alpha.11" />
<PackageReference Include="Hypar.Functions" Version="1.11.0-alpha.7" />
<PackageReference Include="Hypar.Elements.Components" Version="2.2.0-alpha.11" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions LayoutFunctions/Doors/src/Doors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace Doors
{
public static class Doors
{
// Door offset from end of wall. Determines initial position.
private const double doorOffset = 9 * 0.0254;
/// <summary>
///
/// </summary>
Expand All @@ -22,8 +24,6 @@ public static DoorsOutputs Execute(Dictionary<string, Model> inputModels, DoorsI
var walls = GetWallCandidates(inputModels);
var doors = new List<Door>();

double doorOffset = 9 * 0.0254;

foreach (var roomsOfLevel in rooms.GroupBy(r => r.Level))
{
var levelCorridors = corridors.Where(c => c.Level == roomsOfLevel.Key);
Expand Down
22 changes: 10 additions & 12 deletions LayoutFunctions/InteriorPartitions/src/InteriorPartitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>
var thickness = wallCandidate.Thickness;
var type = wallCandidate.Type;
var height = wallCandidate.Height;
var levelTransform = wallCandidate.LevelTransform;
var wallCandidateId = wallCandidate.Id;

var doorsToAdd = doors.Where(x => x.Transform.Origin.DistanceTo(line) < 0.001).ToList();
var doorsToAdd = doors.Where(x => x.Transform.Origin.DistanceTo(line) < 0.01).ToList();

var lineProjected = line.TransformedLine(new Transform(0, 0, -line.End.Z));
if (thickness != null && thickness.Value.innerWidth == 0 && thickness.Value.outerWidth == 0)
{
return elements;
Expand All @@ -128,7 +126,7 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>
// thickness, we have to offset the centerline by their
// difference.
var offset = (thicknessOrDefault.outerWidth - thicknessOrDefault.innerWidth) / 2.0;
lineProjected = lineProjected.Offset(offset, false);
var lineOffset = line.Offset(offset, false);
if (sumThickness < 0.01)
{
sumThickness = 0.2;
Expand All @@ -138,7 +136,7 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>

if (type == "Solid")
{
wall = new StandardWall(lineProjected, sumThickness, height, wallMat, levelTransform);
wall = new StandardWall(lineOffset, sumThickness, height, wallMat);
wall.AdditionalProperties[wallCandidatePropertyName] = wallCandidateId;

foreach (var door in doorsToAdd)
Expand All @@ -153,17 +151,17 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>
}
else if (type == "Partition")
{
wall = new StandardWall(lineProjected, sumThickness, height, wallMat, levelTransform);
wall = new StandardWall(lineOffset, sumThickness, height, wallMat);
wall.AdditionalProperties[wallCandidatePropertyName] = wallCandidateId;

RepresentationInstance wallRepresentationInstance = CreateWallRepresentationInstance(wall);
wall.RepresentationInstances.Add(wallRepresentationInstance);
}
else if (type == "Glass")
{
wall = new StorefrontWall(lineProjected, 0.05, height, glassMat, levelTransform);
wall = new StorefrontWall(lineOffset, 0.05, height, glassMat);
wall.AdditionalProperties[wallCandidatePropertyName] = wallCandidateId;
var grid = new Grid1d(lineProjected);
var grid = new Grid1d(lineOffset);

var doorEdgeDistances = new List<double>();

Expand Down Expand Up @@ -197,7 +195,7 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>
}
var separators = grid.GetCellSeparators(true);

var beam = new Beam(lineProjected, Polygon.Rectangle(mullionSize, mullionSize), null, mullionMat)
var beam = new Beam(lineOffset, Polygon.Rectangle(mullionSize, mullionSize), null, mullionMat)
{
IsElementDefinition = true
};
Expand Down Expand Up @@ -228,7 +226,7 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>

var mullionObject = new Mullion()
{
BaseLine = (Line)mullionLine.Transformed(new Transform(separator, lineProjected.Direction(), Vector3.ZAxis, 0).Concatenated(levelTransform)),
BaseLine = (Line)mullionLine.Transformed(new Transform(separator, lineOffset.Direction(), Vector3.ZAxis, 0)),
Width = mullionSize,
Height = totalStorefrontHeight,
Material = mullionMat
Expand All @@ -244,7 +242,7 @@ public static List<Element> GenerateWall(WallCandidate wallCandidate, List<Door>
var headerHeight = height - totalStorefrontHeight;
if (headerHeight > 0.01)
{
var header = new Header((Line)lineProjected.Transformed(levelTransform.Concatenated(new Transform(0, 0, totalStorefrontHeight))), sumThickness, headerHeight, wallMat);
var header = new Header((Line)lineOffset.Transformed(new Transform(0, 0, totalStorefrontHeight)), sumThickness, headerHeight, wallMat);
header.UpdateRepresentations();
var headerRep = header.Representation;
wall.RepresentationInstances.Add(new RepresentationInstance(new SolidRepresentation(headerRep.SolidOperations), header.Material, true));
Expand Down Expand Up @@ -294,7 +292,7 @@ internal static List<WallCandidate> CreateWallCandidates(InteriorPartitionsInput
var candidates = WallGeneration.DeduplicateWallLines(levelGroup.ToList());
var height = levelGroup.OrderBy(l => l.Height).FirstOrDefault()?.Height ?? defaultHeight;
var levelWallCandidates = candidates.Select(c =>
new WallCandidate(c.Line.TransformedLine(levelGroup.Key),
new WallCandidate(c.Line,
c.Type,
height,
levelGroup.Key,
Expand Down

0 comments on commit fc734a5

Please sign in to comment.