From 8035de5c64a074979f3b6d65cbe92d17ddf7e5a0 Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Wed, 5 Apr 2023 16:58:16 +0200 Subject: [PATCH 1/2] #1345 fixed --- .../Convert/Architecture/FromRevit/Ceiling.cs | 2 +- Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs | 2 +- Revit_Core_Engine/Query/OpeningSurface.cs | 4 ++-- Revit_Core_Engine/Query/PanelSurfaces.cs | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs b/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs index a53739bcf..d3375167f 100644 --- a/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs +++ b/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs @@ -70,7 +70,7 @@ public static oM.Architecture.Elements.Ceiling CeilingFromRevit(this Ceiling cei List locations = new List(); foreach (KeyValuePair> kvp in surfaces) { - locations.Add(new PlanarSurface(kvp.Key.ExternalBoundary, kvp.Value.Select(x => x.ExternalBoundary).ToList())); + locations.Add(BH.Engine.Geometry.Create.PlanarSurface(kvp.Key.ExternalBoundary, kvp.Value.Select(x => x.ExternalBoundary).ToList())); } if (locations.Count == 1) diff --git a/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs b/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs index 97e6f05d1..f156867c1 100644 --- a/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs +++ b/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs @@ -47,7 +47,7 @@ public static oM.Geometry.PlanarSurface FromRevit(this PlanarFace face) oM.Geometry.ICurve externalBoundary = crvLoop[0].FromRevit(); List internalBoundary = crvLoop.Skip(1).Select(x => x.FromRevit() as oM.Geometry.ICurve).ToList(); - return new oM.Geometry.PlanarSurface(externalBoundary, internalBoundary); + return BH.Engine.Geometry.Create.PlanarSurface(externalBoundary, internalBoundary); } diff --git a/Revit_Core_Engine/Query/OpeningSurface.cs b/Revit_Core_Engine/Query/OpeningSurface.cs index 538389613..b5cf61cc0 100644 --- a/Revit_Core_Engine/Query/OpeningSurface.cs +++ b/Revit_Core_Engine/Query/OpeningSurface.cs @@ -193,7 +193,7 @@ private static List OpeningSurfaces_LinkDocument(this FamilyInstance f pc.Curves.Add(new BH.oM.Geometry.Line { Start = pc.EndPoint(), End = pc.StartPoint() }); } - return new List(outlines.Select(x => new PlanarSurface(x, new List()))); + return new List(outlines.Select(x => BH.Engine.Geometry.Create.PlanarSurface(x, new List()))); } else return familyInstance.OpeningSurfaces_Curtain(); @@ -310,7 +310,7 @@ private static List GetOpeningGeometry(Transaction t, Document doc, Li t.RollBack(failureHandlingOptions); if (loops != null) - surfaces.AddRange(loops.Select(x => new PlanarSurface(x.FromRevit(), null))); + surfaces.AddRange(loops.Select(x => BH.Engine.Geometry.Create.PlanarSurface(x.FromRevit(), null))); else if (surfaces.Count != 0) BH.Engine.Base.Compute.RecordWarning(String.Format("Geometrical processing of a Revit element failed due to an internal Revit error. Converted opening might be missing one or more of its surfaces. Revit ElementId: {0}", familyInstance.Id)); diff --git a/Revit_Core_Engine/Query/PanelSurfaces.cs b/Revit_Core_Engine/Query/PanelSurfaces.cs index 4c1911ce7..fbd1dac4d 100644 --- a/Revit_Core_Engine/Query/PanelSurfaces.cs +++ b/Revit_Core_Engine/Query/PanelSurfaces.cs @@ -292,11 +292,11 @@ private static Dictionary x.IsCounterclockwise(plane.Normal)); - PlanarSurface surface = new PlanarSurface(outline.FromRevit(), null); + PlanarSurface surface = BH.Engine.Geometry.Create.PlanarSurface(outline.FromRevit(), null); List openings = new List(); foreach (CurveLoop loop in loops.Where(x => x != outline)) { - openings.Add(new PlanarSurface(loop.FromRevit(), null)); + openings.Add(BH.Engine.Geometry.Create.PlanarSurface(loop.FromRevit(), null)); } if (insertsDeleted[id]) @@ -319,7 +319,7 @@ private static Dictionary> PanelSurfaces_Link } if (outline != null) - result.Add(new PlanarSurface(outline, new List()), openings.Select(x => new PlanarSurface(x, new List())).ToList()); + result.Add(BH.Engine.Geometry.Create.PlanarSurface(outline, new List()), openings.Select(x => BH.Engine.Geometry.Create.PlanarSurface(x, new List())).ToList()); } return result; From 70bece4553e959ffa69342d06d4bdb0974da9c6f Mon Sep 17 00:00:00 2001 From: Pawel Baran Date: Thu, 13 Apr 2023 19:34:09 +0200 Subject: [PATCH 2/2] constructor restored instead of Create method where applicable --- .../Convert/Architecture/FromRevit/Ceiling.cs | 2 +- Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs | 2 +- Revit_Core_Engine/Query/OpeningSurface.cs | 4 ++-- Revit_Core_Engine/Query/PanelSurfaces.cs | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs b/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs index d3375167f..a53739bcf 100644 --- a/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs +++ b/Revit_Core_Engine/Convert/Architecture/FromRevit/Ceiling.cs @@ -70,7 +70,7 @@ public static oM.Architecture.Elements.Ceiling CeilingFromRevit(this Ceiling cei List locations = new List(); foreach (KeyValuePair> kvp in surfaces) { - locations.Add(BH.Engine.Geometry.Create.PlanarSurface(kvp.Key.ExternalBoundary, kvp.Value.Select(x => x.ExternalBoundary).ToList())); + locations.Add(new PlanarSurface(kvp.Key.ExternalBoundary, kvp.Value.Select(x => x.ExternalBoundary).ToList())); } if (locations.Count == 1) diff --git a/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs b/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs index f156867c1..97e6f05d1 100644 --- a/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs +++ b/Revit_Core_Engine/Convert/Geometry/FromRevit/Surface.cs @@ -47,7 +47,7 @@ public static oM.Geometry.PlanarSurface FromRevit(this PlanarFace face) oM.Geometry.ICurve externalBoundary = crvLoop[0].FromRevit(); List internalBoundary = crvLoop.Skip(1).Select(x => x.FromRevit() as oM.Geometry.ICurve).ToList(); - return BH.Engine.Geometry.Create.PlanarSurface(externalBoundary, internalBoundary); + return new oM.Geometry.PlanarSurface(externalBoundary, internalBoundary); } diff --git a/Revit_Core_Engine/Query/OpeningSurface.cs b/Revit_Core_Engine/Query/OpeningSurface.cs index b5cf61cc0..75797c4d4 100644 --- a/Revit_Core_Engine/Query/OpeningSurface.cs +++ b/Revit_Core_Engine/Query/OpeningSurface.cs @@ -193,7 +193,7 @@ private static List OpeningSurfaces_LinkDocument(this FamilyInstance f pc.Curves.Add(new BH.oM.Geometry.Line { Start = pc.EndPoint(), End = pc.StartPoint() }); } - return new List(outlines.Select(x => BH.Engine.Geometry.Create.PlanarSurface(x, new List()))); + return new List(outlines.Select(x => new PlanarSurface(x, new List()))); } else return familyInstance.OpeningSurfaces_Curtain(); @@ -310,7 +310,7 @@ private static List GetOpeningGeometry(Transaction t, Document doc, Li t.RollBack(failureHandlingOptions); if (loops != null) - surfaces.AddRange(loops.Select(x => BH.Engine.Geometry.Create.PlanarSurface(x.FromRevit(), null))); + surfaces.AddRange(loops.Select(x => new PlanarSurface(x.FromRevit(), new List()))); else if (surfaces.Count != 0) BH.Engine.Base.Compute.RecordWarning(String.Format("Geometrical processing of a Revit element failed due to an internal Revit error. Converted opening might be missing one or more of its surfaces. Revit ElementId: {0}", familyInstance.Id)); diff --git a/Revit_Core_Engine/Query/PanelSurfaces.cs b/Revit_Core_Engine/Query/PanelSurfaces.cs index fbd1dac4d..d6f16cf0e 100644 --- a/Revit_Core_Engine/Query/PanelSurfaces.cs +++ b/Revit_Core_Engine/Query/PanelSurfaces.cs @@ -292,11 +292,11 @@ private static Dictionary x.IsCounterclockwise(plane.Normal)); - PlanarSurface surface = BH.Engine.Geometry.Create.PlanarSurface(outline.FromRevit(), null); + PlanarSurface surface = new PlanarSurface(outline.FromRevit(), new List()); List openings = new List(); foreach (CurveLoop loop in loops.Where(x => x != outline)) { - openings.Add(BH.Engine.Geometry.Create.PlanarSurface(loop.FromRevit(), null)); + openings.Add(new PlanarSurface(loop.FromRevit(), new List())); } if (insertsDeleted[id]) @@ -319,7 +319,7 @@ private static Dictionary())); } } } @@ -418,7 +418,7 @@ private static Dictionary> PanelSurfaces_Link } if (outline != null) - result.Add(BH.Engine.Geometry.Create.PlanarSurface(outline, new List()), openings.Select(x => BH.Engine.Geometry.Create.PlanarSurface(x, new List())).ToList()); + result.Add(new PlanarSurface(outline, new List()), openings.Select(x => new PlanarSurface(x, new List())).ToList()); } return result;