From 01bc8bf929fbab57ca4e4e7444e7eab19ee6545d Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Thu, 9 Jan 2025 18:22:28 +0000 Subject: [PATCH 1/2] fix: stacked wall duplication when sending by view --- .../HostApp/ElementUnpacker.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs index bc3304998..b30ec74b0 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs @@ -31,7 +31,8 @@ public IEnumerable UnpackSelectionForConversion(IEnumerable se // Step 2: pack curtain wall elements, once we know the full extent of our flattened item list. // The behaviour we're looking for: // If parent wall is part of selection, does not select individual elements out. Otherwise, selects individual elements (Panels, Mullions) as atomic objects. - return PackCurtainWallElements(atomicObjects); + // NOTE: this also conditionally "packs" stacked wall elements if their parent is present. See detailed note inside the function. + return PackCurtainWallElementsAndStackedWalls(atomicObjects); } /// @@ -90,7 +91,7 @@ private List UnpackElements(IEnumerable elements) return unpackedElements.GroupBy(el => el.Id).Select(g => g.First()).ToList(); // no disinctBy in here sadly. } - private List PackCurtainWallElements(List elements) + private List PackCurtainWallElementsAndStackedWalls(List elements) { var ids = elements.Select(el => el.Id).ToArray(); var doc = _revitContext.UIApplication?.ActiveUIDocument.Document!; @@ -102,6 +103,12 @@ private List PackCurtainWallElements(List elements) && doc.GetElement(f.Host.Id) is Wall { CurtainGrid: not null } && ids.Contains(f.Host.Id) ) + // NOTE: It is required to explicitly skip stacked wall members because, when getting objects from a view, + // the api will return the wall parent and its stacked children walls separately. This does not happen + // via selection. Via category ("Walls") we do not get any parent wall, but just the components of the stacked wall separately. + // If you wonder why revit is driving people to insanity, this is one of those moments. + // See [CNX-851: Stacked Wall Duplicate Geometry or Materials not applied](https://linear.app/speckle/issue/CNX-851/stacked-wall-duplicate-geometry-or-materials-not-applied) + || (element is Wall { IsStackedWallMember: true } wall && ids.Contains(wall.StackedWallOwnerId)) ); return elements; } From c5d37a125075ef720ae1fba2ee2a8b11d5e66ca8 Mon Sep 17 00:00:00 2001 From: Adam Hathcock Date: Fri, 10 Jan 2025 09:37:15 +0000 Subject: [PATCH 2/2] Add custom assembly resolve for Navisworks (#478) * Add custom assembly resolve for Navisworks * format --- .../Plugin/DockableConnectorPane.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs index b779afe43..a06842db6 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs @@ -32,6 +32,8 @@ internal sealed class Connector : NAV.Plugins.DockPanePlugin public override Control CreateControlPane() { + AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.OnAssemblyResolve; + var services = new ServiceCollection(); services.Initialize(HostApplications.Navisworks, HostAppVersion.v2024);