fix(revit): walls sweeps published duplicated (#850)
* fix: wall sweeps duplicate publish * docs: reporting on findings * fix: wall sweeps published duplicated * fix: same thing for linked models
This commit is contained in:
@@ -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.
|
||||
|
||||
+7
-2
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user