From fc734a5eb79947a39ef0e3e21b80c0be43517e82 Mon Sep 17 00:00:00 2001 From: Anthonie Kramer Date: Mon, 20 Nov 2023 16:56:06 -0800 Subject: [PATCH] don't need level transform, line is at correct position --- .../CustomSpaceType.Dependencies.csproj | 6 ++--- LayoutFunctions/Doors/src/Doors.cs | 4 ++-- .../src/InteriorPartitions.cs | 22 +++++++++---------- 3 files changed, 15 insertions(+), 17 deletions(-) diff --git a/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj b/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj index cac9a95b..3acbd27c 100644 --- a/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj +++ b/LayoutFunctions/CustomLayout/dependencies/CustomSpaceType.Dependencies.csproj @@ -9,9 +9,9 @@ - - - + + + \ No newline at end of file diff --git a/LayoutFunctions/Doors/src/Doors.cs b/LayoutFunctions/Doors/src/Doors.cs index fa7a5f66..4f902b83 100644 --- a/LayoutFunctions/Doors/src/Doors.cs +++ b/LayoutFunctions/Doors/src/Doors.cs @@ -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; /// /// /// @@ -22,8 +24,6 @@ public static DoorsOutputs Execute(Dictionary inputModels, DoorsI var walls = GetWallCandidates(inputModels); var doors = new List(); - double doorOffset = 9 * 0.0254; - foreach (var roomsOfLevel in rooms.GroupBy(r => r.Level)) { var levelCorridors = corridors.Where(c => c.Level == roomsOfLevel.Key); diff --git a/LayoutFunctions/InteriorPartitions/src/InteriorPartitions.cs b/LayoutFunctions/InteriorPartitions/src/InteriorPartitions.cs index 67621442..402503aa 100644 --- a/LayoutFunctions/InteriorPartitions/src/InteriorPartitions.cs +++ b/LayoutFunctions/InteriorPartitions/src/InteriorPartitions.cs @@ -111,12 +111,10 @@ public static List GenerateWall(WallCandidate wallCandidate, List 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; @@ -128,7 +126,7 @@ public static List GenerateWall(WallCandidate wallCandidate, List // 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; @@ -138,7 +136,7 @@ public static List GenerateWall(WallCandidate wallCandidate, List 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) @@ -153,7 +151,7 @@ public static List GenerateWall(WallCandidate wallCandidate, List } 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); @@ -161,9 +159,9 @@ public static List GenerateWall(WallCandidate wallCandidate, List } 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(); @@ -197,7 +195,7 @@ public static List GenerateWall(WallCandidate wallCandidate, List } 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 }; @@ -228,7 +226,7 @@ public static List GenerateWall(WallCandidate wallCandidate, List 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 @@ -244,7 +242,7 @@ public static List GenerateWall(WallCandidate wallCandidate, List 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)); @@ -294,7 +292,7 @@ internal static List 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,