diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/LinkedModelHandler.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/LinkedModelHandler.cs index 729d7c45b..539a52399 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/LinkedModelHandler.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/LinkedModelHandler.cs @@ -63,7 +63,9 @@ public class LinkedModelHandler viewFilter.GetView().NotNull().Id, linkInstance.Id ); - return viewCollector.WhereElementIsNotElementType().ToElements().ToList(); + + // NOTE: related to [CNX-1482](https://linear.app/speckle/issue/CNX-1482/wall-sweeps-published-duplicated). See RevitViewsFilter.cs + return viewCollector.WhereElementIsNotElementType().Where(e => !string.IsNullOrEmpty(e.Name)).ToList(); #else // 🚨 LIMITATION: in Revit 2023 and below, we can only check if the entire linked model is visible, // not individual elements within it. If the linked model is visible, all its elements will be included. 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 3756d85c8..ca9abea8b 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs @@ -72,12 +72,17 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt if (view is null) { - //this used to throw an exception but we don't want to fail loudly if the view is not found + //this used to throw an exception, but we don't want to fail loudly if the view is not found return []; } using var viewCollector = new FilteredElementCollector(_doc, view.Id); var elementsInView = viewCollector.ToElements(); - var objectIds = elementsInView.Select(e => e.UniqueId).ToList(); + + // 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(); SelectedObjectIds = objectIds; return objectIds; }