From 12c80e2d4022b1154ec54d4b5692b2faf6ec520d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20Koral?= <45078678+oguzhankoral@users.noreply.github.com> Date: Mon, 11 Nov 2024 15:19:17 +0000 Subject: [PATCH] Fix(dui3): do not pass selectedobjectids from idmap (#380) * Do not reset selectedObjectIds from IdMap * Format --- .../Bindings/BasicConnectorBindingRevit.cs | 2 +- .../Bindings/RevitSendBinding.cs | 4 +++- .../Bindings/SendBindingUICommands.cs | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs index db2faf01..d118b513 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs @@ -126,7 +126,7 @@ await _apiContext return; } - var selectedObjects = senderModelCard.SendFilter.NotNull().IdMap.NotNull().Values; + var selectedObjects = senderModelCard.SendFilter.NotNull().SelectedObjectIds; elementIds = selectedObjects .Select(uid => ElementIdHelper.GetElementIdFromUniqueId(activeUIDoc.Document, uid)) diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs index c8362e69..ef9059ef 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs @@ -190,14 +190,16 @@ private async Task> RefreshElementsOnSender(SenderModelCard modelC if (modelCard.SendFilter is not null && modelCard.SendFilter.IdMap is not null) { + var newSelectedObjectIds = new List(); foreach (Element element in elements) { modelCard.SendFilter.IdMap[element.Id.ToString()] = element.UniqueId; + newSelectedObjectIds.Add(element.UniqueId); } // We update the state on the UI SenderModelCard to prevent potential inconsistencies between hostApp IdMap in sendfilters. await Commands - .SetFilterObjectIds(modelCard.ModelCardId.NotNull(), modelCard.SendFilter.IdMap) + .SetFilterObjectIds(modelCard.ModelCardId.NotNull(), modelCard.SendFilter.IdMap, newSelectedObjectIds) .ConfigureAwait(false); } diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs b/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs index 047eb62c..72569f5a 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs @@ -18,8 +18,22 @@ public async Task RefreshSendFilters() => public async Task SetModelsExpired(IEnumerable expiredModelIds) => await Bridge.Send(SET_MODELS_EXPIRED_UI_COMMAND_NAME, expiredModelIds).ConfigureAwait(false); - public async Task SetFilterObjectIds(string modelCardId, Dictionary idMap) => - await Bridge.Send(SET_ID_MAP_COMMAND_NAME, new { modelCardId, idMap }).ConfigureAwait(false); + public async Task SetFilterObjectIds( + string modelCardId, + Dictionary idMap, + List newSelectedObjectIds + ) => + await Bridge + .Send( + SET_ID_MAP_COMMAND_NAME, + new + { + modelCardId, + idMap, + newSelectedObjectIds + } + ) + .ConfigureAwait(false); public async Task SetModelSendResult( string modelCardId,