From a0e23e6acd512e40c35c11b2d54f97134664edca Mon Sep 17 00:00:00 2001 From: Mucahit Bilal GOKER <51519350+bimgeek@users.noreply.github.com> Date: Tue, 24 Feb 2026 13:07:19 +0300 Subject: [PATCH] fix(revit): bolts and plates missing when published via View filter (#1289) * first pass * trim comment --- .../Send/Filters/RevitViewsFilter.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs index 882cceb37..a49c36a6a 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs @@ -82,11 +82,10 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt IEnumerable elementsInView = GetFilteredElementsForView(document, view); - // NOTE: FilteredElementCollector() includes sweeps and reveals from a wall family's definition and includes them as additional objects - // on this return. displayValue for Wall already includes these, therefore we end up with duplicate elements on wall sweeps - // related to [CNX-1482](https://linear.app/speckle/issue/CNX-1482/wall-sweeps-published-duplicated) - // i (björn) noticed that all these elements have an empty string as Name parameter, hence below exclusion. tested as much as possible, seems like legit fix - var objectIds = elementsInView.Where(e => !string.IsNullOrEmpty(e.Name)).Select(e => e.UniqueId).ToList(); + // Filter out wall sweep/reveal sub-elements with empty names to avoid duplicates (CNX-1482). + // Only these specific categories are excluded — other unnamed elements like steel connections + // must be kept (CNX-3130). + var objectIds = elementsInView.Where(e => !IsEmptyNameWallSubElement(e)).Select(e => e.UniqueId).ToList(); // we need the view uniqueId among the objectIds // to expire the modelCards with viewFilters when the user changes category visibility // a change in category visibility will trigger DocChangeHandler in RevitSendBinding @@ -176,4 +175,21 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt return allElements; } + + /// + /// Detects wall sweep/reveal sub-elements that have empty names when returned by the + /// view-scoped FilteredElementCollector. These are duplicates of geometry already included + /// in the parent wall's displayValue. + /// See CNX-1482. + /// + private static bool IsEmptyNameWallSubElement(Element e) + { + if (!string.IsNullOrEmpty(e.Name)) + { + return false; + } + + var bic = e.Category?.GetBuiltInCategory(); + return bic is BuiltInCategory.OST_Cornices or BuiltInCategory.OST_Reveals; + } }