diff --git a/Build/Consts.cs b/Build/Consts.cs index 8fabcd0cf..93fb96031 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -41,7 +41,13 @@ public static class Consts new("Connectors/Autocad/Speckle.Connectors.Civil3d2025", "net8.0-windows") ] ), - new("tekla-structures", [new("Connectors/Tekla/Speckle.Connector.Tekla2024", "net48")]) + new( + "tekla-structures", + [ + new("Connectors/Tekla/Speckle.Connector.Tekla2023", "net48"), + new("Connectors/Tekla/Speckle.Connector.Tekla2024", "net48") + ] + ) }; } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs index db2faf01b..d118b513c 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 c8362e69c..ef9059ef9 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/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj b/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj index 04402ca45..b3fcb0edd 100644 --- a/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj +++ b/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj @@ -48,12 +48,6 @@ - - - Always - - - diff --git a/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj b/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj index 5fe48282f..e25666ed0 100644 --- a/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj +++ b/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj @@ -47,12 +47,6 @@ - - - Always - - - diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/Plugin/TeklaPlugin.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/Plugin/TeklaPlugin.cs index 901e2c479..87a7fc644 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/Plugin/TeklaPlugin.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/Plugin/TeklaPlugin.cs @@ -2,9 +2,9 @@ namespace Speckle.Connector.Tekla2024.Plugin; -[Plugin("Speckle (Beta)")] +[Plugin("Speckle")] [PluginUserInterface("Speckle.Connector.Tekla2024.SpeckleTeklaPanelHost")] -[InputObjectDependency(InputObjectDependency.NOT_DEPENDENT)] // See DevDocs/InputObjectDependency.NOT_DEPENDENT.png +[InputObjectDependency(InputObjectDependency.NOT_DEPENDENT)] public class TeklaPlugin : PluginBase { #pragma warning disable IDE1006 diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/SpeckleTeklaPanelHost.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/SpeckleTeklaPanelHost.cs index 1eddf7d91..1979989b5 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/SpeckleTeklaPanelHost.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/SpeckleTeklaPanelHost.cs @@ -1,3 +1,4 @@ +using System.Drawing; using System.Windows.Forms; using System.Windows.Forms.Integration; using Microsoft.Extensions.DependencyInjection; @@ -15,17 +16,38 @@ public class SpeckleTeklaPanelHost : PluginFormBase { private ElementHost Host { get; } public Model Model { get; private set; } - public static new ServiceProvider? Container { get; private set; } - - // TODO: private IDisposable? _disposableLogger; + private static readonly List s_instances = new(); public SpeckleTeklaPanelHost() { this.Text = "Speckle (Beta)"; this.Name = "Speckle (Beta)"; - //TODO: Add Speckle icon - // TODO: Add thumbnail to connector + + // CNX-790: Needs to be solved + string version = GetVersion().ToString()[1..]; // removes the 'v' from version + string resourcePath = $"Speckle.Connector.Tekla{version}.Resources.et_element_Speckle.bmp"; + using ( + Bitmap bmp = new Bitmap( + GetType().Assembly.GetManifestResourceStream(resourcePath) + ?? throw new InvalidOperationException($"Could not find resource: {resourcePath}") + ) + ) + { + this.Icon = Icon.FromHandle(bmp.GetHicon()); + } + + // adds instances to tracking list + s_instances.Add(this); + + if (s_instances.Count > 1) + { + var firstInstance = s_instances[0]; + s_instances.RemoveAt(0); + // hides the first instance if there is more than one + firstInstance.Hide(); + } + var services = new ServiceCollection(); services.Initialize(HostApplications.TeklaStructures, GetVersion()); services.AddTekla(); diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs b/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs index 047eb62ce..72569f5ac 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,