diff --git a/.editorconfig b/.editorconfig index 32ff38613..416023432 100644 --- a/.editorconfig +++ b/.editorconfig @@ -254,6 +254,9 @@ dotnet_diagnostic.ca1508.severity = warning # Avoid dead conditional code dotnet_diagnostic.ca1509.severity = warning # Invalid entry in code metrics configuration file dotnet_diagnostic.ca1861.severity = none # Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1861) +# CA2007: Consider calling ConfigureAwait on the awaited task (this is not needed for application code, in fact we don't want to call anything but ConfigureAwait(true) which is the default) +dotnet_diagnostic.CA2007.severity = none + dotnet_diagnostic.cs8618.severity = suggestion # nullable problem diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d2512ca3..6c358f36a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,10 @@ jobs: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - - name: ⚒️ Run build + - name: ⚒️ Run Build on Linux + run: ./build.sh build-linux + + - name: ⚒️ Run tests run: ./build.sh test-only - name: Upload coverage reports to Codecov with GitHub Action diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 478f552d6..3a51c8cd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,7 +6,7 @@ on: tags: ["v3.*"] # Manual delivery on every 3.x tag jobs: - build: + build-windows: runs-on: windows-latest outputs: version: ${{ steps.set-version.outputs.version }} @@ -27,10 +27,10 @@ jobs: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - - name: ⚒️ Run GitVersion + - name: ⚒️ Run GitVersion on Windows run: ./build.ps1 build-server-version - - name: ⚒️ Run build + - name: ⚒️ Run build on Windows run: ./build.ps1 - name: ⬆️ Upload artifacts @@ -46,7 +46,7 @@ jobs: deploy-installers: runs-on: ubuntu-latest - needs: build + needs: build-windows env: IS_TAG_BUILD: ${{ github.ref_type == 'tag' }} IS_RELEASE_BRANCH: ${{ startsWith(github.ref_name, 'release/') || github.ref_name == 'main'}} @@ -58,7 +58,7 @@ jobs: workflow: Build Installers repo: specklesystems/connector-installers token: ${{ secrets.CONNECTORS_GH_TOKEN }} - inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build.outputs.version }}", "public_release": ${{ env.IS_TAG_BUILD }}, "store_artifacts": ${{ env.IS_RELEASE_BRANCH }} }' + inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build-windows.outputs.version }}", "public_release": ${{ env.IS_TAG_BUILD }}, "store_artifacts": ${{ env.IS_RELEASE_BRANCH }} }' ref: main wait-for-completion: true wait-for-completion-interval: 10s @@ -70,11 +70,13 @@ jobs: with: name: output-* - test: + build-linux: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v4 @@ -87,11 +89,20 @@ jobs: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} - - name: ⚒️ Run build + - name: ⚒️ Run GitVersion on Linux + run: ./build.sh build-server-version + + - name: ⚒️ Run tests on Linux run: ./build.sh test-only + - name: ⚒️ Run Build and Pack on Linux + run: ./build.sh build-linux + - name: Upload coverage reports to Codecov with GitHub Action uses: codecov/codecov-action@v5 with: file: Converters/**/coverage.xml token: ${{ secrets.CODECOV_TOKEN }} + + - name: Push to nuget.org + run: dotnet nuget push output/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.CONNECTORS_NUGET_TOKEN }} --skip-duplicate diff --git a/Build/Github.cs b/Build/Github.cs index b62ddeb39..9c9f335a1 100644 --- a/Build/Github.cs +++ b/Build/Github.cs @@ -28,11 +28,11 @@ public static async Task BuildInstallers(string token, string runId, string vers Content = content }; request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); - var response = await client.SendAsync(request).ConfigureAwait(false); + var response = await client.SendAsync(request); if (!response.IsSuccessStatusCode) { throw new InvalidOperationException( - $"{response.StatusCode} {response.ReasonPhrase} {await response.Content.ReadAsStringAsync().ConfigureAwait(false)}" + $"{response.StatusCode} {response.ReasonPhrase} {await response.Content.ReadAsStringAsync()}" ); } } diff --git a/Build/Program.cs b/Build/Program.cs index 8604c198c..cb6e5fc36 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -7,6 +7,7 @@ const string CLEAN = "clean"; const string RESTORE = "restore"; const string BUILD = "build"; +const string BUILD_LINUX = "build-linux"; const string TEST = "test"; const string TEST_ONLY = "test-only"; const string FORMAT = "format"; @@ -98,7 +99,7 @@ void RemoveDirectory(string d) VERSION, async () => { - var (output, _) = await ReadAsync("dotnet", "minver -v w").ConfigureAwait(false); + var (output, _) = await ReadAsync("dotnet", "minver -v w"); output = output.Trim(); Console.WriteLine($"Version: {output}"); Run("echo", $"\"version={output}\" >> $GITHUB_OUTPUT"); @@ -183,6 +184,28 @@ void RemoveDirectory(string d) } ); +Target( + BUILD_LINUX, + DependsOn(FORMAT), + Glob.Files(".", "**/Speckle.Importers.Ifc.csproj"), + file => + { + Run("dotnet", $"restore {file} --locked-mode"); + var version = Environment.GetEnvironmentVariable("GitVersion_FullSemVer") ?? "3.0.0-localBuild"; + var fileVersion = Environment.GetEnvironmentVariable("GitVersion_AssemblySemFileVer") ?? "3.0.0.0"; + Console.WriteLine($"Version: {version} & {fileVersion}"); + Run( + "dotnet", + $"build {file} -c Release --no-restore -warnaserror -p:Version={version} -p:FileVersion={fileVersion} -v:m" + ); + + RunAsync( + "dotnet", + $"pack {file} -c Release -o output --no-build -p:Version={version} -p:FileVersion={fileVersion} -v:m" + ); + } +); + Target( ZIP, DependsOn(TEST), diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs index ef35bc039..e78caa1ea 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISReceiveBinding.cs @@ -78,17 +78,14 @@ public async Task Receive(string modelCardId) modelCard.GetReceiveInfo("ArcGIS"), // POC: get host app name from settings? same for GetSendInfo _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); modelCard.BakedObjectIds = receiveOperationResults.BakedObjectIds.ToList(); - await Commands - .SetModelReceiveResult( - modelCardId, - receiveOperationResults.BakedObjectIds, - receiveOperationResults.ConversionResults - ) - .ConfigureAwait(false); + await Commands.SetModelReceiveResult( + modelCardId, + receiveOperationResults.BakedObjectIds, + receiveOperationResults.ConversionResults + ); } catch (OperationCanceledException) { @@ -100,7 +97,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs index 1b3dcb613..3114b7c64 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/ArcGISSendBinding.cs @@ -3,7 +3,6 @@ using ArcGIS.Core.Data; using ArcGIS.Desktop.Core; using ArcGIS.Desktop.Editing.Events; -using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using ArcGIS.Desktop.Mapping.Events; using Microsoft.Extensions.DependencyInjection; @@ -13,6 +12,7 @@ using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Cancellation; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Exceptions; @@ -44,6 +44,7 @@ public sealed class ArcGISSendBinding : ISendBinding private readonly ILogger _logger; private readonly ITopLevelExceptionHandler _topLevelExceptionHandler; private readonly IArcGISConversionSettingsFactory _arcGISConversionSettingsFactory; + private readonly IThreadContext _threadContext; /// /// Used internally to aggregate the changed objects' id. Note we're using a concurrent dictionary here as the expiry check method is not thread safe, and this was causing problems. See: @@ -67,7 +68,8 @@ public ArcGISSendBinding( IOperationProgressManager operationProgressManager, ILogger logger, IArcGISConversionSettingsFactory arcGisConversionSettingsFactory, - MapMembersUtils mapMemberUtils + MapMembersUtils mapMemberUtils, + IThreadContext threadContext ) { _store = store; @@ -80,6 +82,7 @@ MapMembersUtils mapMemberUtils _topLevelExceptionHandler = parent.TopLevelExceptionHandler; _arcGISConversionSettingsFactory = arcGisConversionSettingsFactory; _mapMemberUtils = mapMemberUtils; + _threadContext = threadContext; Parent = parent; Commands = new SendBindingUICommands(parent); @@ -94,14 +97,16 @@ private void SubscribeToArcGISEvents() { LayersRemovedEvent.Subscribe( a => - _topLevelExceptionHandler.FireAndForget(async () => await GetIdsForLayersRemovedEvent(a).ConfigureAwait(false)), + _topLevelExceptionHandler.FireAndForget( + async () => await _threadContext.RunOnWorkerAsync(async () => await GetIdsForLayersRemovedEvent(a)) + ), true ); StandaloneTablesRemovedEvent.Subscribe( a => _topLevelExceptionHandler.FireAndForget( - async () => await GetIdsForStandaloneTablesRemovedEvent(a).ConfigureAwait(false) + async () => await _threadContext.RunOnWorkerAsync(async () => await GetIdsForStandaloneTablesRemovedEvent(a)) ), true ); @@ -109,7 +114,7 @@ private void SubscribeToArcGISEvents() MapPropertyChangedEvent.Subscribe( a => _topLevelExceptionHandler.FireAndForget( - async () => await GetIdsForMapPropertyChangedEvent(a).ConfigureAwait(false) + async () => await _threadContext.RunOnWorkerAsync(async () => await GetIdsForMapPropertyChangedEvent(a)) ), true ); // Map units, CRS etc. @@ -117,13 +122,18 @@ private void SubscribeToArcGISEvents() MapMemberPropertiesChangedEvent.Subscribe( a => _topLevelExceptionHandler.FireAndForget( - async () => await GetIdsForMapMemberPropertiesChangedEvent(a).ConfigureAwait(false) + async () => + await _threadContext.RunOnWorkerAsync(async () => await GetIdsForMapMemberPropertiesChangedEvent(a)) ), true ); // e.g. Layer name ActiveMapViewChangedEvent.Subscribe( - _ => _topLevelExceptionHandler.CatchUnhandled(SubscribeToMapMembersDataSourceChange), + _ => + _topLevelExceptionHandler.FireAndForget(async () => + { + await _threadContext.RunOnWorker(SubscribeToMapMembersDataSourceChange); + }), true ); @@ -139,28 +149,24 @@ private void SubscribeToArcGISEvents() private void SubscribeToMapMembersDataSourceChange() { - var task = QueuedTask.Run(() => + if (MapView.Active == null) { - if (MapView.Active == null) - { - return; - } + return; + } - // subscribe to layers - foreach (Layer layer in MapView.Active.Map.Layers) - { - if (layer is FeatureLayer featureLayer) - { - SubscribeToFeatureLayerDataSourceChange(featureLayer); - } - } - // subscribe to tables - foreach (StandaloneTable table in MapView.Active.Map.StandaloneTables) + // subscribe to layers + foreach (Layer layer in MapView.Active.Map.Layers) + { + if (layer is FeatureLayer featureLayer) { - SubscribeToTableDataSourceChange(table); + SubscribeToFeatureLayerDataSourceChange(featureLayer); } - }); - task.Wait(); + } + // subscribe to tables + foreach (StandaloneTable table in MapView.Active.Map.StandaloneTables) + { + SubscribeToTableDataSourceChange(table); + } } private void SubscribeToFeatureLayerDataSourceChange(FeatureLayer layer) @@ -197,7 +203,7 @@ private void SubscribeToAnyDataSourceChange(Table layerTable) (args) => Parent.TopLevelExceptionHandler.FireAndForget(async () => { - await OnRowChanged(args).ConfigureAwait(false); + await OnRowChanged(args); }), layerTable ); @@ -205,7 +211,7 @@ private void SubscribeToAnyDataSourceChange(Table layerTable) (args) => Parent.TopLevelExceptionHandler.FireAndForget(async () => { - await OnRowChanged(args).ConfigureAwait(false); + await OnRowChanged(args); }), layerTable ); @@ -213,7 +219,7 @@ private void SubscribeToAnyDataSourceChange(Table layerTable) (args) => Parent.TopLevelExceptionHandler.FireAndForget(async () => { - await OnRowChanged(args).ConfigureAwait(false); + await OnRowChanged(args); }), layerTable ); @@ -258,7 +264,7 @@ private async Task OnRowChanged(RowChangedEventArgs args) } } - await RunExpirationChecks(false).ConfigureAwait(false); + await RunExpirationChecks(false); } private async Task GetIdsForLayersRemovedEvent(LayerEventsArgs args) @@ -267,7 +273,7 @@ private async Task GetIdsForLayersRemovedEvent(LayerEventsArgs args) { ChangedObjectIds[layer.URI] = 1; } - await RunExpirationChecks(true).ConfigureAwait(false); + await RunExpirationChecks(true); } private async Task GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArgs args) @@ -276,7 +282,7 @@ private async Task GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArg { ChangedObjectIds[table.URI] = 1; } - await RunExpirationChecks(true).ConfigureAwait(false); + await RunExpirationChecks(true); } private async Task GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs args) @@ -289,7 +295,7 @@ private async Task GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs ChangedObjectIds[member.URI] = 1; } } - await RunExpirationChecks(false).ConfigureAwait(false); + await RunExpirationChecks(false); } private void GetIdsForLayersAddedEvent(LayerEventsArgs args) @@ -339,7 +345,7 @@ private async Task GetIdsForMapMemberPropertiesChangedEvent(MapMemberPropertiesC { ChangedObjectIds[member.URI] = 1; } - await RunExpirationChecks(false).ConfigureAwait(false); + await RunExpirationChecks(false); } } @@ -366,64 +372,52 @@ public async Task Send(string modelCardId) CancellationToken cancellationToken = _cancellationManager.InitCancellationTokenSource(modelCardId); - var sendResult = await QueuedTask - .Run(async () => + using var scope = _serviceProvider.CreateScope(); + scope + .ServiceProvider.GetRequiredService>() + .Initialize( + _arcGISConversionSettingsFactory.Create( + Project.Current, + MapView.Active.Map, + new CRSoffsetRotation(MapView.Active.Map) + ) + ); + List mapMembers = modelCard + .SendFilter.NotNull() + .RefreshObjectIds() + .Select(id => (MapMember)MapView.Active.Map.FindLayer(id) ?? MapView.Active.Map.FindStandaloneTable(id)) + .Where(obj => obj != null) + .ToList(); + + if (mapMembers.Count == 0) + { + // Handle as CARD ERROR in this function + throw new SpeckleSendFilterException("No objects were found to convert. Please update your publish filter!"); + } + + // subscribe to the selected layer events + foreach (MapMember mapMember in mapMembers) + { + if (mapMember is FeatureLayer featureLayer) + { + SubscribeToFeatureLayerDataSourceChange(featureLayer); + } + else if (mapMember is StandaloneTable table) { - using var scope = _serviceProvider.CreateScope(); - scope - .ServiceProvider.GetRequiredService>() - .Initialize( - _arcGISConversionSettingsFactory.Create( - Project.Current, - MapView.Active.Map, - new CRSoffsetRotation(MapView.Active.Map) - ) - ); - List mapMembers = modelCard - .SendFilter.NotNull() - .RefreshObjectIds() - .Select(id => (MapMember)MapView.Active.Map.FindLayer(id) ?? MapView.Active.Map.FindStandaloneTable(id)) - .Where(obj => obj != null) - .ToList(); - - if (mapMembers.Count == 0) - { - // Handle as CARD ERROR in this function - throw new SpeckleSendFilterException( - "No objects were found to convert. Please update your publish filter!" - ); - } - - // subscribe to the selected layer events - foreach (MapMember mapMember in mapMembers) - { - if (mapMember is FeatureLayer featureLayer) - { - SubscribeToFeatureLayerDataSourceChange(featureLayer); - } - else if (mapMember is StandaloneTable table) - { - SubscribeToTableDataSourceChange(table); - } - } - - var result = await scope - .ServiceProvider.GetRequiredService>() - .Execute( - mapMembers, - modelCard.GetSendInfo("ArcGIS"), // POC: get host app name from settings? same for GetReceiveInfo - _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), - cancellationToken - ) - .ConfigureAwait(false); - - return result; - }) - .ConfigureAwait(false); - - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); + SubscribeToTableDataSourceChange(table); + } + } + + var sendResult = await scope + .ServiceProvider.GetRequiredService>() + .Execute( + mapMembers, + modelCard.GetSendInfo("ArcGIS"), // POC: get host app name from settings? same for GetReceiveInfo + _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), + cancellationToken + ); + + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -435,7 +429,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } @@ -470,7 +464,7 @@ private async Task RunExpirationChecks(bool idsDeleted) } } - await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false); + await Commands.SetModelsExpired(expiredSenderIds); ChangedObjectIds = new(); } } diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/BasicConnectorBinding.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/BasicConnectorBinding.cs index 13e0d315c..d3881899e 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/BasicConnectorBinding.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Bindings/BasicConnectorBinding.cs @@ -1,5 +1,4 @@ using ArcGIS.Core.Data; -using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using Speckle.Connectors.ArcGIS.Utils; using Speckle.Connectors.DUI.Bindings; @@ -32,7 +31,7 @@ public BasicConnectorBinding(DocumentModelStore store, IBrowserBridge parent, IS _store.DocumentChanged += (_, _) => parent.TopLevelExceptionHandler.FireAndForget(async () => { - await Commands.NotifyDocumentChanged().ConfigureAwait(false); + await Commands.NotifyDocumentChanged(); }); } @@ -60,16 +59,19 @@ public BasicConnectorBinding(DocumentModelStore store, IBrowserBridge parent, IS public void RemoveModel(ModelCard model) => _store.RemoveModel(model); - public async Task HighlightObjects(IReadOnlyList objectIds) => - await HighlightObjectsOnView(objectIds.Select(x => new ObjectID(x)).ToList()).ConfigureAwait(false); + public Task HighlightObjects(IReadOnlyList objectIds) + { + HighlightObjectsOnView(objectIds.Select(x => new ObjectID(x)).ToList()); + return Task.CompletedTask; + } - public async Task HighlightModel(string modelCardId) + public Task HighlightModel(string modelCardId) { var model = _store.GetModelById(modelCardId); if (model is null) { - return; + return Task.CompletedTask; } var objectIds = new List(); @@ -86,26 +88,22 @@ public async Task HighlightModel(string modelCardId) if (objectIds is null) { - return; + return Task.CompletedTask; } - await HighlightObjectsOnView(objectIds).ConfigureAwait(false); + HighlightObjectsOnView(objectIds); + return Task.CompletedTask; } - private async Task HighlightObjectsOnView(IReadOnlyList objectIds) + private void HighlightObjectsOnView(IReadOnlyList objectIds) { MapView mapView = MapView.Active; - await QueuedTask - .Run(async () => - { - List mapMembersFeatures = GetMapMembers(objectIds, mapView); - ClearSelectionInTOC(); - ClearSelection(); - await SelectMapMembersInTOC(mapMembersFeatures).ConfigureAwait(false); - SelectMapMembersAndFeatures(mapMembersFeatures); - mapView.ZoomToSelected(); - }) - .ConfigureAwait(false); + List mapMembersFeatures = GetMapMembers(objectIds, mapView); + ClearSelectionInTOC(); + ClearSelection(); + SelectMapMembersInTOC(mapMembersFeatures); + SelectMapMembersAndFeatures(mapMembersFeatures); + mapView.ZoomToSelected(); } private List GetMapMembers(IReadOnlyList objectIds, MapView mapView) @@ -171,7 +169,7 @@ private void SelectMapMembersAndFeatures(IReadOnlyList mapMemb } } - private async Task SelectMapMembersInTOC(IReadOnlyList mapMembersFeatures) + private void SelectMapMembersInTOC(IReadOnlyList mapMembersFeatures) { List layers = new(); List tables = new(); @@ -187,7 +185,7 @@ private async Task SelectMapMembersInTOC(IReadOnlyList mapMemb } else { - await QueuedTask.Run(() => layer.SetExpanded(true)).ConfigureAwait(false); + layer.SetExpanded(true); } } else if (member is StandaloneTable table) diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/DependencyInjection/ArcGISConnectorModule.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/DependencyInjection/ArcGISConnectorModule.cs index d6b57a0ce..301c13272 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/DependencyInjection/ArcGISConnectorModule.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/DependencyInjection/ArcGISConnectorModule.cs @@ -27,7 +27,7 @@ public static class ArcGISConnectorModule public static void AddArcGIS(this IServiceCollection serviceCollection) { serviceCollection.AddConnectorUtils(); - serviceCollection.AddDUI(); + serviceCollection.AddDUI(); serviceCollection.AddDUIView(); // Register bindings diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISColorManager.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISColorManager.cs index eabf069bf..2ac406ca4 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISColorManager.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISColorManager.cs @@ -25,7 +25,7 @@ public class ArcGISColorManager /// /// /// - public async Task ParseColors(List colorProxies, IProgress onOperationProgressed) + public void ParseColors(List colorProxies, IProgress onOperationProgressed) { // injected as Singleton, so we need to clean existing proxies first ObjectColorsIdMap = new(); @@ -33,7 +33,6 @@ public async Task ParseColors(List colorProxies, IProgress colorProxies, IProgress /// /// - public async Task ParseMaterials( - List materialProxies, - IProgress onOperationProgressed - ) + public void ParseMaterials(List materialProxies, IProgress onOperationProgressed) { // injected as Singleton, so we need to clean existing proxies first ObjectMaterialsIdMap = new(); @@ -58,7 +54,6 @@ IProgress onOperationProgressed foreach (RenderMaterialProxy colorProxy in materialProxies) { onOperationProgressed.Report(new("Converting materials", (double)++count / materialProxies.Count)); - await Task.Yield(); foreach (string objectId in colorProxy.objects) { Color convertedColor = Color.FromArgb(colorProxy.value.diffuse); diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISLayerUnpacker.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISLayerUnpacker.cs index b8955f895..3db6653e0 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISLayerUnpacker.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/HostApp/ArcGISLayerUnpacker.cs @@ -18,7 +18,7 @@ public class ArcGISLayerUnpacker /// /// List of layers containing objects. /// Thrown when this method is *not* called on the MCT, because this method accesses mapmember fields - public async Task> UnpackSelectionAsync( + public List UnpackSelection( IEnumerable mapMembers, Collection parentCollection, List? objects = null @@ -37,7 +37,7 @@ public class ArcGISLayerUnpacker Collection containerCollection = CreateAndCacheMapMemberCollection(mapMember, true); parentCollection.elements.Add(containerCollection); - await UnpackSelectionAsync(container.Layers, containerCollection, objects).ConfigureAwait(false); + UnpackSelection(container.Layers, containerCollection, objects); break; default: diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/ArcGISHostObjectBuilder.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/ArcGISHostObjectBuilder.cs index fa71580fe..5a9ce6512 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/ArcGISHostObjectBuilder.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Receive/ArcGISHostObjectBuilder.cs @@ -1,7 +1,6 @@ using System.Diagnostics.Contracts; using ArcGIS.Core.CIM; using ArcGIS.Core.Geometry; -using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using Speckle.Connectors.ArcGIS.HostApp; using Speckle.Connectors.ArcGIS.Utils; @@ -54,7 +53,7 @@ ArcGISColorManager colorManager _colorManager = colorManager; } - public async Task Build( + public HostObjectBuilderResult Build( Base rootObject, string projectName, string modelName, @@ -74,14 +73,14 @@ CancellationToken cancellationToken .ToList(); if (materials != null) { - await _colorManager.ParseMaterials(materials, onOperationProgressed).ConfigureAwait(false); + _colorManager.ParseMaterials(materials, onOperationProgressed); } // get colors List? colors = (rootObject[ProxyKeys.COLOR] as List)?.Cast().ToList(); if (colors != null) { - await _colorManager.ParseColors(colors, onOperationProgressed).ConfigureAwait(false); + _colorManager.ParseColors(colors, onOperationProgressed); } int count = 0; @@ -100,7 +99,7 @@ CancellationToken cancellationToken try { obj = _localToGlobalConverterUtils.TransformObjects(objectToConvert.AtomicObject, objectToConvert.Matrix); - object? conversionResult = await QueuedTask.Run(() => _converter.Convert(obj)).ConfigureAwait(false); + object conversionResult = _converter.Convert(obj); string nestedLayerPath = $"{string.Join("\\", path)}"; @@ -128,29 +127,20 @@ CancellationToken cancellationToken // 2.1. Group conversionTrackers (to write into datasets) onOperationProgressed.Report(new("Grouping features into layers", null)); - Dictionary> convertedGroups = await QueuedTask - .Run(async () => - { - return await _featureClassUtils - .GroupConversionTrackers(conversionTracker, (s, progres) => onOperationProgressed.Report(new(s, progres))) - .ConfigureAwait(false); - }) - .ConfigureAwait(false); + Dictionary> convertedGroups = + _featureClassUtils.GroupConversionTrackers( + conversionTracker, + (s, progres) => onOperationProgressed.Report(new(s, progres)) + ); // 2.2. Write groups of objects to Datasets onOperationProgressed.Report(new("Writing to Database", null)); - await QueuedTask - .Run(async () => - { - await _featureClassUtils - .CreateDatasets( - conversionTracker, - convertedGroups, - (s, progres) => onOperationProgressed.Report(new(s, progres)) - ) - .ConfigureAwait(false); - }) - .ConfigureAwait(false); + + _featureClassUtils.CreateDatasets( + conversionTracker, + convertedGroups, + (s, progres) => onOperationProgressed.Report(new(s, progres)) + ); // 3. add layer and tables to the Map and Table Of Content @@ -202,8 +192,7 @@ await _featureClassUtils else { // no layer yet, create and add layer to Map - MapMember mapMember = await AddDatasetsToMap(trackerItem, createdLayerGroups, projectName, modelName) - .ConfigureAwait(false); + MapMember mapMember = AddDatasetsToMap(trackerItem, createdLayerGroups, projectName, modelName); // add layer and layer URI to tracker trackerItem.AddConvertedMapMember(mapMember); @@ -231,7 +220,7 @@ await _featureClassUtils if (bakedMember.Value.Item1 is FeatureLayer fLayer) { // Set the feature layer's renderer. - await QueuedTask.Run(() => fLayer.SetRenderer(bakedMember.Value.Item2)).ConfigureAwait(false); + fLayer.SetRenderer(bakedMember.Value.Item2); } } bakedObjectIds.AddRange(createdLayerGroups.Values.Select(x => x.URI)); @@ -298,80 +287,72 @@ private void AddResultsFromTracker(ObjectConversionTracker trackerItem, List AddDatasetsToMap( + private MapMember AddDatasetsToMap( ObjectConversionTracker trackerItem, Dictionary createdLayerGroups, string projectName, string modelName ) { - return await QueuedTask - .Run(() => - { - // get layer details - string? datasetId = trackerItem.DatasetId; // should not be null here - Uri uri = new($"{_settingsStore.Current.SpeckleDatabasePath.AbsolutePath.Replace('/', '\\')}\\{datasetId}"); - string nestedLayerName = trackerItem.NestedLayerName; + // get layer details + string? datasetId = trackerItem.DatasetId; // should not be null here + Uri uri = new($"{_settingsStore.Current.SpeckleDatabasePath.AbsolutePath.Replace('/', '\\')}\\{datasetId}"); + string nestedLayerName = trackerItem.NestedLayerName; - // add group for the current layer - string shortName = nestedLayerName.Split("\\")[^1]; - string nestedLayerPath = string.Join("\\", nestedLayerName.Split("\\").SkipLast(1)); + // add group for the current layer + string shortName = nestedLayerName.Split("\\")[^1]; + string nestedLayerPath = string.Join("\\", nestedLayerName.Split("\\").SkipLast(1)); - // if no general group layer found - if (createdLayerGroups.Count == 0) - { - Map map = _settingsStore.Current.Map; - GroupLayer mainGroupLayer = LayerFactory.Instance.CreateGroupLayer(map, 0, $"{projectName}: {modelName}"); - mainGroupLayer.SetExpanded(true); - createdLayerGroups["Basic Speckle Group"] = mainGroupLayer; // key doesn't really matter here - } + // if no general group layer found + if (createdLayerGroups.Count == 0) + { + Map map = _settingsStore.Current.Map; + GroupLayer mainGroupLayer = LayerFactory.Instance.CreateGroupLayer(map, 0, $"{projectName}: {modelName}"); + mainGroupLayer.SetExpanded(true); + createdLayerGroups["Basic Speckle Group"] = mainGroupLayer; // key doesn't really matter here + } - var groupLayer = CreateNestedGroupLayer(nestedLayerPath, createdLayerGroups); + var groupLayer = CreateNestedGroupLayer(nestedLayerPath, createdLayerGroups); - // Most of the Speckle-written datasets will be containing geometry and added as Layers - // although, some datasets might be just tables (e.g. native GIS Tables, in the future maybe Revit schedules etc. - // We can create a connection to the dataset in advance and determine its type, but this will be more - // expensive, than assuming by default that it's a layer with geometry (which in most cases it's expected to be) - try - { - var layer = LayerFactory.Instance.CreateLayer(uri, groupLayer, layerName: shortName); - if (layer == null) - { - throw new SpeckleException($"Layer '{shortName}' was not created"); - } - layer.SetExpanded(false); - - // if Scene - // https://community.esri.com/t5/arcgis-pro-sdk-questions/sdk-equivalent-to-changing-layer-s-elevation/td-p/1346139 - if (_settingsStore.Current.Map.IsScene) - { - var groundSurfaceLayer = _settingsStore.Current.Map.GetGroundElevationSurfaceLayer(); - var layerElevationSurface = new CIMLayerElevationSurface - { - ElevationSurfaceLayerURI = groundSurfaceLayer.URI, - }; - - // for Feature Layers - if (layer.GetDefinition() is CIMFeatureLayer cimLyr) - { - cimLyr.LayerElevation = layerElevationSurface; - layer.SetDefinition(cimLyr); - } - } - - return (MapMember)layer; - } - catch (ArgumentException) + // Most of the Speckle-written datasets will be containing geometry and added as Layers + // although, some datasets might be just tables (e.g. native GIS Tables, in the future maybe Revit schedules etc. + // We can create a connection to the dataset in advance and determine its type, but this will be more + // expensive, than assuming by default that it's a layer with geometry (which in most cases it's expected to be) + try + { + var layer = LayerFactory.Instance.CreateLayer(uri, groupLayer, layerName: shortName); + if (layer == null) + { + throw new SpeckleException($"Layer '{shortName}' was not created"); + } + layer.SetExpanded(false); + + // if Scene + // https://community.esri.com/t5/arcgis-pro-sdk-questions/sdk-equivalent-to-changing-layer-s-elevation/td-p/1346139 + if (_settingsStore.Current.Map.IsScene) + { + var groundSurfaceLayer = _settingsStore.Current.Map.GetGroundElevationSurfaceLayer(); + var layerElevationSurface = new CIMLayerElevationSurface { ElevationSurfaceLayerURI = groundSurfaceLayer.URI, }; + + // for Feature Layers + if (layer.GetDefinition() is CIMFeatureLayer cimLyr) { - StandaloneTable table = StandaloneTableFactory.Instance.CreateStandaloneTable( - uri, - groupLayer, - tableName: shortName - ); - return table; + cimLyr.LayerElevation = layerElevationSurface; + layer.SetDefinition(cimLyr); } - }) - .ConfigureAwait(false); + } + + return layer; + } + catch (ArgumentException) + { + StandaloneTable table = StandaloneTableFactory.Instance.CreateStandaloneTable( + uri, + groupLayer, + tableName: shortName + ); + return table; + } } private GroupLayer CreateNestedGroupLayer(string nestedLayerPath, Dictionary createdLayerGroups) diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Send/ArcGISRootObjectBuilder.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Send/ArcGISRootObjectBuilder.cs index 97d7f9587..da9b437ff 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Send/ArcGISRootObjectBuilder.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Operations/Send/ArcGISRootObjectBuilder.cs @@ -1,12 +1,10 @@ using ArcGIS.Core.Data.Raster; using ArcGIS.Core.Geometry; -using ArcGIS.Desktop.Framework.Threading.Tasks; using Microsoft.Extensions.Logging; using Speckle.Connectors.ArcGIS.HostApp; using Speckle.Connectors.ArcGIS.HostApp.Extensions; using Speckle.Connectors.ArcGIS.Utils; using Speckle.Connectors.Common.Builders; -using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Conversion; using Speckle.Connectors.Common.Extensions; using Speckle.Connectors.Common.Operations; @@ -25,7 +23,6 @@ namespace Speckle.Connectors.ArcGis.Operations.Send; public class ArcGISRootObjectBuilder : IRootObjectBuilder { private readonly IRootToSpeckleConverter _rootToSpeckleConverter; - private readonly ISendConversionCache _sendConversionCache; private readonly ArcGISLayerUnpacker _layerUnpacker; private readonly ArcGISColorUnpacker _colorUnpacker; private readonly IConverterSettingsStore _converterSettings; @@ -34,7 +31,6 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder private readonly MapMembersUtils _mapMemberUtils; public ArcGISRootObjectBuilder( - ISendConversionCache sendConversionCache, ArcGISLayerUnpacker layerUnpacker, ArcGISColorUnpacker colorUnpacker, IConverterSettingsStore converterSettings, @@ -44,7 +40,6 @@ public ArcGISRootObjectBuilder( MapMembersUtils mapMemberUtils ) { - _sendConversionCache = sendConversionCache; _layerUnpacker = layerUnpacker; _colorUnpacker = colorUnpacker; _converterSettings = converterSettings; @@ -54,11 +49,11 @@ MapMembersUtils mapMemberUtils _mapMemberUtils = mapMemberUtils; } - public async Task Build( + public async Task BuildAsync( IReadOnlyList layers, - SendInfo sendInfo, + SendInfo __, IProgress onOperationProgressed, - CancellationToken ct = default + CancellationToken cancellationToken ) { // TODO: add a warning if Geographic CRS is set @@ -103,9 +98,7 @@ public async Task Build( IEnumerable layersOrdered = _mapMemberUtils.GetMapMembersInOrder(map, layers); using (var _ = _activityFactory.Start("Unpacking selection")) { - unpackedLayers = await QueuedTask - .Run(() => _layerUnpacker.UnpackSelectionAsync(layersOrdered, rootCollection)) - .ConfigureAwait(false); + unpackedLayers = _layerUnpacker.UnpackSelection(layersOrdered, rootCollection); } List results = new(unpackedLayers.Count); @@ -115,7 +108,7 @@ public async Task Build( int count = 0; foreach (ADM.MapMember layer in unpackedLayers) { - ct.ThrowIfCancellationRequested(); + cancellationToken.ThrowIfCancellationRequested(); string layerApplicationId = layer.GetSpeckleApplicationId(); try @@ -141,21 +134,15 @@ out ObjectReference? value switch (layer) { case ADM.FeatureLayer featureLayer: - List convertedFeatureLayerObjects = await QueuedTask - .Run(() => ConvertFeatureLayerObjectsAsync(featureLayer)) - .ConfigureAwait(false); + List convertedFeatureLayerObjects = ConvertFeatureLayerObjects(featureLayer); layerCollection.elements.AddRange(convertedFeatureLayerObjects); break; case ADM.RasterLayer rasterLayer: - List convertedRasterLayerObjects = await QueuedTask - .Run(() => ConvertRasterLayerObjectsAsync(rasterLayer)) - .ConfigureAwait(false); + List convertedRasterLayerObjects = ConvertRasterLayerObjects(rasterLayer); layerCollection.elements.AddRange(convertedRasterLayerObjects); break; case ADM.LasDatasetLayer lasDatasetLayer: - List convertedLasDatasetObjects = await QueuedTask - .Run(() => ConvertLasDatasetLayerObjectsAsync(lasDatasetLayer)) - .ConfigureAwait(false); + List convertedLasDatasetObjects = ConvertLasDatasetLayerObjects(lasDatasetLayer); layerCollection.elements.AddRange(convertedLasDatasetObjects); break; default: @@ -180,6 +167,7 @@ out ObjectReference? value } onOperationProgressed.Report(new("Converting", (double)++count / layers.Count)); + await Task.Yield(); } } @@ -194,96 +182,78 @@ out ObjectReference? value return new RootObjectBuilderResult(rootCollection, results); } - private async Task> ConvertFeatureLayerObjectsAsync(ADM.FeatureLayer featureLayer) + private List ConvertFeatureLayerObjects(ADM.FeatureLayer featureLayer) { string layerApplicationId = featureLayer.GetSpeckleApplicationId(); List convertedObjects = new(); - await QueuedTask - .Run(() => - { - // store the layer renderer for color unpacking - _colorUnpacker.StoreRendererAndFields(featureLayer); + // store the layer renderer for color unpacking + _colorUnpacker.StoreRendererAndFields(featureLayer); - // search the rows of the layer, where each row is treated like an object - // RowCursor is IDisposable but is not being correctly picked up by IDE warnings. - // This means we need to be carefully adding using statements based on the API documentation coming from each method/class - using (ACD.RowCursor rowCursor = featureLayer.Search()) + // search the rows of the layer, where each row is treated like an object + // RowCursor is IDisposable but is not being correctly picked up by IDE warnings. + // This means we need to be carefully adding using statements based on the API documentation coming from each method/class + using (ACD.RowCursor rowCursor = featureLayer.Search()) + { + while (rowCursor.MoveNext()) + { + // Same IDisposable issue appears to happen on Row class too. Docs say it should always be disposed of manually by the caller. + using (ACD.Row row = rowCursor.Current) { - while (rowCursor.MoveNext()) - { - // Same IDisposable issue appears to happen on Row class too. Docs say it should always be disposed of manually by the caller. - using (ACD.Row row = rowCursor.Current) - { - // get application id. test for subtypes before defaulting to base type. - Base converted = _rootToSpeckleConverter.Convert(row); - string applicationId = row.GetSpeckleApplicationId(layerApplicationId); - converted.applicationId = applicationId; + // get application id. test for subtypes before defaulting to base type. + Base converted = _rootToSpeckleConverter.Convert(row); + string applicationId = row.GetSpeckleApplicationId(layerApplicationId); + converted.applicationId = applicationId; - convertedObjects.Add(converted); + convertedObjects.Add(converted); - // process the object color - _colorUnpacker.ProcessFeatureLayerColor(row, applicationId); - } - } + // process the object color + _colorUnpacker.ProcessFeatureLayerColor(row, applicationId); } - }) - .ConfigureAwait(false); + } + } return convertedObjects; } // POC: raster colors are stored as mesh vertex colors in RasterToSpeckleConverter. Should probably move to color unpacker. - private async Task> ConvertRasterLayerObjectsAsync(ADM.RasterLayer rasterLayer) + private List ConvertRasterLayerObjects(ADM.RasterLayer rasterLayer) { string layerApplicationId = rasterLayer.GetSpeckleApplicationId(); List convertedObjects = new(); - await QueuedTask - .Run(() => - { - Raster raster = rasterLayer.GetRaster(); - Base converted = _rootToSpeckleConverter.Convert(raster); - string applicationId = raster.GetSpeckleApplicationId(layerApplicationId); - converted.applicationId = applicationId; - convertedObjects.Add(converted); - }) - .ConfigureAwait(false); - + Raster raster = rasterLayer.GetRaster(); + Base converted = _rootToSpeckleConverter.Convert(raster); + string applicationId = raster.GetSpeckleApplicationId(layerApplicationId); + converted.applicationId = applicationId; + convertedObjects.Add(converted); return convertedObjects; } - private async Task> ConvertLasDatasetLayerObjectsAsync(ADM.LasDatasetLayer lasDatasetLayer) + private List ConvertLasDatasetLayerObjects(ADM.LasDatasetLayer lasDatasetLayer) { string layerApplicationId = lasDatasetLayer.GetSpeckleApplicationId(); List convertedObjects = new(); try { - await QueuedTask - .Run(() => - { - // store the layer renderer for color unpacking - _colorUnpacker.StoreRenderer(lasDatasetLayer); + // store the layer renderer for color unpacking + _colorUnpacker.StoreRenderer(lasDatasetLayer); - using ( - ACD.Analyst3D.LasPointCursor ptCursor = lasDatasetLayer.SearchPoints(new ACD.Analyst3D.LasPointFilter()) - ) + using (ACD.Analyst3D.LasPointCursor ptCursor = lasDatasetLayer.SearchPoints(new ACD.Analyst3D.LasPointFilter())) + { + while (ptCursor.MoveNext()) + { + using (ACD.Analyst3D.LasPoint pt = ptCursor.Current) { - while (ptCursor.MoveNext()) - { - using (ACD.Analyst3D.LasPoint pt = ptCursor.Current) - { - Base converted = _rootToSpeckleConverter.Convert(pt); - string applicationId = pt.GetSpeckleApplicationId(layerApplicationId); - converted.applicationId = applicationId; - convertedObjects.Add(converted); + Base converted = _rootToSpeckleConverter.Convert(pt); + string applicationId = pt.GetSpeckleApplicationId(layerApplicationId); + converted.applicationId = applicationId; + convertedObjects.Add(converted); - // process the object color - _colorUnpacker.ProcessLasLayerColor(pt, applicationId); - } - } + // process the object color + _colorUnpacker.ProcessLasLayerColor(pt, applicationId); } - }) - .ConfigureAwait(false); + } + } } catch (ACD.Exceptions.TinException ex) { diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleDUI3ViewModel.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleDUI3ViewModel.cs index 9d74daac4..2406f8398 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleDUI3ViewModel.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleDUI3ViewModel.cs @@ -18,7 +18,7 @@ internal static void Create() /// protected override async Task InitializeAsync() { - await base.InitializeAsync().ConfigureAwait(false); + await base.InitializeAsync(); } /// @@ -26,7 +26,7 @@ protected override async Task InitializeAsync() /// protected override async Task UninitializeAsync() { - await base.UninitializeAsync().ConfigureAwait(false); + await base.UninitializeAsync(); } } diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleModule.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleModule.cs index 64370fdf2..1d5eee795 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleModule.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/SpeckleModule.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.DependencyInjection; using Speckle.Connectors.ArcGIS.DependencyInjection; using Speckle.Connectors.Common; -using Speckle.Connectors.DUI; using Speckle.Converters.ArcGIS3; using Speckle.Sdk.Host; using Module = ArcGIS.Desktop.Framework.Contracts.Module; @@ -35,7 +34,6 @@ public SpeckleModule() services.AddArcGIS(); services.AddArcGISConverters(); Container = services.BuildServiceProvider(); - Container.UseDUI(); } private HostAppVersion GetVersion() diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGISThreadContext.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGISThreadContext.cs new file mode 100644 index 000000000..42297eb00 --- /dev/null +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGISThreadContext.cs @@ -0,0 +1,36 @@ +using ArcGIS.Desktop.Framework.Threading.Tasks; +using Speckle.Connectors.Common.Threading; + +namespace Speckle.Connectors.ArcGIS.Utils; + +//don't check for GUI as it's the same check we do in ThreadContext +public class ArcGISThreadContext : ThreadContext +{ + protected override Task MainToWorkerAsync(Func> action) + { + if (QueuedTask.OnWorker) + { + return action(); + } + else + { + return QueuedTask.Run(async () => await action()); + } + } + + protected override Task WorkerToMainAsync(Func> action) => QueuedTask.Run(async () => await action()); + + protected override Task MainToWorker(Func action) + { + if (QueuedTask.OnWorker) + { + return Task.FromResult(action()); + } + else + { + return QueuedTask.Run(action); + } + } + + protected override Task WorkerToMain(Func action) => QueuedTask.Run(action); +} diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGisDocumentStore.cs b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGisDocumentStore.cs index 78be6af1d..0e6e5e1da 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGisDocumentStore.cs +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/Utils/ArcGisDocumentStore.cs @@ -1,8 +1,8 @@ using System.Xml.Linq; using ArcGIS.Desktop.Core.Events; -using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using ArcGIS.Desktop.Mapping.Events; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; using Speckle.Connectors.DUI.Utils; @@ -11,9 +11,16 @@ namespace Speckle.Connectors.ArcGIS.Utils; public class ArcGISDocumentStore : DocumentModelStore { - public ArcGISDocumentStore(IJsonSerializer jsonSerializer, ITopLevelExceptionHandler topLevelExceptionHandler) + private readonly IThreadContext _threadContext; + + public ArcGISDocumentStore( + IJsonSerializer jsonSerializer, + ITopLevelExceptionHandler topLevelExceptionHandler, + IThreadContext threadContext + ) : base(jsonSerializer) { + _threadContext = threadContext; ActiveMapViewChangedEvent.Subscribe(a => topLevelExceptionHandler.CatchUnhandled(() => OnMapViewChanged(a)), true); ProjectSavingEvent.Subscribe( _ => @@ -74,52 +81,52 @@ private void OnMapViewChanged(ActiveMapViewChangedEventArgs args) OnDocumentChanged(); } - protected override void HostAppSaveState(string modelCardState) - { - Map map = MapView.Active.Map; - QueuedTask.Run(() => - { - // Read existing metadata - To prevent messing existing metadata. 🤞 Hope other add-in developers will do same :D - var existingMetadata = map.GetMetadata(); + protected override void HostAppSaveState(string modelCardState) => + _threadContext + .RunOnWorker(() => + { + Map map = MapView.Active.Map; + // Read existing metadata - To prevent messing existing metadata. 🤞 Hope other add-in developers will do same :D + var existingMetadata = map.GetMetadata(); - // Parse existing metadata - XDocument existingXmlDocument = !string.IsNullOrEmpty(existingMetadata) - ? XDocument.Parse(existingMetadata) - : new XDocument(new XElement("metadata")); + // Parse existing metadata + XDocument existingXmlDocument = !string.IsNullOrEmpty(existingMetadata) + ? XDocument.Parse(existingMetadata) + : new XDocument(new XElement("metadata")); - XElement xmlModelCards = new("SpeckleModelCards", modelCardState); + XElement xmlModelCards = new("SpeckleModelCards", modelCardState); - // Check if SpeckleModelCards element already exists at root and update it - var speckleModelCardsElement = existingXmlDocument.Root?.Element("SpeckleModelCards"); - if (speckleModelCardsElement != null) - { - speckleModelCardsElement.ReplaceWith(xmlModelCards); - } - else - { - existingXmlDocument.Root?.Add(xmlModelCards); - } + // Check if SpeckleModelCards element already exists at root and update it + var speckleModelCardsElement = existingXmlDocument.Root?.Element("SpeckleModelCards"); + if (speckleModelCardsElement != null) + { + speckleModelCardsElement.ReplaceWith(xmlModelCards); + } + else + { + existingXmlDocument.Root?.Add(xmlModelCards); + } - map.SetMetadata(existingXmlDocument.ToString()); - }); - } + map.SetMetadata(existingXmlDocument.ToString()); + }) + .FireAndForget(); - protected override void LoadState() - { - Map map = MapView.Active.Map; - QueuedTask.Run(() => - { - var metadata = map.GetMetadata(); - var root = XDocument.Parse(metadata).Root; - var element = root?.Element("SpeckleModelCards"); - if (element is null) + protected override void LoadState() => + _threadContext + .RunOnWorker(() => { - ClearAndSave(); - return; - } + Map map = MapView.Active.Map; + var metadata = map.GetMetadata(); + var root = XDocument.Parse(metadata).Root; + var element = root?.Element("SpeckleModelCards"); + if (element is null) + { + ClearAndSave(); + return; + } - string modelsString = element.Value; - LoadFromString(modelsString); - }); - } + string modelsString = element.Value; + LoadFromString(modelsString); + }) + .FireAndForget(); } diff --git a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json index b897d49a0..87469b826 100644 --- a/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json +++ b/Connectors/ArcGIS/Speckle.Connectors.ArcGIS3/packages.lock.json @@ -231,9 +231,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -241,9 +241,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -267,7 +266,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -299,18 +298,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -320,20 +319,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, "net6.0-windows7.0/win-x64": { diff --git a/Connectors/Autocad/Directory.Build.targets b/Connectors/Autocad/Directory.Build.targets new file mode 100644 index 000000000..5e08b67eb --- /dev/null +++ b/Connectors/Autocad/Directory.Build.targets @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Connectors/Autocad/Speckle.Connectors.Autocad2022/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Autocad2022/packages.lock.json index ae45b97ac..02feb356d 100644 --- a/Connectors/Autocad/Speckle.Connectors.Autocad2022/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Autocad2022/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -300,7 +299,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -338,18 +337,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -359,20 +358,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json index 81cfd9c69..484e8c0be 100644 --- a/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Autocad2023/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -300,7 +299,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -338,18 +337,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -359,20 +358,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Autocad/Speckle.Connectors.Autocad2024/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Autocad2024/packages.lock.json index 986023486..a3a07fbbb 100644 --- a/Connectors/Autocad/Speckle.Connectors.Autocad2024/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Autocad2024/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -301,7 +300,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -339,18 +338,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Autocad/Speckle.Connectors.Autocad2025/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Autocad2025/packages.lock.json index 1f6da00a4..91726308a 100644 --- a/Connectors/Autocad/Speckle.Connectors.Autocad2025/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Autocad2025/packages.lock.json @@ -220,9 +220,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -230,9 +230,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -257,7 +256,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -295,18 +294,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -315,20 +314,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, "net8.0-windows7.0/win-x64": { diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs index 5a976f0fc..e5f8116f8 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadBasicConnectorBinding.cs @@ -1,6 +1,7 @@ using Autodesk.AutoCAD.DatabaseServices; using Microsoft.Extensions.Logging; using Speckle.Connectors.Autocad.HostApp.Extensions; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; @@ -19,6 +20,7 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding private readonly DocumentModelStore _store; private readonly ISpeckleApplication _speckleApplication; + private readonly IThreadContext _threadContext; private readonly ILogger _logger; public BasicConnectorBindingCommands Commands { get; } @@ -28,7 +30,8 @@ public AutocadBasicConnectorBinding( IBrowserBridge parent, IAccountManager accountManager, ISpeckleApplication speckleApplication, - ILogger logger + ILogger logger, + IThreadContext threadContext ) { _store = store; @@ -39,9 +42,10 @@ ILogger logger _store.DocumentChanged += (_, _) => parent.TopLevelExceptionHandler.FireAndForget(async () => { - await Commands.NotifyDocumentChanged().ConfigureAwait(false); + await Commands.NotifyDocumentChanged(); }); _logger = logger; + _threadContext = threadContext; } public string GetConnectorVersion() => _speckleApplication.SpeckleVersion; @@ -79,7 +83,7 @@ public async Task HighlightObjects(IReadOnlyList objectIds) var dbObjects = doc.GetObjects(objectIds); var acadObjectIds = dbObjects.Select(tuple => tuple.Root.Id).ToArray(); - await HighlightObjectsOnView(acadObjectIds).ConfigureAwait(false); + await HighlightObjectsOnView(acadObjectIds); } public async Task HighlightModel(string modelCardId) @@ -116,79 +120,73 @@ public async Task HighlightModel(string modelCardId) if (objectIds.Length == 0) { - await Commands - .SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")) - .ConfigureAwait(false); + await Commands.SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")); return; } - await HighlightObjectsOnView(objectIds, modelCardId).ConfigureAwait(false); + await HighlightObjectsOnView(objectIds, modelCardId); } private async Task HighlightObjectsOnView(ObjectId[] objectIds, string? modelCardId = null) { var doc = Application.DocumentManager.MdiActiveDocument; - await Parent - .RunOnMainThreadAsync(async () => + await _threadContext.RunOnMainAsync(async () => + { + try { + doc.Editor.SetImpliedSelection([]); // Deselects try { - doc.Editor.SetImpliedSelection(Array.Empty()); // Deselects - try - { - doc.Editor.SetImpliedSelection(objectIds); - } - catch (Exception e) when (!e.IsFatal()) - { - // SWALLOW REASON: - // If the objects under the blocks, it won't be able to select them. - // If we try, API will throw the invalid input error, because we request something from API that Autocad doesn't - // handle it on its current canvas. Block elements only selectable when in its scope. - } - doc.Editor.UpdateScreen(); + doc.Editor.SetImpliedSelection(objectIds); + } + catch (Exception e) when (!e.IsFatal()) + { + // SWALLOW REASON: + // If the objects under the blocks, it won't be able to select them. + // If we try, API will throw the invalid input error, because we request something from API that Autocad doesn't + // handle it on its current canvas. Block elements only selectable when in its scope. + } + doc.Editor.UpdateScreen(); - Extents3d selectedExtents = new(); + Extents3d selectedExtents = new(); - var tr = doc.TransactionManager.StartTransaction(); - foreach (ObjectId objectId in objectIds) + var tr = doc.TransactionManager.StartTransaction(); + foreach (ObjectId objectId in objectIds) + { + try { - try + var entity = (Entity?)tr.GetObject(objectId, OpenMode.ForRead); + if (entity?.GeometricExtents != null) { - var entity = (Entity?)tr.GetObject(objectId, OpenMode.ForRead); - if (entity?.GeometricExtents != null) - { - selectedExtents.AddExtents(entity.GeometricExtents); - } - } - catch (Exception e) when (!e.IsFatal()) - { - // Note: we're swallowing exeptions here because of a weird case when receiving blocks, we would have - // acad api throw an error on accessing entity.GeometricExtents. - // may also throw Autodesk.AutoCAD.Runtime.Exception for invalid extents on objects like rays and xlines + selectedExtents.AddExtents(entity.GeometricExtents); } } + catch (Exception e) when (!e.IsFatal()) + { + // Note: we're swallowing exeptions here because of a weird case when receiving blocks, we would have + // acad api throw an error on accessing entity.GeometricExtents. + // may also throw Autodesk.AutoCAD.Runtime.Exception for invalid extents on objects like rays and xlines + } + } - doc.Editor.Zoom(selectedExtents); - tr.Commit(); - Autodesk.AutoCAD.Internal.Utils.FlushGraphics(); + doc.Editor.Zoom(selectedExtents); + tr.Commit(); + Autodesk.AutoCAD.Internal.Utils.FlushGraphics(); + } + catch (Exception ex) when (!ex.IsFatal()) + { + if (modelCardId != null) + { + await Commands.SetModelError(modelCardId, new OperationCanceledException("Failed to highlight objects.")); } - catch (Exception ex) when (!ex.IsFatal()) + else { - if (modelCardId != null) - { - await Commands - .SetModelError(modelCardId, new OperationCanceledException("Failed to highlight objects.")) - .ConfigureAwait(false); - } - else - { - // This will happen, in some cases, where we highlight individual objects. Should be caught by the top level handler and not - // crash the host app. - throw; - } + // This will happen, in some cases, where we highlight individual objects. Should be caught by the top level handler and not + // crash the host app. + throw; } - }) - .ConfigureAwait(false); + } + }); } } diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs index d2d68a7fd..cb5b3b0a6 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadReceiveBinding.cs @@ -81,12 +81,13 @@ public async Task Receive(string modelCardId) modelCard.GetReceiveInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); - await Commands - .SetModelReceiveResult(modelCardId, operationResults.BakedObjectIds, operationResults.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelReceiveResult( + modelCardId, + operationResults.BakedObjectIds, + operationResults.ConversionResults + ); } catch (OperationCanceledException) { @@ -98,7 +99,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } finally { diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs index 0be4d5611..104341c33 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSelectionBinding.cs @@ -1,6 +1,7 @@ using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Speckle.Connectors.Autocad.HostApp.Extensions; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; @@ -10,16 +11,18 @@ public class AutocadSelectionBinding : ISelectionBinding { private const string SELECTION_EVENT = "setSelection"; private readonly ITopLevelExceptionHandler _topLevelExceptionHandler; + private readonly IThreadContext _threadContext; private readonly HashSet _visitedDocuments = new(); public string Name => "selectionBinding"; public IBrowserBridge Parent { get; } - public AutocadSelectionBinding(IBrowserBridge parent) + public AutocadSelectionBinding(IBrowserBridge parent, IThreadContext threadContext) { _topLevelExceptionHandler = parent.TopLevelExceptionHandler; Parent = parent; + _threadContext = threadContext; // POC: Use here Context for doc. In converters it's OK but we are still lacking to use context into bindings. // It is with the case of if binding created with already a document @@ -41,9 +44,7 @@ private void TryRegisterDocumentForSelection(Document? document) if (!_visitedDocuments.Contains(document)) { document.ImpliedSelectionChanged += (_, _) => - _topLevelExceptionHandler.FireAndForget( - async () => await Parent.RunOnMainThreadAsync(OnSelectionChanged).ConfigureAwait(false) - ); + _topLevelExceptionHandler.FireAndForget(async () => await _threadContext.RunOnMainAsync(OnSelectionChanged)); _visitedDocuments.Add(document); } @@ -57,7 +58,7 @@ private void TryRegisterDocumentForSelection(Document? document) private async Task OnSelectionChanged() { _selectionInfo = GetSelectionInternal(); - await Parent.Send(SELECTION_EVENT, _selectionInfo).ConfigureAwait(false); + await Parent.Send(SELECTION_EVENT, _selectionInfo); } public SelectionInfo GetSelection() => _selectionInfo; diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBaseBinding.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBaseBinding.cs index 11f840f92..5f556e623 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBaseBinding.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBaseBinding.cs @@ -8,6 +8,7 @@ using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Cancellation; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Exceptions; @@ -38,6 +39,7 @@ public abstract class AutocadSendBaseBinding : ISendBinding private readonly ILogger _logger; private readonly ITopLevelExceptionHandler _topLevelExceptionHandler; private readonly ISpeckleApplication _speckleApplication; + private readonly IThreadContext _threadContext; /// /// Used internally to aggregate the changed objects' id. Note we're using a concurrent dictionary here as the expiry check method is not thread safe, and this was causing problems. See: @@ -57,7 +59,8 @@ protected AutocadSendBaseBinding( ISendConversionCache sendConversionCache, IOperationProgressManager operationProgressManager, ILogger logger, - ISpeckleApplication speckleApplication + ISpeckleApplication speckleApplication, + IThreadContext threadContext ) { _store = store; @@ -69,6 +72,7 @@ ISpeckleApplication speckleApplication _operationProgressManager = operationProgressManager; _logger = logger; _speckleApplication = speckleApplication; + _threadContext = threadContext; _topLevelExceptionHandler = parent.TopLevelExceptionHandler; Parent = parent; Commands = new SendBindingUICommands(parent); @@ -111,10 +115,7 @@ private void OnObjectChanged(DBObject dbObject) private void OnChangeChangedObjectIds(DBObject dBObject) { ChangedObjectIds[dBObject.GetSpeckleApplicationId()] = 1; - _idleManager.SubscribeToIdle( - nameof(AutocadSendBinding), - async () => await RunExpirationChecks().ConfigureAwait(false) - ); + _idleManager.SubscribeToIdle(nameof(AutocadSendBinding), async () => await RunExpirationChecks()); } private async Task RunExpirationChecks() @@ -135,7 +136,7 @@ private async Task RunExpirationChecks() } } - await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false); + await Commands.SetModelsExpired(expiredSenderIds); ChangedObjectIds = new(); } @@ -144,9 +145,7 @@ private async Task RunExpirationChecks() public List GetSendSettings() => []; public async Task Send(string modelCardId) => - await Parent - .RunOnMainThreadAsync(async () => await SendInternal(modelCardId).ConfigureAwait(false)) - .ConfigureAwait(false); + await _threadContext.RunOnWorkerAsync(async () => await SendInternal(modelCardId)); protected abstract void InitializeSettings(IServiceProvider serviceProvider); @@ -188,12 +187,9 @@ private async Task SendInternal(string modelCardId) modelCard.GetSendInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -205,7 +201,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } finally { diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs index bc2a28a96..ddd5c223c 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Bindings/AutocadSendBinding.cs @@ -3,6 +3,7 @@ using Speckle.Connectors.Autocad.HostApp; using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Cancellation; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; @@ -28,7 +29,8 @@ public AutocadSendBinding( IOperationProgressManager operationProgressManager, ILogger logger, IAutocadConversionSettingsFactory autocadConversionSettingsFactory, - ISpeckleApplication speckleApplication + ISpeckleApplication speckleApplication, + IThreadContext threadContext ) : base( store, @@ -40,7 +42,8 @@ ISpeckleApplication speckleApplication sendConversionCache, operationProgressManager, logger, - speckleApplication + speckleApplication, + threadContext ) { _autocadConversionSettingsFactory = autocadConversionSettingsFactory; diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs index 72bc3567f..8ce12c190 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/DependencyInjection/SharedRegistration.cs @@ -10,6 +10,7 @@ using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Instances; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; @@ -24,7 +25,7 @@ public static class SharedRegistration public static void AddAutocadBase(this IServiceCollection serviceCollection) { serviceCollection.AddConnectorUtils(); - serviceCollection.AddDUI(); + serviceCollection.AddDUI(); serviceCollection.AddDUIView(); // Register other connector specific types @@ -43,10 +44,10 @@ public static void AddAutocadBase(this IServiceCollection serviceCollection) serviceCollection.AddScoped(); serviceCollection.AddScoped(); - serviceCollection.AddScoped(); + serviceCollection.AddScoped(); serviceCollection.AddScoped(); - serviceCollection.AddScoped(); + serviceCollection.AddScoped(); serviceCollection.AddSingleton(); diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadColorBaker.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadColorBaker.cs index 7395ab6e8..c02e1d839 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadColorBaker.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadColorBaker.cs @@ -1,6 +1,7 @@ using Autodesk.AutoCAD.Colors; using Microsoft.Extensions.Logging; using Speckle.Connectors.Common.Operations; +using Speckle.InterfaceGenerator; using Speckle.Sdk; using Speckle.Sdk.Models.Proxies; using AutocadColor = Autodesk.AutoCAD.Colors.Color; @@ -10,15 +11,9 @@ namespace Speckle.Connectors.Autocad.HostApp; /// /// Expects to be a scoped dependency for a given operation and helps with layer creation and cleanup. /// -public class AutocadColorBaker +[GenerateAutoInterface] +public class AutocadColorBaker(ILogger logger) : IAutocadColorBaker { - private readonly ILogger _logger; - - public AutocadColorBaker(ILogger logger) - { - _logger = logger; - } - /// /// For receive operations /// @@ -59,7 +54,7 @@ public void ParseColors(IReadOnlyCollection colorProxies, IProgress< } catch (Exception ex) when (!ex.IsFatal()) { - _logger.LogError(ex, "Failed parsing color proxy"); + logger.LogError(ex, "Failed parsing color proxy"); } } } diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceBaker.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceBaker.cs index 8121d97f7..e1373f54f 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceBaker.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadInstanceBaker.cs @@ -26,16 +26,16 @@ namespace Speckle.Connectors.Autocad.HostApp; public class AutocadInstanceBaker : IInstanceBaker> { private readonly AutocadLayerBaker _layerBaker; - private readonly AutocadColorBaker _colorBaker; - private readonly AutocadMaterialBaker _materialBaker; + private readonly IAutocadColorBaker _colorBaker; + private readonly IAutocadMaterialBaker _materialBaker; private readonly AutocadContext _autocadContext; private readonly ILogger _logger; private readonly IConverterSettingsStore _converterSettings; public AutocadInstanceBaker( AutocadLayerBaker layerBaker, - AutocadColorBaker colorBaker, - AutocadMaterialBaker materialBaker, + IAutocadColorBaker colorBaker, + IAutocadMaterialBaker materialBaker, AutocadContext autocadContext, ILogger logger, IConverterSettingsStore converterSettings diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerBaker.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerBaker.cs index f70d1dca4..ebd4737eb 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerBaker.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadLayerBaker.cs @@ -12,15 +12,15 @@ public class AutocadLayerBaker : TraversalContextUnpacker { private readonly string _layerFilterName = "Speckle"; private readonly AutocadContext _autocadContext; - private readonly AutocadMaterialBaker _materialBaker; - private readonly AutocadColorBaker _colorBaker; + private readonly IAutocadMaterialBaker _materialBaker; + private readonly IAutocadColorBaker _colorBaker; private Document Doc => Application.DocumentManager.MdiActiveDocument; private readonly HashSet _uniqueLayerNames = new(); public AutocadLayerBaker( AutocadContext autocadContext, - AutocadMaterialBaker materialBaker, - AutocadColorBaker colorBaker + IAutocadMaterialBaker materialBaker, + IAutocadColorBaker colorBaker ) { _autocadContext = autocadContext; diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadMaterialBaker.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadMaterialBaker.cs index 13fa39e4e..1e09a7f2b 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadMaterialBaker.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/HostApp/AutocadMaterialBaker.cs @@ -4,6 +4,7 @@ using Microsoft.Extensions.Logging; using Speckle.Connectors.Common.Conversion; using Speckle.Connectors.Common.Operations; +using Speckle.InterfaceGenerator; using Speckle.Objects.Other; using Speckle.Sdk; using Speckle.Sdk.Common; @@ -16,7 +17,8 @@ namespace Speckle.Connectors.Autocad.HostApp; /// /// Expects to be a scoped dependency for a given operation and helps with layer creation and cleanup. /// -public class AutocadMaterialBaker +[GenerateAutoInterface] +public class AutocadMaterialBaker : IAutocadMaterialBaker { private readonly ILogger _logger; private readonly AutocadContext _autocadContext; diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs index cecb3960f..a6e721364 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Receive/AutocadHostObjectBuilder.cs @@ -20,86 +20,44 @@ namespace Speckle.Connectors.Autocad.Operations.Receive; /// /// Expects to be a scoped dependency per receive operation. /// -public class AutocadHostObjectBuilder : IHostObjectBuilder +public class AutocadHostObjectBuilder( + IRootToHostConverter converter, + AutocadLayerBaker layerBaker, + AutocadGroupBaker groupBaker, + AutocadInstanceBaker instanceBaker, + IAutocadMaterialBaker materialBaker, + IAutocadColorBaker colorBaker, + AutocadContext autocadContext, + RootObjectUnpacker rootObjectUnpacker +) : IHostObjectBuilder { - private readonly AutocadLayerBaker _layerBaker; - private readonly IRootToHostConverter _converter; - private readonly ISyncToThread _syncToThread; - private readonly AutocadGroupBaker _groupBaker; - private readonly AutocadMaterialBaker _materialBaker; - private readonly AutocadColorBaker _colorBaker; - private readonly AutocadInstanceBaker _instanceBaker; - private readonly AutocadContext _autocadContext; - private readonly RootObjectUnpacker _rootObjectUnpacker; - - public AutocadHostObjectBuilder( - IRootToHostConverter converter, - AutocadLayerBaker layerBaker, - AutocadGroupBaker groupBaker, - AutocadInstanceBaker instanceBaker, - AutocadMaterialBaker materialBaker, - AutocadColorBaker colorBaker, - ISyncToThread syncToThread, - AutocadContext autocadContext, - RootObjectUnpacker rootObjectUnpacker - ) - { - _converter = converter; - _layerBaker = layerBaker; - _groupBaker = groupBaker; - _instanceBaker = instanceBaker; - _materialBaker = materialBaker; - _colorBaker = colorBaker; - _syncToThread = syncToThread; - _autocadContext = autocadContext; - _rootObjectUnpacker = rootObjectUnpacker; - } - - public async Task Build( + public HostObjectBuilderResult Build( Base rootObject, string projectName, string modelName, IProgress onOperationProgressed, - CancellationToken _ - ) - { - // NOTE: This is the only place we apply ISyncToThread across connectors. We need to sync up with main thread here - // after GetObject and Deserialization. It is anti-pattern now. Happiness level 3/10 but works. - return await _syncToThread - .RunOnThread(async () => - { - await Task.CompletedTask.ConfigureAwait(true); - return BuildSync(rootObject, projectName, modelName, onOperationProgressed); - }) - .ConfigureAwait(false); - } - - private HostObjectBuilderResult BuildSync( - Base rootObject, - string projectName, - string modelName, - IProgress onOperationProgressed + CancellationToken cancellationToken ) { // Prompt the UI conversion started. Progress bar will swoosh. onOperationProgressed.Report(new("Converting", null)); // Layer filter for received commit with project and model name - _layerBaker.CreateLayerFilter(projectName, modelName); + layerBaker.CreateLayerFilter(projectName, modelName); // 0 - Clean then Rock n Roll! - string baseLayerPrefix = _autocadContext.RemoveInvalidChars($"SPK-{projectName}-{modelName}-"); + string baseLayerPrefix = autocadContext.RemoveInvalidChars($"SPK-{projectName}-{modelName}-"); PreReceiveDeepClean(baseLayerPrefix); // 1 - Unpack objects and proxies from root commit object - var unpackedRoot = _rootObjectUnpacker.Unpack(rootObject); + var unpackedRoot = rootObjectUnpacker.Unpack(rootObject); // 2 - Split atomic objects and instance components with their path - var (atomicObjects, instanceComponents) = _rootObjectUnpacker.SplitAtomicObjectsAndInstances( + var (atomicObjects, instanceComponents) = rootObjectUnpacker.SplitAtomicObjectsAndInstances( unpackedRoot.ObjectsToConvert ); - var atomicObjectsWithPath = _layerBaker.GetAtomicObjectsWithPath(atomicObjects); - var instanceComponentsWithPath = _layerBaker.GetInstanceComponentsWithPath(instanceComponents); + var atomicObjectsWithPath = layerBaker.GetAtomicObjectsWithPath(atomicObjects); + var instanceComponentsWithPath = layerBaker.GetInstanceComponentsWithPath(instanceComponents); // POC: these are not captured by traversal, so we need to re-add them here if (unpackedRoot.DefinitionProxies != null && unpackedRoot.DefinitionProxies.Count > 0) @@ -113,7 +71,7 @@ IProgress onOperationProgressed // 3 - Bake materials and colors, as they are used later down the line by layers and objects if (unpackedRoot.RenderMaterialProxies != null) { - _materialBaker.ParseAndBakeRenderMaterials( + materialBaker.ParseAndBakeRenderMaterials( unpackedRoot.RenderMaterialProxies, baseLayerPrefix, onOperationProgressed @@ -122,7 +80,7 @@ IProgress onOperationProgressed if (unpackedRoot.ColorProxies != null) { - _colorBaker.ParseColors(unpackedRoot.ColorProxies, onOperationProgressed); + colorBaker.ParseColors(unpackedRoot.ColorProxies, onOperationProgressed); } // 5 - Convert atomic objects @@ -134,6 +92,7 @@ IProgress onOperationProgressed { string objectId = atomicObject.applicationId ?? atomicObject.id.NotNull(); onOperationProgressed.Report(new("Converting objects", (double)++count / atomicObjects.Count)); + cancellationToken.ThrowIfCancellationRequested(); try { IReadOnlyCollection convertedObjects = ConvertObject(atomicObject, layerPath, baseLayerPrefix); @@ -158,7 +117,7 @@ IProgress onOperationProgressed } // 6 - Convert instances - var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = _instanceBaker.BakeInstances( + var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = instanceBaker.BakeInstances( instanceComponentsWithPath, applicationIdMap, baseLayerPrefix, @@ -173,7 +132,7 @@ IProgress onOperationProgressed // 7 - Create groups if (unpackedRoot.GroupProxies != null) { - IReadOnlyCollection groupResults = _groupBaker.CreateGroups( + IReadOnlyCollection groupResults = groupBaker.CreateGroups( unpackedRoot.GroupProxies, applicationIdMap ); @@ -185,20 +144,20 @@ IProgress onOperationProgressed private void PreReceiveDeepClean(string baseLayerPrefix) { - _layerBaker.DeleteAllLayersByPrefix(baseLayerPrefix); - _instanceBaker.PurgeInstances(baseLayerPrefix); - _materialBaker.PurgeMaterials(baseLayerPrefix); + layerBaker.DeleteAllLayersByPrefix(baseLayerPrefix); + instanceBaker.PurgeInstances(baseLayerPrefix); + materialBaker.PurgeMaterials(baseLayerPrefix); } private IReadOnlyCollection ConvertObject(Base obj, Collection[] layerPath, string baseLayerNamePrefix) { - string layerName = _layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix); + string layerName = layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix); var convertedEntities = new HashSet(); using var tr = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction(); // 1: convert - var converted = _converter.Convert(obj); + var converted = converter.Convert(obj); // 2: handle result if (converted is Entity entity) @@ -219,12 +178,12 @@ private IReadOnlyCollection ConvertObject(Base obj, Collection[] layerPa private Entity BakeObject(Entity entity, Base originalObject, string layerName, Base? parentObject = null) { var objId = originalObject.applicationId ?? originalObject.id.NotNull(); - if (_colorBaker.ObjectColorsIdMap.TryGetValue(objId, out AutocadColor? color)) + if (colorBaker.ObjectColorsIdMap.TryGetValue(objId, out AutocadColor? color)) { entity.Color = color; } - if (_materialBaker.TryGetMaterialId(originalObject, parentObject, out ObjectId matId)) + if (materialBaker.TryGetMaterialId(originalObject, parentObject, out ObjectId matId)) { entity.MaterialId = matId; } @@ -253,7 +212,7 @@ string baseLayerName var groupDictionary = (DBDictionary) tr.GetObject(Application.DocumentManager.CurrentDocument.Database.GroupDictionaryId, OpenMode.ForWrite); - var groupName = _autocadContext.RemoveInvalidChars( + var groupName = autocadContext.RemoveInvalidChars( $@"{parentObject.speckle_type.Split('.').Last()} - {parentObject.applicationId ?? parentObject.id} ({baseLayerName})" ); diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBaseBuilder.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBaseBuilder.cs index 9c8c77e15..ea43660f3 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBaseBuilder.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Operations/Send/AutocadRootObjectBaseBuilder.cs @@ -16,7 +16,7 @@ namespace Speckle.Connectors.Autocad.Operations.Send; -public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder +public abstract class AutocadRootObjectBaseBuilder : RootObjectBuilderBase { private readonly IRootToSpeckleConverter _converter; private readonly string[] _documentPathSeparator = ["\\"]; @@ -49,13 +49,6 @@ ISdkActivityFactory activityFactory _activityFactory = activityFactory; } - public Task Build( - IReadOnlyList objects, - SendInfo sendInfo, - IProgress onOperationProgressed, - CancellationToken ct = default - ) => Task.FromResult(BuildSync(objects, sendInfo, onOperationProgressed, ct)); - [SuppressMessage( "Maintainability", "CA1506:Avoid excessive class coupling", @@ -65,11 +58,11 @@ It is already simplified but has many different references since it is a builder proxy classes yet. So I'm supressing this one now!!! """ )] - private RootObjectBuilderResult BuildSync( + public override RootObjectBuilderResult Build( IReadOnlyList objects, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken ct = default + CancellationToken cancellationToken ) { // 0 - Init the root @@ -101,7 +94,7 @@ private RootObjectBuilderResult BuildSync( int count = 0; foreach (var (entity, applicationId) in atomicObjects) { - ct.ThrowIfCancellationRequested(); + cancellationToken.ThrowIfCancellationRequested(); using (var convertActivity = _activityFactory.Start("Converting object")) { // Create and add a collection for this entity if not done so already. diff --git a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Plugin/AutocadCommand.cs b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Plugin/AutocadCommand.cs index f3c177540..cbc69d098 100644 --- a/Connectors/Autocad/Speckle.Connectors.AutocadShared/Plugin/AutocadCommand.cs +++ b/Connectors/Autocad/Speckle.Connectors.AutocadShared/Plugin/AutocadCommand.cs @@ -3,7 +3,6 @@ using Autodesk.AutoCAD.Windows; using Microsoft.Extensions.DependencyInjection; using Speckle.Connectors.Common; -using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.WebView; #if AUTOCAD using Speckle.Connectors.Autocad.DependencyInjection; @@ -48,7 +47,6 @@ public void Command() services.AddCivil3dConverters(); #endif Container = services.BuildServiceProvider(); - Container.UseDUI(); var panelWebView = Container.GetRequiredService(); diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3d2022/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Civil3d2022/packages.lock.json index 96a0be9d7..f21270c3d 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3d2022/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Civil3d2022/packages.lock.json @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -310,7 +309,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -348,18 +347,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -369,20 +368,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3d2023/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Civil3d2023/packages.lock.json index f3ed0a9f5..6c84659e4 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3d2023/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Civil3d2023/packages.lock.json @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -310,7 +309,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -348,18 +347,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -369,20 +368,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json index 7bd59ebab..afb4ab323 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Civil3d2024/packages.lock.json @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -310,7 +309,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -348,18 +347,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -369,20 +368,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3d2025/packages.lock.json b/Connectors/Autocad/Speckle.Connectors.Civil3d2025/packages.lock.json index 942c755df..54a134f77 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3d2025/packages.lock.json +++ b/Connectors/Autocad/Speckle.Connectors.Civil3d2025/packages.lock.json @@ -229,9 +229,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -239,9 +239,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -267,7 +266,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -305,18 +304,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -325,20 +324,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, "net8.0-windows7.0/win-x64": { diff --git a/Connectors/Autocad/Speckle.Connectors.Civil3dShared/Bindings/Civil3dSendBinding.cs b/Connectors/Autocad/Speckle.Connectors.Civil3dShared/Bindings/Civil3dSendBinding.cs index a1aa571b0..4b26c74ef 100644 --- a/Connectors/Autocad/Speckle.Connectors.Civil3dShared/Bindings/Civil3dSendBinding.cs +++ b/Connectors/Autocad/Speckle.Connectors.Civil3dShared/Bindings/Civil3dSendBinding.cs @@ -4,6 +4,7 @@ using Speckle.Connectors.Autocad.HostApp; using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Cancellation; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; @@ -32,7 +33,8 @@ public Civil3dSendBinding( ILogger logger, ICivil3dConversionSettingsFactory civil3dConversionSettingsFactory, IAutocadConversionSettingsFactory autocadConversionSettingsFactory, - ISpeckleApplication speckleApplication + ISpeckleApplication speckleApplication, + IThreadContext threadContext ) : base( store, @@ -44,7 +46,8 @@ ISpeckleApplication speckleApplication sendConversionCache, operationProgressManager, logger, - speckleApplication + speckleApplication, + threadContext ) { _civil3dConversionSettingsFactory = civil3dConversionSettingsFactory; diff --git a/Connectors/CSi/Speckle.Connectors.CSiShared/Bindings/CsiSharedSendBinding.cs b/Connectors/CSi/Speckle.Connectors.CSiShared/Bindings/CsiSharedSendBinding.cs index 785d2c2ee..0c297fd8d 100644 --- a/Connectors/CSi/Speckle.Connectors.CSiShared/Bindings/CsiSharedSendBinding.cs +++ b/Connectors/CSi/Speckle.Connectors.CSiShared/Bindings/CsiSharedSendBinding.cs @@ -107,12 +107,9 @@ public async Task Send(string modelCardId) modelCard.GetSendInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -121,7 +118,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } diff --git a/Connectors/CSi/Speckle.Connectors.CSiShared/Operations/Send/CsiRootObjectBuilder.cs b/Connectors/CSi/Speckle.Connectors.CSiShared/Operations/Send/CsiRootObjectBuilder.cs index 5660a1ce6..c76aa8dfd 100644 --- a/Connectors/CSi/Speckle.Connectors.CSiShared/Operations/Send/CsiRootObjectBuilder.cs +++ b/Connectors/CSi/Speckle.Connectors.CSiShared/Operations/Send/CsiRootObjectBuilder.cs @@ -42,11 +42,11 @@ ICsiApplicationService csiApplicationService _csiApplicationService = csiApplicationService; } - public async Task Build( + public async Task BuildAsync( IReadOnlyList csiObjects, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken cancellationToken = default + CancellationToken cancellationToken ) { using var activity = _activityFactory.Start("Build"); @@ -62,14 +62,15 @@ public async Task Build( { foreach (ICsiWrapper csiObject in csiObjects) { - using var _2 = _activityFactory.Start("Convert"); cancellationToken.ThrowIfCancellationRequested(); + using var _2 = _activityFactory.Start("Convert"); var result = ConvertCSiObject(csiObject, rootObjectCollection, sendInfo.ProjectId); results.Add(result); count++; onOperationProgressed.Report(new("Converting", (double)count / csiObjects.Count)); + await Task.Yield(); } } @@ -78,7 +79,6 @@ public async Task Build( throw new SpeckleException("Failed to convert all objects."); } - await Task.Yield(); return new RootObjectBuilderResult(rootObjectCollection, results); } diff --git a/Connectors/CSi/Speckle.Connectors.CSiShared/ServiceRegistration.cs b/Connectors/CSi/Speckle.Connectors.CSiShared/ServiceRegistration.cs index 572b81b46..59945da1e 100644 --- a/Connectors/CSi/Speckle.Connectors.CSiShared/ServiceRegistration.cs +++ b/Connectors/CSi/Speckle.Connectors.CSiShared/ServiceRegistration.cs @@ -1,7 +1,8 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Speckle.Connectors.Common; using Speckle.Connectors.Common.Builders; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.CSiShared.Bindings; using Speckle.Connectors.CSiShared.Builders; using Speckle.Connectors.CSiShared.Filters; @@ -9,7 +10,6 @@ using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; -using Speckle.Connectors.DUI.Models; using Speckle.Connectors.DUI.Models.Card.SendFilter; using Speckle.Connectors.DUI.WebView; using Speckle.Converters.CSiShared; @@ -24,11 +24,9 @@ public static IServiceCollection AddCsi(this IServiceCollection services) services.AddSingleton(); services.AddConnectorUtils(); - services.AddDUI(); + services.AddDUI(); services.AddDUIView(); - services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/Connectors/CSi/Speckle.Connectors.ETABS21/packages.lock.json b/Connectors/CSi/Speckle.Connectors.ETABS21/packages.lock.json index 770dfe449..b91ba7385 100644 --- a/Connectors/CSi/Speckle.Connectors.ETABS21/packages.lock.json +++ b/Connectors/CSi/Speckle.Connectors.ETABS21/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -293,7 +292,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.etabs21": { @@ -337,18 +336,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -358,20 +357,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/CSi/Speckle.Connectors.ETABS22/packages.lock.json b/Connectors/CSi/Speckle.Connectors.ETABS22/packages.lock.json index 08682760c..f1ea26d2d 100644 --- a/Connectors/CSi/Speckle.Connectors.ETABS22/packages.lock.json +++ b/Connectors/CSi/Speckle.Connectors.ETABS22/packages.lock.json @@ -220,9 +220,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -230,9 +230,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -249,7 +248,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.etabs22": { @@ -293,18 +292,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -313,20 +312,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Navisworks/Directory.Build.targets b/Connectors/Navisworks/Directory.Build.targets new file mode 100644 index 000000000..ec391895f --- /dev/null +++ b/Connectors/Navisworks/Directory.Build.targets @@ -0,0 +1,34 @@ + + + + true + + NextGen Speckle Connector for Autodesk Navisworks Manage + $(Authors) jonathon@speckle.systems + $(PackageTags) connector nwd nwc nwf navisworks manage + + $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworks.bundle + $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworks.bundle\Contents\$(NavisworksVersion) + Speckle.Connector.Navisworks + + + + + + + + + + + + + + + + + + + + + + diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/Speckle.Connectors.Navisworks2020.csproj b/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/Speckle.Connectors.Navisworks2020.csproj index 5b663b2ce..aa7773930 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/Speckle.Connectors.Navisworks2020.csproj +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/Speckle.Connectors.Navisworks2020.csproj @@ -8,16 +8,7 @@ v17 2020 - true $(DefineConstants);TRACE;NAVIS2020;NAVIS - - NextGen Speckle Connector for Autodesk Navisworks Manage - $(Authors) jonathon@speckle.systems - $(PackageTags) connector nwd nwc nwf navisworks manage - - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion) - @@ -32,25 +23,5 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/packages.lock.json b/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/packages.lock.json index cca42e823..78f291dd2 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/packages.lock.json +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2020/packages.lock.json @@ -41,11 +41,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.navisworks2020": { @@ -348,9 +347,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, ".NETFramework,Version=v4.8/win-x64": { diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/Speckle.Connectors.Navisworks2021.csproj b/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/Speckle.Connectors.Navisworks2021.csproj index 542d8fae2..a08f46980 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/Speckle.Connectors.Navisworks2021.csproj +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/Speckle.Connectors.Navisworks2021.csproj @@ -8,16 +8,7 @@ v18 2021 - true $(DefineConstants);TRACE;NAVIS2021;NAVIS - - NextGen Speckle Connector for Autodesk Navisworks Manage - $(Authors) jonathon@speckle.systems - $(PackageTags) connector nwd nwc nwf navisworks manage - - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion) - @@ -32,25 +23,5 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/packages.lock.json b/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/packages.lock.json index 4ecfd78d8..f7936f3b4 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/packages.lock.json +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2021/packages.lock.json @@ -41,11 +41,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.navisworks2021": { @@ -348,9 +347,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, ".NETFramework,Version=v4.8/win-x64": { diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/Speckle.Connectors.Navisworks2022.csproj b/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/Speckle.Connectors.Navisworks2022.csproj index 72c3d9959..0761b1a9d 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/Speckle.Connectors.Navisworks2022.csproj +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/Speckle.Connectors.Navisworks2022.csproj @@ -1,5 +1,4 @@ - net48 x64 @@ -9,16 +8,7 @@ v19 2022 - true $(DefineConstants);TRACE;NAVIS2022;NAVIS - - NextGen Speckle Connector for Autodesk Navisworks Manage - $(Authors) jonathon@speckle.systems - $(PackageTags) connector nwd nwc nwf navisworks manage - - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion) - @@ -33,25 +23,5 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/packages.lock.json b/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/packages.lock.json index f1c8e67fa..279106ad5 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/packages.lock.json +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2022/packages.lock.json @@ -41,11 +41,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.navisworks2022": { @@ -348,9 +347,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, ".NETFramework,Version=v4.8/win-x64": { diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/Speckle.Connectors.Navisworks2023.csproj b/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/Speckle.Connectors.Navisworks2023.csproj index d093ac0bf..c829891dd 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/Speckle.Connectors.Navisworks2023.csproj +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/Speckle.Connectors.Navisworks2023.csproj @@ -1,5 +1,4 @@ - net48 x64 @@ -9,20 +8,9 @@ v20 2023 - true $(DefineConstants);TRACE;NAVIS2023;NAVIS - - NextGen Speckle Connector for Autodesk Navisworks Manage - $(Authors) jonathon@speckle.systems - $(PackageTags) connector nwd nwc nwf navisworks manage - - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion) - Speckle.Connector.Navisworks - - @@ -35,25 +23,5 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/packages.lock.json b/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/packages.lock.json index f2f020448..db7b70b3c 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/packages.lock.json +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2023/packages.lock.json @@ -41,11 +41,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.navisworks2023": { @@ -348,9 +347,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, ".NETFramework,Version=v4.8/win-x64": { diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/Speckle.Connectors.Navisworks2024.csproj b/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/Speckle.Connectors.Navisworks2024.csproj index 6b346613c..53d06f6a9 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/Speckle.Connectors.Navisworks2024.csproj +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/Speckle.Connectors.Navisworks2024.csproj @@ -1,5 +1,4 @@ - net48 x64 @@ -9,19 +8,9 @@ v21 2024 - true $(DefineConstants);TRACE;NAVIS2024;NAVIS - - NextGen Speckle Connector for Autodesk Navisworks Manage - $(Authors) jonathon@speckle.systems - $(PackageTags) connector nwd nwc nwf navisworks manage - - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion) - Speckle.Connector.Navisworks - - + @@ -34,25 +23,5 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/packages.lock.json b/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/packages.lock.json index 1ca33e433..a9a1f0e9b 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/packages.lock.json +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2024/packages.lock.json @@ -41,11 +41,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.navisworks2024": { @@ -348,9 +347,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, ".NETFramework,Version=v4.8/win-x64": { diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/Speckle.Connectors.Navisworks2025.csproj b/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/Speckle.Connectors.Navisworks2025.csproj index 917a87414..13e9e7f70 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/Speckle.Connectors.Navisworks2025.csproj +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/Speckle.Connectors.Navisworks2025.csproj @@ -8,16 +8,7 @@ v22 2025 - true $(DefineConstants);TRACE;NAVIS2025;NAVIS - - NextGen Speckle Connector for Autodesk Navisworks Manage - $(Authors) jonathon@speckle.systems - $(PackageTags) connector nwd nwc nwf navisworks manage - - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle - $(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion) - @@ -34,23 +25,4 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/packages.lock.json b/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/packages.lock.json index 1e3aad772..25f6aa285 100644 --- a/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/packages.lock.json +++ b/Connectors/Navisworks/Speckle.Connectors.Navisworks2025/packages.lock.json @@ -47,11 +47,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -279,9 +279,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -289,9 +289,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -308,7 +307,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.navisworks2025": { @@ -348,9 +347,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -360,20 +359,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, ".NETFramework,Version=v4.8/win-x64": { diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksBasicConnectorBinding.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksBasicConnectorBinding.cs index 62c0ffda0..8d893c8cc 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksBasicConnectorBinding.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksBasicConnectorBinding.cs @@ -42,20 +42,13 @@ NavisworksDocumentEvents documentEvents public string GetConnectorVersion() => _speckleApplication.SpeckleVersion; public DocumentInfo? GetDocumentInfo() => - Parent - .RunOnMainThreadAsync( - () => - Task.FromResult( - NavisworksApp.ActiveDocument is null || NavisworksApp.ActiveDocument.Models.Count == 0 - ? null - : new DocumentInfo( - NavisworksApp.ActiveDocument.CurrentFileName, - NavisworksApp.ActiveDocument.Title, - NavisworksApp.ActiveDocument.GetHashCode().ToString() - ) - ) - ) - .Result; + NavisworksApp.ActiveDocument is null || NavisworksApp.ActiveDocument.Models.Count == 0 + ? null + : new DocumentInfo( + NavisworksApp.ActiveDocument.CurrentFileName, + NavisworksApp.ActiveDocument.Title, + NavisworksApp.ActiveDocument.GetHashCode().ToString() + ); public DocumentModelStore GetDocumentState() => _store; @@ -68,11 +61,6 @@ NavisworksDocumentEvents documentEvents public Task HighlightModel(string modelCardId) => Task.CompletedTask; public async Task HighlightObjects(IReadOnlyList objectIds) => - await Parent - .RunOnMainThreadAsync(async () => - { - // TODO: Implement highlighting logic on main thread - await Task.CompletedTask.ConfigureAwait(false); - }) - .ConfigureAwait(false); + // TODO: Implement highlighting logic on main thread + await Task.CompletedTask; } diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSelectionBinding.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSelectionBinding.cs index 52389c16b..e7920c205 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSelectionBinding.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSelectionBinding.cs @@ -26,24 +26,12 @@ IElementSelectionService selectionService } private void OnSelectionChange(object? o, EventArgs eventArgs) => - _appIdleManager.SubscribeToIdle( - nameof(NavisworksSelectionBinding), - async () => await UpdateSelectionAsync().ConfigureAwait(false) - ); - - private void UpdateSelection() - { - SelectionInfo selInfo = GetSelection(); - Parent.Send(SELECTION_EVENT, selInfo); - } + _appIdleManager.SubscribeToIdle(nameof(NavisworksSelectionBinding), async () => await UpdateSelectionAsync()); private async Task UpdateSelectionAsync() { - var selInfo = await Parent - .RunOnMainThreadAsync(() => Task.FromResult(GetSelection())) - .ConfigureAwait(false); - - await Parent.Send(SELECTION_EVENT, selInfo).ConfigureAwait(false); + var selInfo = GetSelection(); + await Parent.Send(SELECTION_EVENT, selInfo); } public SelectionInfo GetSelection() diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSendBinding.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSendBinding.cs index 8e5c15e3a..47675b88a 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSendBinding.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Bindings/NavisworksSendBinding.cs @@ -87,27 +87,19 @@ public async Task Send(string modelCardId) using var activity = _activityFactory.Start(); try { - await Parent - .RunOnMainThreadAsync(async () => - { - var modelCard = GetModelCard(modelCardId); + var modelCard = GetModelCard(modelCardId); - using var scope = _serviceProvider.CreateScope(); + using var scope = _serviceProvider.CreateScope(); - InitializeConverterSettings(scope, modelCard); + InitializeConverterSettings(scope, modelCard); - CancellationToken token = _cancellationManager.InitCancellationTokenSource(modelCardId); + CancellationToken token = _cancellationManager.InitCancellationTokenSource(modelCardId); - var navisworksModelItems = GetNavisworksModelItems(modelCard); + var navisworksModelItems = GetNavisworksModelItems(modelCard); - var sendResult = await ExecuteSendOperation(scope, modelCard, navisworksModelItems, token) - .ConfigureAwait(false); + var sendResult = await ExecuteSendOperation(scope, modelCard, navisworksModelItems, token); - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); - }) - .ConfigureAwait(false); + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -118,7 +110,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } @@ -171,10 +163,9 @@ await scope .Execute( navisworksModelItems, modelCard.GetSendInfo(_speckleApplication.Slug), - _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCard.ModelCardId!, token), + _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCard.ModelCardId.NotNull(), token), token - ) - .ConfigureAwait(false); + ); public void CancelSend(string modelCardId) => _cancellationManager.CancelOperation(modelCardId); diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/DependencyInjection/NavisworksConnectorServiceRegistration.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/DependencyInjection/NavisworksConnectorServiceRegistration.cs index a1d398292..b953302de 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/DependencyInjection/NavisworksConnectorServiceRegistration.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/DependencyInjection/NavisworksConnectorServiceRegistration.cs @@ -9,6 +9,7 @@ using Speckle.Connectors.Common.Builders; using Speckle.Connectors.Common.Cancellation; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; @@ -27,7 +28,7 @@ public static void AddNavisworks(this IServiceCollection serviceCollection) { // Register Core functionality serviceCollection.AddConnectorUtils(); - serviceCollection.AddDUI(); + serviceCollection.AddDUI(); serviceCollection.AddDUIView(); // Register bindings @@ -50,6 +51,7 @@ public static void AddNavisworks(this IServiceCollection serviceCollection) >(); serviceCollection.AddScoped(); + serviceCollection.AddScoped(); // Sending operations serviceCollection.AddScoped, NavisworksRootObjectBuilder>(); diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksColorUnpacker.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksColorUnpacker.cs new file mode 100644 index 000000000..c543e1b07 --- /dev/null +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksColorUnpacker.cs @@ -0,0 +1,170 @@ +using Microsoft.Extensions.Logging; +using Speckle.Connector.Navisworks.Services; +using Speckle.Converter.Navisworks.Helpers; +using Speckle.Converter.Navisworks.Settings; +using Speckle.Converters.Common; +using Speckle.Sdk; +using Speckle.Sdk.Models.Proxies; +using ComApi = Autodesk.Navisworks.Api.Interop.ComApi; +using ComBridge = Autodesk.Navisworks.Api.ComApi.ComApiBridge; + +namespace Speckle.Connector.Navisworks.HostApp; + +public class NavisworksColorUnpacker( + ILogger logger, + IConverterSettingsStore converterSettings, + IElementSelectionService selectionService +) +{ + private static T Select(RepresentationMode mode, T active, T permanent, T original, T defaultValue) => + mode switch + { + RepresentationMode.Active => active, + RepresentationMode.Permanent => permanent, + RepresentationMode.Original => original, + _ => defaultValue, + }; + + internal List UnpackColor( + IReadOnlyList navisworksObjects, + Dictionary> groupedNodes + ) + { + if (navisworksObjects == null) + { + throw new ArgumentNullException(nameof(navisworksObjects)); + } + + if (groupedNodes == null) + { + throw new ArgumentNullException(nameof(groupedNodes)); + } + + Dictionary colorProxies = []; + Dictionary mergedIds = []; + + // Build mergedIds map once + foreach (var group in groupedNodes) + { + foreach (var node in group.Value) + { + mergedIds[selectionService.GetModelItemPath(node)] = group.Key; + } + } + + foreach (NAV.ModelItem navisworksObject in navisworksObjects) + { + try + { + // Skip non-2D elements + if (!Is2DElement(navisworksObject)) + { + continue; + } + + var navisworksObjectId = selectionService.GetModelItemPath(navisworksObject); + var finalId = mergedIds.TryGetValue(navisworksObjectId, out var mergedId) ? mergedId : navisworksObjectId; + + var geometry = navisworksObject.Geometry; + var mode = converterSettings.Current.User.VisualRepresentationMode; + + using var defaultColor = new NAV.Color(1.0, 1.0, 1.0); + + var representationColor = Select( + mode, + geometry.ActiveColor, + geometry.PermanentColor, + geometry.OriginalColor, + defaultColor + ); + + var colorId = Select( + mode, + $"{geometry.ActiveColor.GetHashCode()}_{geometry.ActiveTransparency}".GetHashCode(), + $"{geometry.PermanentColor.GetHashCode()}_{geometry.PermanentTransparency}".GetHashCode(), + $"{geometry.OriginalColor.GetHashCode()}_{geometry.OriginalTransparency}".GetHashCode(), + 0 + ); + + var colorName = ColorConverter.NavisworksColorToColor(representationColor).Name; + + if (colorProxies.TryGetValue(colorId.ToString(), out ColorProxy? colorProxy)) + { + colorProxy.objects.Add(finalId); + } + else + { + colorProxies[colorId.ToString()] = new ColorProxy + { + value = ColorConverter.NavisworksColorToColor(representationColor).ToArgb(), + name = colorName, + applicationId = colorId.ToString(), + objects = [finalId] + }; + } + } + catch (Exception ex) when (!ex.IsFatal()) + { + logger.LogError(ex, "Failed to unpack color for Navisworks object"); + } + } + + return colorProxies.Values.ToList(); + } + + private static bool Is2DElement(NAV.ModelItem modelItem) + { + if (!modelItem.HasGeometry) + { + return false; + } + + var primitiveChecker = new PrimitiveChecker(); + + var comSelection = ComBridge.ToInwOpSelection([modelItem]); + try + { + foreach (ComApi.InwOaPath path in comSelection.Paths()) + { + GC.KeepAlive(path); + + foreach (ComApi.InwOaFragment3 fragment in path.Fragments()) + { + GC.KeepAlive(fragment); + + fragment.GenerateSimplePrimitives(ComApi.nwEVertexProperty.eNORMAL, primitiveChecker); + + // Exit early if triangles are found + if (primitiveChecker.HasTriangles) + { + return false; + } + } + } + + // Return true if any 2D primitives are found + return primitiveChecker.HasLines || primitiveChecker.HasPoints || primitiveChecker.HasSnapPoints; + } + finally + { + System.Runtime.InteropServices.Marshal.ReleaseComObject(comSelection); + } + } +} + +public class PrimitiveChecker : ComApi.InwSimplePrimitivesCB +{ + public bool HasTriangles { get; private set; } + public bool HasLines { get; private set; } + public bool HasPoints { get; private set; } + public bool HasSnapPoints { get; private set; } + + public void Line(ComApi.InwSimpleVertex v1, ComApi.InwSimpleVertex v2) => HasLines = true; + + public void Point(ComApi.InwSimpleVertex v1) => HasPoints = true; + + public void SnapPoint(ComApi.InwSimpleVertex v1) => HasSnapPoints = true; + + public void Triangle(ComApi.InwSimpleVertex v1, ComApi.InwSimpleVertex v2, ComApi.InwSimpleVertex v3) => + HasTriangles = true; +} diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentEvents.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentEvents.cs index 26fed81ee..69e05e171 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentEvents.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentEvents.cs @@ -84,10 +84,7 @@ private void HandleDocumentModelCountChanged(object sender, EventArgs e) _topLevelExceptionHandler.CatchUnhandled( () => - _idleManager.SubscribeToIdle( - nameof(NavisworksDocumentEvents), - async () => await ProcessModelStateChangeAsync().ConfigureAwait(false) - ) + _idleManager.SubscribeToIdle(nameof(NavisworksDocumentEvents), async () => await ProcessModelStateChangeAsync()) ); } @@ -102,29 +99,24 @@ private async Task ProcessModelStateChangeAsync() try { - await _parent - .RunOnMainThreadAsync(async () => - { - var store = _serviceProvider.GetRequiredService(); - var basicBinding = _serviceProvider.GetRequiredService(); - var commands = (basicBinding as NavisworksBasicConnectorBinding)?.Commands; - - switch (_finalModelCount) - { - case 0 when _priorModelCount > 0: - store.ClearAndSave(); - break; - case > 0 when _priorModelCount == 0: - store.ReloadState(); - break; - } - - if (commands != null) - { - await commands.NotifyDocumentChanged().ConfigureAwait(false); - } - }) - .ConfigureAwait(false); + var store = _serviceProvider.GetRequiredService(); + var basicBinding = _serviceProvider.GetRequiredService(); + var commands = (basicBinding as NavisworksBasicConnectorBinding)?.Commands; + + switch (_finalModelCount) + { + case 0 when _priorModelCount > 0: + store.ClearAndSave(); + break; + case > 0 when _priorModelCount == 0: + store.ReloadState(); + break; + } + + if (commands != null) + { + await commands.NotifyDocumentChanged(); + } } finally { @@ -164,7 +156,7 @@ private async Task NotifyValidModelStateChange() if (commands != null) { - await commands.NotifyDocumentChanged().ConfigureAwait(false); + await commands.NotifyDocumentChanged(); } } finally diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentModelStore.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentModelStore.cs index e00529721..5763ac5d6 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentModelStore.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksDocumentModelStore.cs @@ -2,6 +2,7 @@ using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; using Speckle.Connectors.DUI.Utils; +using Database = Autodesk.Navisworks.Api.DocumentParts.DocumentDatabase; namespace Speckle.Connector.Navisworks.HostApp; @@ -15,6 +16,7 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore private const string KEY_NAME = "Speckle_DUI3"; private readonly ITopLevelExceptionHandler _topLevelExceptionHandler; + private string _lastSavedState = string.Empty; public NavisworksDocumentModelStore( IJsonSerializer jsonSerializer, @@ -33,9 +35,16 @@ protected override void HostAppSaveState(string modelCardState) return; } + // Compare current state with last saved state + if (modelCardState == _lastSavedState) + { + return; // Skip save if states match + } + try { SaveStateToDatabase(modelCardState); + _lastSavedState = modelCardState; // Update last saved state after successful save } catch (NAV.Data.DatabaseException ex) { @@ -54,7 +63,7 @@ protected override void LoadState() { if (!IsActiveDocumentValid()) { - ClearAndSave(); + ClearAndSaveThisState(); return; } @@ -62,16 +71,23 @@ protected override void LoadState() { string serializedState = RetrieveStateFromDatabase(); LoadFromString(serializedState); + _lastSavedState = serializedState; // Store initial state after loading } catch (NAV.Data.DatabaseException ex) { - ClearAndSave(); // Clear models on failure to avoid stale data + ClearAndSaveThisState(); // Clear models on failure to avoid stale data _topLevelExceptionHandler.CatchUnhandled( () => throw new InvalidOperationException("Failed to read Speckle state from database", ex) ); } } + private void ClearAndSaveThisState() + { + ClearAndSave(); + _lastSavedState = string.Empty; // Reset last saved state when clearing + } + private static bool IsActiveDocumentValid() { try @@ -99,46 +115,55 @@ private static void SaveStateToDatabase(string modelCardState) var database = activeDoc.Database; - using (var transaction = database.BeginTransaction(NAV.Data.DatabaseChangedAction.Reset)) + if (!DoesTableExist(database)) { - EnsureDatabaseTableExists(transaction); + CreateTable(database); } - using (var transaction = database.BeginTransaction(NAV.Data.DatabaseChangedAction.Edited)) + using var transaction = database.BeginTransaction(NAV.Data.DatabaseChangedAction.Edited); + try { - try - { - ReplaceStateInDatabase(transaction, modelCardState); - transaction.Commit(); - } - catch - { - transaction.Rollback(); // Roll back transaction on failure - throw; - } + ReplaceStateInDatabase(transaction, modelCardState); + transaction.Commit(); + } + catch + { + transaction.Rollback(); // Roll back transaction on failure + throw; } } - private static void EnsureDatabaseTableExists(NAV.Data.NavisworksTransaction transaction) + private static void ReplaceStateInDatabase(NAV.Data.NavisworksTransaction transaction, string modelCardState) { var command = transaction.Connection.CreateCommand(); - command.CommandText = $"CREATE TABLE IF NOT EXISTS {TABLE_NAME}(key TEXT PRIMARY KEY, value TEXT)"; + command.CommandText = $"REPLACE INTO {TABLE_NAME}(key, value) VALUES(@key, @value)"; + command.Parameters.AddWithValue("@key", KEY_NAME); + command.Parameters.AddWithValue("@value", modelCardState); command.ExecuteNonQuery(); - transaction.Commit(); // Ensure table exists before proceeding } - private static void ReplaceStateInDatabase(NAV.Data.NavisworksTransaction transaction, string serializedState) + private static bool DoesTableExist(Database database) { - var command = transaction.Connection.CreateCommand(); - - command.CommandText = $"DELETE FROM {TABLE_NAME} WHERE key = @key"; - command.Parameters.AddWithValue("@key", KEY_NAME); - command.ExecuteNonQuery(); + var checkCommand = database.Value.CreateCommand(); + checkCommand.CommandText = $"SELECT name FROM sqlite_master WHERE type='table' AND name='{TABLE_NAME}'"; + return checkCommand.ExecuteScalar() != null; + } - command.CommandText = $"INSERT INTO {TABLE_NAME}(key, value) VALUES(@key, @value)"; - command.Parameters.AddWithValue("@key", KEY_NAME); - command.Parameters.AddWithValue("@value", serializedState); - command.ExecuteNonQuery(); + private static void CreateTable(Database database) + { + using var transaction = database.BeginTransaction(NAV.Data.DatabaseChangedAction.Edited); + try + { + var command = transaction.Connection.CreateCommand(); + command.CommandText = $"CREATE TABLE {TABLE_NAME}(key TEXT PRIMARY KEY, value TEXT)"; + command.ExecuteNonQuery(); + transaction.Commit(); + } + catch + { + transaction.Rollback(); + throw; + } } private static string RetrieveStateFromDatabase() @@ -146,9 +171,9 @@ private static string RetrieveStateFromDatabase() var database = NavisworksApp.ActiveDocument!.Database; using var table = new DataTable(); - using (var transaction = database.BeginTransaction(NAV.Data.DatabaseChangedAction.Reset)) + if (!DoesTableExist(database)) { - EnsureDatabaseTableExists(transaction); + return string.Empty; } using var dataAdapter = new NAV.Data.NavisworksDataAdapter( @@ -158,13 +183,6 @@ private static string RetrieveStateFromDatabase() dataAdapter.SelectCommand.Parameters.AddWithValue("@key", KEY_NAME); dataAdapter.Fill(table); - if (table.Rows.Count <= 0) - { - return string.Empty; // Return an empty collection if no state is found - } - - string stateString = table.Rows[0]["value"] as string ?? string.Empty; - - return stateString; + return table.Rows.Count <= 0 ? string.Empty : table.Rows[0]["value"] as string ?? string.Empty; } } diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksMaterialUnpacker.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksMaterialUnpacker.cs index 030f00b5d..b8170e125 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksMaterialUnpacker.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/HostApp/NavisworksMaterialUnpacker.cs @@ -1,5 +1,6 @@ -using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging; using Speckle.Connector.Navisworks.Services; +using Speckle.Converter.Navisworks.Helpers; using Speckle.Converter.Navisworks.Settings; using Speckle.Converters.Common; using Speckle.Objects.Other; @@ -24,14 +25,32 @@ private static T Select(RepresentationMode mode, T active, T permanent, T ori _ => defaultValue, }; - internal List UnpackRenderMaterial(IReadOnlyList navisworksObjects) + internal List UnpackRenderMaterial( + IReadOnlyList navisworksObjects, + Dictionary> groupedNodes + ) { if (navisworksObjects == null) { throw new ArgumentNullException(nameof(navisworksObjects)); } + if (groupedNodes == null) + { + throw new ArgumentNullException(nameof(groupedNodes)); + } + Dictionary renderMaterialProxies = []; + Dictionary mergedIds = []; + + // Build mergedIds map once + foreach (var group in groupedNodes) + { + foreach (var node in group.Value) + { + mergedIds[selectionService.GetModelItemPath(node)] = group.Key; + } + } foreach (NAV.ModelItem navisworksObject in navisworksObjects) { @@ -43,15 +62,13 @@ internal List UnpackRenderMaterial(IReadOnlyList UnpackRenderMaterial(IReadOnlyList UnpackRenderMaterial(IReadOnlyList UnpackRenderMaterial(IReadOnlyList - System.Drawing.Color.FromArgb( - Convert.ToInt32(color.R * 255), - Convert.ToInt32(color.G * 255), - Convert.ToInt32(color.B * 255) - ); } diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Operations/Send/NavisworksRootObjectBuilder.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Operations/Send/NavisworksRootObjectBuilder.cs index f58d59377..46d14b0a8 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Operations/Send/NavisworksRootObjectBuilder.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Operations/Send/NavisworksRootObjectBuilder.cs @@ -23,48 +23,100 @@ public class NavisworksRootObjectBuilder( ILogger logger, ISdkActivityFactory activityFactory, NavisworksMaterialUnpacker materialUnpacker, + NavisworksColorUnpacker colorUnpacker, IElementSelectionService elementSelectionService ) : IRootObjectBuilder { + private bool SkipNodeMerging { get; set; } + internal NavisworksConversionSettings GetCurrentSettings() => converterSettings.Current; - public Task Build( + /// + /// Asynchronously builds a Speckle object hierarchy from Navisworks model items. + /// + /// The list of Navisworks items to convert. + /// Information about the send operation. + /// Progress reporting callback. + /// Token to cancel the operation. + /// A result containing the root collection and conversion results. + /// Thrown when no objects can be converted. + public async Task BuildAsync( IReadOnlyList navisworksModelItems, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken cancellationToken = default + CancellationToken cancellationToken ) { +#if DEBUG + // This is a temporary workaround to disable node merging for debugging purposes - false is default, true is for debugging + SkipNodeMerging = false; +#endif using var activity = activityFactory.Start("Build"); - // 1. Validate input + ValidateInputs(navisworksModelItems, sendInfo, onOperationProgressed); + + // 2. Initialize root collection + var rootCollection = InitializeRootCollection(); + + // 3. Convert all model items and store results + var (convertedElements, conversionResults) = await ConvertModelItemsAsync( + navisworksModelItems, + sendInfo, + onOperationProgressed, + cancellationToken + ); + + ValidateConversionResults(conversionResults); + + var groupedNodes = SkipNodeMerging ? [] : GroupSiblingGeometryNodes(navisworksModelItems); + var finalElements = BuildFinalElements(convertedElements, groupedNodes); + + await AddProxiesToCollection(rootCollection, navisworksModelItems, groupedNodes); + + rootCollection.elements = finalElements; + return new RootObjectBuilderResult(rootCollection, conversionResults); + } + + private static void ValidateInputs( + IReadOnlyList navisworksModelItems, + SendInfo sendInfo, + IProgress onOperationProgressed + ) + { if (!navisworksModelItems.Any()) { throw new SpeckleException("No objects to convert"); } - // 2. Initialize root collection - var rootObjectCollection = new Collection - { - name = NavisworksApp.ActiveDocument.Title ?? "Unnamed model", - ["units"] = converterSettings.Current.Derived.SpeckleUnits - }; - - // 3. Convert all model items and store results if (navisworksModelItems == null) { throw new ArgumentNullException(nameof(navisworksModelItems)); } - List results = new(navisworksModelItems.Count); - var convertedBases = new Dictionary(); - int processedCount = 0; - int totalCount = navisworksModelItems.Count; - if (onOperationProgressed == null || sendInfo == null) { - throw new ArgumentNullException(nameof(onOperationProgressed)); + throw new ArgumentNullException(onOperationProgressed == null ? nameof(onOperationProgressed) : nameof(sendInfo)); } + } + + private Collection InitializeRootCollection() => + new() + { + name = NavisworksApp.ActiveDocument.Title ?? "Unnamed model", + ["units"] = converterSettings.Current.Derived.SpeckleUnits + }; + + private Task<(Dictionary converted, List results)> ConvertModelItemsAsync( + IReadOnlyList navisworksModelItems, + SendInfo sendInfo, + IProgress onOperationProgressed, + CancellationToken cancellationToken + ) + { + var results = new List(navisworksModelItems.Count); + var convertedBases = new Dictionary(); + int processedCount = 0; + int totalCount = navisworksModelItems.Count; foreach (var item in navisworksModelItems) { @@ -75,85 +127,143 @@ public Task Build( onOperationProgressed.Report(new CardProgress("Converting", (double)processedCount / totalCount)); } + return Task.FromResult((convertedBases, results)); + } + + private static void ValidateConversionResults(List results) + { if (results.All(x => x.Status == Status.ERROR)) { - throw new SpeckleException("Failed to convert all objects."); // fail fast instead creating empty commit! It will appear as model card error with red color. + throw new SpeckleException("Failed to convert all objects."); } + } - // 4. Initialize final elements list and group nodes + private List BuildFinalElements( + Dictionary convertedBases, + Dictionary> groupedNodes + ) + { var finalElements = new List(); - var groupedNodes = GroupSiblingGeometryNodes(navisworksModelItems); var processedPaths = new HashSet(); - // 5. Process and merge grouped nodes + AddGroupedElements(finalElements, convertedBases, groupedNodes, processedPaths); + AddRemainingElements(finalElements, convertedBases, processedPaths); + + return finalElements; + } + + private void AddGroupedElements( + List finalElements, + Dictionary convertedBases, + Dictionary> groupedNodes, + HashSet processedPaths + ) + { foreach (var group in groupedNodes) { var siblingBases = new List(); foreach (var itemPath in group.Value.Select(elementSelectionService.GetModelItemPath)) { processedPaths.Add(itemPath); - if (convertedBases.TryGetValue(itemPath, out var convertedBase) && convertedBase != null) { siblingBases.Add(convertedBase); } } - if (siblingBases.Count == 0) + if (siblingBases.Count > 0) { - continue; + finalElements.Add(CreateNavisworksObject(group.Key, siblingBases)); } - - var navisworksObject = new NavisworksObject - { - name = elementSelectionService.GetModelItemFromPath(group.Key).DisplayName ?? string.Empty, - displayValue = siblingBases.SelectMany(b => b["displayValue"] as List ?? []).ToList(), - properties = siblingBases.First()["properties"] as Dictionary ?? [], - units = converterSettings.Current.Derived.SpeckleUnits, - applicationId = group.Key - }; - - finalElements.Add(navisworksObject); } + } - // 6. Add remaining non-grouped nodes - foreach (var result in results.Where(result => !processedPaths.Contains(result.SourceId))) + private void AddRemainingElements( + List finalElements, + Dictionary convertedBases, + HashSet processedPaths + ) + { + foreach (var kvp in convertedBases.Where(kvp => !processedPaths.Contains(kvp.Key))) { - if (!convertedBases.TryGetValue(result.SourceId, out var convertedBase) || convertedBase == null) + switch (kvp.Value) { - continue; + case null: + continue; + case Collection collection: + finalElements.Add(collection); + break; + default: + finalElements.Add(CreateNavisworksObject(kvp.Value)); + break; } - // TODO: check if converted base is a collection when full tree sending is implemented + } + } - if (convertedBase is Collection convertedCollection) - { - finalElements.Add(convertedCollection); - } - else - { - var navisworksObject = new NavisworksObject - { - name = convertedBase["name"] as string ?? string.Empty, - displayValue = convertedBase["displayValue"] as List ?? [], - properties = convertedBase["properties"] as Dictionary ?? [], - units = converterSettings.Current.Derived.SpeckleUnits, - applicationId = convertedBase.applicationId - }; - finalElements.Add(navisworksObject); - } + /// + /// Processes and adds any remaining non-grouped elements. + /// + /// + /// Handles both Collection and Base type elements differently. + /// Only processes elements that weren't handled in grouped processing. + /// + private NavisworksObject CreateNavisworksObject(string groupKey, List siblingBases) => + new() + { + name = elementSelectionService.GetModelItemFromPath(groupKey).DisplayName ?? string.Empty, + displayValue = siblingBases.SelectMany(b => b["displayValue"] as List ?? []).ToList(), + properties = siblingBases.First()["properties"] as Dictionary ?? [], + units = converterSettings.Current.Derived.SpeckleUnits, + applicationId = groupKey + }; + + /// + /// Creates a NavisworksObject from a single converted base. + /// + /// The converted Speckle Base object. + /// A new NavisworksObject containing the converted data. + private NavisworksObject CreateNavisworksObject(Base convertedBase) => + new() + { + name = convertedBase["name"] as string ?? string.Empty, + displayValue = convertedBase["displayValue"] as List ?? [], + properties = convertedBase["properties"] as Dictionary ?? [], + units = converterSettings.Current.Derived.SpeckleUnits, + applicationId = convertedBase.applicationId + }; + + private Task AddProxiesToCollection( + Collection rootCollection, + IReadOnlyList navisworksModelItems, + Dictionary> groupedNodes + ) + { + using var _ = activityFactory.Start("UnpackProxies"); + + var renderMaterials = materialUnpacker.UnpackRenderMaterial(navisworksModelItems, groupedNodes); + if (renderMaterials.Count > 0) + { + rootCollection[ProxyKeys.RENDER_MATERIAL] = renderMaterials; } - using (var _ = activityFactory.Start("UnpackRenderMaterials")) + var colors = colorUnpacker.UnpackColor(navisworksModelItems, groupedNodes); + if (colors.Count > 0) { - // 7. - Unpack the render material proxies - rootObjectCollection[ProxyKeys.RENDER_MATERIAL] = materialUnpacker.UnpackRenderMaterial(navisworksModelItems); + rootCollection[ProxyKeys.COLOR] = colors; } - // 8. Finalize and return - rootObjectCollection.elements = finalElements; - return Task.FromResult(new RootObjectBuilderResult(rootObjectCollection, results)); + return Task.CompletedTask; } + /// + /// Converts a single Navisworks item to a Speckle object. + /// + /// + /// Attempts to retrieve from cache first. + /// Falls back to fresh conversion if not cached. + /// Logs errors but doesn't throw exceptions. + /// + /// A SendConversionResult indicating success or failure. private SendConversionResult ConvertNavisworksItem( NAV.ModelItem navisworksItem, Dictionary convertedBases, diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs index d6022ca75..a06842db6 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Plugin/DockableConnectorPane.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.DependencyInjection; using Speckle.Connector.Navisworks.DependencyInjection; using Speckle.Connectors.Common; -using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.WebView; using Speckle.Converter.Navisworks.DependencyInjection; using Speckle.Sdk.Host; @@ -33,6 +32,8 @@ internal sealed class Connector : NAV.Plugins.DockPanePlugin public override Control CreateControlPane() { + AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.OnAssemblyResolve; + var services = new ServiceCollection(); services.Initialize(HostApplications.Navisworks, HostAppVersion.v2024); @@ -42,8 +43,6 @@ public override Control CreateControlPane() Container = services.BuildServiceProvider(); - Container.UseDUI(); - var u = Container.GetRequiredService(); var speckleHost = new ElementHost { AutoSize = true, Child = u }; diff --git a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Speckle.Connectors.NavisworksShared.projitems b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Speckle.Connectors.NavisworksShared.projitems index 099d2c611..cd6db0018 100644 --- a/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Speckle.Connectors.NavisworksShared.projitems +++ b/Connectors/Navisworks/Speckle.Connectors.NavisworksShared/Speckle.Connectors.NavisworksShared.projitems @@ -15,6 +15,7 @@ + @@ -54,7 +55,4 @@ Always - - - \ No newline at end of file diff --git a/Connectors/Revit/Directory.Build.targets b/Connectors/Revit/Directory.Build.targets new file mode 100644 index 000000000..9b8142c9b --- /dev/null +++ b/Connectors/Revit/Directory.Build.targets @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/Connectors/Revit/Speckle.Connectors.Revit2022/packages.lock.json b/Connectors/Revit/Speckle.Connectors.Revit2022/packages.lock.json index f3829b4d2..f9871f8ae 100644 --- a/Connectors/Revit/Speckle.Connectors.Revit2022/packages.lock.json +++ b/Connectors/Revit/Speckle.Connectors.Revit2022/packages.lock.json @@ -292,9 +292,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -302,9 +302,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -314,7 +313,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.revit2022": { @@ -353,11 +352,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Revit.API": { @@ -368,9 +367,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -380,20 +379,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json b/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json index d48c21422..b7d2e4e92 100644 --- a/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json +++ b/Connectors/Revit/Speckle.Connectors.Revit2023/packages.lock.json @@ -292,9 +292,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -302,9 +302,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -314,7 +313,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.revit2023": { @@ -353,11 +352,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Revit.API": { @@ -368,9 +367,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -380,20 +379,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Revit/Speckle.Connectors.Revit2024/packages.lock.json b/Connectors/Revit/Speckle.Connectors.Revit2024/packages.lock.json index fed121036..faff91d90 100644 --- a/Connectors/Revit/Speckle.Connectors.Revit2024/packages.lock.json +++ b/Connectors/Revit/Speckle.Connectors.Revit2024/packages.lock.json @@ -292,9 +292,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -302,9 +302,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -314,7 +313,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.revit2024": { @@ -353,11 +352,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Revit.API": { @@ -368,9 +367,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -380,20 +379,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Revit/Speckle.Connectors.Revit2025/packages.lock.json b/Connectors/Revit/Speckle.Connectors.Revit2025/packages.lock.json index fe3a40a99..9ad9ee9e3 100644 --- a/Connectors/Revit/Speckle.Connectors.Revit2025/packages.lock.json +++ b/Connectors/Revit/Speckle.Connectors.Revit2025/packages.lock.json @@ -242,9 +242,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -252,9 +252,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -264,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.revit2025": { @@ -303,11 +302,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Revit.API": { @@ -318,9 +317,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -329,20 +328,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, "net8.0-windows7.0/win-x64": { diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared.Cef/CefSharpPanel.xaml.cs b/Connectors/Revit/Speckle.Connectors.RevitShared.Cef/CefSharpPanel.xaml.cs index ae78681ed..98e98c88f 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared.Cef/CefSharpPanel.xaml.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared.Cef/CefSharpPanel.xaml.cs @@ -13,15 +13,9 @@ public CefSharpPanel() InitializeComponent(); } - public Task ExecuteScriptAsyncMethod(string script, CancellationToken cancellationToken) + public void ExecuteScript(string script) { - Browser.Dispatcher.Invoke( - () => Browser.ExecuteScriptAsync(script), - DispatcherPriority.Background, - cancellationToken - ); - - return Task.CompletedTask; + Browser.Dispatcher.Invoke(() => Browser.ExecuteScriptAsync(script), DispatcherPriority.Background); } public bool IsBrowserInitialized => Browser.IsBrowserInitialized; diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs index 49f973536..c4ce8e66c 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/BasicConnectorBindingRevit.cs @@ -1,9 +1,7 @@ using Autodesk.Revit.DB; -using Revit.Async; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; using Speckle.Connectors.DUI.Models.Card; -using Speckle.Connectors.Revit.HostApp; using Speckle.Connectors.RevitShared; using Speckle.Connectors.RevitShared.Operations.Send.Filters; using Speckle.Converters.RevitShared.Helpers; @@ -20,13 +18,11 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding public BasicConnectorBindingCommands Commands { get; } - private readonly APIContext _apiContext; private readonly DocumentModelStore _store; private readonly RevitContext _revitContext; private readonly ISpeckleApplication _speckleApplication; public BasicConnectorBindingRevit( - APIContext apiContext, DocumentModelStore store, IBrowserBridge parent, RevitContext revitContext, @@ -35,7 +31,6 @@ ISpeckleApplication speckleApplication { Name = "baseBinding"; Parent = parent; - _apiContext = apiContext; _store = store; _revitContext = revitContext; _speckleApplication = speckleApplication; @@ -45,7 +40,7 @@ ISpeckleApplication speckleApplication _store.DocumentChanged += (_, _) => parent.TopLevelExceptionHandler.FireAndForget(async () => { - await Commands.NotifyDocumentChanged().ConfigureAwait(false); + await Commands.NotifyDocumentChanged(); }); } @@ -97,21 +92,16 @@ public async Task HighlightModel(string modelCardId) { if (senderModelCard.SendFilter is IRevitSendFilter revitFilter) { - revitFilter.SetContext(_revitContext, _apiContext); + revitFilter.SetContext(_revitContext); } if (senderModelCard.SendFilter is RevitViewsFilter revitViewsFilter) { - await _apiContext - .Run(() => - { - var view = revitViewsFilter.GetView(); - if (view is not null) - { - _revitContext.UIApplication.ActiveUIDocument.ActiveView = view; - } - }) - .ConfigureAwait(false); + var view = revitViewsFilter.GetView(); + if (view is not null) + { + _revitContext.UIApplication.ActiveUIDocument.ActiveView = view; + } return; } @@ -136,51 +126,42 @@ await _apiContext if (elementIds.Count == 0) { - await Commands - .SetModelError(modelCardId, new InvalidOperationException("No objects found to highlight.")) - .ConfigureAwait(false); + await Commands.SetModelError(modelCardId, new InvalidOperationException("No objects found to highlight.")); return; } - await HighlightObjectsOnView(elementIds).ConfigureAwait(false); + HighlightObjectsOnView(elementIds); } /// /// Highlights the objects from the given ids. /// /// UniqueId's of the DB.Elements. - public async Task HighlightObjects(IReadOnlyList objectIds) + public Task HighlightObjects(IReadOnlyList objectIds) { var activeUIDoc = _revitContext.UIApplication?.ActiveUIDocument ?? throw new SpeckleException("Unable to retrieve active UI document"); - await HighlightObjectsOnView( - objectIds - .Select(uid => ElementIdHelper.GetElementIdFromUniqueId(activeUIDoc.Document, uid)) - .Where(el => el is not null) - .Cast() - .ToList() - ) - .ConfigureAwait(false); - ; + HighlightObjectsOnView( + objectIds + .Select(uid => ElementIdHelper.GetElementIdFromUniqueId(activeUIDoc.Document, uid)) + .Where(el => el is not null) + .Cast() + .ToList() + ); + return Task.CompletedTask; } - private async Task HighlightObjectsOnView(List objectIds) + private void HighlightObjectsOnView(List objectIds) { // POC: don't know if we can rely on storing the ActiveUIDocument, hence getting it each time var activeUIDoc = _revitContext.UIApplication?.ActiveUIDocument ?? throw new SpeckleException("Unable to retrieve active UI document"); - // UiDocument operations should be wrapped into RevitTask, otherwise doesn't work on other tasks. - await RevitTask - .RunAsync(() => - { - activeUIDoc.Selection.SetElementIds(objectIds); - activeUIDoc.ShowElements(objectIds); - }) - .ConfigureAwait(false); + activeUIDoc.Selection.SetElementIds(objectIds); + activeUIDoc.ShowElements(objectIds); ; } } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitReceiveBinding.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitReceiveBinding.cs index 2abd95945..1f52cd26d 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitReceiveBinding.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitReceiveBinding.cs @@ -83,13 +83,14 @@ public async Task Receive(string modelCardId) modelCard.GetReceiveInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); modelCard.BakedObjectIds = conversionResults.BakedObjectIds.ToList(); - await Commands - .SetModelReceiveResult(modelCardId, conversionResults.BakedObjectIds, conversionResults.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelReceiveResult( + modelCardId, + conversionResults.BakedObjectIds, + conversionResults.ConversionResults + ); } catch (OperationCanceledException) { @@ -100,7 +101,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } finally { diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs index c491b7fac..27cb51e56 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/RevitSendBinding.cs @@ -16,7 +16,6 @@ using Speckle.Connectors.DUI.Settings; using Speckle.Connectors.Revit.HostApp; using Speckle.Connectors.Revit.Operations.Send.Settings; -using Speckle.Connectors.Revit.Plugin; using Speckle.Connectors.RevitShared.Operations.Send.Filters; using Speckle.Converters.Common; using Speckle.Converters.RevitShared.Helpers; @@ -28,8 +27,7 @@ namespace Speckle.Connectors.Revit.Bindings; internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding { - private readonly IRevitIdleManager _idleManager; - private readonly APIContext _apiContext; + private readonly IAppIdleManager _idleManager; private readonly CancellationManager _cancellationManager; private readonly IServiceProvider _serviceProvider; private readonly ISendConversionCache _sendConversionCache; @@ -49,9 +47,8 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding private ConcurrentDictionary ChangedObjectIds { get; set; } = new(); public RevitSendBinding( - IRevitIdleManager idleManager, + IAppIdleManager idleManager, RevitContext revitContext, - APIContext apiContext, DocumentModelStore store, CancellationManager cancellationManager, IBrowserBridge bridge, @@ -67,7 +64,6 @@ ISpeckleApplication speckleApplication : base("sendBinding", store, bridge, revitContext) { _idleManager = idleManager; - _apiContext = apiContext; _cancellationManager = cancellationManager; _serviceProvider = serviceProvider; _sendConversionCache = sendConversionCache; @@ -82,20 +78,17 @@ ISpeckleApplication speckleApplication Commands = new SendBindingUICommands(bridge); // TODO expiry events // TODO filters need refresh events - _idleManager.RunAsync(() => - { - revitContext.UIApplication.NotNull().Application.DocumentChanged += (_, e) => - topLevelExceptionHandler.CatchUnhandled(() => DocChangeHandler(e)); - }); - Store.DocumentChanged += (_, _) => - topLevelExceptionHandler.FireAndForget(async () => await OnDocumentChanged().ConfigureAwait(false)); + + revitContext.UIApplication.NotNull().Application.DocumentChanged += (_, e) => + topLevelExceptionHandler.CatchUnhandled(() => DocChangeHandler(e)); + Store.DocumentChanged += (_, _) => topLevelExceptionHandler.FireAndForget(async () => await OnDocumentChanged()); } public List GetSendFilters() => [ new RevitSelectionFilter() { IsDefault = true }, - new RevitViewsFilter(RevitContext, _apiContext), - new RevitCategoriesFilter(RevitContext, _apiContext) + new RevitViewsFilter(RevitContext), + new RevitCategoriesFilter(RevitContext) ]; public List GetSendSettings() => @@ -133,7 +126,7 @@ public async Task Send(string modelCardId) ) ); - List elements = await RefreshElementsOnSender(modelCard.NotNull()).ConfigureAwait(false); + List elements = await RefreshElementsOnSender(modelCard.NotNull()); List elementIds = elements.Select(el => el.Id).ToList(); if (elementIds.Count == 0) @@ -149,12 +142,9 @@ public async Task Send(string modelCardId) modelCard.GetSendInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -165,7 +155,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } finally { @@ -182,12 +172,10 @@ private async Task> RefreshElementsOnSender(SenderModelCard modelC if (modelCard.SendFilter is IRevitSendFilter viewFilter) { - viewFilter.SetContext(RevitContext, _apiContext); + viewFilter.SetContext(RevitContext); } - var selectedObjects = await _apiContext - .Run(_ => modelCard.SendFilter.NotNull().RefreshObjectIds()) - .ConfigureAwait(false); + var selectedObjects = modelCard.SendFilter.NotNull().RefreshObjectIds(); List elements = selectedObjects .Select(uid => activeUIDoc.Document.GetElement(uid)) @@ -204,9 +192,11 @@ private async Task> RefreshElementsOnSender(SenderModelCard modelC } // 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, newSelectedObjectIds) - .ConfigureAwait(false); + await Commands.SetFilterObjectIds( + modelCard.ModelCardId.NotNull(), + modelCard.SendFilter.IdMap, + newSelectedObjectIds + ); } return elements; @@ -315,7 +305,7 @@ private async Task PostSetObjectIds() { foreach (var sender in Store.GetSenders().ToList()) { - await RefreshElementsOnSender(sender).ConfigureAwait(false); + await RefreshElementsOnSender(sender); } } @@ -330,12 +320,12 @@ private async Task CheckFilterExpiration() // var intersection = ChangedObjectIds.Keys.Intersect(views).ToList(); // if (intersection.Count != 0) // { - // await Commands.RefreshSendFilters().ConfigureAwait(false); + // await Commands.RefreshSendFilters(); // } if (ChangedObjectIds.Keys.Any(e => RevitContext.UIApplication?.ActiveUIDocument.Document.GetElement(e) is View)) { - await Commands.RefreshSendFilters().ConfigureAwait(false); + await Commands.RefreshSendFilters(); } } @@ -394,7 +384,7 @@ private async Task RunExpirationChecks() { if (modelCard.SendFilter is IRevitSendFilter viewFilter) { - viewFilter.SetContext(RevitContext, _apiContext); + viewFilter.SetContext(RevitContext); } var selectedObjects = modelCard.SendFilter.NotNull().IdMap.NotNull().Values; @@ -406,7 +396,7 @@ private async Task RunExpirationChecks() } } - await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false); + await Commands.SetModelsExpired(expiredSenderIds); ChangedObjectIds = new(); } @@ -419,13 +409,11 @@ private async Task OnDocumentChanged() if (_cancellationManager.NumberOfOperations > 0) { _cancellationManager.CancelAllOperations(); - await Commands - .SetGlobalNotification( - ToastNotificationType.INFO, - "Document Switch", - "Operations cancelled because of document swap!" - ) - .ConfigureAwait(false); + await Commands.SetGlobalNotification( + ToastNotificationType.INFO, + "Document Switch", + "Operations cancelled because of document swap!" + ); } } } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/SelectionBinding.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/SelectionBinding.cs index 174131ee2..eabb03f7f 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/SelectionBinding.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Bindings/SelectionBinding.cs @@ -1,7 +1,6 @@ using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; -using Speckle.Connectors.Revit.Plugin; using Speckle.Converters.RevitShared.Helpers; using Speckle.Sdk.Common; @@ -17,7 +16,7 @@ internal sealed class SelectionBinding : RevitBaseBinding, ISelectionBinding, ID public SelectionBinding( RevitContext revitContext, DocumentModelStore store, - IRevitIdleManager revitIdleManager, + IAppIdleManager revitIdleManager, IBrowserBridge parent ) : base("selectionBinding", store, parent, revitContext) @@ -28,11 +27,9 @@ IBrowserBridge parent _selectionTimer.Elapsed += (_, _) => parent.TopLevelExceptionHandler.CatchUnhandled(OnSelectionChanged); _selectionTimer.Start(); #else - revitIdleManager.RunAsync(() => - { - RevitContext.UIApplication.NotNull().SelectionChanged += (_, _) => - revitIdleManager.SubscribeToIdle(nameof(SelectionBinding), OnSelectionChanged); - }); + + RevitContext.UIApplication.NotNull().SelectionChanged += (_, _) => + revitIdleManager.SubscribeToIdle(nameof(SelectionBinding), OnSelectionChanged); #endif } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/DependencyInjection/RevitConnectorModule.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/DependencyInjection/RevitConnectorModule.cs index 8302eb18f..b719cc2d4 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/DependencyInjection/RevitConnectorModule.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/DependencyInjection/RevitConnectorModule.cs @@ -25,7 +25,7 @@ public static class ServiceRegistration public static void AddRevit(this IServiceCollection serviceCollection) { serviceCollection.AddConnectorUtils(); - serviceCollection.AddDUI(); + serviceCollection.AddDUI(); RegisterUiDependencies(serviceCollection); // Storage Schema @@ -41,7 +41,7 @@ public static void AddRevit(this IServiceCollection serviceCollection) serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); - serviceCollection.AddSingleton(); + serviceCollection.AddSingleton(); serviceCollection.RegisterTopLevelExceptionHandler(); @@ -69,9 +69,6 @@ public static void AddRevit(this IServiceCollection serviceCollection) // operation progress manager serviceCollection.AddSingleton(); - - // API context helps us to run functions on Revit UI Thread (main) - serviceCollection.AddSingleton(); } public static void RegisterUiDependencies(IServiceCollection serviceCollection) diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/APIContext.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/APIContext.cs deleted file mode 100644 index 5260d0933..000000000 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/APIContext.cs +++ /dev/null @@ -1,130 +0,0 @@ -using Autodesk.Revit.UI; - -namespace Speckle.Connectors.Revit.HostApp; - -/// -/// This class gives access to the Revit API context from anywhere in your codebase. This is essentially a -/// lite version of the Revit.Async package from Kennan Chan. Most of the functionality was taken from that code. -/// The main difference is that this class does not subscribe to the applicationIdling event from revit -/// which the docs say will impact the performance of Revit -/// -public sealed class APIContext : IDisposable -{ - private readonly SemaphoreSlim _semaphore = new(1, 1); - private readonly UIControlledApplication _uiApplication; - private readonly ExternalEventHandler _factoryExternalEventHandler; -#pragma warning disable CA2213 - private readonly ExternalEvent _factoryExternalEvent; -#pragma warning restore CA2213 - - public APIContext(UIControlledApplication application) - { - _uiApplication = application; - _factoryExternalEventHandler = new(ExternalEvent.Create); - _factoryExternalEvent = ExternalEvent.Create(_factoryExternalEventHandler); - } - - public async Task Run(Func func) - { - await _semaphore.WaitAsync().ConfigureAwait(false); - try - { - var handler = new ExternalEventHandler(func); - using var externalEvent = await Run(_factoryExternalEventHandler, handler, _factoryExternalEvent) - .ConfigureAwait(false); - - return await Run(handler, _uiApplication, externalEvent).ConfigureAwait(false); - } - finally - { - _semaphore.Release(); - } - } - - public async Task Run(Action action) => - await Run(app => - { - action(app); - return null!; - }) - .ConfigureAwait(false); - - public async Task Run(Action action) => - await Run(_ => - { - action(); - return null!; - }) - .ConfigureAwait(false); - - private async Task Run( - ExternalEventHandler handler, - TParameter parameter, - ExternalEvent externalEvent - ) - { - var task = handler.GetTask(parameter); - externalEvent.Raise(); - - return await task.ConfigureAwait(false); - } - - public void Dispose() - { - _factoryExternalEvent.Dispose(); - _semaphore.Dispose(); - } -} - -public enum HandlerStatus -{ - NotStarted, - Started, - IsCompleted, - IsFaulted, -} - -internal sealed class ExternalEventHandler : IExternalEventHandler -{ - private TaskCompletionSource Result { get; set; } - - public Task GetTask(TParameter parameter) - { - Parameter = parameter; - Result = new TaskCompletionSource(); - return Result.Task; - } - - private readonly Func _func; - - public ExternalEventHandler(Func func) - { - this._func = func; - } - - public HandlerStatus Status { get; private set; } = HandlerStatus.NotStarted; - private TParameter Parameter { get; set; } - - [System.Diagnostics.CodeAnalysis.SuppressMessage( - "Design", - "CA1031:Do not catch general exception types", - Justification = "This is a very generic utility method for running things in a Revit context. If the result of the Run method is awaited, then the exception caught here will be raised there." - )] - public void Execute(UIApplication app) - { - Status = HandlerStatus.Started; - try - { - var r = _func(Parameter); - Result.SetResult(r); - Status = HandlerStatus.IsCompleted; - } - catch (Exception ex) - { - Status = HandlerStatus.IsFaulted; - Result.SetException(ex); - } - } - - public string GetName() => "SpeckleRevitContextEventHandler"; -} diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs index bc3304998..b30ec74b0 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/ElementUnpacker.cs @@ -31,7 +31,8 @@ public IEnumerable UnpackSelectionForConversion(IEnumerable se // Step 2: pack curtain wall elements, once we know the full extent of our flattened item list. // The behaviour we're looking for: // If parent wall is part of selection, does not select individual elements out. Otherwise, selects individual elements (Panels, Mullions) as atomic objects. - return PackCurtainWallElements(atomicObjects); + // NOTE: this also conditionally "packs" stacked wall elements if their parent is present. See detailed note inside the function. + return PackCurtainWallElementsAndStackedWalls(atomicObjects); } /// @@ -90,7 +91,7 @@ private List UnpackElements(IEnumerable elements) return unpackedElements.GroupBy(el => el.Id).Select(g => g.First()).ToList(); // no disinctBy in here sadly. } - private List PackCurtainWallElements(List elements) + private List PackCurtainWallElementsAndStackedWalls(List elements) { var ids = elements.Select(el => el.Id).ToArray(); var doc = _revitContext.UIApplication?.ActiveUIDocument.Document!; @@ -102,6 +103,12 @@ private List PackCurtainWallElements(List elements) && doc.GetElement(f.Host.Id) is Wall { CurtainGrid: not null } && ids.Contains(f.Host.Id) ) + // NOTE: It is required to explicitly skip stacked wall members because, when getting objects from a view, + // the api will return the wall parent and its stacked children walls separately. This does not happen + // via selection. Via category ("Walls") we do not get any parent wall, but just the components of the stacked wall separately. + // If you wonder why revit is driving people to insanity, this is one of those moments. + // See [CNX-851: Stacked Wall Duplicate Geometry or Materials not applied](https://linear.app/speckle/issue/CNX-851/stacked-wall-duplicate-geometry-or-materials-not-applied) + || (element is Wall { IsStackedWallMember: true } wall && ids.Contains(wall.StackedWallOwnerId)) ); return elements; } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/RevitDocumentStore.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/RevitDocumentStore.cs index d3254822e..5b8629853 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/RevitDocumentStore.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/RevitDocumentStore.cs @@ -2,11 +2,9 @@ using Autodesk.Revit.DB.ExtensibleStorage; using Autodesk.Revit.UI; using Autodesk.Revit.UI.Events; -using Revit.Async; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; using Speckle.Connectors.DUI.Utils; -using Speckle.Connectors.Revit.Plugin; using Speckle.Converters.RevitShared.Helpers; using Speckle.Sdk.Common; @@ -19,12 +17,12 @@ internal sealed class RevitDocumentStore : DocumentModelStore private static readonly Guid s_revitDocumentStoreId = new("D35B3695-EDC9-4E15-B62A-D3FC2CB83FA3"); private readonly RevitContext _revitContext; - private readonly IRevitIdleManager _idleManager; + private readonly IAppIdleManager _idleManager; private readonly DocumentModelStorageSchema _documentModelStorageSchema; private readonly IdStorageSchema _idStorageSchema; public RevitDocumentStore( - IRevitIdleManager idleManager, + IAppIdleManager idleManager, RevitContext revitContext, IJsonSerializer jsonSerializer, DocumentModelStorageSchema documentModelStorageSchema, @@ -38,18 +36,15 @@ ITopLevelExceptionHandler topLevelExceptionHandler _documentModelStorageSchema = documentModelStorageSchema; _idStorageSchema = idStorageSchema; - _idleManager.RunAsync(() => - { - UIApplication uiApplication = _revitContext.UIApplication.NotNull(); + UIApplication uiApplication = _revitContext.UIApplication.NotNull(); - uiApplication.ViewActivated += (s, e) => topLevelExceptionHandler.CatchUnhandled(() => OnViewActivated(s, e)); + uiApplication.ViewActivated += (s, e) => topLevelExceptionHandler.CatchUnhandled(() => OnViewActivated(s, e)); - uiApplication.Application.DocumentOpening += (_, _) => - topLevelExceptionHandler.CatchUnhandled(() => IsDocumentInit = false); + uiApplication.Application.DocumentOpening += (_, _) => + topLevelExceptionHandler.CatchUnhandled(() => IsDocumentInit = false); - uiApplication.Application.DocumentOpened += (_, _) => - topLevelExceptionHandler.CatchUnhandled(() => IsDocumentInit = false); - }); + uiApplication.Application.DocumentOpened += (_, _) => + topLevelExceptionHandler.CatchUnhandled(() => IsDocumentInit = false); // There is no event that we can hook here for double-click file open... // It is kind of harmless since we create this object as "SingleInstance". @@ -92,23 +87,21 @@ protected override void HostAppSaveState(string modelCardState) { return; } - RevitTask.RunAsync(() => - { - var doc = (_revitContext.UIApplication?.ActiveUIDocument?.Document).NotNull(); - using Transaction t = new(doc, "Speckle Write State"); - t.Start(); - using DataStorage ds = GetSettingsDataStorage(doc) ?? DataStorage.Create(doc); - using Entity stateEntity = new(_documentModelStorageSchema.GetSchema()); - stateEntity.Set("contents", modelCardState); + using Transaction t = new(doc, "Speckle Write State"); + t.Start(); + using DataStorage ds = GetSettingsDataStorage(doc) ?? DataStorage.Create(doc); + + using Entity stateEntity = new(_documentModelStorageSchema.GetSchema()); + string serializedModels = Serialize(); + stateEntity.Set("contents", serializedModels); - using Entity idEntity = new(_idStorageSchema.GetSchema()); - idEntity.Set("Id", s_revitDocumentStoreId); + using Entity idEntity = new(_idStorageSchema.GetSchema()); + idEntity.Set("Id", s_revitDocumentStoreId); - ds.SetEntity(idEntity); - ds.SetEntity(stateEntity); - t.Commit(); - }); + ds.SetEntity(idEntity); + ds.SetEntity(stateEntity); + t.Commit(); } protected override void LoadState() diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/SupportedCategoriesUtils.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/SupportedCategoriesUtils.cs new file mode 100644 index 000000000..192952c8a --- /dev/null +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/HostApp/SupportedCategoriesUtils.cs @@ -0,0 +1,29 @@ +using Autodesk.Revit.DB; + +namespace Speckle.Connectors.Revit.HostApp; + +public static class SupportedCategoriesUtils +{ + /// + /// Filters out all categories besides Model categories. This utility should be used + /// to clean any elements we might want to send pre-conversion as well as in what categories + /// to display in our category filter. + /// + /// + /// + public static bool IsSupportedCategory(Category category) + { + return ( + category.CategoryType == CategoryType.Model + // || category.CategoryType == CategoryType.AnalyticalModel + ) +#if REVIT_2023_OR_GREATER + && category.BuiltInCategory != BuiltInCategory.OST_AreaSchemes + && category.BuiltInCategory != BuiltInCategory.OST_AreaSchemeLines +#else + && category.Name != "OST_AreaSchemeLines" + && category.Name != "OST_AreaSchemes" +#endif + && category.IsVisibleInUI; + } +} diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Receive/RevitHostObjectBuilder.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Receive/RevitHostObjectBuilder.cs index a0acbddfc..59ba3a395 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Receive/RevitHostObjectBuilder.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Receive/RevitHostObjectBuilder.cs @@ -1,6 +1,5 @@ using Autodesk.Revit.DB; using Microsoft.Extensions.Logging; -using Revit.Async; using Speckle.Connectors.Common.Builders; using Speckle.Connectors.Common.Conversion; using Speckle.Connectors.Common.Instances; @@ -24,64 +23,24 @@ namespace Speckle.Connectors.Revit.Operations.Receive; -internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable -{ - private readonly IRootToHostConverter _converter; - private readonly IConverterSettingsStore _converterSettings; - private readonly RevitToHostCacheSingleton _revitToHostCacheSingleton; - private readonly ITransactionManager _transactionManager; - private readonly ILocalToGlobalUnpacker _localToGlobalUnpacker; - private readonly RevitGroupBaker _groupBaker; - private readonly RevitMaterialBaker _materialBaker; - private readonly ILogger _logger; - private readonly ITypedConverter< +public sealed class RevitHostObjectBuilder( + IRootToHostConverter converter, + IConverterSettingsStore converterSettings, + ITransactionManager transactionManager, + ISdkActivityFactory activityFactory, + ILocalToGlobalUnpacker localToGlobalUnpacker, + RevitGroupBaker groupManager, + RevitMaterialBaker materialBaker, + RootObjectUnpacker rootObjectUnpacker, + ILogger logger, + RevitToHostCacheSingleton revitToHostCacheSingleton, + ITypedConverter< (Base atomicObject, IReadOnlyCollection matrix), DirectShape - > _localToGlobalDirectShapeConverter; - - private readonly RootObjectUnpacker _rootObjectUnpacker; - private readonly ISdkActivityFactory _activityFactory; - - public RevitHostObjectBuilder( - IRootToHostConverter converter, - IConverterSettingsStore converterSettings, - ITransactionManager transactionManager, - ISdkActivityFactory activityFactory, - ILocalToGlobalUnpacker localToGlobalUnpacker, - RevitGroupBaker groupManager, - RevitMaterialBaker materialBaker, - RootObjectUnpacker rootObjectUnpacker, - ILogger logger, - RevitToHostCacheSingleton revitToHostCacheSingleton, - ITypedConverter< - (Base atomicObject, IReadOnlyCollection matrix), - DirectShape - > localToGlobalDirectShapeConverter - ) - { - _converter = converter; - _converterSettings = converterSettings; - _transactionManager = transactionManager; - _localToGlobalUnpacker = localToGlobalUnpacker; - _groupBaker = groupManager; - _materialBaker = materialBaker; - _rootObjectUnpacker = rootObjectUnpacker; - _logger = logger; - _revitToHostCacheSingleton = revitToHostCacheSingleton; - _localToGlobalDirectShapeConverter = localToGlobalDirectShapeConverter; - _activityFactory = activityFactory; - } - - public Task Build( - Base rootObject, - string projectName, - string modelName, - IProgress onOperationProgressed, - CancellationToken cancellationToken - ) => - RevitTask.RunAsync(() => BuildSync(rootObject, projectName, modelName, onOperationProgressed, cancellationToken)); - - private HostObjectBuilderResult BuildSync( + > localToGlobalDirectShapeConverter +) : IHostObjectBuilder, IDisposable +{ + public HostObjectBuilderResult Build( Base rootObject, string projectName, string modelName, @@ -92,27 +51,27 @@ CancellationToken cancellationToken var baseGroupName = $"Project {projectName}: Model {modelName}"; // TODO: unify this across connectors! onOperationProgressed.Report(new("Converting", null)); - using var activity = _activityFactory.Start("Build"); + using var activity = activityFactory.Start("Build"); // 0 - Clean then Rock n Roll! 🎸 { - _activityFactory.Start("Pre receive clean"); - _transactionManager.StartTransaction(true, "Pre receive clean"); + activityFactory.Start("Pre receive clean"); + transactionManager.StartTransaction(true, "Pre receive clean"); try { PreReceiveDeepClean(baseGroupName); } catch (Exception ex) when (!ex.IsFatal()) { - _logger.LogError(ex, "Failed to clean up before receive in Revit"); + logger.LogError(ex, "Failed to clean up before receive in Revit"); } - _transactionManager.CommitTransaction(); + transactionManager.CommitTransaction(); } // 1 - Unpack objects and proxies from root commit object - var unpackedRoot = _rootObjectUnpacker.Unpack(rootObject); - var localToGlobalMaps = _localToGlobalUnpacker.Unpack( + var unpackedRoot = rootObjectUnpacker.Unpack(rootObject); + var localToGlobalMaps = localToGlobalUnpacker.Unpack( unpackedRoot.DefinitionProxies, unpackedRoot.ObjectsToConvert.ToList() ); @@ -120,14 +79,14 @@ CancellationToken cancellationToken // 2 - Bake materials if (unpackedRoot.RenderMaterialProxies != null) { - _transactionManager.StartTransaction(true, "Baking materials"); - _materialBaker.MapLayersRenderMaterials(unpackedRoot); - var map = _materialBaker.BakeMaterials(unpackedRoot.RenderMaterialProxies, baseGroupName); + transactionManager.StartTransaction(true, "Baking materials"); + materialBaker.MapLayersRenderMaterials(unpackedRoot); + var map = materialBaker.BakeMaterials(unpackedRoot.RenderMaterialProxies, baseGroupName); foreach (var kvp in map) { - _revitToHostCacheSingleton.MaterialsByObjectId.Add(kvp.Key, kvp.Value); + revitToHostCacheSingleton.MaterialsByObjectId.Add(kvp.Key, kvp.Value); } - _transactionManager.CommitTransaction(); + transactionManager.CommitTransaction(); } // 3 - Bake objects @@ -136,26 +95,26 @@ CancellationToken cancellationToken List<(DirectShape res, string applicationId)> postBakePaintTargets ) conversionResults; { - using var _ = _activityFactory.Start("Baking objects"); - _transactionManager.StartTransaction(true, "Baking objects"); + using var _ = activityFactory.Start("Baking objects"); + transactionManager.StartTransaction(true, "Baking objects"); conversionResults = BakeObjects(localToGlobalMaps, onOperationProgressed, cancellationToken); - _transactionManager.CommitTransaction(); + transactionManager.CommitTransaction(); } // 4 - Paint solids { - using var _ = _activityFactory.Start("Painting solids"); - _transactionManager.StartTransaction(true, "Painting solids"); + using var _ = activityFactory.Start("Painting solids"); + transactionManager.StartTransaction(true, "Painting solids"); PostBakePaint(conversionResults.postBakePaintTargets); - _transactionManager.CommitTransaction(); + transactionManager.CommitTransaction(); } // 5 - Create group { - using var _ = _activityFactory.Start("Grouping"); - _transactionManager.StartTransaction(true, "Grouping"); - _groupBaker.BakeGroupForTopLevel(baseGroupName); - _transactionManager.CommitTransaction(); + using var _ = activityFactory.Start("Grouping"); + transactionManager.StartTransaction(true, "Grouping"); + groupManager.BakeGroupForTopLevel(baseGroupName); + transactionManager.CommitTransaction(); } return conversionResults.builderResult; @@ -170,7 +129,7 @@ CancellationToken cancellationToken CancellationToken cancellationToken ) { - using var _ = _activityFactory.Start("BakeObjects"); + using var _ = activityFactory.Start("BakeObjects"); var conversionResults = new List(); var bakedObjectIds = new List(); int count = 0; @@ -182,7 +141,7 @@ CancellationToken cancellationToken cancellationToken.ThrowIfCancellationRequested(); try { - using var activity = _activityFactory.Start("BakeObject"); + using var activity = activityFactory.Start("BakeObject"); // POC hack of the ages: try to pre transform curves, points and meshes before baking // we need to bypass the local to global converter as there we don't have access to what we want. that service will/should stop existing. @@ -208,17 +167,17 @@ localToGlobalMap.AtomicObject is ITransformable transformable // and ICurve } // actual conversion happens here! - var result = _converter.Convert(localToGlobalMap.AtomicObject); + var result = converter.Convert(localToGlobalMap.AtomicObject); onOperationProgressed.Report(new("Converting", (double)++count / localToGlobalMaps.Count)); if (result is DirectShapeDefinitionWrapper) { // direct shape creation happens here - DirectShape directShapes = _localToGlobalDirectShapeConverter.Convert( + DirectShape directShapes = localToGlobalDirectShapeConverter.Convert( (localToGlobalMap.AtomicObject, localToGlobalMap.Matrix) ); bakedObjectIds.Add(directShapes.UniqueId); - _groupBaker.AddToTopLevelGroup(directShapes); + groupManager.AddToTopLevelGroup(directShapes); if (localToGlobalMap.AtomicObject is IRawEncodedObject and Base myBase) { @@ -237,7 +196,7 @@ localToGlobalMap.AtomicObject is ITransformable transformable // and ICurve catch (Exception ex) when (!ex.IsFatal()) { conversionResults.Add(new(Status.ERROR, localToGlobalMap.AtomicObject, null, null, ex)); - _logger.LogError(ex, $"Failed to convert object of type {localToGlobalMap.AtomicObject.speckle_type}"); + logger.LogError(ex, $"Failed to convert object of type {localToGlobalMap.AtomicObject.speckle_type}"); } } return (new(bakedObjectIds, conversionResults), postBakePaintTargets); @@ -253,7 +212,7 @@ private void PostBakePaint(List<(DirectShape res, string applicationId)> paintTa { var elGeometry = res.get_Geometry(new Options() { DetailLevel = ViewDetailLevel.Undefined }); var materialId = ElementId.InvalidElementId; - if (_revitToHostCacheSingleton.MaterialsByObjectId.TryGetValue(applicationId, out var mappedElementId)) + if (revitToHostCacheSingleton.MaterialsByObjectId.TryGetValue(applicationId, out var mappedElementId)) { materialId = mappedElementId; } @@ -270,7 +229,7 @@ private void PostBakePaint(List<(DirectShape res, string applicationId)> paintTa { foreach (Face face in s.Faces) { - _converterSettings.Current.Document.Paint(res.Id, face, materialId); + converterSettings.Current.Document.Paint(res.Id, face, materialId); } } } @@ -279,12 +238,12 @@ private void PostBakePaint(List<(DirectShape res, string applicationId)> paintTa private void PreReceiveDeepClean(string baseGroupName) { - DirectShapeLibrary.GetDirectShapeLibrary(_converterSettings.Current.Document).Reset(); // Note: this needs to be cleared, as it is being used in the converter + DirectShapeLibrary.GetDirectShapeLibrary(converterSettings.Current.Document).Reset(); // Note: this needs to be cleared, as it is being used in the converter - _revitToHostCacheSingleton.MaterialsByObjectId.Clear(); // Massive hack! - _groupBaker.PurgeGroups(baseGroupName); - _materialBaker.PurgeMaterials(baseGroupName); + revitToHostCacheSingleton.MaterialsByObjectId.Clear(); // Massive hack! + groupManager.PurgeGroups(baseGroupName); + materialBaker.PurgeMaterials(baseGroupName); } - public void Dispose() => _transactionManager?.Dispose(); + public void Dispose() => transactionManager?.Dispose(); } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/IRevitSendFilter.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/IRevitSendFilter.cs index 8895b357b..fe576b8b3 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/IRevitSendFilter.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/IRevitSendFilter.cs @@ -1,9 +1,8 @@ -using Speckle.Connectors.Revit.HostApp; -using Speckle.Converters.RevitShared.Helpers; +using Speckle.Converters.RevitShared.Helpers; namespace Speckle.Connectors.RevitShared.Operations.Send.Filters; public interface IRevitSendFilter { - public void SetContext(RevitContext revitContext, APIContext apiContext); + public void SetContext(RevitContext revitContext); } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitCategoriesFilter.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitCategoriesFilter.cs index b1cd74db7..5a3f9b3ee 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitCategoriesFilter.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitCategoriesFilter.cs @@ -12,7 +12,6 @@ public record CategoryData(string Name, string Id); public class RevitCategoriesFilter : DiscriminatedObject, ISendFilter, IRevitSendFilter { private RevitContext _revitContext; - private APIContext _apiContext; private Document? _doc; public string Id { get; set; } = "revitCategories"; public string Name { get; set; } = "Categories"; @@ -25,10 +24,9 @@ public class RevitCategoriesFilter : DiscriminatedObject, ISendFilter, IRevitSen public RevitCategoriesFilter() { } - public RevitCategoriesFilter(RevitContext revitContext, APIContext apiContext) + public RevitCategoriesFilter(RevitContext revitContext) { _revitContext = revitContext; - _apiContext = apiContext; _doc = _revitContext.UIApplication?.ActiveUIDocument.Document; GetCategories(); @@ -72,7 +70,10 @@ private void GetCategories() foreach (Category category in _doc.Settings.Categories) { - categories.Add(new CategoryData(category.Name, category.Id.ToString())); + if (SupportedCategoriesUtils.IsSupportedCategory(category)) + { + categories.Add(new CategoryData(category.Name, category.Id.ToString())); + } } AvailableCategories = categories; @@ -82,10 +83,9 @@ private void GetCategories() /// NOTE: this is needed since we need doc on `GetObjectIds()` function after it deserialized. /// DI doesn't help here to pass RevitContext from constructor. /// - public void SetContext(RevitContext revitContext, APIContext apiContext) + public void SetContext(RevitContext revitContext) { _revitContext = revitContext; - _apiContext = apiContext; _doc = _revitContext.UIApplication?.ActiveUIDocument.Document; } } 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 d98f46b80..ac54ab0c6 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Filters/RevitViewsFilter.cs @@ -2,7 +2,6 @@ using Speckle.Connectors.DUI.Exceptions; using Speckle.Connectors.DUI.Models.Card.SendFilter; using Speckle.Connectors.DUI.Utils; -using Speckle.Connectors.Revit.HostApp; using Speckle.Converters.RevitShared.Helpers; namespace Speckle.Connectors.RevitShared.Operations.Send.Filters; @@ -10,7 +9,6 @@ namespace Speckle.Connectors.RevitShared.Operations.Send.Filters; public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilter { private RevitContext _revitContext; - private APIContext _apiContext; private Document? _doc; public string Id { get; set; } = "revitViews"; public string Name { get; set; } = "Views"; @@ -23,10 +21,9 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt public RevitViewsFilter() { } - public RevitViewsFilter(RevitContext revitContext, APIContext apiContext) + public RevitViewsFilter(RevitContext revitContext) { _revitContext = revitContext; - _apiContext = apiContext; _doc = _revitContext.UIApplication?.ActiveUIDocument.Document; GetViews(); @@ -91,6 +88,18 @@ private void GetViews() .OfClass(typeof(View)) .Cast() .Where(v => !v.IsTemplate) + .Where(v => !v.IsAssemblyView) + .Where(v => + v.ViewType + is ViewType.FloorPlan + or ViewType.Elevation + or ViewType.Rendering + or ViewType.Section + or ViewType.ThreeD + or ViewType.Detail + or ViewType.CeilingPlan + or ViewType.AreaPlan + ) .Select(v => v.ViewType.ToString() + " - " + v.Name.ToString()) .ToList(); AvailableViews = views; @@ -100,10 +109,9 @@ private void GetViews() /// NOTE: this is needed since we need doc on `GetObjectIds()` function after it deserialized. /// DI doesn't help here to pass RevitContext from constructor. /// - public void SetContext(RevitContext revitContext, APIContext apiContext) + public void SetContext(RevitContext revitContext) { _revitContext = revitContext; - _apiContext = apiContext; _doc = _revitContext.UIApplication?.ActiveUIDocument.Document; } } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/RevitRootObjectBuilder.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/RevitRootObjectBuilder.cs index 2b374c37d..1983ba735 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/RevitRootObjectBuilder.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/RevitRootObjectBuilder.cs @@ -1,6 +1,5 @@ using Autodesk.Revit.DB; using Microsoft.Extensions.Logging; -using Revit.Async; using Speckle.Connectors.Common.Builders; using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Conversion; @@ -11,61 +10,32 @@ using Speckle.Converters.Common; using Speckle.Converters.RevitShared.Helpers; using Speckle.Converters.RevitShared.Settings; -using Speckle.Converters.RevitShared.ToSpeckle; using Speckle.Sdk; using Speckle.Sdk.Models; using Speckle.Sdk.Models.Collections; namespace Speckle.Connectors.Revit.Operations.Send; -public class RevitRootObjectBuilder : IRootObjectBuilder +public class RevitRootObjectBuilder( + IRootToSpeckleConverter converter, + IConverterSettingsStore converterSettings, + ISendConversionCache sendConversionCache, + ElementUnpacker elementUnpacker, + SendCollectionManager sendCollectionManager, + ILogger logger, + RevitToSpeckleCacheSingleton revitToSpeckleCacheSingleton +) : RootObjectBuilderBase { // POC: SendSelection and RevitConversionContextStack should be interfaces, former needs interfaces - private readonly IRootToSpeckleConverter _converter; - private readonly IConverterSettingsStore _converterSettings; - private readonly ISendConversionCache _sendConversionCache; - private readonly ElementUnpacker _elementUnpacker; - private readonly SendCollectionManager _sendCollectionManager; - private readonly RevitToSpeckleCacheSingleton _revitToSpeckleCacheSingleton; - private readonly ILogger _logger; - private readonly ParameterDefinitionHandler _parameterDefinitionHandler; - - public RevitRootObjectBuilder( - IRootToSpeckleConverter converter, - IConverterSettingsStore converterSettings, - ISendConversionCache sendConversionCache, - ElementUnpacker elementUnpacker, - SendCollectionManager sendCollectionManager, - ILogger logger, - ParameterDefinitionHandler parameterDefinitionHandler, - RevitToSpeckleCacheSingleton revitToSpeckleCacheSingleton - ) - { - _converter = converter; - _converterSettings = converterSettings; - _sendConversionCache = sendConversionCache; - _elementUnpacker = elementUnpacker; - _sendCollectionManager = sendCollectionManager; - _revitToSpeckleCacheSingleton = revitToSpeckleCacheSingleton; - _logger = logger; - _parameterDefinitionHandler = parameterDefinitionHandler; - } - public async Task Build( + public override RootObjectBuilderResult Build( IReadOnlyList objects, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken ct = default - ) => await RevitTask.RunAsync(() => BuildSync(objects, sendInfo, onOperationProgressed, ct)).ConfigureAwait(false); - - private RootObjectBuilderResult BuildSync( - IReadOnlyList objects, - SendInfo sendInfo, - IProgress onOperationProgressed, - CancellationToken ct = default + CancellationToken cancellationToken ) { - var doc = _converterSettings.Current.Document; + var doc = converterSettings.Current.Document; if (doc.IsFamilyDocument) { @@ -74,61 +44,80 @@ private RootObjectBuilderResult BuildSync( // 0 - Init the root Collection rootObject = - new() { name = _converterSettings.Current.Document.PathName.Split('\\').Last().Split('.').First() }; - rootObject["units"] = _converterSettings.Current.SpeckleUnits; + new() { name = converterSettings.Current.Document.PathName.Split('\\').Last().Split('.').First() }; + rootObject["units"] = converterSettings.Current.SpeckleUnits; var revitElements = new List(); - + List results = new(revitElements.Count); // Convert ids to actual revit elements foreach (var id in objects) { - var el = _converterSettings.Current.Document.GetElement(id); - if (el != null) + var el = converterSettings.Current.Document.GetElement(id); + if (el == null) { - revitElements.Add(el); + continue; } + + if (el.Category == null) + { + continue; + } + + if (!SupportedCategoriesUtils.IsSupportedCategory(el.Category)) + { + results.Add( + new( + Status.WARNING, + el.UniqueId, + el.Category.Name, + null, + new SpeckleException($"Category {el.Category.Name} is not supported.") + ) + ); + continue; + } + + revitElements.Add(el); } if (revitElements.Count == 0) { - throw new SpeckleSendFilterException("No objects were found. Please update your send filter!"); + throw new SpeckleSendFilterException("No objects were found. Please update your publish filter!"); } - List results = new(revitElements.Count); - // Unpack groups (& other complex data structures) - var atomicObjects = _elementUnpacker.UnpackSelectionForConversion(revitElements).ToList(); + var atomicObjects = elementUnpacker.UnpackSelectionForConversion(revitElements).ToList(); var countProgress = 0; var cacheHitCount = 0; foreach (Element revitElement in atomicObjects) { - ct.ThrowIfCancellationRequested(); + cancellationToken.ThrowIfCancellationRequested(); string applicationId = revitElement.UniqueId; string sourceType = revitElement.GetType().Name; try { Base converted; - if (_sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference? value)) + if (sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference? value)) { converted = value; cacheHitCount++; } else { - converted = _converter.Convert(revitElement); + converted = converter.Convert(revitElement); converted.applicationId = applicationId; } - var collection = _sendCollectionManager.GetAndCreateObjectHostCollection(revitElement, rootObject); + var collection = sendCollectionManager.GetAndCreateObjectHostCollection(revitElement, rootObject); collection.elements.Add(converted); results.Add(new(Status.SUCCESS, applicationId, sourceType, converted)); } catch (Exception ex) when (!ex.IsFatal()) { - _logger.LogSendConversionError(ex, sourceType); + logger.LogSendConversionError(ex, sourceType); results.Add(new(Status.ERROR, applicationId, sourceType, null, ex)); } @@ -140,8 +129,8 @@ private RootObjectBuilderResult BuildSync( throw new SpeckleException("Failed to convert all objects."); } - var idsAndSubElementIds = _elementUnpacker.GetElementsAndSubelementIdsFromAtomicObjects(atomicObjects); - var materialProxies = _revitToSpeckleCacheSingleton.GetRenderMaterialProxyListForObjects(idsAndSubElementIds); + var idsAndSubElementIds = elementUnpacker.GetElementsAndSubelementIdsFromAtomicObjects(atomicObjects); + var materialProxies = revitToSpeckleCacheSingleton.GetRenderMaterialProxyListForObjects(idsAndSubElementIds); rootObject[ProxyKeys.RENDER_MATERIAL] = materialProxies; // NOTE: these are currently not used anywhere, we'll skip them until someone calls for it back diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Settings/ToSpeckleSettingsManager.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Settings/ToSpeckleSettingsManager.cs index 96ce3fde7..f1e55df9b 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Settings/ToSpeckleSettingsManager.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Operations/Send/Settings/ToSpeckleSettingsManager.cs @@ -14,7 +14,6 @@ namespace Speckle.Connectors.Revit.Operations.Send.Settings; public class ToSpeckleSettingsManager : IToSpeckleSettingsManager { private readonly RevitContext _revitContext; - private readonly APIContext _apiContext; private readonly ISendConversionCache _sendConversionCache; private readonly ElementUnpacker _elementUnpacker; @@ -25,13 +24,11 @@ public class ToSpeckleSettingsManager : IToSpeckleSettingsManager public ToSpeckleSettingsManager( RevitContext revitContext, - APIContext apiContext, ISendConversionCache sendConversionCache, ElementUnpacker elementUnpacker ) { _revitContext = revitContext; - _apiContext = apiContext; _elementUnpacker = elementUnpacker; _sendConversionCache = sendConversionCache; } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitExternalApplication.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitExternalApplication.cs index 0cd5c1b60..3eb15365b 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitExternalApplication.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitExternalApplication.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Speckle.Connectors.Common; -using Speckle.Connectors.DUI; using Speckle.Connectors.Revit.DependencyInjection; using Speckle.Converters.RevitShared; using Speckle.Sdk; @@ -48,7 +47,6 @@ public Result OnStartup(UIControlledApplication application) services.AddRevitConverters(); services.AddSingleton(application); _container = services.BuildServiceProvider(); - _container.UseDUI(); // resolve root object _revitPlugin = _container.GetRequiredService(); diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitIdleManager.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitIdleManager.cs index cce89b5dd..3154fb3bd 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitIdleManager.cs +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitIdleManager.cs @@ -6,12 +6,7 @@ namespace Speckle.Connectors.Revit.Plugin; -public interface IRevitIdleManager : IAppIdleManager -{ - public void RunAsync(Action action); -} - -public sealed class RevitIdleManager : AppIdleManager, IRevitIdleManager +public sealed class RevitIdleManager : AppIdleManager { private readonly UIApplication _uiApplication; private readonly IIdleCallManager _idleCallManager; @@ -42,13 +37,4 @@ protected override void AddEvent() private void RevitAppOnIdle(object? sender, IdlingEventArgs e) => _idleCallManager.AppOnIdle(() => OnIdle -= RevitAppOnIdle); - - public void RunAsync(Action action) - { -#if REVIT2025 - global::Revit.Async.RevitTask.RunAsync(action); -#else - action(); -#endif - } } diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitThreadContext.cs b/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitThreadContext.cs new file mode 100644 index 000000000..c64c86c5a --- /dev/null +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Plugin/RevitThreadContext.cs @@ -0,0 +1,22 @@ +using Revit.Async; +using Speckle.Connectors.Common.Threading; + +namespace Speckle.Connectors.Revit.Plugin; + +public class RevitThreadContext : ThreadContext +{ + protected override Task MainToWorkerAsync(Func> action) => action(); + + protected override Task WorkerToMainAsync(Func> action) => + RevitTask.RunAsync(async () => await action()); + + protected override Task MainToWorker(Func action) => Task.FromResult(action()); + + protected override Task WorkerToMain(Func action) => RevitTask.RunAsync(action); + + protected override Task RunMainAsync(Func action) => RevitTask.RunAsync(action); + + protected override Task RunMainAsync(Func action) => RevitTask.RunAsync(action); + + protected override Task RunMainAsync(Func> action) => RevitTask.RunAsync(action); +} diff --git a/Connectors/Revit/Speckle.Connectors.RevitShared/Speckle.Connectors.RevitShared.projitems b/Connectors/Revit/Speckle.Connectors.RevitShared/Speckle.Connectors.RevitShared.projitems index 42e4adfb0..890736c53 100644 --- a/Connectors/Revit/Speckle.Connectors.RevitShared/Speckle.Connectors.RevitShared.projitems +++ b/Connectors/Revit/Speckle.Connectors.RevitShared/Speckle.Connectors.RevitShared.projitems @@ -19,10 +19,10 @@ - + @@ -47,7 +47,8 @@ - + + \ No newline at end of file diff --git a/Connectors/Rhino/Directory.Build.targets b/Connectors/Rhino/Directory.Build.targets new file mode 100644 index 000000000..323108eca --- /dev/null +++ b/Connectors/Rhino/Directory.Build.targets @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json b/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json index f3b8b149b..3622f74b7 100644 --- a/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json +++ b/Connectors/Rhino/Speckle.Connectors.Rhino7/packages.lock.json @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.rhino7": { @@ -347,18 +346,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -368,20 +367,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Rhino/Speckle.Connectors.Rhino8/packages.lock.json b/Connectors/Rhino/Speckle.Connectors.Rhino8/packages.lock.json index 6acce660b..ff20c1dba 100644 --- a/Connectors/Rhino/Speckle.Connectors.Rhino8/packages.lock.json +++ b/Connectors/Rhino/Speckle.Connectors.Rhino8/packages.lock.json @@ -273,9 +273,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -283,9 +283,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -302,7 +301,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.converters.rhino8": { @@ -347,18 +346,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -368,20 +367,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoBasicConnectorBinding.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoBasicConnectorBinding.cs index 432c2c81f..b34e002d0 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoBasicConnectorBinding.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoBasicConnectorBinding.cs @@ -38,7 +38,7 @@ ISpeckleApplication speckleApplication _store.DocumentChanged += (_, _) => parent.TopLevelExceptionHandler.FireAndForget(async () => { - await Commands.NotifyDocumentChanged().ConfigureAwait(false); + await Commands.NotifyDocumentChanged(); // Note: this prevents scaling issues when copy-pasting from one rhino doc to another in the same session. _sendConversionCache.ClearCache(); }); @@ -100,9 +100,7 @@ public async Task HighlightModel(string modelCardId) if (objectIds.Count == 0) { - await Commands - .SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")) - .ConfigureAwait(false); + await Commands.SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")); return; } @@ -112,9 +110,7 @@ await Commands if (objects.rhinoObjects.Count == 0 && objects.groups.Count == 0) { - await Commands - .SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")) - .ConfigureAwait(false); + await Commands.SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")); return; } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoReceiveBinding.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoReceiveBinding.cs index dcf60ab73..c0599f6b9 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoReceiveBinding.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoReceiveBinding.cs @@ -77,13 +77,14 @@ public async Task Receive(string modelCardId) modelCard.GetReceiveInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); modelCard.BakedObjectIds = conversionResults.BakedObjectIds.ToList(); - await Commands - .SetModelReceiveResult(modelCardId, conversionResults.BakedObjectIds, conversionResults.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelReceiveResult( + modelCardId, + conversionResults.BakedObjectIds, + conversionResults.ConversionResults + ); } catch (OperationCanceledException) { @@ -95,7 +96,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoSendBinding.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoSendBinding.cs index 23bf041ff..61e389faa 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoSendBinding.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Bindings/RhinoSendBinding.cs @@ -44,12 +44,19 @@ public sealed class RhinoSendBinding : ISendBinding private readonly ISdkActivityFactory _activityFactory; /// - /// Used internally to aggregate the changed objects' id. Note we're using a concurrent dictionary here as the expiry check method is not thread safe, and this was causing problems. See: + /// Used internally to aggregate the changed objects' id. Objects in this list will be reconverted. + /// + /// Note we're using a concurrent dictionary here as the expiry check method is not thread safe, and this was causing problems. See: /// [CNX-202: Unhandled Exception Occurred when receiving in Rhino](https://linear.app/speckle/issue/CNX-202/unhandled-exception-occurred-when-receiving-in-rhino) /// As to why a concurrent dictionary, it's because it's the cheapest/easiest way to do so. /// https://stackoverflow.com/questions/18922985/concurrent-hashsett-in-net-framework /// private ConcurrentDictionary ChangedObjectIds { get; set; } = new(); + + /// + /// Stores objects that have "changed" only the commit structure/proxies - they do not need to be reconverted. + /// + private ConcurrentDictionary ChangedObjectIdsInGroupsOrLayers { get; set; } = new(); private ConcurrentDictionary ChangedMaterialIndexes { get; set; } = new(); private UnitSystem PreviousUnitSystem { get; set; } @@ -96,6 +103,15 @@ private void SubscribeToRhinoEvents() var selectedObject = RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(false, false).First(); ChangedObjectIds[selectedObject.Id.ToString()] = 1; } + + if (e.CommandEnglishName == "Ungroup") + { + foreach (RhinoObject selectedObject in RhinoDoc.ActiveDoc.Objects.GetSelectedObjects(false, false)) + { + ChangedObjectIdsInGroupsOrLayers[selectedObject.Id.ToString()] = 1; + } + _idleManager.SubscribeToIdle(nameof(RhinoSendBinding), RunExpirationChecks); + } }; RhinoDoc.ActiveDocumentChanged += (_, e) => @@ -111,19 +127,17 @@ private void SubscribeToRhinoEvents() { PreviousUnitSystem = newUnit; - await InvalidateAllSender().ConfigureAwait(false); + await InvalidateAllSender(); } }; RhinoDoc.AddRhinoObject += (_, e) => _topLevelExceptionHandler.CatchUnhandled(() => { - // NOTE: This does not work if rhino starts and opens a blank doc; - // These events always happen in a doc. Why guard agains a null doc? - // if (!_store.IsDocumentInit) - // { - // return; - // } + if (!_store.IsDocumentInit) + { + return; + } ChangedObjectIds[e.ObjectId.ToString()] = 1; _idleManager.SubscribeToIdle(nameof(RhinoSendBinding), RunExpirationChecks); @@ -132,12 +146,10 @@ private void SubscribeToRhinoEvents() RhinoDoc.DeleteRhinoObject += (_, e) => _topLevelExceptionHandler.CatchUnhandled(() => { - // NOTE: This does not work if rhino starts and opens a blank doc; - // These events always happen in a doc. Why guard agains a null doc? - // if (!_store.IsDocumentInit) - // { - // return; - // } + if (!_store.IsDocumentInit) + { + return; + } ChangedObjectIds[e.ObjectId.ToString()] = 1; _idleManager.SubscribeToIdle(nameof(RhinoSendBinding), RunExpirationChecks); @@ -147,6 +159,11 @@ private void SubscribeToRhinoEvents() RhinoDoc.RenderMaterialsTableEvent += (_, args) => _topLevelExceptionHandler.CatchUnhandled(() => { + if (!_store.IsDocumentInit) + { + return; + } + if (args is RhinoDoc.RenderMaterialAssignmentChangedEventArgs changedEventArgs) { ChangedObjectIds[changedEventArgs.ObjectId.ToString()] = 1; @@ -154,10 +171,62 @@ private void SubscribeToRhinoEvents() } }); + RhinoDoc.GroupTableEvent += (_, args) => + _topLevelExceptionHandler.CatchUnhandled(() => + { + if (!_store.IsDocumentInit) + { + return; + } + + foreach (var obj in RhinoDoc.ActiveDoc.Groups.GroupMembers(args.GroupIndex)) + { + ChangedObjectIdsInGroupsOrLayers[obj.Id.ToString()] = 1; + } + _idleManager.SubscribeToIdle(nameof(RhinoSendBinding), RunExpirationChecks); + }); + + RhinoDoc.LayerTableEvent += (_, args) => + _topLevelExceptionHandler.CatchUnhandled(() => + { + if (!_store.IsDocumentInit) + { + return; + } + + if ( + args.EventType == LayerTableEventType.Deleted + || args.EventType == LayerTableEventType.Current + || args.EventType == LayerTableEventType.Added + ) + { + return; + } + + var layer = RhinoDoc.ActiveDoc.Layers[args.LayerIndex]; + + // add all objects from the changed layers and sublayers to the non-destructively changed object list. + var allLayers = args.Document.Layers.Where(l => l.FullPath.Contains(layer.Name)); // not e imperfect, but layer.GetChildren(true) is valid only in v8 and above; this filter will include the original layer. + foreach (var childLayer in allLayers) + { + var sublayerObjs = RhinoDoc.ActiveDoc.Objects.FindByLayer(childLayer) ?? []; + foreach (var obj in sublayerObjs) + { + ChangedObjectIdsInGroupsOrLayers[obj.Id.ToString()] = 1; + } + } + _idleManager.SubscribeToIdle(nameof(RhinoSendBinding), RunExpirationChecks); + }); + // Catches and stores changed material ids. These are then used in the expiry checks to invalidate all objects that have assigned any of those material ids. RhinoDoc.MaterialTableEvent += (_, args) => _topLevelExceptionHandler.CatchUnhandled(() => { + if (!_store.IsDocumentInit) + { + return; + } + if (args.EventType == MaterialTableEventType.Modified) { ChangedMaterialIndexes[args.Index] = 1; @@ -168,12 +237,10 @@ private void SubscribeToRhinoEvents() RhinoDoc.ModifyObjectAttributes += (_, e) => _topLevelExceptionHandler.CatchUnhandled(() => { - // NOTE: This does not work if rhino starts and opens a blank doc; - // These events always happen in a doc. Why guard agains a null doc? - // if (!_store.IsDocumentInit) - // { - // return; - // } + if (!_store.IsDocumentInit) + { + return; + } // NOTE: not sure yet we want to track every attribute changes yet. TBD // NOTE: we might want to track here user strings too (once we send them out), and more! @@ -191,12 +258,10 @@ private void SubscribeToRhinoEvents() RhinoDoc.ReplaceRhinoObject += (_, e) => _topLevelExceptionHandler.CatchUnhandled(() => { - // NOTE: This does not work if rhino starts and opens a blank doc; - // These events always happen in a doc. Why guard agains a null doc? - // if (!_store.IsDocumentInit) - // { - // return; - // } + if (!_store.IsDocumentInit) + { + return; + } ChangedObjectIds[e.NewRhinoObject.Id.ToString()] = 1; ChangedObjectIds[e.OldRhinoObject.Id.ToString()] = 1; @@ -245,12 +310,9 @@ public async Task Send(string modelCardId) modelCard.GetSendInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -262,7 +324,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) // UX reasons - we will report operation exceptions as model card error. We may change this later when we have more exception documentation { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } @@ -293,29 +355,40 @@ private async Task RunExpirationChecks() } } - if (ChangedObjectIds.IsEmpty) + if (ChangedObjectIds.IsEmpty && ChangedObjectIdsInGroupsOrLayers.IsEmpty) { return; } // Actual model card invalidation - string[] objectIdsList = ChangedObjectIds.Keys.ToArray(); // NOTE: could not copy to array happens here + string[] objectIdsList = ChangedObjectIds.Keys.ToArray(); + var changedObjectIdsInGroupsOrLayers = ChangedObjectIdsInGroupsOrLayers.Keys.ToArray(); _sendConversionCache.EvictObjects(objectIdsList); var senders = _store.GetSenders(); List expiredSenderIds = new(); foreach (SenderModelCard modelCard in senders) { - var intersection = modelCard.SendFilter.NotNull().SelectedObjectIds.Intersect(objectIdsList).ToList(); - var isExpired = intersection.Count != 0; - if (isExpired) + var intersection = modelCard.SendFilter.NotNull().SelectedObjectIds.Intersect(objectIdsList); + if (intersection.Any()) + { + expiredSenderIds.Add(modelCard.ModelCardId.NotNull()); + continue; + } + + var groupOrLayerIntersection = modelCard + .SendFilter.NotNull() + .SelectedObjectIds.Intersect(changedObjectIdsInGroupsOrLayers); + if (groupOrLayerIntersection.Any()) { expiredSenderIds.Add(modelCard.ModelCardId.NotNull()); + continue; } } - await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false); + await Commands.SetModelsExpired(expiredSenderIds); ChangedObjectIds = new(); + ChangedObjectIdsInGroupsOrLayers = new(); ChangedMaterialIndexes = new(); } @@ -323,6 +396,6 @@ private async Task InvalidateAllSender() { _sendConversionCache.ClearCache(); var senderModelCardIds = _store.GetSenders().Select(s => s.ModelCardId.NotNull()); - await Commands.SetModelsExpired(senderModelCardIds).ConfigureAwait(false); + await Commands.SetModelsExpired(senderModelCardIds); } } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/RhinoLayerBaker.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/RhinoLayerBaker.cs index 46560ae3f..4bb1fb24b 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/RhinoLayerBaker.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/RhinoLayerBaker.cs @@ -83,7 +83,7 @@ public int GetLayerIndex(Collection[] collectionPath, string baseLayerName) return existingLayerIndex; } - throw new SpeckleException("Did not find a layer in the cache."); + throw new SpeckleException($"Did not find a layer in the cache with the name {layerFullName}"); } /// @@ -99,7 +99,8 @@ private int CreateLayerFromPath(Collection[] collectionPath, string baseLayerNam Layer? previousLayer = currentDocument.Layers.FindName(currentLayerName); foreach (Collection collection in collectionPath) { - currentLayerName += s_pathSeparator + collection.name; + currentLayerName += s_pathSeparator + (string.IsNullOrWhiteSpace(collection.name) ? "unnamed" : collection.name); + currentLayerName = currentLayerName.Replace("{", "").Replace("}", ""); // Rhino specific cleanup for gh (see RemoveInvalidRhinoChars) if (_hostLayerCache.TryGetValue(currentLayerName, out int value)) { @@ -133,6 +134,10 @@ out int mIndex } int index = currentDocument.Layers.Add(newLayer); + if (index == -1) + { + throw new SpeckleException($"Could not create layer {currentLayerName}."); + } _hostLayerCache.Add(currentLayerName, index); previousLayer = currentDocument.Layers.FindIndex(index); // note we need to get the correct id out, hence why we're double calling this } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/SpeckleRhinoPanelHost.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/SpeckleRhinoPanelHost.cs index 02654613c..00803ed6e 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/SpeckleRhinoPanelHost.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/HostApp/SpeckleRhinoPanelHost.cs @@ -22,6 +22,33 @@ public SpeckleRhinoPanelHost(uint docSn) Panels.Closed += PanelsOnClosed; } + /// + /// This is a lot like PanelsOnClosed but called when trying to show the panel to clear out a lingering parent as PanelsOnClosed isn't called + /// + /// + public static void Reinitialize(DUI3ControlWebView? webView) + { + if (webView == null) + { + return; + } + // This check comes from behavioral difference on closing Rhino Panels. + // IsPanelVisible returns; + // - True, when docked Panel closed from the list on right click on panel tab, + // whenever it is closed with this way, Rhino.Panels tries to reinit this object and expect the different UIElement, that's why we disconnect Child. + // - False, when detached Panel is closed by 'X' close button. + // whenever it is closed with this way, Rhino.Panels don't create this object, that's why we do not disconnect Child UIElement. + if (Panels.IsPanelVisible(typeof(SpeckleRhinoPanelHost).GUID)) + { + return; + } + // Disconnect UIElement from WpfElementHost. Otherwise, we can't reinit panel with same DUI3ControlWebView + if (LogicalTreeHelper.GetParent(webView) is Border border) + { + border.Child = null; + } + } + private void PanelsOnClosed(object? sender, PanelEventArgs e) { if (e.PanelId == typeof(SpeckleRhinoPanelHost).GUID) diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Receive/RhinoHostObjectBuilder.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Receive/RhinoHostObjectBuilder.cs index 3eb8a1ca8..56305a867 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Receive/RhinoHostObjectBuilder.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Receive/RhinoHostObjectBuilder.cs @@ -6,6 +6,7 @@ using Speckle.Connectors.Common.Extensions; using Speckle.Connectors.Common.Operations; using Speckle.Connectors.Common.Operations.Receive; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.Rhino.HostApp; using Speckle.Converters.Common; using Speckle.Converters.Rhino; @@ -32,6 +33,7 @@ public class RhinoHostObjectBuilder : IHostObjectBuilder private readonly RhinoGroupBaker _groupBaker; private readonly RootObjectUnpacker _rootObjectUnpacker; private readonly ISdkActivityFactory _activityFactory; + private readonly IThreadContext _threadContext; public RhinoHostObjectBuilder( IRootToHostConverter converter, @@ -42,7 +44,8 @@ public RhinoHostObjectBuilder( RhinoMaterialBaker materialBaker, RhinoColorBaker colorBaker, RhinoGroupBaker groupBaker, - ISdkActivityFactory activityFactory + ISdkActivityFactory activityFactory, + IThreadContext threadContext ) { _converter = converter; @@ -54,10 +57,11 @@ ISdkActivityFactory activityFactory _layerBaker = layerBaker; _groupBaker = groupBaker; _activityFactory = activityFactory; + _threadContext = threadContext; } #pragma warning disable CA1506 - public Task Build( + public HostObjectBuilderResult Build( #pragma warning restore CA1506 Base rootObject, string projectName, @@ -112,13 +116,16 @@ CancellationToken cancellationToken onOperationProgressed.Report(new("Baking layers (redraw disabled)", null)); using (var _ = _activityFactory.Start("Pre baking layers")) { - RhinoApp.InvokeAndWait(() => - { - using var layerNoDraw = new DisableRedrawScope(_converterSettings.Current.Document.Views); - var paths = atomicObjectsWithoutInstanceComponentsWithPath.Select(t => t.path).ToList(); - paths.AddRange(instanceComponentsWithPath.Select(t => t.path)); - _layerBaker.CreateAllLayersForReceive(paths, baseLayerName); - }); + //Rhino 8 doesn't play nice with Eto and layers + _threadContext + .RunOnMain(() => + { + using var layerNoDraw = new DisableRedrawScope(_converterSettings.Current.Document.Views); + var paths = atomicObjectsWithoutInstanceComponentsWithPath.Select(t => t.path).ToList(); + paths.AddRange(instanceComponentsWithPath.Select(t => t.path)); + _layerBaker.CreateAllLayersForReceive(paths, baseLayerName); + }) + .Wait(cancellationToken); } // 5 - Convert atomic objects @@ -136,6 +143,7 @@ CancellationToken cancellationToken onOperationProgressed.Report( new("Converting objects", (double)++count / atomicObjectsWithoutInstanceComponentsForConverter.Count) ); + cancellationToken.ThrowIfCancellationRequested(); try { // 0: get pre-created layer from cache in layer baker @@ -229,7 +237,7 @@ CancellationToken cancellationToken } _converterSettings.Current.Document.Views.Redraw(); - return Task.FromResult(new HostObjectBuilderResult(bakedObjectIds, conversionResults)); + return new HostObjectBuilderResult(bakedObjectIds, conversionResults); } private void PreReceiveDeepClean(string baseLayerName) @@ -241,35 +249,38 @@ private void PreReceiveDeepClean(string baseLayerName) RhinoMath.UnsetIntIndex ); - RhinoApp.InvokeAndWait(() => - { - _instanceBaker.PurgeInstances(baseLayerName); - _materialBaker.PurgeMaterials(baseLayerName); - - var doc = _converterSettings.Current.Document; - // Cleans up any previously received objects - if (rootLayerIndex != RhinoMath.UnsetIntIndex) + //Rhino 8 doesn't play nice with Eto and layers + _threadContext + .RunOnMain(() => { - var documentLayer = doc.Layers[rootLayerIndex]; - var childLayers = documentLayer.GetChildren(); - if (childLayers != null) + _instanceBaker.PurgeInstances(baseLayerName); + _materialBaker.PurgeMaterials(baseLayerName); + + var doc = _converterSettings.Current.Document; + // Cleans up any previously received objects + if (rootLayerIndex != RhinoMath.UnsetIntIndex) { - using var layerNoDraw = new DisableRedrawScope(doc.Views); - foreach (var layer in childLayers) + var documentLayer = doc.Layers[rootLayerIndex]; + var childLayers = documentLayer.GetChildren(); + if (childLayers != null) { - var purgeSuccess = doc.Layers.Purge(layer.Index, true); - if (!purgeSuccess) + using var layerNoDraw = new DisableRedrawScope(doc.Views); + foreach (var layer in childLayers) { - Console.WriteLine($"Failed to purge layer: {layer}"); + var purgeSuccess = doc.Layers.Purge(layer.Index, true); + if (!purgeSuccess) + { + Console.WriteLine($"Failed to purge layer: {layer}"); + } } } + doc.Layers.Purge(documentLayer.Index, true); } - doc.Layers.Purge(documentLayer.Index, true); - } - // Cleans up any previously received group - _groupBaker.PurgeGroups(baseLayerName); - }); + // Cleans up any previously received group + _groupBaker.PurgeGroups(baseLayerName); + }) + .Wait(); } /// diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Send/RhinoRootObjectBuilder.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Send/RhinoRootObjectBuilder.cs index 5f337e491..c3f5c33c9 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Send/RhinoRootObjectBuilder.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Operations/Send/RhinoRootObjectBuilder.cs @@ -60,11 +60,11 @@ ISdkActivityFactory activityFactory _activityFactory = activityFactory; } - public async Task Build( + public async Task BuildAsync( IReadOnlyList rhinoObjects, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken cancellationToken = default + CancellationToken cancellationToken ) { using var activity = _activityFactory.Start("Build"); @@ -95,8 +95,8 @@ public async Task Build( { foreach (RhinoObject rhinoObject in atomicObjects) { - using var _2 = _activityFactory.Start("Convert"); cancellationToken.ThrowIfCancellationRequested(); + using var _2 = _activityFactory.Start("Convert"); // handle layer Layer layer = _converterSettings.Current.Document.Layers[rhinoObject.Attributes.LayerIndex]; @@ -108,6 +108,7 @@ public async Task Build( ++count; onOperationProgressed.Report(new("Converting", (double)count / atomicObjects.Count)); + await Task.Yield(); // NOTE: useful for testing ui states, pls keep for now so we can easily uncomment // Thread.Sleep(550); @@ -130,7 +131,6 @@ public async Task Build( rootObjectCollection[ProxyKeys.COLOR] = _colorUnpacker.UnpackColors(atomicObjects, versionLayers.ToList()); } - await Task.Yield(); return new RootObjectBuilderResult(rootObjectCollection, results); } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoCommand.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoCommand.cs index 029029529..704965ad7 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoCommand.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoCommand.cs @@ -5,8 +5,10 @@ using Rhino.Input.Custom; using Rhino.UI; using Speckle.Connectors.Rhino.HostApp; - -// using Speckle.Connectorss.Rhino.Properties; +#if RHINO8_OR_GREATER +using Microsoft.Extensions.DependencyInjection; +using Speckle.Connectors.DUI.WebView; +#endif namespace Speckle.Connectors.Rhino.Plugin; @@ -65,6 +67,11 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode) if (mode == RunMode.Interactive) { +#if RHINO8_OR_GREATER + SpeckleRhinoPanelHost.Reinitialize( + SpeckleConnectorsRhinoPlugin.Instance.Container?.GetRequiredService() + ); +#endif Panels.OpenPanel(panelId); return Result.Success; } diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoPlugin.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoPlugin.cs index a172c693e..a1158578e 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoPlugin.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Plugin/Speckle.Connectors.RhinoPlugin.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Rhino.PlugIns; using Speckle.Connectors.Common; -using Speckle.Connectors.DUI; using Speckle.Connectors.Rhino.DependencyInjection; using Speckle.Converters.Rhino; using Speckle.Sdk; @@ -52,7 +51,6 @@ protected override LoadReturnCode OnLoad(ref string errorMessage) // but the Rhino connector has `.rhp` as it is extension. Container = services.BuildServiceProvider(); - Container.UseDUI(); // Resolve root plugin object and initialise. _rhinoPlugin = Container.GetRequiredService(); diff --git a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Registration/ServiceRegistration.cs b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Registration/ServiceRegistration.cs index 086c513a8..a5ad1c12d 100644 --- a/Connectors/Rhino/Speckle.Connectors.RhinoShared/Registration/ServiceRegistration.cs +++ b/Connectors/Rhino/Speckle.Connectors.RhinoShared/Registration/ServiceRegistration.cs @@ -8,6 +8,7 @@ using Speckle.Connectors.Common.Cancellation; using Speckle.Connectors.Common.Instances; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; @@ -32,12 +33,9 @@ public static void AddRhino(this IServiceCollection serviceCollection) serviceCollection.AddSingleton(SpeckleConnectorsRhinoCommand.Instance); serviceCollection.AddConnectorUtils(); - serviceCollection.AddDUI(); + serviceCollection.AddDUI(); serviceCollection.AddDUIView(); - // POC: Overwriting the SyncToMainThread to SyncToCurrentThread for Rhino! - // builder.AddSingletonInstance(); - // Register other connector specific types serviceCollection.AddSingleton(); serviceCollection.AddSingleton(); diff --git a/Connectors/Tekla/Directory.Build.targets b/Connectors/Tekla/Directory.Build.targets new file mode 100644 index 000000000..5362ffbe0 --- /dev/null +++ b/Connectors/Tekla/Directory.Build.targets @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + diff --git a/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj b/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj index 2739dcef3..4e52bc0dc 100644 --- a/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj +++ b/Connectors/Tekla/Speckle.Connector.Tekla2023/Speckle.Connector.Tekla2023.csproj @@ -7,37 +7,13 @@ true $(DefineConstants);TEKLA2023 - - - - - - - - - - - - - - - - - + - - - - + + + + @@ -45,10 +21,6 @@ - - - - diff --git a/Connectors/Tekla/Speckle.Connector.Tekla2023/packages.lock.json b/Connectors/Tekla/Speckle.Connector.Tekla2023/packages.lock.json index d28102127..463949c95 100644 --- a/Connectors/Tekla/Speckle.Connector.Tekla2023/packages.lock.json +++ b/Connectors/Tekla/Speckle.Connector.Tekla2023/packages.lock.json @@ -35,11 +35,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Tekla.Structures.Dialog": { @@ -332,9 +332,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -342,9 +342,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -369,7 +368,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -407,9 +406,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -419,20 +418,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj b/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj index b391f3023..5dfd9c4ac 100644 --- a/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj +++ b/Connectors/Tekla/Speckle.Connector.Tekla2024/Speckle.Connector.Tekla2024.csproj @@ -7,31 +7,8 @@ true $(DefineConstants);TEKLA2024 - - - - - - - - - - - - - - - - + @@ -44,10 +21,6 @@ - - - - diff --git a/Connectors/Tekla/Speckle.Connector.Tekla2024/packages.lock.json b/Connectors/Tekla/Speckle.Connector.Tekla2024/packages.lock.json index d6aeca925..34e4cd10c 100644 --- a/Connectors/Tekla/Speckle.Connector.Tekla2024/packages.lock.json +++ b/Connectors/Tekla/Speckle.Connector.Tekla2024/packages.lock.json @@ -35,11 +35,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Tekla.Structures.Dialog": { @@ -413,9 +413,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -423,9 +423,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -450,7 +449,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -488,9 +487,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -500,20 +499,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaBasicConnectorBinding.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaBasicConnectorBinding.cs index bc1449c7c..519ac132e 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaBasicConnectorBinding.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaBasicConnectorBinding.cs @@ -37,7 +37,7 @@ TSM.Model model _store.DocumentChanged += (_, _) => parent.TopLevelExceptionHandler.FireAndForget(async () => { - await Commands.NotifyDocumentChanged().ConfigureAwait(false); + await Commands.NotifyDocumentChanged(); }); } @@ -80,18 +80,16 @@ public async Task HighlightModel(string modelCardId) if (objectIds.Count == 0) { - await Commands - .SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")) - .ConfigureAwait(false); + await Commands.SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight.")); return; } - await HighlightObjects(objectIds).ConfigureAwait(false); + await HighlightObjects(objectIds); } catch (InvalidOperationException ex) { _logger.LogError(ex, "Failed to highlight model"); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } @@ -100,48 +98,47 @@ public async Task HighlightObjects(IReadOnlyList objectIds) try { await Task.Run(() => - { - // passing an empty list to create current selection - var selector = new TSMUI.ModelObjectSelector(); - selector.Select(new ArrayList()); + { + // passing an empty list to create current selection + var selector = new TSMUI.ModelObjectSelector(); + selector.Select(new ArrayList()); - if (objectIds.Count > 0) - { - var modelObjects = objectIds - .Select(id => _model.SelectModelObject(new Identifier(new Guid(id)))) - .Where(obj => obj != null) - .ToList(); + if (objectIds.Count > 0) + { + var modelObjects = objectIds + .Select(id => _model.SelectModelObject(new Identifier(new Guid(id)))) + .Where(obj => obj != null) + .ToList(); - selector.Select(new ArrayList(modelObjects)); + selector.Select(new ArrayList(modelObjects)); - // to find the min and max coordinates of the selected objects - // with that we can create a bounding box and zoom selected - var points = new List(); - foreach (var obj in modelObjects) + // to find the min and max coordinates of the selected objects + // with that we can create a bounding box and zoom selected + var points = new List(); + foreach (var obj in modelObjects) + { + points.Add(obj.GetCoordinateSystem().Origin); + foreach (TSM.ModelObject child in obj.GetChildren()) { - points.Add(obj.GetCoordinateSystem().Origin); - foreach (TSM.ModelObject child in obj.GetChildren()) - { - points.Add(child.GetCoordinateSystem().Origin); - } + points.Add(child.GetCoordinateSystem().Origin); } + } - var minX = points.Min(p => p.X); - var minY = points.Min(p => p.Y); - var minZ = points.Min(p => p.Z); - var maxX = points.Max(p => p.X); - var maxY = points.Max(p => p.Y); - var maxZ = points.Max(p => p.Z); + var minX = points.Min(p => p.X); + var minY = points.Min(p => p.Y); + var minZ = points.Min(p => p.Z); + var maxX = points.Max(p => p.X); + var maxY = points.Max(p => p.Y); + var maxZ = points.Max(p => p.Z); - // create the bounding box - var bounds = new AABB { MinPoint = new Point(minX, minY, minZ), MaxPoint = new Point(maxX, maxY, maxZ) }; + // create the bounding box + var bounds = new AABB { MinPoint = new Point(minX, minY, minZ), MaxPoint = new Point(maxX, maxY, maxZ) }; - // zoom in to bounding box - TSMUI.ViewHandler.ZoomToBoundingBox(bounds); - } - _model.CommitChanges(); - }) - .ConfigureAwait(false); + // zoom in to bounding box + TSMUI.ViewHandler.ZoomToBoundingBox(bounds); + } + _model.CommitChanges(); + }); } catch (InvalidOperationException ex) { diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSelectionBinding.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSelectionBinding.cs index 4c26ab1d1..710d0d5b5 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSelectionBinding.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSelectionBinding.cs @@ -8,7 +8,7 @@ public class TeklaSelectionBinding : ISelectionBinding { private readonly IAppIdleManager _idleManager; private const string SELECTION_EVENT = "setSelection"; - private readonly Tekla.Structures.Model.Events _events; + private readonly Events _events; private readonly object _selectionEventHandlerLock = new object(); private readonly Tekla.Structures.Model.UI.ModelObjectSelector _selector; @@ -29,8 +29,6 @@ Tekla.Structures.Model.UI.ModelObjectSelector selector _events.SelectionChange += Events_SelectionChangeEvent; _events.Register(); - - UpdateSelection(); } private void Events_SelectionChangeEvent() @@ -50,20 +48,34 @@ private void UpdateSelection() public SelectionInfo GetSelection() { + if (_selector == null) + { + return new SelectionInfo(new List(), "No objects selected."); + } + + var objectIds = new List(); + var objectTypes = new List(); + ModelObjectEnumerator selectedObjects = _selector.GetSelectedObjects(); - List objectIds = new List(); - List objectTypes = new List(); + if (selectedObjects == null) + { + return new SelectionInfo(new List(), "No objects selected."); + } while (selectedObjects.MoveNext()) { ModelObject modelObject = selectedObjects.Current; + if (modelObject?.Identifier?.GUID == null) + { + continue; // Skip if any part is null + } + string globalId = modelObject.Identifier.GUID.ToString(); objectIds.Add(globalId); objectTypes.Add(modelObject.GetType().Name); } string typesString = string.Join(", ", objectTypes.Distinct()); - return new SelectionInfo( objectIds, objectIds.Count == 0 ? "No objects selected." : $"{objectIds.Count} objects ({typesString})" diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSendBinding.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSendBinding.cs index 54d99146e..cff0f1198 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSendBinding.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/Bindings/TeklaSendBinding.cs @@ -150,12 +150,9 @@ public async Task Send(string modelCardId) modelCard.GetSendInfo(_speckleApplication.Slug), _operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken), cancellationToken - ) - .ConfigureAwait(false); + ); - await Commands - .SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults) - .ConfigureAwait(false); + await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults); } catch (OperationCanceledException) { @@ -164,7 +161,7 @@ await Commands catch (Exception ex) when (!ex.IsFatal()) { _logger.LogModelCardHandledError(ex); - await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false); + await Commands.SetModelError(modelCardId, ex); } } @@ -194,7 +191,7 @@ private async Task RunExpirationChecks() } } - await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false); + await Commands.SetModelsExpired(expiredSenderIds); ChangedObjectIds = new ConcurrentDictionary(); } diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/Operations/Send/TeklaRootObjectBuilder.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/Operations/Send/TeklaRootObjectBuilder.cs index 69da6664c..5cbfc1961 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/Operations/Send/TeklaRootObjectBuilder.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/Operations/Send/TeklaRootObjectBuilder.cs @@ -11,7 +11,6 @@ using Speckle.Sdk.Logging; using Speckle.Sdk.Models; using Speckle.Sdk.Models.Collections; -using Task = System.Threading.Tasks.Task; namespace Speckle.Connectors.TeklaShared.Operations.Send; @@ -44,11 +43,11 @@ TeklaMaterialUnpacker materialUnpacker _materialUnpacker = materialUnpacker; } - public async Task Build( + public async Task BuildAsync( IReadOnlyList teklaObjects, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken cancellationToken = default + CancellationToken cancellationToken ) { using var activity = _activityFactory.Start("Build"); @@ -66,14 +65,15 @@ public async Task Build( { foreach (TSM.ModelObject teklaObject in teklaObjects) { - using var _2 = _activityFactory.Start("Convert"); cancellationToken.ThrowIfCancellationRequested(); + using var _2 = _activityFactory.Start("Convert"); var result = ConvertTeklaObject(teklaObject, rootObjectCollection, sendInfo.ProjectId); results.Add(result); ++count; onOperationProgressed.Report(new("Converting", (double)count / teklaObjects.Count)); + await Task.Yield(); } } @@ -88,7 +88,6 @@ public async Task Build( rootObjectCollection[ProxyKeys.RENDER_MATERIAL] = renderMaterialProxies; } - await Task.Yield(); return new RootObjectBuilderResult(rootObjectCollection, results); } diff --git a/Connectors/Tekla/Speckle.Connector.TeklaShared/ServiceRegistration.cs b/Connectors/Tekla/Speckle.Connector.TeklaShared/ServiceRegistration.cs index b112365cb..d9d42e0cf 100644 --- a/Connectors/Tekla/Speckle.Connector.TeklaShared/ServiceRegistration.cs +++ b/Connectors/Tekla/Speckle.Connector.TeklaShared/ServiceRegistration.cs @@ -4,6 +4,7 @@ using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Cancellation; using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; @@ -31,7 +32,7 @@ public static IServiceCollection AddTekla(this IServiceCollection services) services.AddSingleton(); services.AddConnectorUtils(); - services.AddDUI(); + services.AddDUI(); services.AddDUIView(); services.AddSingleton(); diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ArcGISConversionSettingsFactory.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ArcGISConversionSettingsFactory.cs index 5ae9ae250..d1aa36b1e 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ArcGISConversionSettingsFactory.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ArcGISConversionSettingsFactory.cs @@ -1,7 +1,6 @@ using ArcGIS.Core.Data; using ArcGIS.Core.Data.DDL; using ArcGIS.Desktop.Core; -using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using Speckle.Converters.ArcGIS3.Utils; using Speckle.Converters.Common; @@ -61,15 +60,15 @@ or System.Security.SecurityException public Uri ValidateDatabasePath(Uri originalGatabasePath) { var fGdbName = originalGatabasePath.Segments[^1]; - var parentFolder = Path.GetDirectoryName(originalGatabasePath.AbsolutePath); - if (parentFolder == null) - { - // POC: customize the exception type - throw new ArgumentException($"Invalid path: {originalGatabasePath}"); - } + // Uri.AbsolutePath will return escaped string (replacing spaces), we need them back via .UnescapeDataString + var parentFolder = Uri.UnescapeDataString( + Path.GetDirectoryName(originalGatabasePath.AbsolutePath) + ?? throw new ArgumentException($"Invalid path: {originalGatabasePath}") + ); Uri databasePath = originalGatabasePath; Item folderToAdd = ItemFactory.Instance.Create(parentFolder); + if (folderToAdd is null) { // ArcGIS API doesn't show it as nullable, but it is @@ -134,11 +133,13 @@ public Uri ValidateDatabasePath(Uri originalGatabasePath) public Uri AddDatabaseToProject(Uri databasePath) { // Add a folder connection to a project - var parentFolder = Path.GetDirectoryName(databasePath.AbsolutePath); + // Uri.AbsolutePath will return escaped string (replacing spaces), we need them back via .UnescapeDataString + var parentFolder = Uri.UnescapeDataString( + Path.GetDirectoryName(databasePath.AbsolutePath) ?? throw new ArgumentException($"Invalid path: {databasePath}") + ); var fGdbName = databasePath.Segments[^1]; Item folderToAdd = ItemFactory.Instance.Create(parentFolder); - // POC: QueuedTask - QueuedTask.Run(() => Project.Current.AddItem(folderToAdd as IProjectItem)); + Project.Current.AddItem(folderToAdd as IProjectItem); // Add a file geodatabase or a SQLite or enterprise database connection to a project try @@ -149,8 +150,7 @@ public Uri AddDatabaseToProject(Uri databasePath) if (gdbToAdd is not null) { - // POC: QueuedTask - var addedGeodatabase = QueuedTask.Run(() => Project.Current.AddItem(gdbToAdd as IProjectItem)); + var addedGeodatabase = Project.Current.AddItem(gdbToAdd as IProjectItem); } } catch (NullReferenceException ex) diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs index 83db8e40d..70656c175 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/ArcToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ArcToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs index 993f84d9a..758d6a42f 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/CircleToHostConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CircleToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs index 27b87b537..7ca52d1eb 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/EllipseToHostConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class EllipseToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs index 730dd09ab..b75d9b01b 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/FallbackToHostConverter.cs @@ -6,7 +6,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(DisplayableObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(DisplayableObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class FallbackToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter, ACG.Multipatch> _meshListConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs index 47e6b5c9d..ec19f153c 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/LineToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class LineSingleToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs index cbb55f3ce..123c79c84 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/MeshToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class MeshToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter, ACG.Multipatch> _meshConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs index 6f7bd23f0..ef00a9307 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PointToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointToHostConverter : IToHostTopLevelConverter { private readonly ITypedConverter, ACG.Multipoint> _pointConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs index fbda9459b..003bc2fa1 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolycurveToHostConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolycurveToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly IRootToHostConverter _converter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs index b6842cdc9..38e5dcbd4 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToHost/TopLevel/PolylineToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.ArcGIS3.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolylineToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/CoreObjectsBaseToSpeckleTopLevelConverter.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/CoreObjectsBaseToSpeckleTopLevelConverter.cs index 2bb4a2032..75c4a5bf2 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/CoreObjectsBaseToSpeckleTopLevelConverter.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/ToSpeckle/TopLevel/CoreObjectsBaseToSpeckleTopLevelConverter.cs @@ -6,7 +6,7 @@ namespace Speckle.Converters.ArcGIS3.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(AC.CoreObjectsBase), 0)] +[NameAndRankValue(typeof(AC.CoreObjectsBase), 0)] public class CoreObjectsBaseToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter { private readonly DisplayValueExtractor _displayValueExtractor; diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/FeatureClassUtils.cs b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/FeatureClassUtils.cs index 2a0613efd..81bd19a87 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/FeatureClassUtils.cs +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/Utils/FeatureClassUtils.cs @@ -73,7 +73,7 @@ private Geodatabase GetDatabase() return geodatabase; } - public async Task>> GroupConversionTrackers( + public Dictionary> GroupConversionTrackers( Dictionary conversionTracker, Action onOperationProgressed ) @@ -134,13 +134,12 @@ private Geodatabase GetDatabase() ClearExistingDataset(uniqueKey); onOperationProgressed.Invoke("Grouping features into layers", count++ / conversionTracker.Count); - await Task.Yield(); } return geometryGroups; } - public async Task CreateDatasets( + public void CreateDatasets( Dictionary conversionTracker, Dictionary> featureClassElements, Action onOperationProgressed @@ -203,7 +202,6 @@ public async Task CreateDatasets( } onOperationProgressed.Invoke("Writing to Database", count++ / featureClassElements.Count); - await Task.Yield(); } } diff --git a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json index 83e1ae584..0d425bf72 100644 --- a/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json +++ b/Converters/ArcGIS/Speckle.Converters.ArcGIS3/packages.lock.json @@ -224,7 +224,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -247,18 +247,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -268,14 +268,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Autocad/Speckle.Converters.Autocad2022/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2022/packages.lock.json index 8f6c6c81c..1bb82d001 100644 --- a/Converters/Autocad/Speckle.Converters.Autocad2022/packages.lock.json +++ b/Converters/Autocad/Speckle.Converters.Autocad2022/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Autocad/Speckle.Converters.Autocad2023/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2023/packages.lock.json index 09d29073b..38e839500 100644 --- a/Converters/Autocad/Speckle.Converters.Autocad2023/packages.lock.json +++ b/Converters/Autocad/Speckle.Converters.Autocad2023/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Autocad/Speckle.Converters.Autocad2024/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2024/packages.lock.json index 6ccbf7012..9c9879c19 100644 --- a/Converters/Autocad/Speckle.Converters.Autocad2024/packages.lock.json +++ b/Converters/Autocad/Speckle.Converters.Autocad2024/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -293,7 +292,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -331,18 +330,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -352,20 +351,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Autocad/Speckle.Converters.Autocad2025/packages.lock.json b/Converters/Autocad/Speckle.Converters.Autocad2025/packages.lock.json index 8db2bef98..24f36c22a 100644 --- a/Converters/Autocad/Speckle.Converters.Autocad2025/packages.lock.json +++ b/Converters/Autocad/Speckle.Converters.Autocad2025/packages.lock.json @@ -220,9 +220,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -230,9 +230,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -249,7 +248,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -287,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -307,20 +306,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs index bc1b7fb1c..65f2ef5cb 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/ArcToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ArcToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _arcConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/AutocadPolycurveToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/AutocadPolycurveToHostConverter.cs index 3f98ed847..65a3028b5 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/AutocadPolycurveToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/AutocadPolycurveToHostConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Autocad2023.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Autocad.AutocadPolycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Autocad.AutocadPolycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class AutocadPolycurveToHostConverter : IToHostTopLevelConverter { private readonly ITypedConverter _polylineConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CircleToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CircleToHostConverter.cs index 67faf5769..aba0c711e 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CircleToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CircleToHostConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Autocad.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CircleToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CurveToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CurveToHostConverter.cs index 5da630ce9..299862754 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CurveToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/CurveToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.AutocadShared.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Curve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Curve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CurveToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _curveConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/DataObjectConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/DataObjectConverter.cs index e0fb67637..c758a2045 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/DataObjectConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/DataObjectConverter.cs @@ -6,7 +6,7 @@ namespace Speckle.Converters.Rhino7.ToHost.TopLevel; -[NameAndRankValue(nameof(DataObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(DataObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DataObjectConverter : IToHostTopLevelConverter, ITypedConverter> { private readonly ITypedConverter _lineConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/EllipseToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/EllipseToHostConverter.cs index e179d15da..04572a8ef 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/EllipseToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/EllipseToHostConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Autocad.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class EllipseToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/LineToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/LineToHostConverter.cs index ab390a46a..a087a5c6b 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/LineToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/LineToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class LineToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/MeshToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/MeshToHostConverter.cs index 340a601c4..a3856168c 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/MeshToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/MeshToHostConverter.cs @@ -6,7 +6,7 @@ namespace Speckle.Converters.Autocad.Geometry; -[NameAndRankValue(nameof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class MeshToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PointToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PointToHostConverter.cs index 4feb6cdcd..6f0efd5f0 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PointToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PointToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolycurveToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolycurveToHostConverter.cs index 3f1b9731d..e1c6aad43 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolycurveToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolycurveToHostConverter.cs @@ -9,7 +9,7 @@ namespace Speckle.Converters.AutocadShared.ToHost.Geometry; /// If polycurve segments are planar and only of type and , it can be represented as Polyline in Autocad. /// Otherwise we convert it as spline (list of ADB.Entity) that switch cases according to each segment type. /// -[NameAndRankValue(nameof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolycurveToHostConverter : IToHostTopLevelConverter { private readonly ITypedConverter _polylineConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolylineToHostConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolylineToHostConverter.cs index 9809303d0..a6c26bec5 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolylineToHostConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Geometry/PolylineToHostConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToHost.Geometry; -[NameAndRankValue(nameof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolylineToHostConverter : IToHostTopLevelConverter, ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs index 6a68b43ac..a5d09151d 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToHost/Raw/ArcToHostRawConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToHost.Raw; -[NameAndRankValue(nameof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ArcToHostRowConverter : ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs index e179f15fa..edbf962e4 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/ArcToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; -[NameAndRankValue(nameof(ADB.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBArcToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _arcConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs index 89415efd7..21f8c7e95 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/CircleToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; -[NameAndRankValue(nameof(ADB.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBCircleToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _circleConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs index 89d5b9af3..ec170697b 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/EllipseToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; -[NameAndRankValue(nameof(ADB.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBEllipseToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _ellipseConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs index ea4be5229..e9c0eb5b1 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/LineToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; -[NameAndRankValue(nameof(ADB.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class LineToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _lineConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PointToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PointToSpeckleConverter.cs index 0dc4bc102..ffe163dcc 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PointToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PointToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; -[NameAndRankValue(nameof(ADB.DBPoint), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.DBPoint), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolyfaceMeshToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolyfaceMeshToSpeckleConverter.cs index 5e5cffd92..a8d23bbef 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolyfaceMeshToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolyfaceMeshToSpeckleConverter.cs @@ -11,7 +11,7 @@ namespace Speckle.Converters.Autocad.Geometry; /// /// The IToSpeckleTopLevelConverter inheritance should only expect database-resident objects. IRawConversion inheritance can expect non database-resident objects, when generated from other converters. /// -[NameAndRankValue(nameof(ADB.PolyFaceMesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.PolyFaceMesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBPolyfaceMeshToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs index 519e7615f..e6cdfe890 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline2dToSpeckleConverter.cs @@ -14,7 +14,7 @@ namespace Speckle.Converters.Autocad.Geometry; /// of type and will have only one in . /// The IToSpeckleTopLevelConverter inheritance should only expect database-resident objects. IRawConversion inheritance can expect non database-resident objects, when generated from other converters. /// -[NameAndRankValue(nameof(ADB.Polyline2d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Polyline2d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class Polyline2dToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs index f01ff31f9..76218142d 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Polyline3dToSpeckleConverter.cs @@ -13,7 +13,7 @@ namespace Speckle.Converters.Autocad.Geometry; /// of type and will have only one in . /// The IToSpeckleTopLevelConverter inheritance should only expect database-resident Polyline2d objects. IRawConversion inheritance can expect non database-resident objects, when generated from other converters. /// -[NameAndRankValue(nameof(ADB.Polyline3d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Polyline3d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class Polyline3dToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolylineToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolylineToSpeckleConverter.cs index d0a63cb02..da89a945b 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolylineToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/PolylineToSpeckleConverter.cs @@ -10,7 +10,7 @@ namespace Speckle.Converters.Autocad.Geometry; /// /// is of type and will have only s and s in . /// -[NameAndRankValue(nameof(ADB.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolylineToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/RegionToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/RegionToSpeckleConverter.cs index 4723e50ac..72ba00eef 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/RegionToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/RegionToSpeckleConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Autocad.Geometry; -[NameAndRankValue(nameof(ADB.Region), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Region), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class RegionToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter { private readonly ITypedConverter _brepConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs index f0989e1f2..02a8a840c 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/Solid3dToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.Geometry; -[NameAndRankValue(nameof(ADB.Solid3d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Solid3d), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class Solid3dToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _solidConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs index 955096c7c..4512da61a 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SplineToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Autocad.ToSpeckle.Geometry; -[NameAndRankValue(nameof(ADB.Spline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Spline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class SplineToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _splineConverter; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SubDMeshToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SubDMeshToSpeckleConverter.cs index 996b0e1db..608c31243 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SubDMeshToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SubDMeshToSpeckleConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Autocad.Geometry; -[NameAndRankValue(nameof(ADB.SubDMesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.SubDMesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DBSubDMeshToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly IConverterSettingsStore _settingsStore; diff --git a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SurfaceToSpeckleConverter.cs b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SurfaceToSpeckleConverter.cs index e15d5f3e1..786a91ced 100644 --- a/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SurfaceToSpeckleConverter.cs +++ b/Converters/Autocad/Speckle.Converters.AutocadShared/ToSpeckle/Geometry/SurfaceToSpeckleConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Autocad.Geometry; -[NameAndRankValue(nameof(ADB.Surface), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ADB.Surface), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class SurfaceToSpeckleConverter : IToSpeckleTopLevelConverter, ITypedConverter { private readonly ITypedConverter _brepConverter; diff --git a/Converters/CSi/Speckle.Converters.ETABS21/packages.lock.json b/Converters/CSi/Speckle.Converters.ETABS21/packages.lock.json index a60441325..817d3dbbd 100644 --- a/Converters/CSi/Speckle.Converters.ETABS21/packages.lock.json +++ b/Converters/CSi/Speckle.Converters.ETABS21/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/CSi/Speckle.Converters.ETABS22/packages.lock.json b/Converters/CSi/Speckle.Converters.ETABS22/packages.lock.json index 4de4db7fe..fbf0014f1 100644 --- a/Converters/CSi/Speckle.Converters.ETABS22/packages.lock.json +++ b/Converters/CSi/Speckle.Converters.ETABS22/packages.lock.json @@ -219,7 +219,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -242,18 +242,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -262,14 +262,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/CSi/Speckle.Converters.ETABSShared/ToSpeckle/TopLevel/EtabsObjectToSpeckleConverter.cs b/Converters/CSi/Speckle.Converters.ETABSShared/ToSpeckle/TopLevel/EtabsObjectToSpeckleConverter.cs index 2bdda3d11..349a65ede 100644 --- a/Converters/CSi/Speckle.Converters.ETABSShared/ToSpeckle/TopLevel/EtabsObjectToSpeckleConverter.cs +++ b/Converters/CSi/Speckle.Converters.ETABSShared/ToSpeckle/TopLevel/EtabsObjectToSpeckleConverter.cs @@ -22,7 +22,7 @@ namespace Speckle.Converters.ETABSShared.ToSpeckle.TopLevel; /// * IApplicationPropertiesExtractor for ETABS-specific data /// 3. CreateTargetObject method ensures type-safe conversion to EtabsObject /// -[NameAndRankValue(nameof(CsiWrapperBase), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(CsiWrapperBase), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class EtabsObjectToSpeckleConverter : CsiObjectToSpeckleConverterBase { public EtabsObjectToSpeckleConverter( diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2022/packages.lock.json b/Converters/Civil3d/Speckle.Converters.Civil3d2022/packages.lock.json index 81bb4b482..847871f2c 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3d2022/packages.lock.json +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2022/packages.lock.json @@ -272,7 +272,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -295,18 +295,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -316,14 +316,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2023/packages.lock.json b/Converters/Civil3d/Speckle.Converters.Civil3d2023/packages.lock.json index a406b1fc0..d2561827d 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3d2023/packages.lock.json +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2023/packages.lock.json @@ -272,7 +272,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -295,18 +295,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -316,14 +316,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json b/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json index 2fc253038..312cd35cc 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2024/packages.lock.json @@ -272,7 +272,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -295,18 +295,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -316,14 +316,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Civil3d/Speckle.Converters.Civil3d2025/packages.lock.json b/Converters/Civil3d/Speckle.Converters.Civil3d2025/packages.lock.json index 24648dbef..6249dd317 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3d2025/packages.lock.json +++ b/Converters/Civil3d/Speckle.Converters.Civil3d2025/packages.lock.json @@ -229,9 +229,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -239,9 +239,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui.webview": { @@ -258,7 +257,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -296,18 +295,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -316,20 +315,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToSpeckleConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToSpeckleConverter.cs index aefb201ac..fd056b5f2 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToSpeckleConverter.cs +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Civil3dRootToSpeckleConverter.cs @@ -34,6 +34,8 @@ public Base Convert(object target) object objectToConvert = dbObject; // check first for civil type objects + // POC: some classes (eg Civil.DatabaseServices.CogoPoint) actually inherit from Autocad.DatabaseServices.Entity instead of Civil!! + // These need top level converters in Civil for now, but in the future we should implement a EntityToSpeckleTopLevelConverter for Autocad as well. if (target is CDB.Entity civilEntity) { type = civilEntity.GetType(); diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems index 0e98b9c50..0ab60d801 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/Speckle.Converters.Civil3dShared.projitems @@ -23,6 +23,7 @@ + diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/Point3dCollectionToSpeckleRawConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/Point3dCollectionToSpeckleRawConverter.cs index b2c29160b..53ab432db 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/Point3dCollectionToSpeckleRawConverter.cs +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/Raw/Point3dCollectionToSpeckleRawConverter.cs @@ -5,15 +5,10 @@ namespace Speckle.Converters.Civil3dShared.ToSpeckle.Raw; public class Point3dCollectionToSpeckleRawConverter : ITypedConverter { - private readonly ITypedConverter _pointConverter; private readonly IConverterSettingsStore _settingsStore; - public Point3dCollectionToSpeckleRawConverter( - ITypedConverter pointConverter, - IConverterSettingsStore settingsStore - ) + public Point3dCollectionToSpeckleRawConverter(IConverterSettingsStore settingsStore) { - _pointConverter = pointConverter; _settingsStore = settingsStore; } diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CivilEntityToSpeckleTopLevelConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CivilEntityToSpeckleTopLevelConverter.cs index 6b16b85c3..a98c9a0cd 100644 --- a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CivilEntityToSpeckleTopLevelConverter.cs +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CivilEntityToSpeckleTopLevelConverter.cs @@ -7,9 +7,9 @@ using Speckle.Sdk; using Speckle.Sdk.Models; -namespace Speckle.Converters.Civil3dShared.ToSpeckle.BuiltElements; +namespace Speckle.Converters.Civil3dShared.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(CDB.Entity), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(CDB.Entity), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CivilEntityToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter { private readonly IConverterSettingsStore _settingsStore; diff --git a/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CogoPointToSpeckleTopLevelConverter.cs b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CogoPointToSpeckleTopLevelConverter.cs new file mode 100644 index 000000000..461f97f56 --- /dev/null +++ b/Converters/Civil3d/Speckle.Converters.Civil3dShared/ToSpeckle/TopLevel/CogoPointToSpeckleTopLevelConverter.cs @@ -0,0 +1,65 @@ +using Speckle.Converters.Civil3dShared.Extensions; +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Objects.Data; +using Speckle.Sdk; +using Speckle.Sdk.Models; + +namespace Speckle.Converters.Civil3dShared.ToSpeckle.TopLevel; + +/// +/// This top level converter is needed because the namespace of CogoPoint is Autodesk.Civil.DatabaseServices, but the inheritance of CogoPoint is Autodesk.Autocad.Entity +/// This means cogo points will *not* be picked up by the top level civil entity converter. +/// POC: implementing a top level autocad entity converter can probably replace this converter. +/// +[NameAndRankValue(typeof(CDB.CogoPoint), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class CogoPointToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter +{ + private readonly IConverterSettingsStore _settingsStore; + private readonly ITypedConverter _pointConverter; + + public CogoPointToSpeckleTopLevelConverter( + IConverterSettingsStore settingsStore, + ITypedConverter pointConverter + ) + { + _settingsStore = settingsStore; + _pointConverter = pointConverter; + } + + public Base Convert(object target) => Convert((CDB.CogoPoint)target); + + public Civil3dObject Convert(CDB.CogoPoint target) + { + string name = ""; + try + { + name = target.PointName; + } + catch (Autodesk.Civil.CivilException e) when (!e.IsFatal()) { } // throws if name doesn't exist + + // extract display value as point + SOG.Point displayPoint = _pointConverter.Convert(target.Location); + + Civil3dObject civilObject = + new() + { + name = name, + type = target.GetType().ToString().Split('.').Last(), + baseCurves = null, + elements = new(), + displayValue = new() { displayPoint }, + properties = new(), + units = _settingsStore.Current.SpeckleUnits, + applicationId = target.Id.GetSpeckleApplicationId() + }; + + // add additional class properties + civilObject["pointNumber"] = target.PointNumber; + civilObject["northing"] = target.Northing; + //civilObject["latitude"] = target.Latitude; // might not be necessary, and also sometimes throws if transforms are not enabled + //civilObject["longitude"] = target.Longitude; // might not be necessary, and also sometimes throws if transforms are not enabled + + return civilObject; + } +} diff --git a/Converters/Navisworks/Speckle.Converters.Navisworks2020/packages.lock.json b/Converters/Navisworks/Speckle.Converters.Navisworks2020/packages.lock.json index 606b4af2d..beb730041 100644 --- a/Converters/Navisworks/Speckle.Converters.Navisworks2020/packages.lock.json +++ b/Converters/Navisworks/Speckle.Converters.Navisworks2020/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -286,7 +285,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -318,18 +317,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -339,20 +338,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Navisworks/Speckle.Converters.Navisworks2021/packages.lock.json b/Converters/Navisworks/Speckle.Converters.Navisworks2021/packages.lock.json index ea57905a4..f0b65eefb 100644 --- a/Converters/Navisworks/Speckle.Converters.Navisworks2021/packages.lock.json +++ b/Converters/Navisworks/Speckle.Converters.Navisworks2021/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -286,7 +285,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -318,18 +317,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -339,20 +338,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Navisworks/Speckle.Converters.Navisworks2022/packages.lock.json b/Converters/Navisworks/Speckle.Converters.Navisworks2022/packages.lock.json index 1f0dea93b..ac7cebf3a 100644 --- a/Converters/Navisworks/Speckle.Converters.Navisworks2022/packages.lock.json +++ b/Converters/Navisworks/Speckle.Converters.Navisworks2022/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -286,7 +285,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -318,18 +317,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -339,20 +338,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Navisworks/Speckle.Converters.Navisworks2023/packages.lock.json b/Converters/Navisworks/Speckle.Converters.Navisworks2023/packages.lock.json index a01be05b4..a105edc4c 100644 --- a/Converters/Navisworks/Speckle.Converters.Navisworks2023/packages.lock.json +++ b/Converters/Navisworks/Speckle.Converters.Navisworks2023/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -286,7 +285,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -318,18 +317,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -339,20 +338,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Navisworks/Speckle.Converters.Navisworks2024/packages.lock.json b/Converters/Navisworks/Speckle.Converters.Navisworks2024/packages.lock.json index 0aa4cf769..316c826d7 100644 --- a/Converters/Navisworks/Speckle.Converters.Navisworks2024/packages.lock.json +++ b/Converters/Navisworks/Speckle.Converters.Navisworks2024/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -286,7 +285,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -318,18 +317,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -339,20 +338,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Navisworks/Speckle.Converters.Navisworks2025/packages.lock.json b/Converters/Navisworks/Speckle.Converters.Navisworks2025/packages.lock.json index 8aaed2a4f..056191e6d 100644 --- a/Converters/Navisworks/Speckle.Converters.Navisworks2025/packages.lock.json +++ b/Converters/Navisworks/Speckle.Converters.Navisworks2025/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -286,7 +285,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.DependencyInjection": { @@ -318,18 +317,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -339,20 +338,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Navisworks/Speckle.Converters.NavisworksShared/Helpers/ColorConverter.cs b/Converters/Navisworks/Speckle.Converters.NavisworksShared/Helpers/ColorConverter.cs new file mode 100644 index 000000000..5c2925365 --- /dev/null +++ b/Converters/Navisworks/Speckle.Converters.NavisworksShared/Helpers/ColorConverter.cs @@ -0,0 +1,56 @@ +using Convert = System.Convert; +using Sys = System.Drawing; + +namespace Speckle.Converter.Navisworks.Helpers; + +public static class ColorConverter +{ + /// + /// Converts a Navisworks color to a System.Drawing.Color. + /// + /// The Navisworks color to convert + /// Optional transparency value (0.0 to 1.0) + /// A System.Drawing.Color with the converted values + public static Sys.Color NavisworksColorToColor(NAV.Color color, double? transparency = null) + { + var alpha = transparency.HasValue ? Convert.ToInt32((1.0 - transparency.Value) * 255) : 255; + + return Sys.Color.FromArgb( + alpha: alpha, + red: Convert.ToInt32(color.R * 255), + green: Convert.ToInt32(color.G * 255), + blue: Convert.ToInt32(color.B * 255) + ); + } + + /// + /// Converts RGB values to a color hash string. + /// + /// The Navisworks color + /// Optional transparency value + /// A unique hash string for the color + public static string GetColorHash(NAV.Color color, double? transparency = null) + { + var rgbValues = + Convert.ToInt32(color.R * 255) << 16 | Convert.ToInt32(color.G * 255) << 8 | Convert.ToInt32(color.B * 255); + + if (!transparency.HasValue) + { + return rgbValues.ToString(); + } + + var alpha = Convert.ToInt32((1.0 - transparency.Value) * 255); + return $"{rgbValues}_{alpha}"; + } + + /// + /// Gets a human-readable color name. + /// + /// The Navisworks color to name + /// A descriptive name for the color + public static string GetColorName(NAV.Color color) + { + var converted = NavisworksColorToColor(color); + return converted.IsKnownColor ? converted.Name : $"Custom_{converted.ToArgb():X8}"; + } +} diff --git a/Converters/Navisworks/Speckle.Converters.NavisworksShared/Speckle.Converters.NavisworksShared.projitems b/Converters/Navisworks/Speckle.Converters.NavisworksShared/Speckle.Converters.NavisworksShared.projitems index 211a57058..121b8a9a4 100644 --- a/Converters/Navisworks/Speckle.Converters.NavisworksShared/Speckle.Converters.NavisworksShared.projitems +++ b/Converters/Navisworks/Speckle.Converters.NavisworksShared/Speckle.Converters.NavisworksShared.projitems @@ -21,6 +21,7 @@ + diff --git a/Converters/Navisworks/Speckle.Converters.NavisworksShared/ToSpeckle/TopLevel/ModelItemTopLevelConverterToSpeckle.cs b/Converters/Navisworks/Speckle.Converters.NavisworksShared/ToSpeckle/TopLevel/ModelItemTopLevelConverterToSpeckle.cs index 17e3a89f2..1fb85b5d5 100644 --- a/Converters/Navisworks/Speckle.Converters.NavisworksShared/ToSpeckle/TopLevel/ModelItemTopLevelConverterToSpeckle.cs +++ b/Converters/Navisworks/Speckle.Converters.NavisworksShared/ToSpeckle/TopLevel/ModelItemTopLevelConverterToSpeckle.cs @@ -10,7 +10,7 @@ namespace Speckle.Converter.Navisworks.ToSpeckle; /// /// Converts Navisworks ModelItem objects to Speckle Base objects. /// -[NameAndRankValue(nameof(NAV.ModelItem), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(NAV.ModelItem), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ModelItemToToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly StandardPropertyHandler _standardHandler; diff --git a/Converters/Revit/Speckle.Converters.Revit2022.Tests/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2022.Tests/packages.lock.json index 247b68aba..6273fe7ec 100644 --- a/Converters/Revit/Speckle.Converters.Revit2022.Tests/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2022.Tests/packages.lock.json @@ -345,7 +345,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.testing": { @@ -375,18 +375,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -395,14 +395,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.Revit2022/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2022/packages.lock.json index fd4a7b94d..a96161d91 100644 --- a/Converters/Revit/Speckle.Converters.Revit2022/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2022/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json index 0b71e1e3d..abb3a4180 100644 --- a/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2023.Tests/packages.lock.json @@ -345,7 +345,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.testing": { @@ -375,18 +375,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -395,14 +395,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json index a1131a9a1..642607ccd 100644 --- a/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2023/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.Revit2024.Tests/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2024.Tests/packages.lock.json index 481463041..02bbc1902 100644 --- a/Converters/Revit/Speckle.Converters.Revit2024.Tests/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2024.Tests/packages.lock.json @@ -345,7 +345,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.testing": { @@ -375,18 +375,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -395,14 +395,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.Revit2024/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2024/packages.lock.json index 4e81a439b..7404b3b6d 100644 --- a/Converters/Revit/Speckle.Converters.Revit2024/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2024/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.Revit2025/packages.lock.json b/Converters/Revit/Speckle.Converters.Revit2025/packages.lock.json index 1e47fee24..bfa8ed9a5 100644 --- a/Converters/Revit/Speckle.Converters.Revit2025/packages.lock.json +++ b/Converters/Revit/Speckle.Converters.Revit2025/packages.lock.json @@ -219,7 +219,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -242,18 +242,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -262,14 +262,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Revit/Speckle.Converters.RevitShared/Helpers/DisplayValueExtractor.cs b/Converters/Revit/Speckle.Converters.RevitShared/Helpers/DisplayValueExtractor.cs index 52e861a06..406903982 100644 --- a/Converters/Revit/Speckle.Converters.RevitShared/Helpers/DisplayValueExtractor.cs +++ b/Converters/Revit/Speckle.Converters.RevitShared/Helpers/DisplayValueExtractor.cs @@ -240,20 +240,23 @@ private bool ShouldSetElementDisplayToTransparent(DB.Element element) /// private DB.Options OverrideViewOptions(DB.Element element, DB.Options currentOptions) { + // there is no point to progress if element category already null + if (element.Category is null) + { + return currentOptions; + } + var elementBuiltInCategory = element.Category.GetBuiltInCategory(); // Note: some elements do not get display values (you get invalid solids) unless we force the view detail level to be fine. This is annoying, but it's bad ux: people think the // elements are not there (they are, just invisible). if ( - element.Category is not null - && ( - elementBuiltInCategory == DB.BuiltInCategory.OST_PipeFitting - || elementBuiltInCategory == DB.BuiltInCategory.OST_PipeAccessory - || elementBuiltInCategory == DB.BuiltInCategory.OST_PlumbingFixtures + elementBuiltInCategory == DB.BuiltInCategory.OST_PipeFitting + || elementBuiltInCategory == DB.BuiltInCategory.OST_PipeAccessory + || elementBuiltInCategory == DB.BuiltInCategory.OST_PlumbingFixtures #if REVIT2024_OR_GREATER - || element is DB.Toposolid // note, brought back from 2.x.x. + || element is DB.Toposolid // note, brought back from 2.x.x. #endif - ) ) { currentOptions.DetailLevel = DB.ViewDetailLevel.Fine; // Force detail level to be fine diff --git a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs index 3f1f25448..2be4bb2bd 100644 --- a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs +++ b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/ModelCurveToSpeckleTopLevelConverter.cs @@ -6,7 +6,7 @@ namespace Speckle.Converters.RevitShared.ToSpeckle; // Converts model curves to regular speckle curves, since we aren't receiving them and the only property used in V2 was the linestyle (not element ids or parameters). Don't see a need to handle these differently from regular geometry. -[NameAndRankValue(nameof(DB.ModelCurve), 0)] +[NameAndRankValue(typeof(DB.ModelCurve), 0)] public class ModelCurveToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _curveConverter; diff --git a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/PointcloudTopLevelConverterToSpeckle.cs b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/PointcloudTopLevelConverterToSpeckle.cs index 70d5403cc..3cd9047c6 100644 --- a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/PointcloudTopLevelConverterToSpeckle.cs +++ b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/PointcloudTopLevelConverterToSpeckle.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.RevitShared.ToSpeckle; -[NameAndRankValue(nameof(DB.PointCloudInstance), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(DB.PointCloudInstance), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public sealed class PointcloudTopLevelConverterToSpeckle : IToSpeckleTopLevelConverter { private readonly IConverterSettingsStore _converterSettings; diff --git a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/RevitElementTopLevelConverterToSpeckle.cs b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/RevitElementTopLevelConverterToSpeckle.cs index 223cb5c0e..cac374104 100644 --- a/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/RevitElementTopLevelConverterToSpeckle.cs +++ b/Converters/Revit/Speckle.Converters.RevitShared/ToSpeckle/TopLevel/RevitElementTopLevelConverterToSpeckle.cs @@ -10,7 +10,7 @@ namespace Speckle.Converters.RevitShared.ToSpeckle; -[NameAndRankValue(nameof(DB.Element), 0)] +[NameAndRankValue(typeof(DB.Element), 0)] public class ElementTopLevelConverterToSpeckle : IToSpeckleTopLevelConverter { private readonly DisplayValueExtractor _displayValueExtractor; @@ -73,7 +73,7 @@ public RevitObject Convert(DB.Element target) // get location if any Base? convertedLocation = null; - if (target.Location is DB.Location location) // location can be null + if (target.Location is DB.Location location and (DB.LocationCurve or DB.LocationPoint)) // location can be null { try { @@ -81,6 +81,9 @@ public RevitObject Convert(DB.Element target) } catch (ValidationException) { + // NOTE: i've improved the if check above to make sure we never reach here + // we were throwing a lot here for various elements (e.g. floors) and we would + // be slowing things down // location was not a supported, do not attach to base element } } diff --git a/Converters/Rhino/Speckle.Converters.Rhino7.Tests/packages.lock.json b/Converters/Rhino/Speckle.Converters.Rhino7.Tests/packages.lock.json index 53845d717..4619d787f 100644 --- a/Converters/Rhino/Speckle.Converters.Rhino7.Tests/packages.lock.json +++ b/Converters/Rhino/Speckle.Converters.Rhino7.Tests/packages.lock.json @@ -345,7 +345,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.testing": { @@ -375,18 +375,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -395,14 +395,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json b/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json index c0d379e72..d3211c7ca 100644 --- a/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json +++ b/Converters/Rhino/Speckle.Converters.Rhino7/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Rhino/Speckle.Converters.Rhino8/packages.lock.json b/Converters/Rhino/Speckle.Converters.Rhino8/packages.lock.json index 9d6ab03ff..9faafa0d6 100644 --- a/Converters/Rhino/Speckle.Converters.Rhino8/packages.lock.json +++ b/Converters/Rhino/Speckle.Converters.Rhino8/packages.lock.json @@ -263,7 +263,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -286,18 +286,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -307,14 +307,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/ArcToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/ArcToHostTopLevelConverter.cs index 3ebd21b35..3edf4dccd 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/ArcToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/ArcToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Arc), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ArcToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public ArcToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepToHostTopLevelConverter.cs index a20d9f1c3..d7908ec6d 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Brep), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Brep), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class BrepToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public BrepToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepXToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepXToHostTopLevelConverter.cs index 08f1c6902..d7ba18740 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepXToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/BrepXToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.BrepX), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.BrepX), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class BrepXToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter> { public BrepXToHostTopLevelConverter( @@ -13,7 +13,7 @@ public BrepXToHostTopLevelConverter( : base(settingsStore, geometryBaseConverter) { } } -[NameAndRankValue(nameof(SOG.SubDX), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.SubDX), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class SubDXToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter> { public SubDXToHostTopLevelConverter( @@ -23,7 +23,7 @@ public SubDXToHostTopLevelConverter( : base(settingsStore, geometryBaseConverter) { } } -[NameAndRankValue(nameof(SOG.ExtrusionX), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.ExtrusionX), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ExtrusionXToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter> { diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/CircleToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/CircleToHostTopLevelConverter.cs index 17e60e248..73de699da 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/CircleToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/CircleToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Circle), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CircleToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public CircleToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DataObjectConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DataObjectConverter.cs index cf4b4f935..0db806137 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DataObjectConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DataObjectConverter.cs @@ -7,7 +7,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(DataObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(DataObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class DataObjectConverter : IToHostTopLevelConverter, ITypedConverter> diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DisplayableObjectToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DisplayableObjectToHostTopLevelConverter.cs new file mode 100644 index 000000000..24bde1354 --- /dev/null +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/DisplayableObjectToHostTopLevelConverter.cs @@ -0,0 +1,77 @@ +using Speckle.Converters.Common; +using Speckle.Converters.Common.Objects; +using Speckle.Sdk.Common; +using Speckle.Sdk.Common.Exceptions; +using Speckle.Sdk.Models; + +namespace Speckle.Converters.Rhino.ToHost.TopLevel; + +[NameAndRankValue(typeof(DisplayableObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +public class DisplayableObjectConverter + : IToHostTopLevelConverter, + ITypedConverter> +{ + private readonly ITypedConverter _pointConverter; + private readonly ITypedConverter _lineConverter; + private readonly ITypedConverter _polylineConverter; + private readonly ITypedConverter _arcConverter; + private readonly ITypedConverter _meshConverter; + private readonly IConverterSettingsStore _settingsStore; + + public DisplayableObjectConverter( + ITypedConverter pointConverter, + ITypedConverter lineConverter, + ITypedConverter polylineConverter, + ITypedConverter arcConverter, + ITypedConverter meshConverter, + IConverterSettingsStore settingsStore + ) + { + _pointConverter = pointConverter; + _lineConverter = lineConverter; + _polylineConverter = polylineConverter; + _arcConverter = arcConverter; + _meshConverter = meshConverter; + _settingsStore = settingsStore; + } + + public object Convert(Base target) => Convert((DisplayableObject)target); + + public List<(RG.GeometryBase a, Base b)> Convert(DisplayableObject target) + { + var result = new List(); + foreach (var item in target.displayValue) + { + RG.GeometryBase x = item switch + { + SOG.Line line => _lineConverter.Convert(line), + SOG.Polyline polyline => _polylineConverter.Convert(polyline), + SOG.Arc arc => _arcConverter.Convert(arc), + SOG.Mesh mesh => _meshConverter.Convert(mesh), + SOG.Point point => _pointConverter.Convert(point), + _ => throw new ConversionException($"Found unsupported fallback geometry: {item.GetType()}") + }; + x.Transform(GetUnitsTransform(item)); + result.Add(x); + } + + return result.Zip(target.displayValue, (a, b) => (a, b)).ToList(); + } + + private RG.Transform GetUnitsTransform(Base speckleObject) + { + /* + * POC: CNX-9270 Looking at a simpler, more performant way of doing unit scaling on `ToNative` + * by fully relying on the transform capabilities of the HostApp, and only transforming top-level stuff. + * This may not hold when adding more complex conversions, but it works for now! + */ + if (speckleObject["units"] is string units) + { + var scaleFactor = Units.GetConversionFactor(units, _settingsStore.Current.SpeckleUnits); + var scale = RG.Transform.Scale(RG.Point3d.Origin, scaleFactor); + return scale; + } + + return RG.Transform.Identity; + } +} diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/EllipseToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/EllipseToHostTopLevelConverter.cs index 24851e534..68cf3eab7 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/EllipseToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/EllipseToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Ellipse), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class EllipseToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public EllipseToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/LineToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/LineToHostTopLevelConverter.cs index 315fcd611..411c9fc87 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/LineToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/LineToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Line), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class LineToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public LineToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/MeshToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/MeshToHostTopLevelConverter.cs index db768ad0d..9b56b86e9 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/MeshToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/MeshToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class MeshToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public MeshToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/NurbsCurveToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/NurbsCurveToHostTopLevelConverter.cs index 2c507f6ac..9000b281a 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/NurbsCurveToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/NurbsCurveToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Curve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Curve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class NurbsCurveToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public NurbsCurveToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointCloudToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointCloudToHostTopLevelConverter.cs index 99439d9c2..2f7589290 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointCloudToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointCloudToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Pointcloud), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Pointcloud), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointCloudToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointToHostTopLevelConverter.cs index 2211f8227..3b8b0f841 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PointToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Point), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public PointToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolycurveToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolycurveToHostTopLevelConverter.cs index 7a523999d..84f178e54 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolycurveToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolycurveToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Polycurve), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolycurveToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { public PolycurveToHostTopLevelConverter( diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolylineToHostTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolylineToHostTopLevelConverter.cs index 6323f955a..d8608ad78 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolylineToHostTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToHost/TopLevel/PolylineToHostTopLevelConverter.cs @@ -3,7 +3,7 @@ namespace Speckle.Converters.Rhino.ToHost.TopLevel; -[NameAndRankValue(nameof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SOG.Polyline), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PolylineToHostTopLevelConverter : SpeckleToHostGeometryBaseTopLevelConverter { diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/Raw/MeshToSpeckleConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/Raw/MeshToSpeckleConverter.cs index 54c68c543..b8e36647f 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/Raw/MeshToSpeckleConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/Raw/MeshToSpeckleConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.Raw; -[NameAndRankValue(nameof(RG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(RG.Mesh), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class MeshToSpeckleConverter : ITypedConverter { private readonly ITypedConverter _pointConverter; diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/BrepObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/BrepObjectToSpeckleTopLevelConverter.cs index c79440bfe..1f5b97268 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/BrepObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/BrepObjectToSpeckleTopLevelConverter.cs @@ -7,7 +7,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(BrepObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(BrepObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class BrepObjectToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _meshConverter; diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/CurveObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/CurveObjectToSpeckleTopLevelConverter.cs index 6db96b2bd..cb5266954 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/CurveObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/CurveObjectToSpeckleTopLevelConverter.cs @@ -5,7 +5,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(CurveObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(CurveObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class CurveObjectToSpeckleTopLevelConverter : RhinoObjectToSpeckleTopLevelConverter { public CurveObjectToSpeckleTopLevelConverter(ITypedConverter conversion) diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/ExtrusionObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/ExtrusionObjectToSpeckleTopLevelConverter.cs index 255ed0162..4c5c9abd8 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/ExtrusionObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/ExtrusionObjectToSpeckleTopLevelConverter.cs @@ -7,7 +7,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(ExtrusionObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(ExtrusionObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ExtrusionObjectToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _meshConverter; diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/MeshObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/MeshObjectToSpeckleTopLevelConverter.cs index dc528dab3..92a4675b1 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/MeshObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/MeshObjectToSpeckleTopLevelConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(MeshObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(MeshObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class MeshObjectToSpeckleTopLevelConverter : RhinoObjectToSpeckleTopLevelConverter { public MeshObjectToSpeckleTopLevelConverter(ITypedConverter conversion) diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointCloudObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointCloudObjectToSpeckleTopLevelConverter.cs index a5af1cfaa..e26ac0fd1 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointCloudObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointCloudObjectToSpeckleTopLevelConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(PointCloudObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(PointCloudObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointCloudObjectToSpeckleTopLevelConverter : RhinoObjectToSpeckleTopLevelConverter { diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointObjectToSpeckleTopLevelConverter.cs index 4f480ef2e..3c5493acb 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/PointObjectToSpeckleTopLevelConverter.cs @@ -4,7 +4,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(PointObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(PointObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class PointObjectToSpeckleTopLevelConverter : RhinoObjectToSpeckleTopLevelConverter { diff --git a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/SubDObjectToSpeckleTopLevelConverter.cs b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/SubDObjectToSpeckleTopLevelConverter.cs index f86839467..20669432f 100644 --- a/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/SubDObjectToSpeckleTopLevelConverter.cs +++ b/Converters/Rhino/Speckle.Converters.RhinoShared/ToSpeckle/TopLevel/SubDObjectToSpeckleTopLevelConverter.cs @@ -7,7 +7,7 @@ namespace Speckle.Converters.Rhino.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(SubDObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(SubDObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class SubDObjectToSpeckleTopLevelConverter : IToSpeckleTopLevelConverter { private readonly ITypedConverter _meshConverter; diff --git a/Converters/Tekla/Speckle.Converter.Tekla2023/packages.lock.json b/Converters/Tekla/Speckle.Converter.Tekla2023/packages.lock.json index 2ac6d1096..4a6b6c90c 100644 --- a/Converters/Tekla/Speckle.Converter.Tekla2023/packages.lock.json +++ b/Converters/Tekla/Speckle.Converter.Tekla2023/packages.lock.json @@ -300,7 +300,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -323,18 +323,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -344,14 +344,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" }, "Tekla.Structures.Dialog": { "type": "CentralTransitive", diff --git a/Converters/Tekla/Speckle.Converter.Tekla2024/packages.lock.json b/Converters/Tekla/Speckle.Converter.Tekla2024/packages.lock.json index 862340523..2f5138b6a 100644 --- a/Converters/Tekla/Speckle.Converter.Tekla2024/packages.lock.json +++ b/Converters/Tekla/Speckle.Converter.Tekla2024/packages.lock.json @@ -341,7 +341,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "Microsoft.Extensions.Logging": { @@ -364,18 +364,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -385,14 +385,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" }, "Tekla.Structures.Plugins": { "type": "CentralTransitive", diff --git a/Converters/Tekla/Speckle.Converters.TeklaShared/ToSpeckle/TopLevel/ModelObjectToSpeckleConverter.cs b/Converters/Tekla/Speckle.Converters.TeklaShared/ToSpeckle/TopLevel/ModelObjectToSpeckleConverter.cs index 64ba7bf73..759b70e1a 100644 --- a/Converters/Tekla/Speckle.Converters.TeklaShared/ToSpeckle/TopLevel/ModelObjectToSpeckleConverter.cs +++ b/Converters/Tekla/Speckle.Converters.TeklaShared/ToSpeckle/TopLevel/ModelObjectToSpeckleConverter.cs @@ -7,7 +7,7 @@ namespace Speckle.Converters.TeklaShared.ToSpeckle.TopLevel; -[NameAndRankValue(nameof(TSM.ModelObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] +[NameAndRankValue(typeof(TSM.ModelObject), NameAndRankValueAttribute.SPECKLE_DEFAULT_RANK)] public class ModelObjectToSpeckleConverter : IToSpeckleTopLevelConverter { private readonly IConverterSettingsStore _settingsStore; diff --git a/DUI3/Speckle.Connectors.DUI.Tests/Bridge/IdleCallManagerTests.cs b/DUI3/Speckle.Connectors.DUI.Tests/Bridge/IdleCallManagerTests.cs index ecbb6ebaa..9c8397023 100644 --- a/DUI3/Speckle.Connectors.DUI.Tests/Bridge/IdleCallManagerTests.cs +++ b/DUI3/Speckle.Connectors.DUI.Tests/Bridge/IdleCallManagerTests.cs @@ -56,7 +56,7 @@ public async Task AppOnIdleInternalTest() handler .Setup(m => m.CatchUnhandledAsync(It.IsAny>())) .Callback>(a => a.Invoke()) - .Returns(Task.CompletedTask); + .ReturnsAsync(new Result()); var removeEvent = Create(); removeEvent.Setup(x => x.Invoke()); diff --git a/DUI3/Speckle.Connectors.DUI.Tests/Speckle.Connectors.DUI.Tests.csproj b/DUI3/Speckle.Connectors.DUI.Tests/Speckle.Connectors.DUI.Tests.csproj index 0b607cbe3..b5bbadceb 100644 --- a/DUI3/Speckle.Connectors.DUI.Tests/Speckle.Connectors.DUI.Tests.csproj +++ b/DUI3/Speckle.Connectors.DUI.Tests/Speckle.Connectors.DUI.Tests.csproj @@ -5,12 +5,6 @@ true Debug;Release;Local System.Runtime.CompilerServices.IsExternalInit;System.Runtime.CompilerServices.RequiresLocationAttribute - - - - CA2007; - $(NoWarn) - diff --git a/DUI3/Speckle.Connectors.DUI.Tests/packages.lock.json b/DUI3/Speckle.Connectors.DUI.Tests/packages.lock.json index dcaa45d58..82b409d57 100644 --- a/DUI3/Speckle.Connectors.DUI.Tests/packages.lock.json +++ b/DUI3/Speckle.Connectors.DUI.Tests/packages.lock.json @@ -324,9 +324,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -334,9 +334,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -378,18 +377,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -398,20 +397,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/DUI3/Speckle.Connectors.DUI.WebView/DUI3ControlWebView.xaml.cs b/DUI3/Speckle.Connectors.DUI.WebView/DUI3ControlWebView.xaml.cs index c401a3289..59307e4bb 100644 --- a/DUI3/Speckle.Connectors.DUI.WebView/DUI3ControlWebView.xaml.cs +++ b/DUI3/Speckle.Connectors.DUI.WebView/DUI3ControlWebView.xaml.cs @@ -26,7 +26,7 @@ public DUI3ControlWebView(IServiceProvider serviceProvider) public object BrowserElement => Browser; - public Task ExecuteScriptAsyncMethod(string script, CancellationToken cancellationToken) + public void ExecuteScript(string script) { if (!Browser.IsInitialized) { @@ -39,7 +39,6 @@ public Task ExecuteScriptAsyncMethod(string script, CancellationToken cancellati () => Browser.ExecuteScriptAsync(script), DispatcherPriority.Background ); - return Task.CompletedTask; } private void OnInitialized(object? sender, CoreWebView2InitializationCompletedEventArgs e) diff --git a/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json b/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json index 3cf6575ea..5b3ceecbb 100644 --- a/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json +++ b/DUI3/Speckle.Connectors.DUI.WebView/packages.lock.json @@ -264,9 +264,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -274,9 +274,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -311,18 +310,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -332,20 +331,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, "net6.0-windows7.0": { @@ -572,9 +565,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.dui": { @@ -582,9 +575,8 @@ "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", "Speckle.Connectors.Common": "[1.0.0, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )", - "System.Threading.Tasks.Dataflow": "[6.0.0, )" + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -619,18 +611,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -640,20 +632,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "CentralTransitive", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/IBasicConnectorBinding.cs b/DUI3/Speckle.Connectors.DUI/Bindings/IBasicConnectorBinding.cs index 2677926d4..28a229d6d 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/IBasicConnectorBinding.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/IBasicConnectorBinding.cs @@ -53,8 +53,7 @@ public BasicConnectorBindingCommands(IBrowserBridge bridge) Bridge = bridge; } - public async Task NotifyDocumentChanged() => - await Bridge.Send(NOTIFY_DOCUMENT_CHANGED_EVENT_NAME).ConfigureAwait(false); + public async Task NotifyDocumentChanged() => await Bridge.Send(NOTIFY_DOCUMENT_CHANGED_EVENT_NAME); /// /// Use it whenever you want to send global toast notification to UI. @@ -69,21 +68,17 @@ public async Task SetGlobalNotification( string message, bool autoClose = true ) => - await Bridge - .Send( - SET_GLOBAL_NOTIFICATION, - new - { - type, - title, - description = message, - autoClose - } - ) - .ConfigureAwait(false); + await Bridge.Send( + SET_GLOBAL_NOTIFICATION, + new + { + type, + title, + description = message, + autoClose + } + ); public async Task SetModelError(string modelCardId, Exception error) => - await Bridge - .Send(SET_MODEL_ERROR_UI_COMMAND_NAME, new { modelCardId, error = error.Message }) - .ConfigureAwait(false); + await Bridge.Send(SET_MODEL_ERROR_UI_COMMAND_NAME, new { modelCardId, error = error.Message }); } diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/OperationProgressManager.cs b/DUI3/Speckle.Connectors.DUI/Bindings/OperationProgressManager.cs index 992aaf669..3724eed44 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/OperationProgressManager.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/OperationProgressManager.cs @@ -30,20 +30,18 @@ CancellationToken cancellationToken ) { var progress = new NonUIThreadProgress(args => - bridge.TopLevelExceptionHandler.FireAndForget( - () => - SetModelProgress( - bridge, - modelCardId, - new ModelCardProgress(modelCardId, args.Status, args.Progress), - cancellationToken - ) - ) - ); + { + SetModelProgress( + bridge, + modelCardId, + new ModelCardProgress(modelCardId, args.Status, args.Progress), + cancellationToken + ); + }); return progress; } - public async Task SetModelProgress( + public void SetModelProgress( IBrowserBridge bridge, string modelCardId, ModelCardProgress progress, @@ -60,7 +58,7 @@ CancellationToken cancellationToken t.Item1 = DateTime.Now; s_lastProgressValues[modelCardId] = (t.Item1, progress.Status); // Since it's the first time we get a call for this model card, we should send it out - await SendProgress(bridge, modelCardId, progress).ConfigureAwait(false); + SendProgress(bridge, modelCardId, progress); return; } @@ -72,9 +70,9 @@ CancellationToken cancellationToken return; } s_lastProgressValues[modelCardId] = (currentTime, progress.Status); - await SendProgress(bridge, modelCardId, progress).ConfigureAwait(false); + SendProgress(bridge, modelCardId, progress); } - private static async Task SendProgress(IBrowserBridge bridge, string modelCardId, ModelCardProgress progress) => - await bridge.Send(SET_MODEL_PROGRESS_UI_COMMAND_NAME, new { modelCardId, progress }).ConfigureAwait(false); + private static void SendProgress(IBrowserBridge bridge, string modelCardId, ModelCardProgress progress) => + bridge.Send2(SET_MODEL_PROGRESS_UI_COMMAND_NAME, new { modelCardId, progress }); } diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/ReceiveBindingUICommands.cs b/DUI3/Speckle.Connectors.DUI/Bindings/ReceiveBindingUICommands.cs index 0c7bd3428..2cabe20dd 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/ReceiveBindingUICommands.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/ReceiveBindingUICommands.cs @@ -17,16 +17,14 @@ public async Task SetModelReceiveResult( IEnumerable conversionResults ) { - await Bridge - .Send( - SET_MODEL_RECEIVE_RESULT_UI_COMMAND_NAME, - new - { - ModelCardId = modelCardId, - bakedObjectIds, - conversionResults - } - ) - .ConfigureAwait(false); + await Bridge.Send( + SET_MODEL_RECEIVE_RESULT_UI_COMMAND_NAME, + new + { + ModelCardId = modelCardId, + bakedObjectIds, + conversionResults + } + ); } } diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs b/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs index 72569f5ac..45e3ff23f 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs @@ -12,43 +12,38 @@ public class SendBindingUICommands(IBrowserBridge bridge) : BasicConnectorBindin private const string SET_ID_MAP_COMMAND_NAME = "setIdMap"; // POC.. the only reasons this needs the bridge is to send? realtionship to these messages and the bridge is unclear - public async Task RefreshSendFilters() => - await Bridge.Send(REFRESH_SEND_FILTERS_UI_COMMAND_NAME).ConfigureAwait(false); + public async Task RefreshSendFilters() => await Bridge.Send(REFRESH_SEND_FILTERS_UI_COMMAND_NAME); public async Task SetModelsExpired(IEnumerable expiredModelIds) => - await Bridge.Send(SET_MODELS_EXPIRED_UI_COMMAND_NAME, expiredModelIds).ConfigureAwait(false); + await Bridge.Send(SET_MODELS_EXPIRED_UI_COMMAND_NAME, expiredModelIds); public async Task SetFilterObjectIds( string modelCardId, Dictionary idMap, List newSelectedObjectIds ) => - await Bridge - .Send( - SET_ID_MAP_COMMAND_NAME, - new - { - modelCardId, - idMap, - newSelectedObjectIds - } - ) - .ConfigureAwait(false); + await Bridge.Send( + SET_ID_MAP_COMMAND_NAME, + new + { + modelCardId, + idMap, + newSelectedObjectIds + } + ); public async Task SetModelSendResult( string modelCardId, string versionId, IEnumerable sendConversionResults ) => - await Bridge - .Send( - SET_MODEL_SEND_RESULT_UI_COMMAND_NAME, - new - { - modelCardId, - versionId, - sendConversionResults - } - ) - .ConfigureAwait(false); + await Bridge.Send( + SET_MODEL_SEND_RESULT_UI_COMMAND_NAME, + new + { + modelCardId, + versionId, + sendConversionResults + } + ); } diff --git a/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs b/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs index a5e095fbc..f43a0bd42 100644 --- a/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs +++ b/DUI3/Speckle.Connectors.DUI/Bindings/TestBinding.cs @@ -46,22 +46,20 @@ public async Task TriggerEvent(string eventName) switch (eventName) { case "emptyTestEvent": - await Parent.Send("emptyTestEvent").ConfigureAwait(false); + await Parent.Send("emptyTestEvent"); break; case "testEvent": default: - await Parent - .Send( - "testEvent", - new - { - IsOk = true, - Name = "foo", - Count = 42 - } - ) - .ConfigureAwait(false); + await Parent.Send( + "testEvent", + new + { + IsOk = true, + Name = "foo", + Count = 42 + } + ); break; } } diff --git a/DUI3/Speckle.Connectors.DUI/Bridge/BrowserBridge.cs b/DUI3/Speckle.Connectors.DUI/Bridge/BrowserBridge.cs index 252119ab2..f692e41c3 100644 --- a/DUI3/Speckle.Connectors.DUI/Bridge/BrowserBridge.cs +++ b/DUI3/Speckle.Connectors.DUI/Bridge/BrowserBridge.cs @@ -3,8 +3,8 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.InteropServices; -using System.Threading.Tasks.Dataflow; using Microsoft.Extensions.Logging; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Utils; using Speckle.Newtonsoft.Json; @@ -27,15 +27,14 @@ public sealed class BrowserBridge : IBrowserBridge /// private readonly ConcurrentDictionary _resultsStore = new(); - private readonly SynchronizationContext _mainThreadContext; public ITopLevelExceptionHandler TopLevelExceptionHandler { get; } + private readonly IThreadContext _threadContext; + private readonly IThreadOptions _threadOptions; private readonly IBrowserScriptExecutor _browserScriptExecutor; private readonly IJsonSerializer _jsonSerializer; private IReadOnlyDictionary _bindingMethodCache = new Dictionary(); - - private ActionBlock? _actionBlock; private IBinding? _binding; private Type? _bindingType; @@ -57,26 +56,22 @@ private set } } - private struct RunMethodArgs - { - public string MethodName; - public string RequestId; - public string MethodArgs; - } - public BrowserBridge( + IThreadContext threadContext, IJsonSerializer jsonSerializer, ILogger logger, ILogger topLogger, - IBrowserScriptExecutor browserScriptExecutor + IBrowserScriptExecutor browserScriptExecutor, + IThreadOptions threadOptions ) { + _threadContext = threadContext; _jsonSerializer = jsonSerializer; _logger = logger; TopLevelExceptionHandler = new TopLevelExceptionHandler(topLogger, this); // Capture the main thread's SynchronizationContext - _mainThreadContext = SynchronizationContext.Current.NotNull("No UI thread to capture?"); _browserScriptExecutor = browserScriptExecutor; + _threadOptions = threadOptions; } public void AssociateWithBinding(IBinding binding) @@ -95,30 +90,9 @@ public void AssociateWithBinding(IBinding binding) bindingMethodCache[m.Name] = m; } _bindingMethodCache = bindingMethodCache; - - // Whenever the ui will call run method inside .net, it will post a message to this action block. - // This conveniently executes the code outside the UI thread and does not block during long operations (such as sending). - _actionBlock = new ActionBlock( - OnActionBlock, - new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1000 } - ); - _logger.LogInformation("Bridge bound to front end name {FrontEndName}", binding.Name); } - private async Task OnActionBlock(RunMethodArgs args) - { - Result result = await TopLevelExceptionHandler - .CatchUnhandledAsync(async () => await ExecuteMethod(args.MethodName, args.MethodArgs).ConfigureAwait(false)) - .ConfigureAwait(false); - - string resultJson = result.IsSuccess - ? _jsonSerializer.Serialize(result.Value) - : SerializeFormattedException(result.Exception); - - await NotifyUIMethodCallResultReady(args.RequestId, resultJson).ConfigureAwait(false); - } - /// /// Used by the Frontend bridge logic to understand which methods are available. /// @@ -130,81 +104,27 @@ public string[] GetBindingsMethodNames() return bindingNames; } - /// - /// This method posts the requested call to our action block executor. - /// - /// - /// - /// - public void RunMethod(string methodName, string requestId, string args) - { - TopLevelExceptionHandler.CatchUnhandled(Post); - return; - - void Post() - { - bool wasAccepted = _actionBlock - .NotNull() - .Post( - new RunMethodArgs + //don't wait for browser runs on purpose + public void RunMethod(string methodName, string requestId, string methodArgs) => + _threadContext + .RunOnThreadAsync( + async () => + { + var task = await TopLevelExceptionHandler.CatchUnhandledAsync(async () => + { + var result = await ExecuteMethod(methodName, methodArgs); + string resultJson = _jsonSerializer.Serialize(result); + NotifyUIMethodCallResultReady(requestId, resultJson); + }); + if (task.Exception is not null) { - MethodName = methodName, - RequestId = requestId, - MethodArgs = args + string resultJson = SerializeFormattedException(task.Exception); + NotifyUIMethodCallResultReady(requestId, resultJson); } - ); - if (!wasAccepted) - { - throw new InvalidOperationException($"Action block declined to Post ({methodName} {requestId} {args})"); - } - } - } - - public void RunOnMainThread(Action action) - { - _mainThreadContext.Post( - _ => - { - // Execute the action on the main thread - TopLevelExceptionHandler.CatchUnhandled(action); - }, - null - ); - } - - public async Task RunOnMainThreadAsync(Func action) - { - await RunOnMainThreadAsync(async () => - { - await action.Invoke().ConfigureAwait(false); - return null; - }) - .ConfigureAwait(false); - } - - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "TaskCompletionSource")] - public Task RunOnMainThreadAsync(Func> action) - { - TaskCompletionSource tcs = new(); - - _mainThreadContext.Post( - async _ => - { - try - { - T result = await action.Invoke().ConfigureAwait(false); - tcs.SetResult(result); - } - catch (Exception ex) - { - tcs.SetException(ex); - } - }, - null - ); - - return tcs.Task; - } + }, + _threadOptions.RunCommandsOnMainThread + ) + .FireAndForget(); /// /// Used by the action block to invoke the actual method called by the UI. @@ -266,7 +186,7 @@ public Task RunOnMainThreadAsync(Func> action) } // It's an async call - await resultTypedTask.ConfigureAwait(false); + await resultTypedTask; // If has a "Result" property return the value otherwise null (Task etc) PropertyInfo? resultProperty = resultTypedTask.GetType().GetProperty(nameof(Task.Result)); @@ -296,16 +216,12 @@ private string SerializeFormattedException(Exception e) /// /// /// - /// - private async Task NotifyUIMethodCallResultReady( - string requestId, - string? serializedData = null, - CancellationToken cancellationToken = default - ) + /// + private void NotifyUIMethodCallResultReady(string requestId, string? serializedData = null) { _resultsStore[requestId] = serializedData; string script = $"{FrontendBoundName}.responseReady('{requestId}')"; - await _browserScriptExecutor.ExecuteScriptAsyncMethod(script, cancellationToken).ConfigureAwait(false); + _browserScriptExecutor.ExecuteScript(script); } /// @@ -339,7 +255,7 @@ public void OpenUrl(string url) Process.Start(new ProcessStartInfo { FileName = url, UseShellExecute = true }); } - public async Task Send(string eventName, CancellationToken cancellationToken = default) + public Task Send(string eventName, CancellationToken cancellationToken = default) { if (_binding is null) { @@ -348,10 +264,27 @@ public async Task Send(string eventName, CancellationToken cancellationToken = d var script = $"{FrontendBoundName}.emit('{eventName}')"; - await _browserScriptExecutor.ExecuteScriptAsyncMethod(script, cancellationToken).ConfigureAwait(false); + _browserScriptExecutor.ExecuteScript(script); + return Task.CompletedTask; + } + + public Task Send(string eventName, T data, CancellationToken cancellationToken = default) + where T : class + { + if (_binding is null) + { + throw new InvalidOperationException("Bridge was not initialized with a binding"); + } + + string payload = _jsonSerializer.Serialize(data); + string requestId = $"{Guid.NewGuid()}_{eventName}"; + _resultsStore[requestId] = payload; + var script = $"{FrontendBoundName}.emitResponseReady('{eventName}', '{requestId}')"; + _browserScriptExecutor.ExecuteScript(script); + return Task.CompletedTask; } - public async Task Send(string eventName, T data, CancellationToken cancellationToken = default) + public void Send2(string eventName, T data) where T : class { if (_binding is null) @@ -363,6 +296,6 @@ public async Task Send(string eventName, T data, CancellationToken cancellati string requestId = $"{Guid.NewGuid()}_{eventName}"; _resultsStore[requestId] = payload; var script = $"{FrontendBoundName}.emitResponseReady('{eventName}', '{requestId}')"; - await _browserScriptExecutor.ExecuteScriptAsyncMethod(script, cancellationToken).ConfigureAwait(false); + _browserScriptExecutor.ExecuteScript(script); } } diff --git a/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserBridge.cs b/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserBridge.cs index 7bd772978..65ec766df 100644 --- a/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserBridge.cs +++ b/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserBridge.cs @@ -29,22 +29,6 @@ public interface IBrowserBridge /// public void RunMethod(string methodName, string requestId, string args); - /// - /// Posts an onto the main thread - /// Some applications might need to run some operations on main thread as deferred actions. - /// - /// An awaitable - /// Action to run on the main thread - public Task RunOnMainThreadAsync(Func> action); - - /// - /// Posts an onto the main thread - /// Some applications might need to run some operations on main thread as deferred actions. - /// - /// An awaitable - /// Action to run on the main thread - public Task RunOnMainThreadAsync(Func action); - /// /// Bridge was not initialized with a binding public Task Send(string eventName, CancellationToken cancellationToken = default); @@ -56,5 +40,7 @@ public interface IBrowserBridge public Task Send(string eventName, T data, CancellationToken cancellationToken = default) where T : class; + public void Send2(string eventName, T data) + where T : class; public ITopLevelExceptionHandler TopLevelExceptionHandler { get; } } diff --git a/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserScriptExecutor.cs b/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserScriptExecutor.cs index 6c3fb69f9..c0979f36c 100644 --- a/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserScriptExecutor.cs +++ b/DUI3/Speckle.Connectors.DUI/Bridge/IBrowserScriptExecutor.cs @@ -4,7 +4,7 @@ public interface IBrowserScriptExecutor { /// thrown when is /// The (constant string) script to execute on the browser - public Task ExecuteScriptAsyncMethod(string script, CancellationToken cancellationToken); + public void ExecuteScript(string script); public bool IsBrowserInitialized { get; } diff --git a/DUI3/Speckle.Connectors.DUI/Bridge/IdleCallManager.cs b/DUI3/Speckle.Connectors.DUI/Bridge/IdleCallManager.cs index 0b3e83504..d25c63d42 100644 --- a/DUI3/Speckle.Connectors.DUI/Bridge/IdleCallManager.cs +++ b/DUI3/Speckle.Connectors.DUI/Bridge/IdleCallManager.cs @@ -57,13 +57,13 @@ internal void SubscribeInternal(string id, Func action, Action addEvent) } public void AppOnIdle(Action removeEvent) => - _topLevelExceptionHandler.FireAndForget(async () => await AppOnIdleInternal(removeEvent).ConfigureAwait(false)); + _topLevelExceptionHandler.FireAndForget(async () => await AppOnIdleInternal(removeEvent)); internal async Task AppOnIdleInternal(Action removeEvent) { foreach (KeyValuePair> kvp in Calls) { - await _topLevelExceptionHandler.CatchUnhandledAsync(kvp.Value).ConfigureAwait(false); + await _topLevelExceptionHandler.CatchUnhandledAsync(kvp.Value); } Calls.Clear(); diff --git a/DUI3/Speckle.Connectors.DUI/Bridge/SyncToUIThread.cs b/DUI3/Speckle.Connectors.DUI/Bridge/SyncToUIThread.cs deleted file mode 100644 index bb7bbe0c3..000000000 --- a/DUI3/Speckle.Connectors.DUI/Bridge/SyncToUIThread.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Diagnostics.CodeAnalysis; -using Speckle.Connectors.Common.Operations; - -namespace Speckle.Connectors.DUI.Bridge; - -public class SyncToUIThread : ISyncToThread -{ - private readonly IBrowserBridge _bridge; - - public SyncToUIThread(IBrowserBridge bridge) - { - _bridge = bridge; - } - - [SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Task Completion Source")] - public async Task RunOnThread(Func> func) => - await _bridge.RunOnMainThreadAsync(func).ConfigureAwait(false); -} diff --git a/DUI3/Speckle.Connectors.DUI/Bridge/TopLevelExceptionHandler.cs b/DUI3/Speckle.Connectors.DUI/Bridge/TopLevelExceptionHandler.cs index b8b78ee97..1684e3c81 100644 --- a/DUI3/Speckle.Connectors.DUI/Bridge/TopLevelExceptionHandler.cs +++ b/DUI3/Speckle.Connectors.DUI/Bridge/TopLevelExceptionHandler.cs @@ -58,14 +58,32 @@ public Result CatchUnhandled(Func function) => /// /// A result pattern struct (where exceptions have been handled) - public async Task CatchUnhandledAsync(Func function) + public async Task CatchUnhandledAsync(Func function) { - _ = await CatchUnhandledAsync(async () => + try + { + try + { + await function(); + return new Result(); + } + catch (Exception ex) when (!ex.IsFatal()) { - await function().ConfigureAwait(false); - return null; - }) - .ConfigureAwait(false); + _logger.LogError(ex, UNHANDLED_LOGGER_TEMPLATE); + await SetGlobalNotification( + ToastNotificationType.DANGER, + "Unhandled Exception Occured", + ex.ToFormattedString(), + false + ); + return new(ex); + } + } + catch (Exception ex) + { + _logger.LogCritical(ex, UNHANDLED_LOGGER_TEMPLATE); + throw; + } } /// @@ -75,11 +93,11 @@ public async Task> CatchUnhandledAsync(Func> function) { try { - return new(await function.Invoke().ConfigureAwait(false)); + return new(await function.Invoke()); } catch (Exception ex) when (!ex.IsFatal()) { - await HandleException(ex).ConfigureAwait(false); + await HandleException(ex); return new(ex); } } @@ -97,12 +115,11 @@ private async Task HandleException(Exception ex) try { await SetGlobalNotification( - ToastNotificationType.DANGER, - "Unhandled Exception Occured", - ex.ToFormattedString(), - false - ) - .ConfigureAwait(false); + ToastNotificationType.DANGER, + "Unhandled Exception Occured", + ex.ToFormattedString(), + false + ); } catch (Exception toastEx) { @@ -126,19 +143,17 @@ await SetGlobalNotification( /// In cases where you can use keyword, you should prefer using /// /// - public async void FireAndForget(Func function) => await CatchUnhandledAsync(function).ConfigureAwait(false); + public async void FireAndForget(Func function) => await CatchUnhandledAsync(function); private async Task SetGlobalNotification(ToastNotificationType type, string title, string message, bool autoClose) => - await Parent - .Send( - BasicConnectorBindingCommands.SET_GLOBAL_NOTIFICATION, //TODO: We could move these constants into a DUI3 constants static class - new - { - type, - title, - description = message, - autoClose - } - ) - .ConfigureAwait(false); + await Parent.Send( + BasicConnectorBindingCommands.SET_GLOBAL_NOTIFICATION, //TODO: We could move these constants into a DUI3 constants static class + new + { + type, + title, + description = message, + autoClose + } + ); } diff --git a/DUI3/Speckle.Connectors.DUI/ContainerRegistration.cs b/DUI3/Speckle.Connectors.DUI/ContainerRegistration.cs index 05f78b842..ce594de8a 100644 --- a/DUI3/Speckle.Connectors.DUI/ContainerRegistration.cs +++ b/DUI3/Speckle.Connectors.DUI/ContainerRegistration.cs @@ -1,6 +1,6 @@ using System.Reflection; using Microsoft.Extensions.DependencyInjection; -using Speckle.Connectors.Common.Operations; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.DUI.Bindings; using Speckle.Connectors.DUI.Bridge; using Speckle.Connectors.DUI.Models; @@ -11,22 +11,20 @@ namespace Speckle.Connectors.DUI; public static class ContainerRegistration { - public static void AddDUI(this IServiceCollection serviceCollection) + public static void AddDUI(this IServiceCollection serviceCollection) where TDocumentStore : DocumentModelStore + where TThreadContext : IThreadContext, new() { + // context always newed up on host app's main/ui thread + serviceCollection.AddSingleton(new TThreadContext()); serviceCollection.AddSingleton(); - // send operation and dependencies - serviceCollection.AddSingleton(); serviceCollection.AddTransient(); // POC: Each binding should have it's own bridge instance serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetAssembly(typeof(IdleCallManager))); serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetAssembly(typeof(IServerTransportFactory))); } - public static void UseDUI(this IServiceProvider serviceProvider) => - serviceProvider.GetRequiredService(); - public static void RegisterTopLevelExceptionHandler(this IServiceCollection serviceCollection) { serviceCollection.AddSingleton(sp => diff --git a/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCardProgress.cs b/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCardProgress.cs index 1d2dbdeb7..aff002bd2 100644 --- a/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCardProgress.cs +++ b/DUI3/Speckle.Connectors.DUI/Models/Card/ModelCardProgress.cs @@ -4,4 +4,7 @@ /// Progress value between 0 and 1 to calculate UI progress bar width. /// If it is null it will swooshing on UI. /// -public record ModelCardProgress(string ModelCardId, string Status, double? Progress); +public record ModelCardProgress(string ModelCardId, string Status, double? Progress) +{ + public override string ToString() => $"{ModelCardId} - {Status} - {Progress}"; +} diff --git a/DUI3/Speckle.Connectors.DUI/Speckle.Connectors.DUI.csproj b/DUI3/Speckle.Connectors.DUI/Speckle.Connectors.DUI.csproj index 8f3048e1a..e2909423f 100644 --- a/DUI3/Speckle.Connectors.DUI/Speckle.Connectors.DUI.csproj +++ b/DUI3/Speckle.Connectors.DUI/Speckle.Connectors.DUI.csproj @@ -12,7 +12,6 @@ - diff --git a/DUI3/Speckle.Connectors.DUI/packages.lock.json b/DUI3/Speckle.Connectors.DUI/packages.lock.json index d5873f05b..5a2313abd 100644 --- a/DUI3/Speckle.Connectors.DUI/packages.lock.json +++ b/DUI3/Speckle.Connectors.DUI/packages.lock.json @@ -50,9 +50,9 @@ }, "Speckle.Sdk": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -62,20 +62,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" - }, - "System.Threading.Tasks.Dataflow": { - "type": "Direct", - "requested": "[6.0.0, )", - "resolved": "6.0.0", - "contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" }, "GraphQL.Client": { "type": "Transitive", @@ -320,9 +314,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -351,11 +345,11 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } } } diff --git a/Directory.Build.targets b/Directory.Build.targets deleted file mode 100644 index cabf959a2..000000000 --- a/Directory.Build.targets +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Directory.Packages.props b/Directory.Packages.props index 4ddd08fff..6a648e78a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,5 +1,8 @@ + + + @@ -36,16 +39,15 @@ + - - - + + + - - diff --git a/Importers/Ifc/Speckle.Importers.Ifc.Tester/DummySendCacheManager.cs b/Importers/Ifc/Speckle.Importers.Ifc.Tester/DummySendCacheManager.cs new file mode 100644 index 000000000..10f5d8454 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc.Tester/DummySendCacheManager.cs @@ -0,0 +1,28 @@ +using Speckle.Sdk.SQLite; + +namespace Speckle.Importers.Ifc.Tester; + +public sealed class DummySendCacheManager(Dictionary objects) : ISqLiteJsonCacheManager +{ + public void Dispose() { } + + public IReadOnlyCollection<(string, string)> GetAllObjects() => throw new NotImplementedException(); + + public void DeleteObject(string id) => throw new NotImplementedException(); + + public string? GetObject(string id) => null; + + public void SaveObject(string id, string json) => throw new NotImplementedException(); + + public bool HasObject(string objectId) => false; + + public void SaveObjects(IEnumerable<(string id, string json)> items) + { + foreach (var (id, json) in items) + { + objects[id] = json; + } + } + + public void UpdateObject(string id, string json) => throw new NotImplementedException(); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc.Tester/DummyServerObjectManager.cs b/Importers/Ifc/Speckle.Importers.Ifc.Tester/DummyServerObjectManager.cs new file mode 100644 index 000000000..0adb1a878 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc.Tester/DummyServerObjectManager.cs @@ -0,0 +1,43 @@ +using System.Text; +using Speckle.Sdk.Serialisation.V2; +using Speckle.Sdk.Serialisation.V2.Send; +using Speckle.Sdk.Transports; + +namespace Speckle.Importers.Ifc.Tester; + +public class DummyServerObjectManager : IServerObjectManager +{ + public IAsyncEnumerable<(string, string)> DownloadObjects( + IReadOnlyCollection objectIds, + IProgress? progress, + CancellationToken cancellationToken + ) => throw new NotImplementedException(); + + public Task DownloadSingleObject( + string objectId, + IProgress? progress, + CancellationToken cancellationToken + ) => throw new NotImplementedException(); + + public Task> HasObjects( + IReadOnlyCollection objectIds, + CancellationToken cancellationToken + ) => Task.FromResult(objectIds.ToDictionary(id => id, id => false)); + + public Task UploadObjects( + IReadOnlyList objects, + bool compressPayloads, + IProgress? progress, + CancellationToken cancellationToken + ) + { + long totalBytes = 0; + foreach (var item in objects) + { + totalBytes += Encoding.Default.GetByteCount(item.Json.Value); + } + + progress?.Report(new(ProgressEvent.UploadBytes, totalBytes, totalBytes)); + return Task.CompletedTask; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc.Tester/Program.cs b/Importers/Ifc/Speckle.Importers.Ifc.Tester/Program.cs new file mode 100644 index 000000000..a8d0c4758 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc.Tester/Program.cs @@ -0,0 +1,65 @@ +#pragma warning disable CA1506 +using System.Diagnostics; +using Ara3D.Utils; +//using JetBrains.Profiler.SelfApi; +using Microsoft.Extensions.DependencyInjection; +using Speckle.Importers.Ifc; +using Speckle.Importers.Ifc.Ara3D.IfcParser; +using Speckle.Importers.Ifc.Converters; +using Speckle.Importers.Ifc.Tester; +using Speckle.Importers.Ifc.Types; +using Speckle.Sdk.Serialisation.V2.Send; +using Speckle.Sdk.SQLite; + +var serviceProvider = Import.GetServiceProvider(); + +//DotMemory.Init(); +var filePath = new FilePath( + //"C:\\Users\\adam\\Git\\speckle-server\\packages\\fileimport-service\\ifc-dotnet\\ifcs\\20210221PRIMARK.ifc" + //"C:\\Users\\adam\\Git\\speckle-server\\packages\\fileimport-service\\ifc-dotnet\\ifcs\\231110ADT-FZK-Haus-2005-2006.ifc" + //"C:\\Users\\adam\\Downloads\\T03PV06IMPMI01C.ifc" + "C:\\Users\\adam\\Downloads\\20231128_HW_Bouwkosten.ifc" +); + +var ifcFactory = serviceProvider.GetRequiredService(); +var stopwatch = Stopwatch.StartNew(); + +Console.WriteLine($"Opening with WebIFC: {filePath}"); +var model = ifcFactory.Open(filePath); +var ms = stopwatch.ElapsedMilliseconds; +Console.WriteLine($"Opened with WebIFC: {ms} ms"); + +var graph = IfcGraph.Load(new FilePath(filePath)); +var ms2 = stopwatch.ElapsedMilliseconds; +Console.WriteLine($"Loaded with StepParser: {ms2 - ms} ms"); + +var converter = serviceProvider.GetRequiredService(); +var b = converter.Convert(model, graph); +ms = ms2; +ms2 = stopwatch.ElapsedMilliseconds; +Console.WriteLine($"Converted to Speckle Bases: {ms2 - ms} ms"); + +var cache = $"C:\\Users\\adam\\Git\\temp\\{Guid.NewGuid()}.db"; +using var sqlite = new SqLiteJsonCacheManager($"Data Source={cache};", 2); +using var process2 = new SerializeProcess( + new Progress(true), + sqlite, + new DummyServerObjectManager(), + new BaseChildFinder(new BasePropertyGatherer()), + new ObjectSerializerFactory(new BasePropertyGatherer()), + new SerializeProcessOptions(SkipServer: true) +); +Console.WriteLine($"Caching to Speckle: {cache}"); + +/*var config = new DotMemory.Config(); +config.OpenDotMemory(); +config.SaveToDir("C:\\Users\\adam\\dotTraceSnapshots"); +DotMemory.Attach(config); +DotMemory.GetSnapshot("Before");*/ +var (rootId, _) = await process2.Serialize(b, default).ConfigureAwait(false); +Console.WriteLine(rootId); +ms2 = stopwatch.ElapsedMilliseconds; +Console.WriteLine($"Converted to JSON: {ms2 - ms} ms"); +//DotMemory.GetSnapshot("After"); +//DotMemory.Detach(); +#pragma warning restore CA1506 diff --git a/Importers/Ifc/Speckle.Importers.Ifc.Tester/Progress.cs b/Importers/Ifc/Speckle.Importers.Ifc.Tester/Progress.cs new file mode 100644 index 000000000..0601c31f7 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc.Tester/Progress.cs @@ -0,0 +1,36 @@ +using Speckle.Sdk.Transports; + +namespace Speckle.Importers.Ifc.Tester; + +public class Progress(bool write) : IProgress +{ + private readonly TimeSpan _debounce = TimeSpan.FromMilliseconds(1000); + private DateTime _lastTime = DateTime.UtcNow; + + private long _totalBytes; + + public void Report(ProgressArgs value) + { + if (write) + { + if (value.ProgressEvent == ProgressEvent.DownloadBytes) + { + Interlocked.Add(ref _totalBytes, value.Count); + } + var now = DateTime.UtcNow; + if (now - _lastTime >= _debounce) + { + if (value.ProgressEvent == ProgressEvent.DownloadBytes) + { + Console.WriteLine(value.ProgressEvent + " t " + _totalBytes); + } + else + { + Console.WriteLine(value.ProgressEvent + " c " + value.Count + " t " + value.Total); + } + + _lastTime = now; + } + } + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc.Tester/Speckle.Importers.Ifc.Tester.csproj b/Importers/Ifc/Speckle.Importers.Ifc.Tester/Speckle.Importers.Ifc.Tester.csproj new file mode 100644 index 000000000..17b459a6c --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc.Tester/Speckle.Importers.Ifc.Tester.csproj @@ -0,0 +1,13 @@ + + + + Exe + net8.0 + Debug;Release;Local + + + + + + + diff --git a/Importers/Ifc/Speckle.Importers.Ifc.Tester/packages.lock.json b/Importers/Ifc/Speckle.Importers.Ifc.Tester/packages.lock.json new file mode 100644 index 000000000..13a4b3737 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc.Tester/packages.lock.json @@ -0,0 +1,307 @@ +{ + "version": 2, + "dependencies": { + "net8.0": { + "Microsoft.NETFramework.ReferenceAssemblies": { + "type": "Direct", + "requested": "[1.0.3, )", + "resolved": "1.0.3", + "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", + "dependencies": { + "Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3" + } + }, + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "PolySharp": { + "type": "Direct", + "requested": "[1.14.1, )", + "resolved": "1.14.1", + "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" + }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.6, )", + "resolved": "0.9.6", + "contentHash": "HKH7tYrYYlCK1ct483hgxERAdVdMtl7gUKW9ijWXxA1UsYR4Z+TrRHYmzZ9qmpu1NnTycSrp005NYM78GDKV1w==" + }, + "GraphQL.Client": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0", + "GraphQL.Client.Abstractions.Websocket": "6.0.0", + "System.Reactive": "5.0.0" + } + }, + "GraphQL.Client.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==", + "dependencies": { + "GraphQL.Primitives": "6.0.0" + } + }, + "GraphQL.Client.Abstractions.Websocket": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0" + } + }, + "GraphQL.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA==" + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" + }, + "Microsoft.Data.Sqlite": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==", + "dependencies": { + "Microsoft.Data.Sqlite.Core": "7.0.5", + "SQLitePCLRaw.bundle_e_sqlite3": "2.1.4" + } + }, + "Microsoft.Data.Sqlite.Core": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "Microsoft.Extensions.Configuration": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "nOP8R1mVb/6mZtm2qgAJXn/LFm/2kMjHDAg/QJLFG6CuWYJtaD3p1BwQhufBVvRzL9ceJ/xF0SQ0qsI2GkDQAA==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "2.2.0" + } + }, + "Microsoft.Extensions.Configuration.Abstractions": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "65MrmXCziWaQFrI0UHkQbesrX5wTwf9XPjY5yFm/VkgJKFJ5gqvXRoXjIZcf2wLi5ZlwGz/oMYfyURVCWbM5iw==", + "dependencies": { + "Microsoft.Extensions.Primitives": "2.2.0" + } + }, + "Microsoft.Extensions.Configuration.Binder": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "vJ9xvOZCnUAIHcGC3SU35r3HKmHTVIeHzo6u/qzlHAqD8m6xv92MLin4oJntTvkpKxVX3vI1GFFkIQtU3AdlsQ==", + "dependencies": { + "Microsoft.Extensions.Configuration": "2.2.0" + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "f9hstgjVmr6rmrfGSpfsVOl2irKAgr1QjrSi3FgnS7kulxband50f2brRLwySAQTADPZeTdow0mpSMcoAdadCw==" + }, + "Microsoft.Extensions.Options": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "UpZLNLBpIZ0GTebShui7xXYh6DmBHjWM8NxGxZbdQh/bPZ5e6YswqI+bru6BnEL5eWiOdodsXtEz3FROcgi/qg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", + "Microsoft.Extensions.Primitives": "2.2.0", + "System.ComponentModel.Annotations": "4.5.0" + } + }, + "Microsoft.Extensions.Primitives": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==", + "dependencies": { + "System.Memory": "4.5.1", + "System.Runtime.CompilerServices.Unsafe": "4.5.1" + } + }, + "Microsoft.NETFramework.ReferenceAssemblies.net461": { + "type": "Transitive", + "resolved": "1.0.3", + "contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA==" + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Speckle.DoubleNumerics": { + "type": "Transitive", + "resolved": "4.0.1", + "contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w==" + }, + "Speckle.Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.2", + "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" + }, + "SQLitePCLRaw.bundle_e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==", + "dependencies": { + "SQLitePCLRaw.lib.e_sqlite3": "2.1.4", + "SQLitePCLRaw.provider.e_sqlite3": "2.1.4" + } + }, + "SQLitePCLRaw.core": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==", + "dependencies": { + "System.Memory": "4.5.3" + } + }, + "SQLitePCLRaw.lib.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg==" + }, + "SQLitePCLRaw.provider.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "CSlb5dUp1FMIkez9Iv5EXzpeq7rHryVNqwJMWnpq87j9zWZexaEMdisDktMsnnrzKM6ahNrsTkjqNodTBPBxtQ==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "System.ComponentModel.Annotations": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "UxYQ3FGUOtzJ7LfSdnYSFd7+oEv6M8NgUatatIN2HxNtDdlcvFAf+VIq4Of9cDMJEJC0aSRv/x898RYhB4Yppg==" + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==" + }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==" + }, + "System.Runtime.CompilerServices.Unsafe": { + "type": "Transitive", + "resolved": "4.5.1", + "contentHash": "Zh8t8oqolRaFa9vmOZfdQm/qKejdqz0J9kr7o2Fu0vPeoH3BL1EOXipKWwkWtLT1JPzjByrF19fGuFlNbmPpiw==" + }, + "speckle.importers.ifc": { + "type": "Project", + "dependencies": { + "Ara3D.Buffers": "[1.4.5, )", + "Ara3D.Logging": "[1.4.5, )", + "Ara3D.Utils": "[1.4.5, )", + "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )" + } + }, + "Ara3D.Buffers": { + "type": "CentralTransitive", + "requested": "[1.4.5, )", + "resolved": "1.4.5", + "contentHash": "SKcQqgtXukyHTlTKFPCaUW4spSkue3XfBU/GmoA7KhH6H995v6TbJxtqjs0EfSgnXEkajL8U7X1NqktScRozXw==", + "dependencies": { + "System.Memory": "4.5.5" + } + }, + "Ara3D.Logging": { + "type": "CentralTransitive", + "requested": "[1.4.5, )", + "resolved": "1.4.5", + "contentHash": "7HPCe5Dq21JoOBF1iclk9H37XFCoB2ZzCPqTMNgdg4PWFvuRsofNbiuMdiE/HKgMHCVhy1C5opB2KwDKcO7Axw==", + "dependencies": { + "Ara3D.Utils": "1.4.5" + } + }, + "Ara3D.Utils": { + "type": "CentralTransitive", + "requested": "[1.4.5, )", + "resolved": "1.4.5", + "contentHash": "yba/E7PpbWP0+RDp+KbKw/vBXnXBSIheScdpVKuDnr8ytRg8pZ2Jd6nwKES+G0FcVEB9PeOVmEW7SGrFvAwRCg==" + }, + "Microsoft.Extensions.DependencyInjection": { + "type": "CentralTransitive", + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "MZtBIwfDFork5vfjpJdG5g8wuJFt7d/y3LOSVVtDK/76wlbtz6cjltfKHqLx2TKVqTj5/c41t77m1+h20zqtPA==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0" + } + }, + "Microsoft.Extensions.Logging": { + "type": "CentralTransitive", + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "Nxqhadc9FCmFHzU+fz3oc8sFlE6IadViYg8dfUdGzJZ2JUxnCsRghBhhOWdM4B2zSZqEc+0BjliBh/oNdRZuig==", + "dependencies": { + "Microsoft.Extensions.Configuration.Binder": "2.2.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", + "Microsoft.Extensions.Logging.Abstractions": "2.2.0", + "Microsoft.Extensions.Options": "2.2.0" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "CentralTransitive", + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A==" + }, + "Speckle.Objects": { + "type": "CentralTransitive", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", + "dependencies": { + "Speckle.Sdk": "3.1.0-dev.228" + } + }, + "Speckle.Sdk": { + "type": "CentralTransitive", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", + "dependencies": { + "GraphQL.Client": "6.0.0", + "Microsoft.CSharp": "4.7.0", + "Microsoft.Data.Sqlite": "7.0.5", + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", + "Microsoft.Extensions.Logging": "2.2.0", + "Speckle.DoubleNumerics": "4.0.1", + "Speckle.Newtonsoft.Json": "13.0.2", + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" + } + }, + "Speckle.Sdk.Dependencies": { + "type": "CentralTransitive", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" + } + } + } +} \ No newline at end of file diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/Extensions.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/Extensions.cs new file mode 100644 index 000000000..dc5933a1d --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/Extensions.cs @@ -0,0 +1,197 @@ +using System.Text; +using Ara3D.Buffers; +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +public static class IfcExtensions +{ + public static void Add(this IDictionary> self, TKey key, TValue value) + { + if (!self.ContainsKey(key)) + self[key] = new List(); + self[key].Add(value); + } + + public static uint AsId(this StepValue value) => value is StepUnassigned ? 0u : ((StepId)value).Id; + + public static string AsString(this StepValue value) => + value is StepString ss + ? ss.AsString() + : value is StepNumber sn + ? sn.Value.ToString() + : value is StepId si + ? si.Id.ToString() + : value is StepSymbol ssm + ? ssm.Name.ToString() + : ""; + + public static double AsNumber(this StepValue value) => value is StepUnassigned ? 0 : ((StepNumber)value).Value; + + public static List AsList(this StepValue value) => + value is StepUnassigned ? new List() : ((StepList)value).Values; + + public static List AsIdList(this StepValue value) => + value is StepUnassigned ? new List() : value.AsList().Select(AsId).ToList(); + + // Uses Latin1 encoding (aka ISO-8859-1) + // Extended characters converted using an IFC specific system + public static string AsString(this ByteSpan span) => Encoding.Latin1.GetString(span.ToSpan()).IfcToUnicode(); + + // https://technical.buildingsmart.org/resources/ifcimplementationguidance/string-encoding/ + public static string IfcToUnicode(this string input) + { + if (!input.Contains('\\')) + return input; + + var output = new StringBuilder(); + var i = 0; + var length = input.Length; + while (i < length) + { + if (input[i] != '\\') + { + // Regular character, append to output + output.Append(input[i++]); + continue; + } + + i++; // Move past '\' + if (i >= length) + { + output.Append('\\'); + break; + } + + var escapeChar = input[i++]; + + if (escapeChar == 'S' && i < length && input[i] == '\\') + { + i++; // Move past '\' + if (i < length) + { + var c = input[i++]; + var code = c + 128; + output.Append((char)code); + } + else + { + output.Append("\\S\\"); + } + continue; + } + + if (escapeChar == 'X') + { + if (i < length && input[i] == '\\') + { + // Handle \X\XX escape sequence (8-bit character code) + i++; // Move past '\' + if (i + 1 < length) + { + var hex = input.Substring(i, 2); + i += 2; + var code = Convert.ToInt32(hex, 16); + output.Append((char)code); + } + else + { + output.Append("\\X\\"); + } + + continue; + } + + // Handle extended \Xn\...\X0\ escape sequence + // Skip 'n' until the next '\' + while (i < length && input[i] != '\\') + i++; + if (i < length) + i++; // Move past '\' + + // Collect hex digits until '\X0\' + var hexDigits = new StringBuilder(); + while (i + 3 <= length && input.Substring(i, 3) != "\\X0") + { + hexDigits.Append(input[i++]); + } + + if (i + 3 <= length && input.Substring(i, 3) == "\\X0") + { + i += 3; // Move past '\X0' + if (i < length && input[i] == '\\') + i++; // Move past '\' + + var hexStr = hexDigits.ToString(); + + // Process hex digits in chunks of 4 (representing Unicode code points) + for (var k = 0; k + 4 <= hexStr.Length; k += 4) + { + var codeHex = hexStr.Substring(k, 4); + var code = Convert.ToInt32(codeHex, 16); + output.Append(char.ConvertFromUtf32(code)); + } + continue; + } + + // Invalid format, append as is + output.Append("\\X"); + continue; + } + + // Unrecognized escape sequence, append as is + output.Append('\\').Append(escapeChar); + } + + return output.ToString(); + } + + public static string AsString(this StepString ss) => ss.Value.AsString(); + + public static object? ToJsonObject(this StepValue sv) + { + switch (sv) + { + case StepEntity stepEntity: + { + var attr = stepEntity.Attributes; + if (attr.Values.Count == 0) + return stepEntity.ToString(); + + if (attr.Values.Count == 1) + return attr.Values[0].ToJsonObject(); + + return attr.Values.Select(ToJsonObject).ToList(); + } + + case StepId stepId: + return stepId.Id; + + case StepList stepList: + return stepList.Values.Select(ToJsonObject).ToList(); + + case StepNumber stepNumber: + return stepNumber.AsNumber(); + + case StepRedeclared stepRedeclared: + return null; + + case StepString stepString: + return stepString.AsString(); + + case StepSymbol stepSymbol: + var tmp = stepSymbol.Name.AsString(); + if (tmp == "T") + return true; + if (tmp == "F") + return false; + return tmp; + + case StepUnassigned stepUnassigned: + return null; + + default: + throw new ArgumentOutOfRangeException(nameof(sv)); + } + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcEntity.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcEntity.cs new file mode 100644 index 000000000..899daa146 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcEntity.cs @@ -0,0 +1,65 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +/// +/// It represents an entity definition. It is usually a single line in a STEP file. +/// Many entity definitions are derived from IfcRoot (including relations). +/// IfcRoot has a GUID, OwnerId, optional Name, and optional Description +/// https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifckernel/lexical/ifcroot.htm +/// +public class IfcEntity +{ + public StepInstance LineData { get; } + public IfcGraph Graph { get; } + public uint Id => LineData.Id; + public string Type => LineData?.EntityType ?? ""; + + public IfcEntity(IfcGraph graph, StepInstance lineData) + { + Graph = graph; + LineData = lineData; + } + + public override bool Equals(object? obj) + { + if (obj is IfcEntity other) + return Id == other.Id; + return false; + } + + public override int GetHashCode() => (int)Id; + + public override string ToString() => $"{Type}#{Id}"; + + public bool IsIfcRoot => Count >= 4 && this[0] is StepString && (this[1] is StepId) || (this[1] is StepUnassigned); + + // Modern IFC files conform to this, but older ones have been observed to have different length IDs. + // Leaving as a comment for now. + //&& str.Value.Length == 22; + + public string? Guid => IsIfcRoot ? (this[0] as StepString)?.Value.ToString() : null; + + public uint OwnerId => IsIfcRoot ? (this[1] as StepId)?.Id ?? 0 : 0; + + public string? Name => IsIfcRoot ? (this[2] as StepString)?.AsString() : null; + + public string? Description => IsIfcRoot ? (this[3] as StepString)?.AsString() : null; + + public int Count => LineData.Count; + + public StepValue this[int i] => LineData[i]; + + public IReadOnlyList GetOutgoingRelations() => Graph.GetRelationsFrom(Id); + + public IEnumerable GetAggregatedChildren() => + GetOutgoingRelations().OfType().SelectMany(r => r.GetRelatedNodes()); + + public IEnumerable GetSpatialChildren() => + GetOutgoingRelations().OfType().SelectMany(r => r.GetRelatedNodes()); + + public IEnumerable GetChildren() => GetAggregatedChildren().Concat(GetSpatialChildren()); + + public IReadOnlyList GetPropSets() => + Graph.PropertySetsByNode.TryGetValue(Id, out var list) ? list : Array.Empty(); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcGraph.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcGraph.cs new file mode 100644 index 000000000..1f2664e6d --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcGraph.cs @@ -0,0 +1,232 @@ +using System.Diagnostics; +using Ara3D.Logging; +using Ara3D.Utils; +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +/// +/// This is a high-level representation of an IFC model as a graph of nodes and relations. +/// It also contains the properties, and property sets. +/// +public class IfcGraph +{ + public static IfcGraph Load(FilePath fp, ILogger? logger = null) => + new IfcGraph(new StepDocument(fp, logger), logger); + + public StepDocument Document { get; } + + public Dictionary Nodes { get; } = new Dictionary(); + public List Relations { get; } = new List(); + public Dictionary> RelationsByNode { get; } = new Dictionary>(); + public Dictionary> PropertySetsByNode { get; } = new Dictionary>(); + + public IReadOnlyList RootIds { get; } + + public IfcNode AddNode(IfcNode n) => Nodes[n.Id] = n; + + public IfcRelation AddRelation(IfcRelation r) + { + Relations.Add(r); + RelationsByNode.Add(r.From.Id, r); + return r; + } + + public IfcGraph(StepDocument d, ILogger? logger = null) + { + Document = d; + + logger?.Log("Computing entities"); + foreach (var inst in Document.RawInstances) + { + if (!inst.IsValid()) + continue; + + // TODO: converting entities into numerical hashes would likely improve performance significantly. + // Here we are doing a lot of comparisons. + + // Property Values + if (inst.Type.Equals("IFCPROPERTYSINGLEVALUE")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[2])); + } + else if (inst.Type.Equals("IFCPROPERTYENUMERATEDVALUE")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[2])); + } + else if (inst.Type.Equals("IFCPROPERTYREFERENCEVALUE")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCPROPERTYLISTVALUE")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[2])); + } + else if (inst.Type.Equals("IFCCOMPLEXPROPERTY")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + // Quantities which are a treated as a kind of prop + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcphysicalquantity.htm + else if (inst.Type.Equals("IFCQUANTITYLENGTH")) + { + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcquantitylength.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCQUANTITYAREA")) + { + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcquantityarea.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCQUANTITYVOLUME")) + { + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcquantityvolume.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCQUANTITYCOUNT")) + { + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcquantitycount.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCQUANTITYWEIGHT")) + { + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcquantityweight.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCQUANTITYTIME")) + { + // https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcquantitytime.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[3])); + } + else if (inst.Type.Equals("IFCPHYSICALCOMPLEXQUANTITY")) + { + //https://iaiweb.lbl.gov/Resources/IFC_Releases/R2x3_final/ifcquantityresource/lexical/ifcphysicalcomplexquantity.htm + var e = d.GetInstanceWithData(inst); + AddNode(new IfcProp(this, e, e[2])); + } + // Property Set (or element quantity) + else if (inst.Type.Equals("IFCPROPERTYSET")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcPropSet(this, e, (StepList)e[4])); + } + else if (inst.Type.Equals("IFCELEMENTQUANTITY")) + { + var e = d.GetInstanceWithData(inst); + AddNode(new IfcPropSet(this, e, (StepList)e[5])); + } + // Aggregate relation + else if (inst.Type.Equals("IFCRELAGGREGATES")) + { + var e = d.GetInstanceWithData(inst); + AddRelation(new IfcRelationAggregate(this, e, (StepId)e[4], (StepList)e[5])); + } + // Spatial relation + else if (inst.Type.Equals("IFCRELCONTAINEDINSPATIALSTRUCTURE")) + { + var e = d.GetInstanceWithData(inst); + AddRelation(new IfcRelationSpatial(this, e, (StepId)e[5], (StepList)e[4])); + } + // Property set relations + else if (inst.Type.Equals("IFCRELDEFINESBYPROPERTIES")) + { + var e = d.GetInstanceWithData(inst); + AddRelation(new IfcPropSetRelation(this, e, (StepId)e[5], (StepList)e[4])); + } + // Type relations + else if (inst.Type.Equals("IFCRELDEFINESBYTYPE")) + { + var e = d.GetInstanceWithData(inst); + AddRelation(new IfcRelationType(this, e, (StepId)e[5], (StepList)e[4])); + } + // Everything else + else + { + // Simple IFC node: without step entity data. + var e = d.GetInstanceWithData(inst); + AddNode(new IfcNode(this, e)); + } + } + + logger?.Log("Retrieving the roots of all of the spatial relationship"); + RootIds = GetSpatialRelations().Where(r => r.From != null).Select(r => r.From.Id).Distinct().ToList(); + + logger?.Log("Creating lookup of property sets"); + + foreach (var psr in Relations.OfType()) + { + var ps = psr.PropSet; + foreach (var id in psr.GetRelatedIds()) + { + PropertySetsByNode.Add(id, ps); + } + } + + logger?.Log("Completed creating model graph"); + } + + public IEnumerable GetNodes() => Nodes.Values; + + public IEnumerable GetNodes(IEnumerable ids) => ids.Select(GetNode); + + public IfcNode GetOrCreateNode(StepInstance lineData, int arg) + { + if (arg < 0 || arg >= lineData.AttributeValues.Count) + throw new SpeckleIfcException("Argument index out of range"); + return GetOrCreateNode(lineData.AttributeValues[arg]); + } + + public IfcNode GetOrCreateNode(StepValue o) => + GetOrCreateNode(o is StepId id ? id.Id : throw new SpeckleIfcException($"Expected a StepId value, not {o}")); + + public IfcNode GetOrCreateNode(uint id) + { + var r = Nodes.TryGetValue(id, out var node) ? node : AddNode(new IfcNode(this, Document.GetInstanceWithData(id))); + Debug.Assert(r.Id == id); + return r; + } + + public List GetOrCreateNodes(List list) => list.Select(GetOrCreateNode).ToList(); + + public List GetOrCreateNodes(StepInstance line, int arg) + { + if (arg < 0 || arg >= line.AttributeValues.Count) + throw new SpeckleIfcException("Argument out of range"); + if (line.AttributeValues[arg] is not StepList agg) + throw new SpeckleIfcException("Expected a list"); + return GetOrCreateNodes(agg.Values); + } + + public IfcNode GetNode(StepId id) => GetNode(id.Id); + + public IfcNode GetNode(uint id) + { + var r = Nodes[id]; + Debug.Assert(r.Id == id); + return r; + } + + public IEnumerable GetSources() => RootIds.Select(GetNode); + + public IEnumerable GetPropSets() => GetNodes().OfType(); + + public IEnumerable GetProps() => GetNodes().OfType(); + + public IEnumerable GetSpatialRelations() => Relations.OfType(); + + public IEnumerable GetAggregateRelations() => Relations.OfType(); + + public IReadOnlyList GetRelationsFrom(uint id) => + RelationsByNode.TryGetValue(id, out var list) ? list : Array.Empty(); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcNode.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcNode.cs new file mode 100644 index 000000000..36b333f61 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcNode.cs @@ -0,0 +1,9 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +public class IfcNode : IfcEntity +{ + public IfcNode(IfcGraph graph, StepInstance lineData) + : base(graph, lineData) { } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcProp.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcProp.cs new file mode 100644 index 000000000..575c3894b --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcProp.cs @@ -0,0 +1,21 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +public class IfcProp : IfcNode +{ + public readonly StepValue Value; + + public new string Name => this[0].AsString(); + public new string Description => this[1].AsString(); + + public IfcProp(IfcGraph graph, StepInstance lineData, StepValue value) + : base(graph, lineData) + { + if (lineData.Count < 2) + throw new SpeckleIfcException("Expected at least two values in the line data"); + if (lineData[0] is not StepString) + throw new SpeckleIfcException("Expected the first value to be a string (Name)"); + Value = value; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcPropSet.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcPropSet.cs new file mode 100644 index 000000000..cd388a77d --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcPropSet.cs @@ -0,0 +1,42 @@ +using System.Diagnostics; +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +// This merges two separate entity types: IfcPropertySet and IfcElementQuantity. +// Both of which are derived from IfcPropertySetDefinition. +// This is something that can be referred to by a PropertySetRelation +// An IfcElementQuantity has an additional "method of measurement" property. +// https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifckernel/lexical/ifcpropertyset.htm +// https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcproductextension/lexical/ifcelementquantity.htm +public class IfcPropSet : IfcNode +{ + public readonly StepList PropertyIdList; + + public IfcPropSet(IfcGraph graph, StepInstance lineData, StepList propertyIdList) + : base(graph, lineData) + { + Debug.Assert(IsIfcRoot); + Debug.Assert(lineData.AttributeValues.Count is 5 or 6); + Debug.Assert(Type is "IFCPROPERTYSET" or "IFCELEMENTQUANTITY"); + PropertyIdList = propertyIdList; + } + + public IEnumerable GetProperties() + { + for (var i = 0; i < NumProperties; ++i) + { + var id = PropertyId(i); + var node = Graph.GetNode(id); + if (node is not IfcProp prop) + throw new SpeckleIfcException($"Expected a property not {node} from id {id}"); + yield return prop; + } + } + + public bool IsQuantity => LineData.AttributeValues.Count == 6; + public string? MethodOfMeasurement => IsQuantity ? this[4]?.AsString() : null; + public int NumProperties => PropertyIdList.Values.Count; + + public uint PropertyId(int i) => PropertyIdList.Values[i].AsId(); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcPropSetRelation.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcPropSetRelation.cs new file mode 100644 index 000000000..13c30b0f5 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcPropSetRelation.cs @@ -0,0 +1,21 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +// https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifckernel/lexical/ifcreldefinesbyproperties.htm +public class IfcPropSetRelation : IfcRelation +{ + public IfcPropSetRelation(IfcGraph graph, StepInstance lineData, StepId from, StepList to) + : base(graph, lineData, from, to) { } + + public IfcPropSet PropSet + { + get + { + var node = Graph.GetNode(From); + if (node is not IfcPropSet r) + throw new SpeckleIfcException($"Expected a property set not {node} from id {From}"); + return r; + } + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelation.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelation.cs new file mode 100644 index 000000000..276b7cf97 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelation.cs @@ -0,0 +1,25 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +/// +/// Always express a 1-to-many relation +/// +public class IfcRelation : IfcEntity +{ + public StepId From { get; } + public StepList To { get; } + + public IfcRelation(IfcGraph graph, StepInstance lineData, StepId from, StepList to) + : base(graph, lineData) + { + if (!IsIfcRoot) + throw new SpeckleIfcException("Expected relation to be an IFC root entity"); + From = from; + To = to; + } + + public IEnumerable GetRelatedIds() => To.Values.Select(v => v.AsId()); + + public IEnumerable GetRelatedNodes() => Graph.GetNodes(GetRelatedIds()); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationAggregate.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationAggregate.cs new file mode 100644 index 000000000..5b826a1a0 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationAggregate.cs @@ -0,0 +1,9 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +public class IfcRelationAggregate : IfcRelation +{ + public IfcRelationAggregate(IfcGraph graph, StepInstance lineData, StepId from, StepList to) + : base(graph, lineData, from, to) { } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationSpatial.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationSpatial.cs new file mode 100644 index 000000000..1509d0ae0 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationSpatial.cs @@ -0,0 +1,9 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +public class IfcRelationSpatial : IfcRelation +{ + public IfcRelationSpatial(IfcGraph graph, StepInstance lineData, StepId from, StepList to) + : base(graph, lineData, from, to) { } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationType.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationType.cs new file mode 100644 index 000000000..f049e1b55 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.IfcParser/IfcRelationType.cs @@ -0,0 +1,9 @@ +using Speckle.Importers.Ifc.Ara3D.StepParser; + +namespace Speckle.Importers.Ifc.Ara3D.IfcParser; + +public class IfcRelationType : IfcRelation +{ + public IfcRelationType(IfcGraph graph, StepInstance lineData, StepId from, StepList to) + : base(graph, lineData, from, to) { } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/AlignedMemoryReader.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/AlignedMemoryReader.cs new file mode 100644 index 000000000..2d61b9a9f --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/AlignedMemoryReader.cs @@ -0,0 +1,31 @@ +using System.Diagnostics; +using Ara3D.Buffers; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public static class AlignedMemoryReader +{ + public static unsafe AlignedMemory ReadAllBytes(string path, int bufferSize = 1024 * 1024) + { + using var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, bufferSize, false); + var fileLength = fs.Length; + if (fileLength > int.MaxValue) + throw new IOException("File too big: > 2GB"); + + var count = (int)fileLength; + var r = new AlignedMemory(count); + var pBytes = r.BytePtr; + while (count > 0) + { + var span = new Span(pBytes, count); + var n = fs.Read(span); + if (n == 0) + break; + pBytes += n; + count -= n; + } + + Debug.Assert(count == 0); + return r; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/ByteSpanExtensions.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/ByteSpanExtensions.cs new file mode 100644 index 000000000..60bccc81a --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/ByteSpanExtensions.cs @@ -0,0 +1,13 @@ +using System.Runtime.CompilerServices; +using Ara3D.Buffers; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public static class ByteSpanExtensions +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static double ToDouble(this ByteSpan self) => double.Parse(self.ToSpan()); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static int ToInt(this ByteSpan self) => int.Parse(self.ToSpan()); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepDocument.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepDocument.cs new file mode 100644 index 000000000..e56a490d3 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepDocument.cs @@ -0,0 +1,102 @@ +using System.Runtime.Intrinsics; +using Ara3D.Buffers; +using Ara3D.Logging; +using Ara3D.Utils; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public sealed unsafe class StepDocument : IDisposable +{ + public readonly FilePath FilePath; + public readonly byte* DataStart; + public readonly byte* DataEnd; + public readonly AlignedMemory Data; + + /// + /// This is a list of raw step instance information. + /// Each one has only a type and an ID. + /// + public readonly StepRawInstance[] RawInstances; + + /// + /// The number of raw instance + /// + public readonly int NumRawInstances; + + /// + /// This gives us a fast way to look up a StepInstance by their ID + /// + public readonly Dictionary InstanceIdToIndex = new(); + + /// + /// This tells us the byte offset of the start of each line in the file + /// + public readonly List LineOffsets; + + public StepDocument(FilePath filePath, ILogger? logger = null) + { + FilePath = filePath; + logger ??= Logger.Null; + + logger.Log($"Loading {filePath.GetFileSizeAsString()} of data from {filePath.GetFileName()}"); + Data = AlignedMemoryReader.ReadAllBytes(filePath); + DataStart = Data.BytePtr; + DataEnd = DataStart + Data.NumBytes; + + logger.Log($"Computing the start of each line"); + // NOTE: this estimates that the average line length is at least 32 characters. + // This minimize the number of allocations that happen + var cap = Data.NumBytes / 32; + LineOffsets = new List(cap); + + // We are going to report the beginning of the lines, while the "ComputeLines" function + // will compute the ends of lines. + var currentLine = 1; + for (var i = 0; i < Data.NumVectors; i++) + { + StepLineParser.ComputeOffsets(((Vector256*)Data.BytePtr)[i], ref currentLine, LineOffsets); + } + + logger.Log($"Found {LineOffsets.Count} lines"); + + logger.Log($"Creating instance records"); + RawInstances = new StepRawInstance[LineOffsets.Count]; + + for (var i = 0; i < LineOffsets.Count - 1; i++) + { + var lineStart = LineOffsets[i]; + var lineEnd = LineOffsets[i + 1]; + var inst = StepLineParser.ParseLine(DataStart + lineStart, DataStart + lineEnd); + if (inst.IsValid()) + { + InstanceIdToIndex.Add(inst.Id, NumRawInstances); + RawInstances[NumRawInstances++] = inst; + } + } + + logger.Log($"Completed creation of STEP document from {filePath.GetFileName()}"); + } + + public void Dispose() => Data.Dispose(); + + public StepInstance GetInstanceWithData(uint id) => GetInstanceWithDataFromIndex(InstanceIdToIndex[id]); + + public StepInstance GetInstanceWithDataFromIndex(int index) => GetInstanceWithData(RawInstances[index]); + + public StepInstance GetInstanceWithData(StepRawInstance inst) + { + var attr = inst.GetAttributes(DataEnd); + var se = new StepEntity(inst.Type, attr); + return new StepInstance(inst.Id, se); + } + + public static StepDocument Create(FilePath fp) => new(fp); + + public IEnumerable GetRawInstances(string typeCode) => + RawInstances.Where(inst => inst.Type.Equals(typeCode)); + + public IEnumerable GetInstances() => RawInstances.Select(GetInstanceWithData); + + public IEnumerable GetInstances(string typeCode) => + GetRawInstances(typeCode).Select(GetInstanceWithData); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepFactory.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepFactory.cs new file mode 100644 index 000000000..e7cb5bbab --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepFactory.cs @@ -0,0 +1,90 @@ +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public static unsafe class StepFactory +{ + public static StepList GetAttributes(this StepRawInstance inst, byte* lineEnd) + { + if (!inst.IsValid()) + return StepList.CreateDefault(); + var ptr = inst.Type.End(); + var token = StepTokenizer.ParseToken(ptr, lineEnd); + // TODO: there is a potential bug here when the line is split across multiple line + return CreateAggregate(ref token, lineEnd); + } + + public static StepValue Create(ref StepToken token, byte* end) + { + switch (token.Type) + { + case StepTokenType.String: + return StepString.Create(token); + + case StepTokenType.Symbol: + return StepSymbol.Create(token); + + case StepTokenType.Id: + return StepId.Create(token); + + case StepTokenType.Redeclared: + return StepRedeclared.Create(token); + + case StepTokenType.Unassigned: + return StepUnassigned.Create(token); + + case StepTokenType.Number: + return StepNumber.Create(token); + + case StepTokenType.Ident: + var span = token.Span; + StepTokenizer.ParseNextToken(ref token, end); + var attr = CreateAggregate(ref token, end); + return new StepEntity(span, attr); + + case StepTokenType.BeginGroup: + return CreateAggregate(ref token, end); + + case StepTokenType.None: + case StepTokenType.Whitespace: + case StepTokenType.Comment: + case StepTokenType.Unknown: + case StepTokenType.LineBreak: + case StepTokenType.EndOfLine: + case StepTokenType.Definition: + case StepTokenType.Separator: + case StepTokenType.EndGroup: + default: + throw new SpeckleIfcException($"Cannot convert token type {token.Type} to a StepValue"); + } + } + + public static StepList CreateAggregate(ref StepToken token, byte* end) + { + var values = new List(); + StepTokenizer.EatWSpace(ref token, end); + if (token.Type != StepTokenType.BeginGroup) + throw new SpeckleIfcException("Expected '('"); + + while (StepTokenizer.ParseNextToken(ref token, end)) + { + switch (token.Type) + { + // Advance past comments, whitespace, and commas + case StepTokenType.Comment: + case StepTokenType.Whitespace: + case StepTokenType.LineBreak: + case StepTokenType.Separator: + case StepTokenType.None: + continue; + + // Expected end of group + case StepTokenType.EndGroup: + return new StepList(values); + } + + var curValue = Create(ref token, end); + values.Add(curValue); + } + + throw new SpeckleIfcException("Unexpected end of input"); + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepGraph.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepGraph.cs new file mode 100644 index 000000000..dd45cba98 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepGraph.cs @@ -0,0 +1,59 @@ +using Ara3D.Utils; +using Speckle.Sdk.Common; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public class StepGraph +{ + public StepDocument Document { get; } + + public readonly Dictionary Lookup = new(); + + public StepNode GetNode(uint id) => Lookup[id]; + + public IEnumerable Nodes => Lookup.Values; + + public StepGraph(StepDocument doc) + { + Document = doc; + + foreach (var e in doc.GetInstances()) + { + var node = new StepNode(this, e); + Lookup.Add(node.Entity.Id, node); + } + + foreach (var n in Nodes) + n.Init(); + } + + public static StepGraph Create(StepDocument doc) => new(doc); + + public string ToValString(StepNode node, int depth) => ToValString(node.Entity.Entity, depth - 1); + + public string ToValString(StepValue value, int depth) + { + if (value == null) + return ""; + + switch (value) + { + case StepList stepAggregate: + return $"({stepAggregate.Values.Select(v => ToValString(v, depth)).JoinStringsWithComma()})"; + + case StepEntity stepEntity: + return $"{stepEntity.EntityType}{ToValString(stepEntity.Attributes, depth)}"; + + case StepId stepId: + return depth <= 0 ? "#" : ToValString(GetNode(stepId.Id), depth - 1); + + case StepNumber stepNumber: + case StepRedeclared stepRedeclared: + case StepString stepString: + case StepSymbol stepSymbol: + case StepUnassigned stepUnassigned: + default: + return value.ToString().NotNull(); + } + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepInstance.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepInstance.cs new file mode 100644 index 000000000..8d405acc5 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepInstance.cs @@ -0,0 +1,25 @@ +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public class StepInstance +{ + public readonly StepEntity Entity; + public readonly uint Id; + + public List AttributeValues => Entity.Attributes.Values; + + public string EntityType => Entity?.EntityType.ToString() ?? ""; + + public StepInstance(uint id, StepEntity entity) + { + Id = id; + Entity = entity; + } + + public bool IsEntityType(string str) => EntityType == str; + + public override string ToString() => $"#{Id}={Entity};"; + + public int Count => AttributeValues.Count; + + public StepValue this[int i] => AttributeValues[i]; +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepLineParser.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepLineParser.cs new file mode 100644 index 000000000..48316abfe --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepLineParser.cs @@ -0,0 +1,151 @@ +using System.Runtime.CompilerServices; +using System.Runtime.Intrinsics; +using System.Runtime.Intrinsics.X86; +using Ara3D.Buffers; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public static class StepLineParser +{ + public static readonly Vector256 Comma = Vector256.Create((byte)','); + public static readonly Vector256 NewLine = Vector256.Create((byte)'\n'); + public static readonly Vector256 StartGroup = Vector256.Create((byte)'('); + public static readonly Vector256 EndGroup = Vector256.Create((byte)')'); + public static readonly Vector256 Definition = Vector256.Create((byte)'='); + public static readonly Vector256 Quote = Vector256.Create((byte)'\''); + public static readonly Vector256 Id = Vector256.Create((byte)'#'); + public static readonly Vector256 SemiColon = Vector256.Create((byte)';'); + public static readonly Vector256 Unassigned = Vector256.Create((byte)'*'); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static void ComputeOffsets(in Vector256 v, ref int index, List offsets) + { + var r = Avx2.CompareEqual(v, NewLine); + var mask = (uint)Avx2.MoveMask(r); + if (mask == 0) + { + index += 32; + return; + } + + // Fully unrolled handling of each bit + if ((mask & 0x00000001) != 0) + offsets.Add(index); + if ((mask & 0x00000002) != 0) + offsets.Add(index + 1); + if ((mask & 0x00000004) != 0) + offsets.Add(index + 2); + if ((mask & 0x00000008) != 0) + offsets.Add(index + 3); + if ((mask & 0x00000010) != 0) + offsets.Add(index + 4); + if ((mask & 0x00000020) != 0) + offsets.Add(index + 5); + if ((mask & 0x00000040) != 0) + offsets.Add(index + 6); + if ((mask & 0x00000080) != 0) + offsets.Add(index + 7); + if ((mask & 0x00000100) != 0) + offsets.Add(index + 8); + if ((mask & 0x00000200) != 0) + offsets.Add(index + 9); + if ((mask & 0x00000400) != 0) + offsets.Add(index + 10); + if ((mask & 0x00000800) != 0) + offsets.Add(index + 11); + if ((mask & 0x00001000) != 0) + offsets.Add(index + 12); + if ((mask & 0x00002000) != 0) + offsets.Add(index + 13); + if ((mask & 0x00004000) != 0) + offsets.Add(index + 14); + if ((mask & 0x00008000) != 0) + offsets.Add(index + 15); + if ((mask & 0x00010000) != 0) + offsets.Add(index + 16); + if ((mask & 0x00020000) != 0) + offsets.Add(index + 17); + if ((mask & 0x00040000) != 0) + offsets.Add(index + 18); + if ((mask & 0x00080000) != 0) + offsets.Add(index + 19); + if ((mask & 0x00100000) != 0) + offsets.Add(index + 20); + if ((mask & 0x00200000) != 0) + offsets.Add(index + 21); + if ((mask & 0x00400000) != 0) + offsets.Add(index + 22); + if ((mask & 0x00800000) != 0) + offsets.Add(index + 23); + if ((mask & 0x01000000) != 0) + offsets.Add(index + 24); + if ((mask & 0x02000000) != 0) + offsets.Add(index + 25); + if ((mask & 0x04000000) != 0) + offsets.Add(index + 26); + if ((mask & 0x08000000) != 0) + offsets.Add(index + 27); + if ((mask & 0x10000000) != 0) + offsets.Add(index + 28); + if ((mask & 0x20000000) != 0) + offsets.Add(index + 29); + if ((mask & 0x40000000) != 0) + offsets.Add(index + 30); + if ((mask & 0x80000000) != 0) + offsets.Add(index + 31); + + // Update lineIndex to the next starting position + index += 32; + } + + public static unsafe StepRawInstance ParseLine(byte* ptr, byte* end) + { + var start = ptr; + var cnt = end - ptr; + const int MIN_LINE_LENGTH = 5; + if (cnt < MIN_LINE_LENGTH) + return default; + + // Parse the ID + if (*ptr++ != '#') + return default; + + var id = 0u; + while (ptr < end) + { + if (*ptr < '0' || *ptr > '9') + break; + id = id * 10 + *ptr - '0'; + ptr++; + } + + var foundEquals = false; + while (ptr < end) + { + if (*ptr == '=') + foundEquals = true; + + if (*ptr != (byte)' ' && *ptr != (byte)'=') + break; + + ptr++; + } + + if (!foundEquals) + return default; + + // Parse the entity type name + var entityStart = ptr; + while (ptr < end) + { + if (!StepTokenizer.IsIdentLookup[*ptr]) + break; + ptr++; + } + if (ptr == entityStart) + return default; + + var entityType = new ByteSpan(entityStart, ptr); + return new(id, entityType, start); + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepNode.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepNode.cs new file mode 100644 index 000000000..c23188c7a --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepNode.cs @@ -0,0 +1,52 @@ +using Ara3D.Utils; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public class StepNode +{ + public readonly StepGraph Graph; + public readonly StepInstance Entity; + + public StepNode(StepGraph g, StepInstance e) + { + Graph = g; + Entity = e; + } + + public List Nodes { get; } = new(); + + private void AddNodes(StepValue value) + { + if (value is StepId id) + { + var n = Graph.GetNode(id.Id); + Nodes.Add(n); + } + else if (value is StepList agg) + { + foreach (var v in agg.Values) + AddNodes(v); + } + } + + public void Init() + { + foreach (var a in Entity.AttributeValues) + AddNodes(a); + } + + public override string ToString() => Entity.ToString(); + + public string ToGraph(HashSet? prev = null) + { + prev ??= new HashSet(); + if (prev.Contains(this)) + return "_"; + var nodeStr = Nodes.Select(n => n.ToGraph(prev)).JoinStringsWithComma(); + return $"{EntityType}({nodeStr})"; + } + + public string EntityType => Entity.EntityType; + + public string QuickHash() => $"{EntityType}:{Nodes.Count}"; +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepRawInstance.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepRawInstance.cs new file mode 100644 index 000000000..ee15dd920 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepRawInstance.cs @@ -0,0 +1,20 @@ +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Ara3D.Buffers; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +/// +/// Contains information about where an instance is within a file. +/// +[StructLayout(LayoutKind.Sequential, Pack = 1)] +[method: MethodImpl(MethodImplOptions.AggressiveInlining)] +public readonly unsafe struct StepRawInstance(uint id, ByteSpan type, byte* ptr) +{ + public readonly uint Id = id; + public readonly ByteSpan Type = type; + public readonly byte* Ptr = ptr; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool IsValid() => Id > 0; +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepToken.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepToken.cs new file mode 100644 index 000000000..19fc352ee --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepToken.cs @@ -0,0 +1,17 @@ +using System.Diagnostics; +using Ara3D.Buffers; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public readonly struct StepToken +{ + public readonly ByteSpan Span; + public readonly StepTokenType Type; + + public StepToken(ByteSpan span, StepTokenType type) + { + Span = span; + Debug.Assert(span.Length > 0); + Type = type; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepTokenType.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepTokenType.cs new file mode 100644 index 000000000..f42e11b6b --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepTokenType.cs @@ -0,0 +1,22 @@ +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public enum StepTokenType : byte +{ + None, + Ident, + String, + Whitespace, + Number, + Symbol, + Id, + Separator, + Unassigned, + Redeclared, + Comment, + Unknown, + BeginGroup, + EndGroup, + LineBreak, + EndOfLine, + Definition, +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepTokenizer.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepTokenizer.cs new file mode 100644 index 000000000..a23a2e949 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepTokenizer.cs @@ -0,0 +1,306 @@ +using System.Diagnostics; +using System.Runtime.CompilerServices; +using Ara3D.Buffers; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +public static class StepTokenizer +{ + public static readonly StepTokenType[] TokenLookup = CreateTokenLookup(); + + public static readonly bool[] IsNumberLookup = CreateNumberLookup(); + + public static readonly bool[] IsIdentLookup = CreateIdentLookup(); + + public static StepTokenType[] CreateTokenLookup() + { + var r = new StepTokenType[256]; + for (var i = 0; i < 256; i++) + r[i] = GetTokenType((byte)i); + return r; + } + + public static bool[] CreateNumberLookup() + { + var r = new bool[256]; + for (var i = 0; i < 256; i++) + r[i] = IsNumberChar((byte)i); + return r; + } + + public static bool[] CreateIdentLookup() + { + var r = new bool[256]; + for (var i = 0; i < 256; i++) + r[i] = IsIdentOrDigitChar((byte)i); + return r; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static StepTokenType LookupToken(byte b) => TokenLookup[b]; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsNumberChar(byte b) + { + switch (b) + { + case (byte)'0': + case (byte)'1': + case (byte)'2': + case (byte)'3': + case (byte)'4': + case (byte)'5': + case (byte)'6': + case (byte)'7': + case (byte)'8': + case (byte)'9': + case (byte)'E': + case (byte)'e': + case (byte)'+': + case (byte)'-': + case (byte)'.': + return true; + } + + return false; + } + + public static StepTokenType GetTokenType(byte b) + { + switch (b) + { + case (byte)'0': + case (byte)'1': + case (byte)'2': + case (byte)'3': + case (byte)'4': + case (byte)'5': + case (byte)'6': + case (byte)'7': + case (byte)'8': + case (byte)'9': + case (byte)'+': + case (byte)'-': + return StepTokenType.Number; + + case (byte)' ': + case (byte)'\t': + return StepTokenType.Whitespace; + + case (byte)'\n': + case (byte)'\r': + return StepTokenType.LineBreak; + + case (byte)'\'': + case (byte)'"': + return StepTokenType.String; + + case (byte)'.': + return StepTokenType.Symbol; + + case (byte)'#': + return StepTokenType.Id; + + case (byte)';': + return StepTokenType.EndOfLine; + + case (byte)'(': + return StepTokenType.BeginGroup; + + case (byte)'=': + return StepTokenType.Definition; + + case (byte)')': + return StepTokenType.EndGroup; + + case (byte)',': + return StepTokenType.Separator; + + case (byte)'$': + return StepTokenType.Unassigned; + + case (byte)'*': + return StepTokenType.Redeclared; + + case (byte)'/': + return StepTokenType.Comment; + + case (byte)'a': + case (byte)'b': + case (byte)'c': + case (byte)'d': + case (byte)'e': + case (byte)'f': + case (byte)'g': + case (byte)'h': + case (byte)'i': + case (byte)'j': + case (byte)'k': + case (byte)'l': + case (byte)'m': + case (byte)'n': + case (byte)'o': + case (byte)'p': + case (byte)'q': + case (byte)'r': + case (byte)'s': + case (byte)'t': + case (byte)'u': + case (byte)'v': + case (byte)'w': + case (byte)'x': + case (byte)'y': + case (byte)'z': + case (byte)'A': + case (byte)'B': + case (byte)'C': + case (byte)'D': + case (byte)'E': + case (byte)'F': + case (byte)'G': + case (byte)'H': + case (byte)'I': + case (byte)'J': + case (byte)'K': + case (byte)'L': + case (byte)'M': + case (byte)'N': + case (byte)'O': + case (byte)'P': + case (byte)'Q': + case (byte)'R': + case (byte)'S': + case (byte)'T': + case (byte)'U': + case (byte)'V': + case (byte)'W': + case (byte)'X': + case (byte)'Y': + case (byte)'Z': + case (byte)'_': + return StepTokenType.Ident; + + default: + return StepTokenType.Unknown; + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsWhiteSpace(byte b) => b == ' ' || b == '\t'; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsLineBreak(byte b) => b == '\n' || b == '\r'; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsIdent(byte b) => b >= 'A' && b <= 'Z' || b >= 'a' && b <= 'z' || b == '_'; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsDigit(byte b) => b >= '0' && b <= '9'; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static bool IsIdentOrDigitChar(byte b) => IsIdent(b) || IsDigit(b); + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe byte* AdvancePast(byte* begin, byte* end, string s) + { + if (end - begin < s.Length) + return null; + foreach (var c in s) + if (*begin++ != (byte)c) + return null; + return begin; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe StepToken ParseToken(byte* begin, byte* end) + { + var cur = begin; + var tt = InternalParseToken(ref cur, end); + Debug.Assert(cur < end); + var span = new ByteSpan(begin, cur); + return new StepToken(span, tt); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool EatWSpace(ref StepToken cur, byte* end) + { + while ( + cur.Type == StepTokenType.Comment || cur.Type == StepTokenType.Whitespace || cur.Type == StepTokenType.LineBreak + ) + { + if (!ParseNextToken(ref cur, end)) + return false; + } + return true; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool ParseNextToken(ref StepToken prev, byte* end) + { + var cur = prev.Span.End(); + if (cur >= end) + return false; + prev = ParseToken(cur, end); + return true; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private static unsafe StepTokenType InternalParseToken(ref byte* cur, byte* end) + { + var type = TokenLookup[*cur++]; + + switch (type) + { + case StepTokenType.Ident: + while (IsIdentLookup[*cur]) + cur++; + break; + + case StepTokenType.String: + // usually it is as single quote, + // but in rare cases it could be a double quote + var quoteChar = *(cur - 1); + while (cur < end) + { + if (*cur++ == quoteChar) + { + if (*cur != quoteChar) + break; + else + cur++; + } + } + + break; + + case StepTokenType.LineBreak: + while (IsLineBreak(*cur)) + cur++; + break; + + case StepTokenType.Number: + while (IsNumberLookup[*cur]) + cur++; + break; + + case StepTokenType.Symbol: + while (*cur++ != '.') { } + + break; + + case StepTokenType.Id: + while (IsNumberLookup[*cur]) + cur++; + break; + + case StepTokenType.Comment: + var prev = *cur++; + while (cur < end && (prev != '*' || *cur != '/')) + prev = *cur++; + cur++; + break; + } + + return type; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepValue.cs b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepValue.cs new file mode 100644 index 000000000..6b1e93bf9 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Ara3D.StepParser/StepValue.cs @@ -0,0 +1,154 @@ +using System.Diagnostics; +using Ara3D.Buffers; +using Ara3D.Utils; + +namespace Speckle.Importers.Ifc.Ara3D.StepParser; + +/// +/// The base class of the different type of value items that can be found in a STEP file. +/// * Entity +/// * List +/// * String +/// * Symbol +/// * Unassigned token +/// * Redeclared token +/// * Number +/// +public class StepValue; + +public class StepEntity : StepValue +{ + public readonly ByteSpan EntityType; + public readonly StepList Attributes; + + public StepEntity(ByteSpan entityType, StepList attributes) + { + Debug.Assert(!entityType.IsNull()); + EntityType = entityType; + Attributes = attributes; + } + + public override string ToString() => $"{EntityType}{Attributes}"; +} + +public class StepList : StepValue +{ + public readonly List Values; + + public StepList(List values) => Values = values; + + public override string ToString() => $"({Values.JoinStringsWithComma()})"; + + public static StepList CreateDefault() => new(new List()); +} + +public class StepString : StepValue +{ + public readonly ByteSpan Value; + + public static StepString Create(StepToken token) + { + var span = token.Span; + Debug.Assert(token.Type == StepTokenType.String); + Debug.Assert(span.Length >= 2); + Debug.Assert(span.First() == '\'' || span.First() == '"'); + Debug.Assert(span.Last() == '\'' || span.Last() == '"'); + return new StepString(span.Trim(1, 1)); + } + + public StepString(ByteSpan value) => Value = value; + + public override string ToString() => $"'{Value}'"; +} + +public class StepSymbol : StepValue +{ + public readonly ByteSpan Name; + + public StepSymbol(ByteSpan name) => Name = name; + + public override string ToString() => $".{Name}."; + + public static StepSymbol Create(StepToken token) + { + Debug.Assert(token.Type == StepTokenType.Symbol); + var span = token.Span; + Debug.Assert(span.Length >= 2); + Debug.Assert(span.First() == '.'); + Debug.Assert(span.Last() == '.'); + return new StepSymbol(span.Trim(1, 1)); + } +} + +public class StepNumber : StepValue +{ + public readonly ByteSpan Span; + public double Value => Span.ToDouble(); + + public StepNumber(ByteSpan span) => Span = span; + + public override string ToString() => $"{Value}"; + + public static StepNumber Create(StepToken token) + { + Debug.Assert(token.Type == StepTokenType.Number); + var span = token.Span; + return new(span); + } +} + +public class StepId : StepValue +{ + public readonly uint Id; + + public StepId(uint id) => Id = id; + + public override string ToString() => $"#{Id}"; + + public static unsafe StepId Create(StepToken token) + { + Debug.Assert(token.Type == StepTokenType.Id); + var span = token.Span; + Debug.Assert(span.Length >= 2); + Debug.Assert(span.First() == '#'); + var id = 0u; + for (var i = 1; i < span.Length; ++i) + { + Debug.Assert(span.Ptr[i] >= '0' && span.Ptr[i] <= '9'); + id = id * 10 + span.Ptr[i] - '0'; + } + return new StepId(id); + } +} + +public class StepUnassigned : StepValue +{ + public static readonly StepUnassigned Default = new(); + + public override string ToString() => "$"; + + public static StepUnassigned Create(StepToken token) + { + Debug.Assert(token.Type == StepTokenType.Unassigned); + var span = token.Span; + Debug.Assert(span.Length == 1); + Debug.Assert(span.First() == '$'); + return Default; + } +} + +public class StepRedeclared : StepValue +{ + public static readonly StepRedeclared Default = new(); + + public override string ToString() => "*"; + + public static StepRedeclared Create(StepToken token) + { + Debug.Assert(token.Type == StepTokenType.Redeclared); + var span = token.Span; + Debug.Assert(span.Length == 1); + Debug.Assert(span.First() == '*'); + return Default; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Converters/GeometryConverter.cs b/Importers/Ifc/Speckle.Importers.Ifc/Converters/GeometryConverter.cs new file mode 100644 index 000000000..c59ad90b9 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Converters/GeometryConverter.cs @@ -0,0 +1,20 @@ +using Speckle.Importers.Ifc.Types; +using Speckle.InterfaceGenerator; +using Speckle.Sdk.Models.Collections; + +namespace Speckle.Importers.Ifc.Converters; + +[GenerateAutoInterface] +public class GeometryConverter(IMeshConverter meshConverter) : IGeometryConverter +{ + public Collection Convert(IfcGeometry geometry) + { + var c = new Collection(); + foreach (var mesh in geometry.GetMeshes()) + { + c.elements.Add(meshConverter.Convert(mesh)); + } + + return c; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Converters/GraphConverter.cs b/Importers/Ifc/Speckle.Importers.Ifc/Converters/GraphConverter.cs new file mode 100644 index 000000000..3c6c3f88d --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Converters/GraphConverter.cs @@ -0,0 +1,19 @@ +using Speckle.Importers.Ifc.Ara3D.IfcParser; +using Speckle.Importers.Ifc.Types; +using Speckle.InterfaceGenerator; +using Speckle.Sdk.Models; +using Speckle.Sdk.Models.Collections; + +namespace Speckle.Importers.Ifc.Converters; + +[GenerateAutoInterface] +public class GraphConverter(INodeConverter nodeConverter) : IGraphConverter +{ + public Base Convert(IfcModel model, IfcGraph graph) + { + var collection = new Collection(); + var children = graph.GetSources().Select(x => nodeConverter.Convert(model, x)).ToList(); + collection.elements = children; + return collection; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Converters/MeshConverter.cs b/Importers/Ifc/Speckle.Importers.Ifc/Converters/MeshConverter.cs new file mode 100644 index 000000000..961bc3297 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Converters/MeshConverter.cs @@ -0,0 +1,49 @@ +using Speckle.Importers.Ifc.Types; +using Speckle.InterfaceGenerator; +using Speckle.Objects.Geometry; + +namespace Speckle.Importers.Ifc.Converters; + +[GenerateAutoInterface] +public class MeshConverter : IMeshConverter +{ + public unsafe Mesh Convert(IfcMesh mesh) + { + var m = (double*)mesh.Transform; + var vp = mesh.GetVertices(); + var ip = mesh.GetIndexes(); + + var vertices = new List(mesh.VertexCount * 3); + for (var i = 0; i < mesh.VertexCount; i++) + { + var x = vp[i].PX; + var y = vp[i].PY; + var z = vp[i].PZ; + vertices.Add(m[0] * x + m[4] * y + m[8] * z + m[12]); + vertices.Add(-(m[2] * x + m[6] * y + m[10] * z + m[14])); + vertices.Add(m[1] * x + m[5] * y + m[9] * z + m[13]); + } + + var faces = new List(mesh.IndexCount * 4); + for (var i = 0; i < mesh.IndexCount; i += 3) + { + var a = ip[i]; + var b = ip[i + 1]; + var c = ip[i + 2]; + faces.Add(3); + faces.Add(a); + faces.Add(b); + faces.Add(c); + } + + var color = mesh.GetColor(); + List colors = [(int)(color->A * 255), (int)(color->R * 255), (int)(color->G * 255), (int)(color->B * 255),]; + return new Mesh() + { + colors = colors, + vertices = vertices, + faces = faces, + units = "m", + }; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Converters/NodeConverter.cs b/Importers/Ifc/Speckle.Importers.Ifc/Converters/NodeConverter.cs new file mode 100644 index 000000000..f9b246d27 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Converters/NodeConverter.cs @@ -0,0 +1,73 @@ +using System.Reflection; +using Speckle.Importers.Ifc.Ara3D.IfcParser; +using Speckle.Importers.Ifc.Types; +using Speckle.InterfaceGenerator; +using Speckle.Sdk.Models; + +namespace Speckle.Importers.Ifc.Converters; + +[GenerateAutoInterface] +public class NodeConverter(IGeometryConverter geometryConverter) : INodeConverter +{ + public Base Convert(IfcModel model, IfcNode node) + { + var b = new Base(); + if (node is IfcPropSet ps) + { + b["Name"] = ps.Name; + b["GlobalId"] = ps.Guid; + } + + // https://github.com/specklesystems/speckle-server/issues/1180 + b["ifc_type"] = node.Type; + + // This is required because "speckle_type" has no setter, but is backed by a private field. + var baseType = typeof(Base); + var typeField = baseType.GetField("_type", BindingFlags.Instance | BindingFlags.NonPublic); + typeField?.SetValue(b, node.Type); + + // Guid is null for property values, and other Ifc entities not derived from IfcRoot + b.applicationId = node.Guid; + + // This is the express ID used to identify an entity wihtin a file. + b["expressID"] = node.Id; + + // Even if there is no geometry, this will return an empty collection. + var geo = model.GetGeometry(node.Id); + if (geo != null) + { + var c = geometryConverter.Convert(geo); + if (c.elements.Count > 0) + b["@displayValue"] = c.elements; + } + + // Create the children + var children = node.GetChildren().Select(x => Convert(model, x)).ToList(); + b["@elements"] = children; + + // Add the properties + foreach (var p in node.GetPropSets()) + { + // Only when there are actually some properties. + if (p.NumProperties > 0) + { + var name = p.Name; + if (string.IsNullOrWhiteSpace(name)) + name = $"#{p.Id}"; + b[name] = ToSpeckleDictionary(p); + } + } + + // TODO: add the "type" properties + + return b; + } + + public static Dictionary ToSpeckleDictionary(IfcPropSet ps) + { + var d = new Dictionary(); + foreach (var p in ps.GetProperties()) + d[p.Name] = p.Value.ToJsonObject(); + return d; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Import.cs b/Importers/Ifc/Speckle.Importers.Ifc/Import.cs new file mode 100644 index 000000000..b32fa2c2e --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Import.cs @@ -0,0 +1,107 @@ +using System.Diagnostics; +using System.Reflection; +using Ara3D.Utils; +using Microsoft.Extensions.DependencyInjection; +using Speckle.Importers.Ifc.Ara3D.IfcParser; +using Speckle.Importers.Ifc.Converters; +using Speckle.Importers.Ifc.Types; +using Speckle.Objects.Geometry; +using Speckle.Sdk; +using Speckle.Sdk.Api; +using Speckle.Sdk.Api.GraphQL.Inputs; +using Speckle.Sdk.Api.GraphQL.Models; +using Speckle.Sdk.Credentials; +using Speckle.Sdk.Host; +using Speckle.Sdk.Models; +using Speckle.Sdk.Serialisation.V2; +using Speckle.Sdk.Serialisation.V2.Send; +using Speckle.Sdk.Transports; + +namespace Speckle.Importers.Ifc; + +public static class Import +{ + public static async Task Ifc( + string url, + string filePath, + string streamId, + string modelId, + string commitMessage, + string token, + IProgress? progress = null + ) + { + var serviceProvider = GetServiceProvider(); + return await Ifc(serviceProvider, url, filePath, streamId, modelId, commitMessage, token, progress); + } + + public static ServiceProvider GetServiceProvider() + { + TypeLoader.Initialize(typeof(Base).Assembly, typeof(Point).Assembly); + var serviceCollection = new ServiceCollection(); + serviceCollection.AddSpeckleSdk(HostApplications.Other, HostAppVersion.v2024, "IFC-Importer"); + serviceCollection.AddSpeckleWebIfc(); + serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetExecutingAssembly()); + return serviceCollection.BuildServiceProvider(); + } + + public static async Task Ifc( + IServiceProvider serviceProvider, + string url, + string filePath, + string streamId, + string modelId, + string commitMessage, + string token, + IProgress? progress = null + ) + { + var ifcFactory = serviceProvider.GetRequiredService(); + var clientFactory = serviceProvider.GetRequiredService(); + var baseUri = new Uri(url); + var stopwatch = Stopwatch.StartNew(); + + var model = ifcFactory.Open(filePath); + var ms = stopwatch.ElapsedMilliseconds; + Console.WriteLine($"Opened with WebIFC: {ms} ms"); + + var graph = IfcGraph.Load(new FilePath(filePath)); + var ms2 = stopwatch.ElapsedMilliseconds; + Console.WriteLine($"Loaded with StepParser: {ms2 - ms} ms"); + + var converter = serviceProvider.GetRequiredService(); + var b = converter.Convert(model, graph); + ms = ms2; + ms2 = stopwatch.ElapsedMilliseconds; + Console.WriteLine($"Converted to Speckle Bases: {ms2 - ms} ms"); + + var serializeProcessFactory = serviceProvider.GetRequiredService(); + var process = serializeProcessFactory.CreateSerializeProcess( + baseUri, + streamId, + token, + progress, + new SerializeProcessOptions(true, true, true, false) + ); + var (rootId, _) = await process.Serialize(b, default).ConfigureAwait(false); + Account account = + new() + { + token = token, + serverInfo = new ServerInfo { url = baseUri.ToString() }, + }; + ms = ms2; + ms2 = stopwatch.ElapsedMilliseconds; + Console.WriteLine($"Uploaded to Speckle: {ms2 - ms} ms"); + + // 8 - Create the version (commit) + using var apiClient = clientFactory.Create(account); + var commitId = await apiClient.Version.Create( + new CreateVersionInput(rootId, modelId, streamId, message: commitMessage) + ); + ms = ms2; + ms2 = stopwatch.ElapsedMilliseconds; + Console.WriteLine($"Committed to Speckle: {ms2 - ms} ms"); + return commitId; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Native/WebIfc.cs b/Importers/Ifc/Speckle.Importers.Ifc/Native/WebIfc.cs new file mode 100644 index 000000000..52f182185 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Native/WebIfc.cs @@ -0,0 +1,108 @@ +using System.Diagnostics.CodeAnalysis; +using System.Runtime.InteropServices; + +namespace Speckle.Importers.Ifc.Native; + +[SuppressMessage("Globalization", "CA2101:Specify marshaling for P/Invoke string arguments")] +[SuppressMessage("Interoperability", "CA1401:P/Invokes should not be visible")] +[SuppressMessage("Security", "CA5393:Do not use unsafe DllImportSearchPath value")] +public static class WebIfc +{ +#if WINDOWS + private const string DllName = "web-ifc.dll"; + private const CharSet Set = CharSet.Ansi; +#else + private const string DllName = "libweb-ifc.so"; + private const CharSet Set = CharSet.Auto; +#endif + + private const DllImportSearchPath ImportSearchPath = DllImportSearchPath.AssemblyDirectory; + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr InitializeApi(); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern void FinalizeApi(IntPtr api); + + [DllImport(DllName, CharSet = Set)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr LoadModel(IntPtr api, string fileName); + + [DllImport(DllName, CharSet = Set)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern string GetVersion(); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetMesh(IntPtr geometry, int index); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern int GetNumMeshes(IntPtr geometry); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern uint GetGeometryType(IntPtr geometry); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern uint GetGeometryId(IntPtr geometry); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern uint GetLineId(IntPtr line); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern uint GetLineType(IntPtr line); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern string GetLineArguments(IntPtr line); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern int GetNumVertices(IntPtr mesh); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetVertices(IntPtr mesh); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetTransform(IntPtr mesh); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern int GetNumIndices(IntPtr mesh); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetIndices(IntPtr mesh); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetColor(IntPtr mesh); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetGeometryFromId(IntPtr model, uint id); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern int GetNumGeometries(IntPtr model); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetGeometryFromIndex(IntPtr model, int index); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern uint GetMaxId(IntPtr model); + + [DllImport(DllName)] + [DefaultDllImportSearchPaths(ImportSearchPath)] + public static extern IntPtr GetLineFromModel(IntPtr model, uint id); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Native/libweb-ifc.so b/Importers/Ifc/Speckle.Importers.Ifc/Native/libweb-ifc.so new file mode 100644 index 000000000..b303c198d Binary files /dev/null and b/Importers/Ifc/Speckle.Importers.Ifc/Native/libweb-ifc.so differ diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Native/web-ifc.dll b/Importers/Ifc/Speckle.Importers.Ifc/Native/web-ifc.dll new file mode 100644 index 000000000..35808817c Binary files /dev/null and b/Importers/Ifc/Speckle.Importers.Ifc/Native/web-ifc.dll differ diff --git a/Importers/Ifc/Speckle.Importers.Ifc/ServiceRegistration.cs b/Importers/Ifc/Speckle.Importers.Ifc/ServiceRegistration.cs new file mode 100644 index 000000000..129d398d6 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/ServiceRegistration.cs @@ -0,0 +1,31 @@ +using System.Reflection; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Speckle.Importers.Ifc.Types; +using Speckle.Sdk; + +namespace Speckle.Importers.Ifc; + +public static class ServiceRegistration +{ + public static void AddSpeckleWebIfc(this IServiceCollection services) + { + services.AddSingleton(); + } + + public static IServiceCollection AddMatchingInterfacesAsTransient( + this IServiceCollection serviceCollection, + Assembly assembly + ) + { + foreach (var type in assembly.ExportedTypes.Where(t => t.IsNonAbstractClass())) + { + foreach (var matchingInterface in type.FindMatchingInterface()) + { + serviceCollection.TryAddTransient(matchingInterface, type); + } + } + + return serviceCollection; + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Speckle.Importers.Ifc.csproj b/Importers/Ifc/Speckle.Importers.Ifc/Speckle.Importers.Ifc.csproj new file mode 100644 index 000000000..b2b80aa0f --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Speckle.Importers.Ifc.csproj @@ -0,0 +1,43 @@ + + + + net8.0 + true + Debug;Release;Local + WINDOWS + LINUX + + + + true + true + + + + + IDE1006;IDE0130;IDE0011;CA1051;CA1720;CA1002;CA1054;CA1028;CA1721;CA1502;CA1065;NU5104; + $(NoWarn) + + + + + + + + + + + + + + + + PreserveNewest + true + + + PreserveNewest + true + + + diff --git a/Importers/Ifc/Speckle.Importers.Ifc/SpeckleIfcException.cs b/Importers/Ifc/Speckle.Importers.Ifc/SpeckleIfcException.cs new file mode 100644 index 000000000..4ab39d11c --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/SpeckleIfcException.cs @@ -0,0 +1,14 @@ +using Speckle.Sdk; + +namespace Speckle.Importers.Ifc; + +public class SpeckleIfcException : SpeckleException +{ + public SpeckleIfcException() { } + + public SpeckleIfcException(string? message) + : base(message) { } + + public SpeckleIfcException(string? message, Exception? inner = null) + : base(message, inner) { } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcColor.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcColor.cs new file mode 100644 index 000000000..508a57d48 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcColor.cs @@ -0,0 +1,12 @@ +using System.Runtime.InteropServices; + +namespace Speckle.Importers.Ifc.Types; + +[StructLayout(LayoutKind.Sequential, Pack = 1)] +public struct IfcColor +{ + public double R, + G, + B, + A; +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcFactory.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcFactory.cs new file mode 100644 index 000000000..567453924 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcFactory.cs @@ -0,0 +1,21 @@ +using Speckle.InterfaceGenerator; + +namespace Speckle.Importers.Ifc.Types; + +[GenerateAutoInterface] +public class IfcFactory : IIfcFactory +{ + //probably never disposing this + private static readonly IntPtr _ptr = Importers.Ifc.Native.WebIfc.InitializeApi(); + + public IfcModel Open(string fullPath) + { + if (!File.Exists(fullPath)) + { + throw new ArgumentException($"File does not exist: {fullPath}"); + } + return new(Importers.Ifc.Native.WebIfc.LoadModel(_ptr, fullPath)); + } + + public string Version => Importers.Ifc.Native.WebIfc.GetVersion(); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcGeometry.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcGeometry.cs new file mode 100644 index 000000000..099d94618 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcGeometry.cs @@ -0,0 +1,18 @@ +namespace Speckle.Importers.Ifc.Types; + +public class IfcGeometry(IntPtr geometry) +{ + public IfcMesh GetMesh(int i) => new(Importers.Ifc.Native.WebIfc.GetMesh(geometry, i)); + + public int MeshCount => Importers.Ifc.Native.WebIfc.GetNumMeshes(geometry); + + public IfcSchemaType Type => (IfcSchemaType)Importers.Ifc.Native.WebIfc.GetGeometryType(geometry); + + public IEnumerable GetMeshes() + { + for (int i = 0; i < MeshCount; ++i) + { + yield return GetMesh(i); + } + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcLine.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcLine.cs new file mode 100644 index 000000000..a3c2306f1 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcLine.cs @@ -0,0 +1,9 @@ +namespace Speckle.Importers.Ifc.Types; + +public class IfcLine(IntPtr line) +{ + public uint Id => Importers.Ifc.Native.WebIfc.GetLineId(line); + public IfcSchemaType Type => (IfcSchemaType)Importers.Ifc.Native.WebIfc.GetLineType(line); + + public string Arguments() => Importers.Ifc.Native.WebIfc.GetLineArguments(line); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcMesh.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcMesh.cs new file mode 100644 index 000000000..e0b34e73c --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcMesh.cs @@ -0,0 +1,15 @@ +namespace Speckle.Importers.Ifc.Types; + +public class IfcMesh(IntPtr mesh) +{ + public int VertexCount => Importers.Ifc.Native.WebIfc.GetNumVertices(mesh); + + public unsafe IfcVertex* GetVertices() => (IfcVertex*)Importers.Ifc.Native.WebIfc.GetVertices(mesh); + + public IntPtr Transform => Importers.Ifc.Native.WebIfc.GetTransform(mesh); + public int IndexCount => Importers.Ifc.Native.WebIfc.GetNumIndices(mesh); + + public unsafe int* GetIndexes() => (int*)Importers.Ifc.Native.WebIfc.GetIndices(mesh); + + public unsafe IfcColor* GetColor() => (IfcColor*)Importers.Ifc.Native.WebIfc.GetColor(mesh); +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcModel.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcModel.cs new file mode 100644 index 000000000..6da106e9b --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcModel.cs @@ -0,0 +1,33 @@ +namespace Speckle.Importers.Ifc.Types; + +public class IfcModel(IntPtr model) +{ + public int GetNumGeometries() => Importers.Ifc.Native.WebIfc.GetNumGeometries(model); + + public IfcGeometry? GetGeometry(uint id) + { + var geometry = Importers.Ifc.Native.WebIfc.GetGeometryFromId(model, id); + return geometry == IntPtr.Zero ? null : new IfcGeometry(geometry); + } + + public IEnumerable GetGeometries() + { + var numGeometries = Importers.Ifc.Native.WebIfc.GetNumGeometries(model); + for (int i = 0; i < numGeometries; ++i) + { + var gPtr = Importers.Ifc.Native.WebIfc.GetGeometryFromIndex(model, i); + if (gPtr != IntPtr.Zero) + { + yield return new IfcGeometry(gPtr); + } + } + } + + public uint GetMaxId() => Importers.Ifc.Native.WebIfc.GetMaxId(model); + + public IfcLine? GetLine(uint id) + { + var line = Importers.Ifc.Native.WebIfc.GetLineFromModel(model, id); + return line == IntPtr.Zero ? null : new IfcLine(line); + } +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcSchemaType.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcSchemaType.cs new file mode 100644 index 000000000..6c25971d8 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcSchemaType.cs @@ -0,0 +1,1149 @@ +namespace Speckle.Importers.Ifc.Types; + +#pragma warning disable CA1028 +#pragma warning disable CA1008 +public enum IfcSchemaType : uint +{ +#pragma warning restore CA1008 +#pragma warning restore CA1028 + FILE_SCHEMA = 1109904537, + FILE_NAME = 1390159747, + FILE_DESCRIPTION = 599546466, + IFCACTORROLE = 3630933823, + IFCADDRESS = 618182010, + IFCAPPLICATION = 639542469, + IFCAPPLIEDVALUE = 411424972, + IFCAPPLIEDVALUERELATIONSHIP = 1110488051, + IFCAPPROVAL = 130549933, + IFCAPPROVALACTORRELATIONSHIP = 2080292479, + IFCAPPROVALPROPERTYRELATIONSHIP = 390851274, + IFCAPPROVALRELATIONSHIP = 3869604511, + IFCBOUNDARYCONDITION = 4037036970, + IFCBOUNDARYEDGECONDITION = 1560379544, + IFCBOUNDARYFACECONDITION = 3367102660, + IFCBOUNDARYNODECONDITION = 1387855156, + IFCBOUNDARYNODECONDITIONWARPING = 2069777674, + IFCCALENDARDATE = 622194075, + IFCCLASSIFICATION = 747523909, + IFCCLASSIFICATIONITEM = 1767535486, + IFCCLASSIFICATIONITEMRELATIONSHIP = 1098599126, + IFCCLASSIFICATIONNOTATION = 938368621, + IFCCLASSIFICATIONNOTATIONFACET = 3639012971, + IFCCOLOURSPECIFICATION = 3264961684, + IFCCONNECTIONGEOMETRY = 2859738748, + IFCCONNECTIONPOINTGEOMETRY = 2614616156, + IFCCONNECTIONPORTGEOMETRY = 4257277454, + IFCCONNECTIONSURFACEGEOMETRY = 2732653382, + IFCCONSTRAINT = 1959218052, + IFCCONSTRAINTAGGREGATIONRELATIONSHIP = 1658513725, + IFCCONSTRAINTCLASSIFICATIONRELATIONSHIP = 613356794, + IFCCONSTRAINTRELATIONSHIP = 347226245, + IFCCOORDINATEDUNIVERSALTIMEOFFSET = 1065062679, + IFCCOSTVALUE = 602808272, + IFCCURRENCYRELATIONSHIP = 539742890, + IFCCURVESTYLEFONT = 1105321065, + IFCCURVESTYLEFONTANDSCALING = 2367409068, + IFCCURVESTYLEFONTPATTERN = 3510044353, + IFCDATEANDTIME = 1072939445, + IFCDERIVEDUNIT = 1765591967, + IFCDERIVEDUNITELEMENT = 1045800335, + IFCDIMENSIONALEXPONENTS = 2949456006, + IFCDOCUMENTELECTRONICFORMAT = 1376555844, + IFCDOCUMENTINFORMATION = 1154170062, + IFCDOCUMENTINFORMATIONRELATIONSHIP = 770865208, + IFCDRAUGHTINGCALLOUTRELATIONSHIP = 3796139169, + IFCENVIRONMENTALIMPACTVALUE = 1648886627, + IFCEXTERNALREFERENCE = 3200245327, + IFCEXTERNALLYDEFINEDHATCHSTYLE = 2242383968, + IFCEXTERNALLYDEFINEDSURFACESTYLE = 1040185647, + IFCEXTERNALLYDEFINEDSYMBOL = 3207319532, + IFCEXTERNALLYDEFINEDTEXTFONT = 3548104201, + IFCGRIDAXIS = 852622518, + IFCIRREGULARTIMESERIESVALUE = 3020489413, + IFCLIBRARYINFORMATION = 2655187982, + IFCLIBRARYREFERENCE = 3452421091, + IFCLIGHTDISTRIBUTIONDATA = 4162380809, + IFCLIGHTINTENSITYDISTRIBUTION = 1566485204, + IFCLOCALTIME = 30780891, + IFCMATERIAL = 1838606355, + IFCMATERIALCLASSIFICATIONRELATIONSHIP = 1847130766, + IFCMATERIALLAYER = 248100487, + IFCMATERIALLAYERSET = 3303938423, + IFCMATERIALLAYERSETUSAGE = 1303795690, + IFCMATERIALLIST = 2199411900, + IFCMATERIALPROPERTIES = 3265635763, + IFCMEASUREWITHUNIT = 2597039031, + IFCMECHANICALMATERIALPROPERTIES = 4256014907, + IFCMECHANICALSTEELMATERIALPROPERTIES = 677618848, + IFCMETRIC = 3368373690, + IFCMONETARYUNIT = 2706619895, + IFCNAMEDUNIT = 1918398963, + IFCOBJECTPLACEMENT = 3701648758, + IFCOBJECTIVE = 2251480897, + IFCOPTICALMATERIALPROPERTIES = 1227763645, + IFCORGANIZATION = 4251960020, + IFCORGANIZATIONRELATIONSHIP = 1411181986, + IFCOWNERHISTORY = 1207048766, + IFCPERSON = 2077209135, + IFCPERSONANDORGANIZATION = 101040310, + IFCPHYSICALQUANTITY = 2483315170, + IFCPHYSICALSIMPLEQUANTITY = 2226359599, + IFCPOSTALADDRESS = 3355820592, + IFCPREDEFINEDITEM = 3727388367, + IFCPREDEFINEDSYMBOL = 990879717, + IFCPREDEFINEDTERMINATORSYMBOL = 3213052703, + IFCPREDEFINEDTEXTFONT = 1775413392, + IFCPRESENTATIONLAYERASSIGNMENT = 2022622350, + IFCPRESENTATIONLAYERWITHSTYLE = 1304840413, + IFCPRESENTATIONSTYLE = 3119450353, + IFCPRESENTATIONSTYLEASSIGNMENT = 2417041796, + IFCPRODUCTREPRESENTATION = 2095639259, + IFCPRODUCTSOFCOMBUSTIONPROPERTIES = 2267347899, + IFCPROFILEDEF = 3958567839, + IFCPROFILEPROPERTIES = 2802850158, + IFCPROPERTY = 2598011224, + IFCPROPERTYCONSTRAINTRELATIONSHIP = 3896028662, + IFCPROPERTYDEPENDENCYRELATIONSHIP = 148025276, + IFCPROPERTYENUMERATION = 3710013099, + IFCQUANTITYAREA = 2044713172, + IFCQUANTITYCOUNT = 2093928680, + IFCQUANTITYLENGTH = 931644368, + IFCQUANTITYTIME = 3252649465, + IFCQUANTITYVOLUME = 2405470396, + IFCQUANTITYWEIGHT = 825690147, + IFCREFERENCESVALUEDOCUMENT = 2692823254, + IFCREINFORCEMENTBARPROPERTIES = 1580146022, + IFCRELAXATION = 1222501353, + IFCREPRESENTATION = 1076942058, + IFCREPRESENTATIONCONTEXT = 3377609919, + IFCREPRESENTATIONITEM = 3008791417, + IFCREPRESENTATIONMAP = 1660063152, + IFCRIBPLATEPROFILEPROPERTIES = 3679540991, + IFCROOT = 2341007311, + IFCSIUNIT = 448429030, + IFCSECTIONPROPERTIES = 2042790032, + IFCSECTIONREINFORCEMENTPROPERTIES = 4165799628, + IFCSHAPEASPECT = 867548509, + IFCSHAPEMODEL = 3982875396, + IFCSHAPEREPRESENTATION = 4240577450, + IFCSIMPLEPROPERTY = 3692461612, + IFCSTRUCTURALCONNECTIONCONDITION = 2273995522, + IFCSTRUCTURALLOAD = 2162789131, + IFCSTRUCTURALLOADSTATIC = 2525727697, + IFCSTRUCTURALLOADTEMPERATURE = 3408363356, + IFCSTYLEMODEL = 2830218821, + IFCSTYLEDITEM = 3958052878, + IFCSTYLEDREPRESENTATION = 3049322572, + IFCSURFACESTYLE = 1300840506, + IFCSURFACESTYLELIGHTING = 3303107099, + IFCSURFACESTYLEREFRACTION = 1607154358, + IFCSURFACESTYLESHADING = 846575682, + IFCSURFACESTYLEWITHTEXTURES = 1351298697, + IFCSURFACETEXTURE = 626085974, + IFCSYMBOLSTYLE = 1290481447, + IFCTABLE = 985171141, + IFCTABLEROW = 531007025, + IFCTELECOMADDRESS = 912023232, + IFCTEXTSTYLE = 1447204868, + IFCTEXTSTYLEFONTMODEL = 1983826977, + IFCTEXTSTYLEFORDEFINEDFONT = 2636378356, + IFCTEXTSTYLETEXTMODEL = 1640371178, + IFCTEXTSTYLEWITHBOXCHARACTERISTICS = 1484833681, + IFCTEXTURECOORDINATE = 280115917, + IFCTEXTURECOORDINATEGENERATOR = 1742049831, + IFCTEXTUREMAP = 2552916305, + IFCTEXTUREVERTEX = 1210645708, + IFCTHERMALMATERIALPROPERTIES = 3317419933, + IFCTIMESERIES = 3101149627, + IFCTIMESERIESREFERENCERELATIONSHIP = 1718945513, + IFCTIMESERIESVALUE = 581633288, + IFCTOPOLOGICALREPRESENTATIONITEM = 1377556343, + IFCTOPOLOGYREPRESENTATION = 1735638870, + IFCUNITASSIGNMENT = 180925521, + IFCVERTEX = 2799835756, + IFCVERTEXBASEDTEXTUREMAP = 3304826586, + IFCVERTEXPOINT = 1907098498, + IFCVIRTUALGRIDINTERSECTION = 891718957, + IFCWATERPROPERTIES = 1065908215, + IFCANNOTATIONOCCURRENCE = 2442683028, + IFCANNOTATIONSURFACEOCCURRENCE = 962685235, + IFCANNOTATIONSYMBOLOCCURRENCE = 3612888222, + IFCANNOTATIONTEXTOCCURRENCE = 2297822566, + IFCARBITRARYCLOSEDPROFILEDEF = 3798115385, + IFCARBITRARYOPENPROFILEDEF = 1310608509, + IFCARBITRARYPROFILEDEFWITHVOIDS = 2705031697, + IFCBLOBTEXTURE = 616511568, + IFCCENTERLINEPROFILEDEF = 3150382593, + IFCCLASSIFICATIONREFERENCE = 647927063, + IFCCOLOURRGB = 776857604, + IFCCOMPLEXPROPERTY = 2542286263, + IFCCOMPOSITEPROFILEDEF = 1485152156, + IFCCONNECTEDFACESET = 370225590, + IFCCONNECTIONCURVEGEOMETRY = 1981873012, + IFCCONNECTIONPOINTECCENTRICITY = 45288368, + IFCCONTEXTDEPENDENTUNIT = 3050246964, + IFCCONVERSIONBASEDUNIT = 2889183280, + IFCCURVESTYLE = 3800577675, + IFCDERIVEDPROFILEDEF = 3632507154, + IFCDIMENSIONCALLOUTRELATIONSHIP = 2273265877, + IFCDIMENSIONPAIR = 1694125774, + IFCDOCUMENTREFERENCE = 3732053477, + IFCDRAUGHTINGPREDEFINEDTEXTFONT = 4170525392, + IFCEDGE = 3900360178, + IFCEDGECURVE = 476780140, + IFCEXTENDEDMATERIALPROPERTIES = 1860660968, + IFCFACE = 2556980723, + IFCFACEBOUND = 1809719519, + IFCFACEOUTERBOUND = 803316827, + IFCFACESURFACE = 3008276851, + IFCFAILURECONNECTIONCONDITION = 4219587988, + IFCFILLAREASTYLE = 738692330, + IFCFUELPROPERTIES = 3857492461, + IFCGENERALMATERIALPROPERTIES = 803998398, + IFCGENERALPROFILEPROPERTIES = 1446786286, + IFCGEOMETRICREPRESENTATIONCONTEXT = 3448662350, + IFCGEOMETRICREPRESENTATIONITEM = 2453401579, + IFCGEOMETRICREPRESENTATIONSUBCONTEXT = 4142052618, + IFCGEOMETRICSET = 3590301190, + IFCGRIDPLACEMENT = 178086475, + IFCHALFSPACESOLID = 812098782, + IFCHYGROSCOPICMATERIALPROPERTIES = 2445078500, + IFCIMAGETEXTURE = 3905492369, + IFCIRREGULARTIMESERIES = 3741457305, + IFCLIGHTSOURCE = 1402838566, + IFCLIGHTSOURCEAMBIENT = 125510826, + IFCLIGHTSOURCEDIRECTIONAL = 2604431987, + IFCLIGHTSOURCEGONIOMETRIC = 4266656042, + IFCLIGHTSOURCEPOSITIONAL = 1520743889, + IFCLIGHTSOURCESPOT = 3422422726, + IFCLOCALPLACEMENT = 2624227202, + IFCLOOP = 1008929658, + IFCMAPPEDITEM = 2347385850, + IFCMATERIALDEFINITIONREPRESENTATION = 2022407955, + IFCMECHANICALCONCRETEMATERIALPROPERTIES = 1430189142, + IFCOBJECTDEFINITION = 219451334, + IFCONEDIRECTIONREPEATFACTOR = 2833995503, + IFCOPENSHELL = 2665983363, + IFCORIENTEDEDGE = 1029017970, + IFCPARAMETERIZEDPROFILEDEF = 2529465313, + IFCPATH = 2519244187, + IFCPHYSICALCOMPLEXQUANTITY = 3021840470, + IFCPIXELTEXTURE = 597895409, + IFCPLACEMENT = 2004835150, + IFCPLANAREXTENT = 1663979128, + IFCPOINT = 2067069095, + IFCPOINTONCURVE = 4022376103, + IFCPOINTONSURFACE = 1423911732, + IFCPOLYLOOP = 2924175390, + IFCPOLYGONALBOUNDEDHALFSPACE = 2775532180, + IFCPREDEFINEDCOLOUR = 759155922, + IFCPREDEFINEDCURVEFONT = 2559016684, + IFCPREDEFINEDDIMENSIONSYMBOL = 433424934, + IFCPREDEFINEDPOINTMARKERSYMBOL = 179317114, + IFCPRODUCTDEFINITIONSHAPE = 673634403, + IFCPROPERTYBOUNDEDVALUE = 871118103, + IFCPROPERTYDEFINITION = 1680319473, + IFCPROPERTYENUMERATEDVALUE = 4166981789, + IFCPROPERTYLISTVALUE = 2752243245, + IFCPROPERTYREFERENCEVALUE = 941946838, + IFCPROPERTYSETDEFINITION = 3357820518, + IFCPROPERTYSINGLEVALUE = 3650150729, + IFCPROPERTYTABLEVALUE = 110355661, + IFCRECTANGLEPROFILEDEF = 3615266464, + IFCREGULARTIMESERIES = 3413951693, + IFCREINFORCEMENTDEFINITIONPROPERTIES = 3765753017, + IFCRELATIONSHIP = 478536968, + IFCROUNDEDRECTANGLEPROFILEDEF = 2778083089, + IFCSECTIONEDSPINE = 1509187699, + IFCSERVICELIFEFACTOR = 2411513650, + IFCSHELLBASEDSURFACEMODEL = 4124623270, + IFCSLIPPAGECONNECTIONCONDITION = 2609359061, + IFCSOLIDMODEL = 723233188, + IFCSOUNDPROPERTIES = 2485662743, + IFCSOUNDVALUE = 1202362311, + IFCSPACETHERMALLOADPROPERTIES = 390701378, + IFCSTRUCTURALLOADLINEARFORCE = 1595516126, + IFCSTRUCTURALLOADPLANARFORCE = 2668620305, + IFCSTRUCTURALLOADSINGLEDISPLACEMENT = 2473145415, + IFCSTRUCTURALLOADSINGLEDISPLACEMENTDISTORTION = 1973038258, + IFCSTRUCTURALLOADSINGLEFORCE = 1597423693, + IFCSTRUCTURALLOADSINGLEFORCEWARPING = 1190533807, + IFCSTRUCTURALPROFILEPROPERTIES = 3843319758, + IFCSTRUCTURALSTEELPROFILEPROPERTIES = 3653947884, + IFCSUBEDGE = 2233826070, + IFCSURFACE = 2513912981, + IFCSURFACESTYLERENDERING = 1878645084, + IFCSWEPTAREASOLID = 2247615214, + IFCSWEPTDISKSOLID = 1260650574, + IFCSWEPTSURFACE = 230924584, + IFCTSHAPEPROFILEDEF = 3071757647, + IFCTERMINATORSYMBOL = 3028897424, + IFCTEXTLITERAL = 4282788508, + IFCTEXTLITERALWITHEXTENT = 3124975700, + IFCTRAPEZIUMPROFILEDEF = 2715220739, + IFCTWODIRECTIONREPEATFACTOR = 1345879162, + IFCTYPEOBJECT = 1628702193, + IFCTYPEPRODUCT = 2347495698, + IFCUSHAPEPROFILEDEF = 427810014, + IFCVECTOR = 1417489154, + IFCVERTEXLOOP = 2759199220, + IFCWINDOWLININGPROPERTIES = 336235671, + IFCWINDOWPANELPROPERTIES = 512836454, + IFCWINDOWSTYLE = 1299126871, + IFCZSHAPEPROFILEDEF = 2543172580, + IFCANNOTATIONCURVEOCCURRENCE = 3288037868, + IFCANNOTATIONFILLAREA = 669184980, + IFCANNOTATIONFILLAREAOCCURRENCE = 2265737646, + IFCANNOTATIONSURFACE = 1302238472, + IFCAXIS1PLACEMENT = 4261334040, + IFCAXIS2PLACEMENT2D = 3125803723, + IFCAXIS2PLACEMENT3D = 2740243338, + IFCBOOLEANRESULT = 2736907675, + IFCBOUNDEDSURFACE = 4182860854, + IFCBOUNDINGBOX = 2581212453, + IFCBOXEDHALFSPACE = 2713105998, + IFCCSHAPEPROFILEDEF = 2898889636, + IFCCARTESIANPOINT = 1123145078, + IFCCARTESIANTRANSFORMATIONOPERATOR = 59481748, + IFCCARTESIANTRANSFORMATIONOPERATOR2D = 3749851601, + IFCCARTESIANTRANSFORMATIONOPERATOR2DNONUNIFORM = 3486308946, + IFCCARTESIANTRANSFORMATIONOPERATOR3D = 3331915920, + IFCCARTESIANTRANSFORMATIONOPERATOR3DNONUNIFORM = 1416205885, + IFCCIRCLEPROFILEDEF = 1383045692, + IFCCLOSEDSHELL = 2205249479, + IFCCOMPOSITECURVESEGMENT = 2485617015, + IFCCRANERAILASHAPEPROFILEDEF = 4133800736, + IFCCRANERAILFSHAPEPROFILEDEF = 194851669, + IFCCSGPRIMITIVE3D = 2506170314, + IFCCSGSOLID = 2147822146, + IFCCURVE = 2601014836, + IFCCURVEBOUNDEDPLANE = 2827736869, + IFCDEFINEDSYMBOL = 693772133, + IFCDIMENSIONCURVE = 606661476, + IFCDIMENSIONCURVETERMINATOR = 4054601972, + IFCDIRECTION = 32440307, + IFCDOORLININGPROPERTIES = 2963535650, + IFCDOORPANELPROPERTIES = 1714330368, + IFCDOORSTYLE = 526551008, + IFCDRAUGHTINGCALLOUT = 3073041342, + IFCDRAUGHTINGPREDEFINEDCOLOUR = 445594917, + IFCDRAUGHTINGPREDEFINEDCURVEFONT = 4006246654, + IFCEDGELOOP = 1472233963, + IFCELEMENTQUANTITY = 1883228015, + IFCELEMENTTYPE = 339256511, + IFCELEMENTARYSURFACE = 2777663545, + IFCELLIPSEPROFILEDEF = 2835456948, + IFCENERGYPROPERTIES = 80994333, + IFCEXTRUDEDAREASOLID = 477187591, + IFCFACEBASEDSURFACEMODEL = 2047409740, + IFCFILLAREASTYLEHATCHING = 374418227, + IFCFILLAREASTYLETILESYMBOLWITHSTYLE = 4203026998, + IFCFILLAREASTYLETILES = 315944413, + IFCFLUIDFLOWPROPERTIES = 3455213021, + IFCFURNISHINGELEMENTTYPE = 4238390223, + IFCFURNITURETYPE = 1268542332, + IFCGEOMETRICCURVESET = 987898635, + IFCISHAPEPROFILEDEF = 1484403080, + IFCLSHAPEPROFILEDEF = 572779678, + IFCLINE = 1281925730, + IFCMANIFOLDSOLIDBREP = 1425443689, + IFCOBJECT = 3888040117, + IFCOFFSETCURVE2D = 3388369263, + IFCOFFSETCURVE3D = 3505215534, + IFCPERMEABLECOVERINGPROPERTIES = 3566463478, + IFCPLANARBOX = 603570806, + IFCPLANE = 220341763, + IFCPROCESS = 2945172077, + IFCPRODUCT = 4208778838, + IFCPROJECT = 103090709, + IFCPROJECTIONCURVE = 4194566429, + IFCPROPERTYSET = 1451395588, + IFCPROXY = 3219374653, + IFCRECTANGLEHOLLOWPROFILEDEF = 2770003689, + IFCRECTANGULARPYRAMID = 2798486643, + IFCRECTANGULARTRIMMEDSURFACE = 3454111270, + IFCRELASSIGNS = 3939117080, + IFCRELASSIGNSTOACTOR = 1683148259, + IFCRELASSIGNSTOCONTROL = 2495723537, + IFCRELASSIGNSTOGROUP = 1307041759, + IFCRELASSIGNSTOPROCESS = 4278684876, + IFCRELASSIGNSTOPRODUCT = 2857406711, + IFCRELASSIGNSTOPROJECTORDER = 3372526763, + IFCRELASSIGNSTORESOURCE = 205026976, + IFCRELASSOCIATES = 1865459582, + IFCRELASSOCIATESAPPLIEDVALUE = 1327628568, + IFCRELASSOCIATESAPPROVAL = 4095574036, + IFCRELASSOCIATESCLASSIFICATION = 919958153, + IFCRELASSOCIATESCONSTRAINT = 2728634034, + IFCRELASSOCIATESDOCUMENT = 982818633, + IFCRELASSOCIATESLIBRARY = 3840914261, + IFCRELASSOCIATESMATERIAL = 2655215786, + IFCRELASSOCIATESPROFILEPROPERTIES = 2851387026, + IFCRELCONNECTS = 826625072, + IFCRELCONNECTSELEMENTS = 1204542856, + IFCRELCONNECTSPATHELEMENTS = 3945020480, + IFCRELCONNECTSPORTTOELEMENT = 4201705270, + IFCRELCONNECTSPORTS = 3190031847, + IFCRELCONNECTSSTRUCTURALACTIVITY = 2127690289, + IFCRELCONNECTSSTRUCTURALELEMENT = 3912681535, + IFCRELCONNECTSSTRUCTURALMEMBER = 1638771189, + IFCRELCONNECTSWITHECCENTRICITY = 504942748, + IFCRELCONNECTSWITHREALIZINGELEMENTS = 3678494232, + IFCRELCONTAINEDINSPATIALSTRUCTURE = 3242617779, + IFCRELCOVERSBLDGELEMENTS = 886880790, + IFCRELCOVERSSPACES = 2802773753, + IFCRELDECOMPOSES = 2551354335, + IFCRELDEFINES = 693640335, + IFCRELDEFINESBYPROPERTIES = 4186316022, + IFCRELDEFINESBYTYPE = 781010003, + IFCRELFILLSELEMENT = 3940055652, + IFCRELFLOWCONTROLELEMENTS = 279856033, + IFCRELINTERACTIONREQUIREMENTS = 4189434867, + IFCRELNESTS = 3268803585, + IFCRELOCCUPIESSPACES = 2051452291, + IFCRELOVERRIDESPROPERTIES = 202636808, + IFCRELPROJECTSELEMENT = 750771296, + IFCRELREFERENCEDINSPATIALSTRUCTURE = 1245217292, + IFCRELSCHEDULESCOSTITEMS = 1058617721, + IFCRELSEQUENCE = 4122056220, + IFCRELSERVICESBUILDINGS = 366585022, + IFCRELSPACEBOUNDARY = 3451746338, + IFCRELVOIDSELEMENT = 1401173127, + IFCRESOURCE = 2914609552, + IFCREVOLVEDAREASOLID = 1856042241, + IFCRIGHTCIRCULARCONE = 4158566097, + IFCRIGHTCIRCULARCYLINDER = 3626867408, + IFCSPATIALSTRUCTUREELEMENT = 2706606064, + IFCSPATIALSTRUCTUREELEMENTTYPE = 3893378262, + IFCSPHERE = 451544542, + IFCSTRUCTURALACTIVITY = 3544373492, + IFCSTRUCTURALITEM = 3136571912, + IFCSTRUCTURALMEMBER = 530289379, + IFCSTRUCTURALREACTION = 3689010777, + IFCSTRUCTURALSURFACEMEMBER = 3979015343, + IFCSTRUCTURALSURFACEMEMBERVARYING = 2218152070, + IFCSTRUCTUREDDIMENSIONCALLOUT = 4070609034, + IFCSURFACECURVESWEPTAREASOLID = 2028607225, + IFCSURFACEOFLINEAREXTRUSION = 2809605785, + IFCSURFACEOFREVOLUTION = 4124788165, + IFCSYSTEMFURNITUREELEMENTTYPE = 1580310250, + IFCTASK = 3473067441, + IFCTRANSPORTELEMENTTYPE = 2097647324, + IFCACTOR = 2296667514, + IFCANNOTATION = 1674181508, + IFCASYMMETRICISHAPEPROFILEDEF = 3207858831, + IFCBLOCK = 1334484129, + IFCBOOLEANCLIPPINGRESULT = 3649129432, + IFCBOUNDEDCURVE = 1260505505, + IFCBUILDING = 4031249490, + IFCBUILDINGELEMENTTYPE = 1950629157, + IFCBUILDINGSTOREY = 3124254112, + IFCCIRCLEHOLLOWPROFILEDEF = 2937912522, + IFCCOLUMNTYPE = 300633059, + IFCCOMPOSITECURVE = 3732776249, + IFCCONIC = 2510884976, + IFCCONSTRUCTIONRESOURCE = 2559216714, + IFCCONTROL = 3293443760, + IFCCOSTITEM = 3895139033, + IFCCOSTSCHEDULE = 1419761937, + IFCCOVERINGTYPE = 1916426348, + IFCCREWRESOURCE = 3295246426, + IFCCURTAINWALLTYPE = 1457835157, + IFCDIMENSIONCURVEDIRECTEDCALLOUT = 681481545, + IFCDISTRIBUTIONELEMENTTYPE = 3256556792, + IFCDISTRIBUTIONFLOWELEMENTTYPE = 3849074793, + IFCELECTRICALBASEPROPERTIES = 360485395, + IFCELEMENT = 1758889154, + IFCELEMENTASSEMBLY = 4123344466, + IFCELEMENTCOMPONENT = 1623761950, + IFCELEMENTCOMPONENTTYPE = 2590856083, + IFCELLIPSE = 1704287377, + IFCENERGYCONVERSIONDEVICETYPE = 2107101300, + IFCEQUIPMENTELEMENT = 1962604670, + IFCEQUIPMENTSTANDARD = 3272907226, + IFCEVAPORATIVECOOLERTYPE = 3174744832, + IFCEVAPORATORTYPE = 3390157468, + IFCFACETEDBREP = 807026263, + IFCFACETEDBREPWITHVOIDS = 3737207727, + IFCFASTENER = 647756555, + IFCFASTENERTYPE = 2489546625, + IFCFEATUREELEMENT = 2827207264, + IFCFEATUREELEMENTADDITION = 2143335405, + IFCFEATUREELEMENTSUBTRACTION = 1287392070, + IFCFLOWCONTROLLERTYPE = 3907093117, + IFCFLOWFITTINGTYPE = 3198132628, + IFCFLOWMETERTYPE = 3815607619, + IFCFLOWMOVINGDEVICETYPE = 1482959167, + IFCFLOWSEGMENTTYPE = 1834744321, + IFCFLOWSTORAGEDEVICETYPE = 1339347760, + IFCFLOWTERMINALTYPE = 2297155007, + IFCFLOWTREATMENTDEVICETYPE = 3009222698, + IFCFURNISHINGELEMENT = 263784265, + IFCFURNITURESTANDARD = 814719939, + IFCGASTERMINALTYPE = 200128114, + IFCGRID = 3009204131, + IFCGROUP = 2706460486, + IFCHEATEXCHANGERTYPE = 1251058090, + IFCHUMIDIFIERTYPE = 1806887404, + IFCINVENTORY = 2391368822, + IFCJUNCTIONBOXTYPE = 4288270099, + IFCLABORRESOURCE = 3827777499, + IFCLAMPTYPE = 1051575348, + IFCLIGHTFIXTURETYPE = 1161773419, + IFCLINEARDIMENSION = 2506943328, + IFCMECHANICALFASTENER = 377706215, + IFCMECHANICALFASTENERTYPE = 2108223431, + IFCMEMBERTYPE = 3181161470, + IFCMOTORCONNECTIONTYPE = 977012517, + IFCMOVE = 1916936684, + IFCOCCUPANT = 4143007308, + IFCOPENINGELEMENT = 3588315303, + IFCORDERACTION = 3425660407, + IFCOUTLETTYPE = 2837617999, + IFCPERFORMANCEHISTORY = 2382730787, + IFCPERMIT = 3327091369, + IFCPIPEFITTINGTYPE = 804291784, + IFCPIPESEGMENTTYPE = 4231323485, + IFCPLATETYPE = 4017108033, + IFCPOLYLINE = 3724593414, + IFCPORT = 3740093272, + IFCPROCEDURE = 2744685151, + IFCPROJECTORDER = 2904328755, + IFCPROJECTORDERRECORD = 3642467123, + IFCPROJECTIONELEMENT = 3651124850, + IFCPROTECTIVEDEVICETYPE = 1842657554, + IFCPUMPTYPE = 2250791053, + IFCRADIUSDIMENSION = 3248260540, + IFCRAILINGTYPE = 2893384427, + IFCRAMPFLIGHTTYPE = 2324767716, + IFCRELAGGREGATES = 160246688, + IFCRELASSIGNSTASKS = 2863920197, + IFCSANITARYTERMINALTYPE = 1768891740, + IFCSCHEDULETIMECONTROL = 3517283431, + IFCSERVICELIFE = 4105383287, + IFCSITE = 4097777520, + IFCSLABTYPE = 2533589738, + IFCSPACE = 3856911033, + IFCSPACEHEATERTYPE = 1305183839, + IFCSPACEPROGRAM = 652456506, + IFCSPACETYPE = 3812236995, + IFCSTACKTERMINALTYPE = 3112655638, + IFCSTAIRFLIGHTTYPE = 1039846685, + IFCSTRUCTURALACTION = 682877961, + IFCSTRUCTURALCONNECTION = 1179482911, + IFCSTRUCTURALCURVECONNECTION = 4243806635, + IFCSTRUCTURALCURVEMEMBER = 214636428, + IFCSTRUCTURALCURVEMEMBERVARYING = 2445595289, + IFCSTRUCTURALLINEARACTION = 1807405624, + IFCSTRUCTURALLINEARACTIONVARYING = 1721250024, + IFCSTRUCTURALLOADGROUP = 1252848954, + IFCSTRUCTURALPLANARACTION = 1621171031, + IFCSTRUCTURALPLANARACTIONVARYING = 3987759626, + IFCSTRUCTURALPOINTACTION = 2082059205, + IFCSTRUCTURALPOINTCONNECTION = 734778138, + IFCSTRUCTURALPOINTREACTION = 1235345126, + IFCSTRUCTURALRESULTGROUP = 2986769608, + IFCSTRUCTURALSURFACECONNECTION = 1975003073, + IFCSUBCONTRACTRESOURCE = 148013059, + IFCSWITCHINGDEVICETYPE = 2315554128, + IFCSYSTEM = 2254336722, + IFCTANKTYPE = 5716631, + IFCTIMESERIESSCHEDULE = 1637806684, + IFCTRANSFORMERTYPE = 1692211062, + IFCTRANSPORTELEMENT = 1620046519, + IFCTRIMMEDCURVE = 3593883385, + IFCTUBEBUNDLETYPE = 1600972822, + IFCUNITARYEQUIPMENTTYPE = 1911125066, + IFCVALVETYPE = 728799441, + IFCVIRTUALELEMENT = 2769231204, + IFCWALLTYPE = 1898987631, + IFCWASTETERMINALTYPE = 1133259667, + IFCWORKCONTROL = 1028945134, + IFCWORKPLAN = 4218914973, + IFCWORKSCHEDULE = 3342526732, + IFCZONE = 1033361043, + IFC2DCOMPOSITECURVE = 1213861670, + IFCACTIONREQUEST = 3821786052, + IFCAIRTERMINALBOXTYPE = 1411407467, + IFCAIRTERMINALTYPE = 3352864051, + IFCAIRTOAIRHEATRECOVERYTYPE = 1871374353, + IFCANGULARDIMENSION = 2470393545, + IFCASSET = 3460190687, + IFCBSPLINECURVE = 1967976161, + IFCBEAMTYPE = 819618141, + IFCBEZIERCURVE = 1916977116, + IFCBOILERTYPE = 231477066, + IFCBUILDINGELEMENT = 3299480353, + IFCBUILDINGELEMENTCOMPONENT = 52481810, + IFCBUILDINGELEMENTPART = 2979338954, + IFCBUILDINGELEMENTPROXY = 1095909175, + IFCBUILDINGELEMENTPROXYTYPE = 1909888760, + IFCCABLECARRIERFITTINGTYPE = 395041908, + IFCCABLECARRIERSEGMENTTYPE = 3293546465, + IFCCABLESEGMENTTYPE = 1285652485, + IFCCHILLERTYPE = 2951183804, + IFCCIRCLE = 2611217952, + IFCCOILTYPE = 2301859152, + IFCCOLUMN = 843113511, + IFCCOMPRESSORTYPE = 3850581409, + IFCCONDENSERTYPE = 2816379211, + IFCCONDITION = 2188551683, + IFCCONDITIONCRITERION = 1163958913, + IFCCONSTRUCTIONEQUIPMENTRESOURCE = 3898045240, + IFCCONSTRUCTIONMATERIALRESOURCE = 1060000209, + IFCCONSTRUCTIONPRODUCTRESOURCE = 488727124, + IFCCOOLEDBEAMTYPE = 335055490, + IFCCOOLINGTOWERTYPE = 2954562838, + IFCCOVERING = 1973544240, + IFCCURTAINWALL = 3495092785, + IFCDAMPERTYPE = 3961806047, + IFCDIAMETERDIMENSION = 4147604152, + IFCDISCRETEACCESSORY = 1335981549, + IFCDISCRETEACCESSORYTYPE = 2635815018, + IFCDISTRIBUTIONCHAMBERELEMENTTYPE = 1599208980, + IFCDISTRIBUTIONCONTROLELEMENTTYPE = 2063403501, + IFCDISTRIBUTIONELEMENT = 1945004755, + IFCDISTRIBUTIONFLOWELEMENT = 3040386961, + IFCDISTRIBUTIONPORT = 3041715199, + IFCDOOR = 395920057, + IFCDUCTFITTINGTYPE = 869906466, + IFCDUCTSEGMENTTYPE = 3760055223, + IFCDUCTSILENCERTYPE = 2030761528, + IFCEDGEFEATURE = 855621170, + IFCELECTRICAPPLIANCETYPE = 663422040, + IFCELECTRICFLOWSTORAGEDEVICETYPE = 3277789161, + IFCELECTRICGENERATORTYPE = 1534661035, + IFCELECTRICHEATERTYPE = 1365060375, + IFCELECTRICMOTORTYPE = 1217240411, + IFCELECTRICTIMECONTROLTYPE = 712377611, + IFCELECTRICALCIRCUIT = 1634875225, + IFCELECTRICALELEMENT = 857184966, + IFCENERGYCONVERSIONDEVICE = 1658829314, + IFCFANTYPE = 346874300, + IFCFILTERTYPE = 1810631287, + IFCFIRESUPPRESSIONTERMINALTYPE = 4222183408, + IFCFLOWCONTROLLER = 2058353004, + IFCFLOWFITTING = 4278956645, + IFCFLOWINSTRUMENTTYPE = 4037862832, + IFCFLOWMOVINGDEVICE = 3132237377, + IFCFLOWSEGMENT = 987401354, + IFCFLOWSTORAGEDEVICE = 707683696, + IFCFLOWTERMINAL = 2223149337, + IFCFLOWTREATMENTDEVICE = 3508470533, + IFCFOOTING = 900683007, + IFCMEMBER = 1073191201, + IFCPILE = 1687234759, + IFCPLATE = 3171933400, + IFCRAILING = 2262370178, + IFCRAMP = 3024970846, + IFCRAMPFLIGHT = 3283111854, + IFCRATIONALBEZIERCURVE = 3055160366, + IFCREINFORCINGELEMENT = 3027567501, + IFCREINFORCINGMESH = 2320036040, + IFCROOF = 2016517767, + IFCROUNDEDEDGEFEATURE = 1376911519, + IFCSENSORTYPE = 1783015770, + IFCSLAB = 1529196076, + IFCSTAIR = 331165859, + IFCSTAIRFLIGHT = 4252922144, + IFCSTRUCTURALANALYSISMODEL = 2515109513, + IFCTENDON = 3824725483, + IFCTENDONANCHOR = 2347447852, + IFCVIBRATIONISOLATORTYPE = 3313531582, + IFCWALL = 2391406946, + IFCWALLSTANDARDCASE = 3512223829, + IFCWINDOW = 3304561284, + IFCACTUATORTYPE = 2874132201, + IFCALARMTYPE = 3001207471, + IFCBEAM = 753842376, + IFCCHAMFEREDGEFEATURE = 2454782716, + IFCCONTROLLERTYPE = 578613899, + IFCDISTRIBUTIONCHAMBERELEMENT = 1052013943, + IFCDISTRIBUTIONCONTROLELEMENT = 1062813311, + IFCELECTRICDISTRIBUTIONPOINT = 3700593921, + IFCREINFORCINGBAR = 979691226, + IFCCONNECTIONVOLUMEGEOMETRY = 775493141, + IFCCOORDINATEOPERATION = 1785450214, + IFCCOORDINATEREFERENCESYSTEM = 1466758467, + IFCEXTERNALINFORMATION = 4294318154, + IFCMAPCONVERSION = 3057273783, + IFCMATERIALDEFINITION = 760658860, + IFCMATERIALLAYERWITHOFFSETS = 1847252529, + IFCMATERIALPROFILE = 2235152071, + IFCMATERIALPROFILESET = 164193824, + IFCMATERIALPROFILEWITHOFFSETS = 552965576, + IFCMATERIALUSAGEDEFINITION = 1507914824, + IFCPRESENTATIONITEM = 677532197, + IFCPROJECTEDCRS = 3843373140, + IFCPROPERTYABSTRACTION = 986844984, + IFCRECURRENCEPATTERN = 3915482550, + IFCREFERENCE = 2433181523, + IFCRESOURCELEVELRELATIONSHIP = 2439245199, + IFCSCHEDULINGTIME = 1054537805, + IFCSTRUCTURALLOADCONFIGURATION = 3478079324, + IFCSTRUCTURALLOADORRESULT = 609421318, + IFCSURFACEREINFORCEMENTAREA = 2934153892, + IFCTABLECOLUMN = 2043862942, + IFCTASKTIME = 1549132990, + IFCTASKTIMERECURRING = 2771591690, + IFCTEXTUREVERTEXLIST = 3611470254, + IFCTIMEPERIOD = 1199560280, + IFCWORKTIME = 1236880293, + IFCCOLOURRGBLIST = 3285139300, + IFCCONVERSIONBASEDUNITWITHOFFSET = 2713554722, + IFCEVENTTIME = 211053100, + IFCEXTENDEDPROPERTIES = 297599258, + IFCEXTERNALREFERENCERELATIONSHIP = 1437805879, + IFCINDEXEDCOLOURMAP = 3570813810, + IFCINDEXEDTEXTUREMAP = 1437953363, + IFCINDEXEDTRIANGLETEXTUREMAP = 2133299955, + IFCLAGTIME = 1585845231, + IFCMATERIALCONSTITUENT = 3708119000, + IFCMATERIALCONSTITUENTSET = 2852063980, + IFCMATERIALPROFILESETUSAGE = 3079605661, + IFCMATERIALPROFILESETUSAGETAPERING = 3404854881, + IFCMATERIALRELATIONSHIP = 853536259, + IFCMIRROREDPROFILEDEF = 2998442950, + IFCPREDEFINEDPROPERTIES = 3778827333, + IFCPROPERTYTEMPLATEDEFINITION = 1482703590, + IFCQUANTITYSET = 2090586900, + IFCRESOURCEAPPROVALRELATIONSHIP = 2943643501, + IFCRESOURCECONSTRAINTRELATIONSHIP = 1608871552, + IFCRESOURCETIME = 1042787934, + IFCSWEPTDISKSOLIDPOLYGONAL = 1096409881, + IFCTESSELLATEDITEM = 901063453, + IFCTYPEPROCESS = 3736923433, + IFCTYPERESOURCE = 3698973494, + IFCADVANCEDFACE = 3406155212, + IFCCARTESIANPOINTLIST = 574549367, + IFCCARTESIANPOINTLIST2D = 1675464909, + IFCCARTESIANPOINTLIST3D = 2059837836, + IFCCONSTRUCTIONRESOURCETYPE = 2574617495, + IFCCONTEXT = 3419103109, + IFCCREWRESOURCETYPE = 1815067380, + IFCCURVEBOUNDEDSURFACE = 2629017746, + IFCEVENTTYPE = 4024345920, + IFCEXTRUDEDAREASOLIDTAPERED = 2804161546, + IFCFIXEDREFERENCESWEPTAREASOLID = 2652556860, + IFCGEOGRAPHICELEMENTTYPE = 4095422895, + IFCINDEXEDPOLYGONALFACE = 178912537, + IFCINDEXEDPOLYGONALFACEWITHVOIDS = 2294589976, + IFCLABORRESOURCETYPE = 428585644, + IFCPCURVE = 1682466193, + IFCPREDEFINEDPROPERTYSET = 3967405729, + IFCPROCEDURETYPE = 569719735, + IFCPROJECTLIBRARY = 653396225, + IFCPROPERTYSETTEMPLATE = 492091185, + IFCPROPERTYTEMPLATE = 3521284610, + IFCRELASSIGNSTOGROUPBYFACTOR = 1027710054, + IFCRELDECLARES = 2565941209, + IFCRELDEFINESBYOBJECT = 1462361463, + IFCRELDEFINESBYTEMPLATE = 307848117, + IFCRELINTERFERESELEMENTS = 427948657, + IFCRELSPACEBOUNDARY1STLEVEL = 3523091289, + IFCRELSPACEBOUNDARY2NDLEVEL = 1521410863, + IFCREPARAMETRISEDCOMPOSITECURVESEGMENT = 816062949, + IFCREVOLVEDAREASOLIDTAPERED = 3243963512, + IFCSIMPLEPROPERTYTEMPLATE = 3663146110, + IFCSPATIALELEMENT = 1412071761, + IFCSPATIALELEMENTTYPE = 710998568, + IFCSPATIALZONE = 463610769, + IFCSPATIALZONETYPE = 2481509218, + IFCSPHERICALSURFACE = 4015995234, + IFCSTRUCTURALSURFACEREACTION = 603775116, + IFCSUBCONTRACTRESOURCETYPE = 4095615324, + IFCSURFACECURVE = 699246055, + IFCTASKTYPE = 3206491090, + IFCTESSELLATEDFACESET = 2387106220, + IFCTOROIDALSURFACE = 1935646853, + IFCTRIANGULATEDFACESET = 2916149573, + IFCADVANCEDBREP = 1635779807, + IFCADVANCEDBREPWITHVOIDS = 2603310189, + IFCBSPLINESURFACE = 2887950389, + IFCBSPLINESURFACEWITHKNOTS = 167062518, + IFCCHIMNEYTYPE = 2197970202, + IFCCIVILELEMENTTYPE = 3893394355, + IFCCOMPLEXPROPERTYTEMPLATE = 3875453745, + IFCCOMPOSITECURVEONSURFACE = 15328376, + IFCCONSTRUCTIONEQUIPMENTRESOURCETYPE = 2185764099, + IFCCONSTRUCTIONMATERIALRESOURCETYPE = 4105962743, + IFCCONSTRUCTIONPRODUCTRESOURCETYPE = 1525564444, + IFCCYLINDRICALSURFACE = 1213902940, + IFCDOORTYPE = 2323601079, + IFCELEMENTASSEMBLYTYPE = 2397081782, + IFCENGINETYPE = 132023988, + IFCEVENT = 4148101412, + IFCEXTERNALSPATIALSTRUCTUREELEMENT = 2853485674, + IFCFOOTINGTYPE = 1893162501, + IFCFURNITURE = 1509553395, + IFCGEOGRAPHICELEMENT = 3493046030, + IFCINDEXEDPOLYCURVE = 2571569899, + IFCINTERCEPTORTYPE = 3946677679, + IFCINTERSECTIONCURVE = 3113134337, + IFCMEDICALDEVICETYPE = 1114901282, + IFCOPENINGSTANDARDCASE = 3079942009, + IFCPILETYPE = 1158309216, + IFCPOLYGONALFACESET = 2839578677, + IFCRAMPTYPE = 1469900589, + IFCRATIONALBSPLINESURFACEWITHKNOTS = 683857671, + IFCREINFORCINGELEMENTTYPE = 964333572, + IFCREINFORCINGMESHTYPE = 2310774935, + IFCROOFTYPE = 2781568857, + IFCSEAMCURVE = 2157484638, + IFCSHADINGDEVICETYPE = 4074543187, + IFCSOLARDEVICETYPE = 1072016465, + IFCSTAIRTYPE = 338393293, + IFCSTRUCTURALCURVEACTION = 1004757350, + IFCSTRUCTURALCURVEREACTION = 2757150158, + IFCSTRUCTURALSURFACEACTION = 3657597509, + IFCSURFACEFEATURE = 3101698114, + IFCSYSTEMFURNITUREELEMENT = 413509423, + IFCTENDONANCHORTYPE = 3081323446, + IFCTENDONTYPE = 2415094496, + IFCVIBRATIONISOLATOR = 2391383451, + IFCVOIDINGFEATURE = 926996030, + IFCWINDOWTYPE = 4009809668, + IFCWORKCALENDAR = 4088093105, + IFCAUDIOVISUALAPPLIANCETYPE = 1532957894, + IFCBSPLINECURVEWITHKNOTS = 2461110595, + IFCBOUNDARYCURVE = 1136057603, + IFCBUILDINGELEMENTPARTTYPE = 39481116, + IFCBUILDINGSYSTEM = 1177604601, + IFCBURNERTYPE = 2188180465, + IFCCABLEFITTINGTYPE = 2674252688, + IFCCHIMNEY = 3296154744, + IFCCIVILELEMENT = 1677625105, + IFCCOLUMNSTANDARDCASE = 905975707, + IFCCOMMUNICATIONSAPPLIANCETYPE = 400855858, + IFCDISTRIBUTIONSYSTEM = 3205830791, + IFCDOORSTANDARDCASE = 3242481149, + IFCELECTRICDISTRIBUTIONBOARDTYPE = 2417008758, + IFCENGINE = 2814081492, + IFCEVAPORATIVECOOLER = 3747195512, + IFCEVAPORATOR = 484807127, + IFCEXTERNALSPATIALELEMENT = 1209101575, + IFCFLOWMETER = 2188021234, + IFCHEATEXCHANGER = 3319311131, + IFCHUMIDIFIER = 2068733104, + IFCINTERCEPTOR = 4175244083, + IFCJUNCTIONBOX = 2176052936, + IFCLAMP = 76236018, + IFCLIGHTFIXTURE = 629592764, + IFCMEDICALDEVICE = 1437502449, + IFCMEMBERSTANDARDCASE = 1911478936, + IFCMOTORCONNECTION = 2474470126, + IFCOUTERBOUNDARYCURVE = 144952367, + IFCOUTLET = 3694346114, + IFCPIPEFITTING = 310824031, + IFCPIPESEGMENT = 3612865200, + IFCPLATESTANDARDCASE = 1156407060, + IFCPROTECTIVEDEVICE = 738039164, + IFCPROTECTIVEDEVICETRIPPINGUNITTYPE = 655969474, + IFCPUMP = 90941305, + IFCRATIONALBSPLINECURVEWITHKNOTS = 1232101972, + IFCREINFORCINGBARTYPE = 2572171363, + IFCSANITARYTERMINAL = 3053780830, + IFCSHADINGDEVICE = 1329646415, + IFCSLABELEMENTEDCASE = 3127900445, + IFCSLABSTANDARDCASE = 3027962421, + IFCSOLARDEVICE = 3420628829, + IFCSPACEHEATER = 1999602285, + IFCSTACKTERMINAL = 1404847402, + IFCSTRUCTURALLOADCASE = 385403989, + IFCSWITCHINGDEVICE = 1162798199, + IFCTANK = 812556717, + IFCTRANSFORMER = 3825984169, + IFCTUBEBUNDLE = 3026737570, + IFCUNITARYCONTROLELEMENTTYPE = 3179687236, + IFCUNITARYEQUIPMENT = 4292641817, + IFCVALVE = 4207607924, + IFCWALLELEMENTEDCASE = 4156078855, + IFCWASTETERMINAL = 4237592921, + IFCWINDOWSTANDARDCASE = 486154966, + IFCAIRTERMINAL = 1634111441, + IFCAIRTERMINALBOX = 177149247, + IFCAIRTOAIRHEATRECOVERY = 2056796094, + IFCAUDIOVISUALAPPLIANCE = 277319702, + IFCBEAMSTANDARDCASE = 2906023776, + IFCBOILER = 32344328, + IFCBURNER = 2938176219, + IFCCABLECARRIERFITTING = 635142910, + IFCCABLECARRIERSEGMENT = 3758799889, + IFCCABLEFITTING = 1051757585, + IFCCABLESEGMENT = 4217484030, + IFCCHILLER = 3902619387, + IFCCOIL = 639361253, + IFCCOMMUNICATIONSAPPLIANCE = 3221913625, + IFCCOMPRESSOR = 3571504051, + IFCCONDENSER = 2272882330, + IFCCOOLEDBEAM = 4136498852, + IFCCOOLINGTOWER = 3640358203, + IFCDAMPER = 4074379575, + IFCDISTRIBUTIONCIRCUIT = 562808652, + IFCDUCTFITTING = 342316401, + IFCDUCTSEGMENT = 3518393246, + IFCDUCTSILENCER = 1360408905, + IFCELECTRICAPPLIANCE = 1904799276, + IFCELECTRICDISTRIBUTIONBOARD = 862014818, + IFCELECTRICFLOWSTORAGEDEVICE = 3310460725, + IFCELECTRICGENERATOR = 264262732, + IFCELECTRICMOTOR = 402227799, + IFCELECTRICTIMECONTROL = 1003880860, + IFCFAN = 3415622556, + IFCFILTER = 819412036, + IFCFIRESUPPRESSIONTERMINAL = 1426591983, + IFCFLOWINSTRUMENT = 182646315, + IFCPROTECTIVEDEVICETRIPPINGUNIT = 2295281155, + IFCSENSOR = 4086658281, + IFCUNITARYCONTROLELEMENT = 630975310, + IFCACTUATOR = 4288193352, + IFCALARM = 3087945054, + IFCCONTROLLER = 25142252, + IFCALIGNMENTPARAMETERSEGMENT = 2879124712, + IFCALIGNMENTVERTICALSEGMENT = 3633395639, + IFCQUANTITYNUMBER = 2691318326, + IFCTEXTURECOORDINATEINDICES = 222769930, + IFCTEXTURECOORDINATEINDICESWITHVOIDS = 1010789467, + IFCALIGNMENTCANTSEGMENT = 3752311538, + IFCALIGNMENTHORIZONTALSEGMENT = 536804194, + IFCLINEARPLACEMENT = 388784114, + IFCOPENCROSSPROFILEDEF = 182550632, + IFCPOINTBYDISTANCEEXPRESSION = 2165702409, + IFCSEGMENT = 823603102, + IFCAXIS2PLACEMENTLINEAR = 3425423356, + IFCCURVESEGMENT = 4212018352, + IFCDIRECTRIXCURVESWEPTAREASOLID = 593015953, + IFCINDEXEDPOLYGONALTEXTUREMAP = 3465909080, + IFCOFFSETCURVE = 590820931, + IFCOFFSETCURVEBYDISTANCES = 2485787929, + IFCPOLYNOMIALCURVE = 3381221214, + IFCRELASSOCIATESPROFILEDEF = 1033248425, + IFCRELPOSITIONS = 1441486842, + IFCSECTIONEDSOLID = 1862484736, + IFCSECTIONEDSOLIDHORIZONTAL = 1290935644, + IFCSECTIONEDSURFACE = 1356537516, + IFCSPIRAL = 2735484536, + IFCTHIRDORDERPOLYNOMIALSPIRAL = 782932809, + IFCTRANSPORTATIONDEVICETYPE = 3665877780, + IFCTRIANGULATEDIRREGULARNETWORK = 1229763772, + IFCVEHICLETYPE = 3651464721, + IFCBUILTELEMENTTYPE = 1626504194, + IFCCLOTHOID = 3497074424, + IFCCOSINESPIRAL = 2000195564, + IFCCOURSETYPE = 4189326743, + IFCDEEPFOUNDATIONTYPE = 1306400036, + IFCDIRECTRIXDERIVEDREFERENCESWEPTAREASOLID = 4234616927, + IFCFACILITY = 24185140, + IFCFACILITYPART = 1310830890, + IFCFACILITYPARTCOMMON = 4228831410, + IFCGEOTECHNICALELEMENT = 4230923436, + IFCGEOTECHNICALSTRATUM = 1594536857, + IFCGRADIENTCURVE = 2898700619, + IFCIMPACTPROTECTIONDEVICE = 2568555532, + IFCIMPACTPROTECTIONDEVICETYPE = 3948183225, + IFCKERBTYPE = 679976338, + IFCLINEARELEMENT = 2176059722, + IFCLIQUIDTERMINALTYPE = 1770583370, + IFCMARINEFACILITY = 525669439, + IFCMARINEPART = 976884017, + IFCMOBILETELECOMMUNICATIONSAPPLIANCETYPE = 1950438474, + IFCMOORINGDEVICETYPE = 710110818, + IFCNAVIGATIONELEMENTTYPE = 506776471, + IFCPAVEMENTTYPE = 514975943, + IFCPOSITIONINGELEMENT = 1946335990, + IFCRAILTYPE = 1763565496, + IFCRAILWAY = 3992365140, + IFCRAILWAYPART = 1891881377, + IFCREFERENT = 4021432810, + IFCRELADHERESTOELEMENT = 3818125796, + IFCROAD = 146592293, + IFCROADPART = 550521510, + IFCSECONDORDERPOLYNOMIALSPIRAL = 3649235739, + IFCSEGMENTEDREFERENCECURVE = 544395925, + IFCSEVENTHORDERPOLYNOMIALSPIRAL = 1027922057, + IFCSIGN = 33720170, + IFCSIGNTYPE = 3599934289, + IFCSIGNALTYPE = 1894708472, + IFCSINESPIRAL = 42703149, + IFCTENDONCONDUIT = 3663046924, + IFCTENDONCONDUITTYPE = 2281632017, + IFCTRACKELEMENTTYPE = 618700268, + IFCTRANSPORTATIONDEVICE = 1953115116, + IFCVEHICLE = 840318589, + IFCVIBRATIONDAMPER = 1530820697, + IFCVIBRATIONDAMPERTYPE = 3956297820, + IFCALIGNMENTCANT = 4266260250, + IFCALIGNMENTHORIZONTAL = 1545765605, + IFCALIGNMENTSEGMENT = 317615605, + IFCALIGNMENTVERTICAL = 1662888072, + IFCBEARINGTYPE = 3649138523, + IFCBRIDGE = 644574406, + IFCBRIDGEPART = 963979645, + IFCBUILTELEMENT = 1876633798, + IFCBUILTSYSTEM = 3862327254, + IFCCAISSONFOUNDATIONTYPE = 3203706013, + IFCCONVEYORSEGMENTTYPE = 2940368186, + IFCCOURSE = 1502416096, + IFCDEEPFOUNDATION = 3426335179, + IFCDISTRIBUTIONBOARDTYPE = 479945903, + IFCEARTHWORKSCUT = 3071239417, + IFCEARTHWORKSELEMENT = 1077100507, + IFCEARTHWORKSFILL = 3376911765, + IFCELECTRICFLOWTREATMENTDEVICETYPE = 2142170206, + IFCGEOTECHNICALASSEMBLY = 2713699986, + IFCKERB = 2696325953, + IFCLINEARPOSITIONINGELEMENT = 1154579445, + IFCLIQUIDTERMINAL = 1638804497, + IFCMOBILETELECOMMUNICATIONSAPPLIANCE = 2078563270, + IFCMOORINGDEVICE = 234836483, + IFCNAVIGATIONELEMENT = 2182337498, + IFCPAVEMENT = 1383356374, + IFCRAIL = 3290496277, + IFCREINFORCEDSOIL = 3798194928, + IFCSIGNAL = 991950508, + IFCTRACKELEMENT = 3425753595, + IFCALIGNMENT = 325726236, + IFCBEARING = 4196446775, + IFCBOREHOLE = 3314249567, + IFCCAISSONFOUNDATION = 3999819293, + IFCCONVEYORSEGMENT = 3460952963, + IFCDISTRIBUTIONBOARD = 3693000487, + IFCELECTRICFLOWTREATMENTDEVICE = 24726584, + IFCGEOMODEL = 2680139844, + IFCGEOSLICE = 1971632696, + IFCABSORBEDDOSEMEASURE = 3699917729, + IFCACCELERATIONMEASURE = 4182062534, + IFCAMOUNTOFSUBSTANCEMEASURE = 360377573, + IFCANGULARVELOCITYMEASURE = 632304761, + IFCAREAMEASURE = 2650437152, + IFCBOOLEAN = 2735952531, + IFCBOXALIGNMENT = 1867003952, + IFCCOMPLEXNUMBER = 2991860651, + IFCCOMPOUNDPLANEANGLEMEASURE = 3812528620, + IFCCONTEXTDEPENDENTMEASURE = 3238673880, + IFCCOUNTMEASURE = 1778710042, + IFCCURVATUREMEASURE = 94842927, + IFCDAYINMONTHNUMBER = 86635668, + IFCDAYLIGHTSAVINGHOUR = 300323983, + IFCDESCRIPTIVEMEASURE = 1514641115, + IFCDIMENSIONCOUNT = 4134073009, + IFCDOSEEQUIVALENTMEASURE = 524656162, + IFCDYNAMICVISCOSITYMEASURE = 69416015, + IFCELECTRICCAPACITANCEMEASURE = 1827137117, + IFCELECTRICCHARGEMEASURE = 3818826038, + IFCELECTRICCONDUCTANCEMEASURE = 2093906313, + IFCELECTRICCURRENTMEASURE = 3790457270, + IFCELECTRICRESISTANCEMEASURE = 2951915441, + IFCELECTRICVOLTAGEMEASURE = 2506197118, + IFCENERGYMEASURE = 2078135608, + IFCFONTSTYLE = 1102727119, + IFCFONTVARIANT = 2715512545, + IFCFONTWEIGHT = 2590844177, + IFCFORCEMEASURE = 1361398929, + IFCFREQUENCYMEASURE = 3044325142, + IFCGLOBALLYUNIQUEID = 3064340077, + IFCHEATFLUXDENSITYMEASURE = 3113092358, + IFCHEATINGVALUEMEASURE = 1158859006, + IFCHOURINDAY = 2589826445, + IFCIDENTIFIER = 983778844, + IFCILLUMINANCEMEASURE = 3358199106, + IFCINDUCTANCEMEASURE = 2679005408, + IFCINTEGER = 1939436016, + IFCINTEGERCOUNTRATEMEASURE = 3809634241, + IFCIONCONCENTRATIONMEASURE = 3686016028, + IFCISOTHERMALMOISTURECAPACITYMEASURE = 3192672207, + IFCKINEMATICVISCOSITYMEASURE = 2054016361, + IFCLABEL = 3258342251, + IFCLENGTHMEASURE = 1243674935, + IFCLINEARFORCEMEASURE = 191860431, + IFCLINEARMOMENTMEASURE = 2128979029, + IFCLINEARSTIFFNESSMEASURE = 1307019551, + IFCLINEARVELOCITYMEASURE = 3086160713, + IFCLOGICAL = 503418787, + IFCLUMINOUSFLUXMEASURE = 2095003142, + IFCLUMINOUSINTENSITYDISTRIBUTIONMEASURE = 2755797622, + IFCLUMINOUSINTENSITYMEASURE = 151039812, + IFCMAGNETICFLUXDENSITYMEASURE = 286949696, + IFCMAGNETICFLUXMEASURE = 2486716878, + IFCMASSDENSITYMEASURE = 1477762836, + IFCMASSFLOWRATEMEASURE = 4017473158, + IFCMASSMEASURE = 3124614049, + IFCMASSPERLENGTHMEASURE = 3531705166, + IFCMINUTEINHOUR = 102610177, + IFCMODULUSOFELASTICITYMEASURE = 3341486342, + IFCMODULUSOFLINEARSUBGRADEREACTIONMEASURE = 2173214787, + IFCMODULUSOFROTATIONALSUBGRADEREACTIONMEASURE = 1052454078, + IFCMODULUSOFSUBGRADEREACTIONMEASURE = 1753493141, + IFCMOISTUREDIFFUSIVITYMEASURE = 3177669450, + IFCMOLECULARWEIGHTMEASURE = 1648970520, + IFCMOMENTOFINERTIAMEASURE = 3114022597, + IFCMONETARYMEASURE = 2615040989, + IFCMONTHINYEARNUMBER = 765770214, + IFCNORMALISEDRATIOMEASURE = 2095195183, + IFCNUMERICMEASURE = 2395907400, + IFCPHMEASURE = 929793134, + IFCPARAMETERVALUE = 2260317790, + IFCPLANARFORCEMEASURE = 2642773653, + IFCPLANEANGLEMEASURE = 4042175685, + IFCPOSITIVELENGTHMEASURE = 2815919920, + IFCPOSITIVEPLANEANGLEMEASURE = 3054510233, + IFCPOSITIVERATIOMEASURE = 1245737093, + IFCPOWERMEASURE = 1364037233, + IFCPRESENTABLETEXT = 2169031380, + IFCPRESSUREMEASURE = 3665567075, + IFCRADIOACTIVITYMEASURE = 3972513137, + IFCRATIOMEASURE = 96294661, + IFCREAL = 200335297, + IFCROTATIONALFREQUENCYMEASURE = 2133746277, + IFCROTATIONALMASSMEASURE = 1755127002, + IFCROTATIONALSTIFFNESSMEASURE = 3211557302, + IFCSECONDINMINUTE = 2766185779, + IFCSECTIONMODULUSMEASURE = 3467162246, + IFCSECTIONALAREAINTEGRALMEASURE = 2190458107, + IFCSHEARMODULUSMEASURE = 408310005, + IFCSOLIDANGLEMEASURE = 3471399674, + IFCSOUNDPOWERMEASURE = 846465480, + IFCSOUNDPRESSUREMEASURE = 993287707, + IFCSPECIFICHEATCAPACITYMEASURE = 3477203348, + IFCSPECULAREXPONENT = 2757832317, + IFCSPECULARROUGHNESS = 361837227, + IFCTEMPERATUREGRADIENTMEASURE = 58845555, + IFCTEXT = 2801250643, + IFCTEXTALIGNMENT = 1460886941, + IFCTEXTDECORATION = 3490877962, + IFCTEXTFONTNAME = 603696268, + IFCTEXTTRANSFORMATION = 296282323, + IFCTHERMALADMITTANCEMEASURE = 232962298, + IFCTHERMALCONDUCTIVITYMEASURE = 2645777649, + IFCTHERMALEXPANSIONCOEFFICIENTMEASURE = 2281867870, + IFCTHERMALRESISTANCEMEASURE = 857959152, + IFCTHERMALTRANSMITTANCEMEASURE = 2016195849, + IFCTHERMODYNAMICTEMPERATUREMEASURE = 743184107, + IFCTIMEMEASURE = 2726807636, + IFCTIMESTAMP = 2591213694, + IFCTORQUEMEASURE = 1278329552, + IFCVAPORPERMEABILITYMEASURE = 3345633955, + IFCVOLUMEMEASURE = 3458127941, + IFCVOLUMETRICFLOWRATEMEASURE = 2593997549, + IFCWARPINGCONSTANTMEASURE = 51269191, + IFCWARPINGMOMENTMEASURE = 1718600412, + IFCYEARNUMBER = 4065007721, + IFCARCINDEX = 3683503648, + IFCAREADENSITYMEASURE = 1500781891, + IFCBINARY = 2314439260, + IFCCARDINALPOINTREFERENCE = 1683019596, + IFCDATE = 937566702, + IFCDATETIME = 2195413836, + IFCDAYINWEEKNUMBER = 3701338814, + IFCDURATION = 2541165894, + IFCLANGUAGEID = 1275358634, + IFCLINEINDEX = 1774176899, + IFCNONNEGATIVELENGTHMEASURE = 525895558, + IFCPOSITIVEINTEGER = 1790229001, + IFCPROPERTYSETDEFINITIONSET = 2798247006, + IFCSOUNDPOWERLEVELMEASURE = 4157543285, + IFCSOUNDPRESSURELEVELMEASURE = 3457685358, + IFCTEMPERATURERATEOFCHANGEMEASURE = 1209108979, + IFCTIME = 4075327185, + IFCURIREFERENCE = 950732822, +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcVertex.cs b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcVertex.cs new file mode 100644 index 000000000..c4b28722e --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/Types/IfcVertex.cs @@ -0,0 +1,14 @@ +using System.Runtime.InteropServices; + +namespace Speckle.Importers.Ifc.Types; + +[StructLayout(LayoutKind.Sequential, Pack = 1)] +public struct IfcVertex +{ + public double PX, + PY, + PZ; + public double NX, + NY, + NZ; +} diff --git a/Importers/Ifc/Speckle.Importers.Ifc/packages.lock.json b/Importers/Ifc/Speckle.Importers.Ifc/packages.lock.json new file mode 100644 index 000000000..5c6d2f6a8 --- /dev/null +++ b/Importers/Ifc/Speckle.Importers.Ifc/packages.lock.json @@ -0,0 +1,296 @@ +{ + "version": 2, + "dependencies": { + "net8.0": { + "Ara3D.Buffers": { + "type": "Direct", + "requested": "[1.4.5, )", + "resolved": "1.4.5", + "contentHash": "SKcQqgtXukyHTlTKFPCaUW4spSkue3XfBU/GmoA7KhH6H995v6TbJxtqjs0EfSgnXEkajL8U7X1NqktScRozXw==", + "dependencies": { + "System.Memory": "4.5.5" + } + }, + "Ara3D.Logging": { + "type": "Direct", + "requested": "[1.4.5, )", + "resolved": "1.4.5", + "contentHash": "7HPCe5Dq21JoOBF1iclk9H37XFCoB2ZzCPqTMNgdg4PWFvuRsofNbiuMdiE/HKgMHCVhy1C5opB2KwDKcO7Axw==", + "dependencies": { + "Ara3D.Utils": "1.4.5" + } + }, + "Ara3D.Utils": { + "type": "Direct", + "requested": "[1.4.5, )", + "resolved": "1.4.5", + "contentHash": "yba/E7PpbWP0+RDp+KbKw/vBXnXBSIheScdpVKuDnr8ytRg8pZ2Jd6nwKES+G0FcVEB9PeOVmEW7SGrFvAwRCg==" + }, + "Microsoft.Extensions.DependencyInjection": { + "type": "Direct", + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "MZtBIwfDFork5vfjpJdG5g8wuJFt7d/y3LOSVVtDK/76wlbtz6cjltfKHqLx2TKVqTj5/c41t77m1+h20zqtPA==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0" + } + }, + "Microsoft.NETFramework.ReferenceAssemblies": { + "type": "Direct", + "requested": "[1.0.3, )", + "resolved": "1.0.3", + "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", + "dependencies": { + "Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3" + } + }, + "Microsoft.SourceLink.GitHub": { + "type": "Direct", + "requested": "[8.0.0, )", + "resolved": "8.0.0", + "contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==", + "dependencies": { + "Microsoft.Build.Tasks.Git": "8.0.0", + "Microsoft.SourceLink.Common": "8.0.0" + } + }, + "PolySharp": { + "type": "Direct", + "requested": "[1.14.1, )", + "resolved": "1.14.1", + "contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ==" + }, + "Speckle.InterfaceGenerator": { + "type": "Direct", + "requested": "[0.9.6, )", + "resolved": "0.9.6", + "contentHash": "HKH7tYrYYlCK1ct483hgxERAdVdMtl7gUKW9ijWXxA1UsYR4Z+TrRHYmzZ9qmpu1NnTycSrp005NYM78GDKV1w==" + }, + "Speckle.Objects": { + "type": "Direct", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", + "dependencies": { + "Speckle.Sdk": "3.1.0-dev.228" + } + }, + "Speckle.Sdk": { + "type": "Direct", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", + "dependencies": { + "GraphQL.Client": "6.0.0", + "Microsoft.CSharp": "4.7.0", + "Microsoft.Data.Sqlite": "7.0.5", + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", + "Microsoft.Extensions.Logging": "2.2.0", + "Speckle.DoubleNumerics": "4.0.1", + "Speckle.Newtonsoft.Json": "13.0.2", + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" + } + }, + "GraphQL.Client": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0", + "GraphQL.Client.Abstractions.Websocket": "6.0.0", + "System.Reactive": "5.0.0" + } + }, + "GraphQL.Client.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==", + "dependencies": { + "GraphQL.Primitives": "6.0.0" + } + }, + "GraphQL.Client.Abstractions.Websocket": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==", + "dependencies": { + "GraphQL.Client.Abstractions": "6.0.0" + } + }, + "GraphQL.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA==" + }, + "Microsoft.Build.Tasks.Git": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ==" + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==" + }, + "Microsoft.Data.Sqlite": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==", + "dependencies": { + "Microsoft.Data.Sqlite.Core": "7.0.5", + "SQLitePCLRaw.bundle_e_sqlite3": "2.1.4" + } + }, + "Microsoft.Data.Sqlite.Core": { + "type": "Transitive", + "resolved": "7.0.5", + "contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "Microsoft.Extensions.Configuration": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "nOP8R1mVb/6mZtm2qgAJXn/LFm/2kMjHDAg/QJLFG6CuWYJtaD3p1BwQhufBVvRzL9ceJ/xF0SQ0qsI2GkDQAA==", + "dependencies": { + "Microsoft.Extensions.Configuration.Abstractions": "2.2.0" + } + }, + "Microsoft.Extensions.Configuration.Abstractions": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "65MrmXCziWaQFrI0UHkQbesrX5wTwf9XPjY5yFm/VkgJKFJ5gqvXRoXjIZcf2wLi5ZlwGz/oMYfyURVCWbM5iw==", + "dependencies": { + "Microsoft.Extensions.Primitives": "2.2.0" + } + }, + "Microsoft.Extensions.Configuration.Binder": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "vJ9xvOZCnUAIHcGC3SU35r3HKmHTVIeHzo6u/qzlHAqD8m6xv92MLin4oJntTvkpKxVX3vI1GFFkIQtU3AdlsQ==", + "dependencies": { + "Microsoft.Extensions.Configuration": "2.2.0" + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "f9hstgjVmr6rmrfGSpfsVOl2irKAgr1QjrSi3FgnS7kulxband50f2brRLwySAQTADPZeTdow0mpSMcoAdadCw==" + }, + "Microsoft.Extensions.Options": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "UpZLNLBpIZ0GTebShui7xXYh6DmBHjWM8NxGxZbdQh/bPZ5e6YswqI+bru6BnEL5eWiOdodsXtEz3FROcgi/qg==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", + "Microsoft.Extensions.Primitives": "2.2.0", + "System.ComponentModel.Annotations": "4.5.0" + } + }, + "Microsoft.Extensions.Primitives": { + "type": "Transitive", + "resolved": "2.2.0", + "contentHash": "azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==", + "dependencies": { + "System.Memory": "4.5.1", + "System.Runtime.CompilerServices.Unsafe": "4.5.1" + } + }, + "Microsoft.NETFramework.ReferenceAssemblies.net461": { + "type": "Transitive", + "resolved": "1.0.3", + "contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA==" + }, + "Microsoft.SourceLink.Common": { + "type": "Transitive", + "resolved": "8.0.0", + "contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw==" + }, + "Speckle.DoubleNumerics": { + "type": "Transitive", + "resolved": "4.0.1", + "contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w==" + }, + "Speckle.Newtonsoft.Json": { + "type": "Transitive", + "resolved": "13.0.2", + "contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA==" + }, + "SQLitePCLRaw.bundle_e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==", + "dependencies": { + "SQLitePCLRaw.lib.e_sqlite3": "2.1.4", + "SQLitePCLRaw.provider.e_sqlite3": "2.1.4" + } + }, + "SQLitePCLRaw.core": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==", + "dependencies": { + "System.Memory": "4.5.3" + } + }, + "SQLitePCLRaw.lib.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg==" + }, + "SQLitePCLRaw.provider.e_sqlite3": { + "type": "Transitive", + "resolved": "2.1.4", + "contentHash": "CSlb5dUp1FMIkez9Iv5EXzpeq7rHryVNqwJMWnpq87j9zWZexaEMdisDktMsnnrzKM6ahNrsTkjqNodTBPBxtQ==", + "dependencies": { + "SQLitePCLRaw.core": "2.1.4" + } + }, + "System.ComponentModel.Annotations": { + "type": "Transitive", + "resolved": "4.5.0", + "contentHash": "UxYQ3FGUOtzJ7LfSdnYSFd7+oEv6M8NgUatatIN2HxNtDdlcvFAf+VIq4Of9cDMJEJC0aSRv/x898RYhB4Yppg==" + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.5", + "contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==" + }, + "System.Reactive": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==" + }, + "System.Runtime.CompilerServices.Unsafe": { + "type": "Transitive", + "resolved": "4.5.1", + "contentHash": "Zh8t8oqolRaFa9vmOZfdQm/qKejdqz0J9kr7o2Fu0vPeoH3BL1EOXipKWwkWtLT1JPzjByrF19fGuFlNbmPpiw==" + }, + "Microsoft.Extensions.Logging": { + "type": "CentralTransitive", + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "Nxqhadc9FCmFHzU+fz3oc8sFlE6IadViYg8dfUdGzJZ2JUxnCsRghBhhOWdM4B2zSZqEc+0BjliBh/oNdRZuig==", + "dependencies": { + "Microsoft.Extensions.Configuration.Binder": "2.2.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", + "Microsoft.Extensions.Logging.Abstractions": "2.2.0", + "Microsoft.Extensions.Options": "2.2.0" + } + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "CentralTransitive", + "requested": "[2.2.0, )", + "resolved": "2.2.0", + "contentHash": "B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A==" + }, + "Speckle.Sdk.Dependencies": { + "type": "CentralTransitive", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" + } + } + } +} \ No newline at end of file diff --git a/Local.sln b/Local.sln index f8d9e93d0..bb623c542 100644 --- a/Local.sln +++ b/Local.sln @@ -262,6 +262,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Connectors.Naviswor EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Converters.Navisworks2024", "Converters\Navisworks\Speckle.Converters.Navisworks2024\Speckle.Converters.Navisworks2024.csproj", "{52D789C2-5B3C-4225-9F84-C54B3AB4F1B5}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Importers", "Importers", "{24750B06-C90D-43B1-B2E4-088D531D6748}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ifc", "Ifc", "{0EF6C4D6-AC76-408F-8D32-2F9DA8006077}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Importers.Ifc", "Importers\Ifc\Speckle.Importers.Ifc\Speckle.Importers.Ifc.csproj", "{9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Importers.Ifc.Tester", "Importers\Ifc\Speckle.Importers.Ifc.Tester\Speckle.Importers.Ifc.Tester.csproj", "{B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -671,6 +679,18 @@ Global {52D789C2-5B3C-4225-9F84-C54B3AB4F1B5}.Local|Any CPU.Build.0 = Local|Any CPU {52D789C2-5B3C-4225-9F84-C54B3AB4F1B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {52D789C2-5B3C-4225-9F84-C54B3AB4F1B5}.Release|Any CPU.Build.0 = Release|Any CPU + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}.Local|Any CPU.ActiveCfg = Debug|Any CPU + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}.Local|Any CPU.Build.0 = Debug|Any CPU + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B}.Release|Any CPU.Build.0 = Release|Any CPU + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}.Local|Any CPU.ActiveCfg = Debug|Any CPU + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}.Local|Any CPU.Build.0 = Debug|Any CPU + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -791,6 +811,9 @@ Global {FD44E1F0-D20A-49B6-ADC9-482D911A74FB} = {91DCAFB0-283B-4B07-9F6F-7335DECEEB08} {7791806E-7531-41D8-9C9D-4A1249D9F99C} = {A88CFA1F-B2D5-4DBE-8496-68D0AFA46F2D} {52D789C2-5B3C-4225-9F84-C54B3AB4F1B5} = {AE58C92C-DBF3-4248-8614-8F283B8CB5F8} + {0EF6C4D6-AC76-408F-8D32-2F9DA8006077} = {24750B06-C90D-43B1-B2E4-088D531D6748} + {9FD99F9B-8D50-4C7A-B3A6-22E28AB5F26B} = {0EF6C4D6-AC76-408F-8D32-2F9DA8006077} + {B3B126CA-A419-48D1-B117-6DEE1DE1AFAD} = {0EF6C4D6-AC76-408F-8D32-2F9DA8006077} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EE253116-7070-4E9A-BCE8-2911C251B8C8} diff --git a/Sdk/Speckle.Connectors.Common/Builders/IHostObjectBuilder.cs b/Sdk/Speckle.Connectors.Common/Builders/IHostObjectBuilder.cs index 7d9e150dc..112af1952 100644 --- a/Sdk/Speckle.Connectors.Common/Builders/IHostObjectBuilder.cs +++ b/Sdk/Speckle.Connectors.Common/Builders/IHostObjectBuilder.cs @@ -14,11 +14,10 @@ public interface IHostObjectBuilder /// Project of the model. /// Name of the model. /// Action to update UI progress bar. - /// Cancellation token that passed from top -> ReceiveBinding. /// List of application ids. // POC: Where we will return these ids will matter later when we target to also cache received application ids. /// Project and model name are needed for now to construct host app objects into related layers or filters. /// POC: we might consider later to have HostObjectBuilderContext? that might hold all possible data we will need. - Task Build( + HostObjectBuilderResult Build( Base rootObject, string projectName, string modelName, diff --git a/Sdk/Speckle.Connectors.Common/Builders/IRootObjectBuilder.cs b/Sdk/Speckle.Connectors.Common/Builders/IRootObjectBuilder.cs index f3584c726..f1d9acff4 100644 --- a/Sdk/Speckle.Connectors.Common/Builders/IRootObjectBuilder.cs +++ b/Sdk/Speckle.Connectors.Common/Builders/IRootObjectBuilder.cs @@ -6,11 +6,28 @@ namespace Speckle.Connectors.Common.Builders; public interface IRootObjectBuilder { - public Task Build( + public Task BuildAsync( IReadOnlyList objects, SendInfo sendInfo, IProgress onOperationProgressed, - CancellationToken ct = default + CancellationToken cancellationToken + ); +} + +public abstract class RootObjectBuilderBase : IRootObjectBuilder +{ + public Task BuildAsync( + IReadOnlyList objects, + SendInfo sendInfo, + IProgress onOperationProgressed, + CancellationToken cancellationToken + ) => Task.FromResult(Build(objects, sendInfo, onOperationProgressed, cancellationToken)); + + public abstract RootObjectBuilderResult Build( + IReadOnlyList objects, + SendInfo sendInfo, + IProgress onOperationProgressed, + CancellationToken cancellationToken ); } diff --git a/Sdk/Speckle.Connectors.Common/Operations/ISyncToThread.cs b/Sdk/Speckle.Connectors.Common/Operations/ISyncToThread.cs deleted file mode 100644 index 2440e642f..000000000 --- a/Sdk/Speckle.Connectors.Common/Operations/ISyncToThread.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Speckle.Connectors.Common.Operations; - -public interface ISyncToThread -{ - public Task RunOnThread(Func> func); -} diff --git a/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs b/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs index caaa0162f..5827a715f 100644 --- a/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs +++ b/Sdk/Speckle.Connectors.Common/Operations/ReceiveOperation.cs @@ -1,4 +1,5 @@ using Speckle.Connectors.Common.Builders; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.Logging; using Speckle.Sdk.Api; using Speckle.Sdk.Credentials; @@ -14,7 +15,9 @@ public sealed class ReceiveOperation( IReceiveProgress receiveProgress, ISdkActivityFactory activityFactory, IOperations operations, - IClientFactory clientFactory + IClientFactory clientFactory, + IThreadContext threadContext, + IThreadOptions threadOptions ) { public async Task Execute( @@ -30,41 +33,49 @@ CancellationToken cancellationToken using Client apiClient = clientFactory.Create(account); using var userScope = ActivityScope.SetTag(Consts.USER_ID, account.GetHashedEmail()); - var version = await apiClient - .Version.Get(receiveInfo.SelectedVersionId, receiveInfo.ProjectId, cancellationToken) - .ConfigureAwait(false); + var version = await apiClient.Version.Get(receiveInfo.SelectedVersionId, receiveInfo.ProjectId, cancellationToken); - receiveProgress.Begin(); - Base? commitObject = await operations - .Receive2( - new Uri(account.serverInfo.url), - receiveInfo.ProjectId, - version.referencedObject, - account.token, - onProgressAction: new PassthroughProgress(args => receiveProgress.Report(onOperationProgressed, args)), - cancellationToken: cancellationToken - ) - .ConfigureAwait(false); - - cancellationToken.ThrowIfCancellationRequested(); + var commitObject = await threadContext.RunOnWorkerAsync( + () => ReceiveData(account, version, receiveInfo, onOperationProgressed, cancellationToken) + ); // 4 - Convert objects - HostObjectBuilderResult? res = await ConvertObjects( - commitObject, - receiveInfo, - onOperationProgressed, - cancellationToken - ) - .ConfigureAwait(false); + HostObjectBuilderResult res = await threadContext.RunOnThread( + () => ConvertObjects(commitObject, receiveInfo, onOperationProgressed, cancellationToken), + threadOptions.RunReceiveBuildOnMainThread + ); - await apiClient - .Version.Received(new(version.id, receiveInfo.ProjectId, receiveInfo.SourceApplication), cancellationToken) - .ConfigureAwait(false); + await apiClient.Version.Received( + new(version.id, receiveInfo.ProjectId, receiveInfo.SourceApplication), + cancellationToken + ); return res; } - private async Task ConvertObjects( + private async Task ReceiveData( + Account account, + Speckle.Sdk.Api.GraphQL.Models.Version version, + ReceiveInfo receiveInfo, + IProgress onOperationProgressed, + CancellationToken cancellationToken + ) + { + receiveProgress.Begin(); + Base commitObject = await operations.Receive2( + new Uri(account.serverInfo.url), + receiveInfo.ProjectId, + version.referencedObject, + account.token, + onProgressAction: new PassthroughProgress(args => receiveProgress.Report(onOperationProgressed, args)), + cancellationToken: cancellationToken + ); + + cancellationToken.ThrowIfCancellationRequested(); + return commitObject; + } + + private HostObjectBuilderResult ConvertObjects( Base commitObject, ReceiveInfo receiveInfo, IProgress onOperationProgressed, @@ -81,9 +92,13 @@ CancellationToken cancellationToken try { - HostObjectBuilderResult res = await hostObjectBuilder - .Build(commitObject, receiveInfo.ProjectName, receiveInfo.ModelName, onOperationProgressed, cancellationToken) - .ConfigureAwait(false); + HostObjectBuilderResult res = hostObjectBuilder.Build( + commitObject, + receiveInfo.ProjectName, + receiveInfo.ModelName, + onOperationProgressed, + cancellationToken + ); conversionActivity?.SetStatus(SdkActivityStatusCode.Ok); return res; } diff --git a/Sdk/Speckle.Connectors.Common/Operations/ReceiveProgress.cs b/Sdk/Speckle.Connectors.Common/Operations/ReceiveProgress.cs index a0ca61bc4..3e0cf800d 100644 --- a/Sdk/Speckle.Connectors.Common/Operations/ReceiveProgress.cs +++ b/Sdk/Speckle.Connectors.Common/Operations/ReceiveProgress.cs @@ -7,40 +7,48 @@ namespace Speckle.Connectors.Common.Operations; public sealed class ReceiveProgress(IProgressDisplayManager progressDisplayManager) : IReceiveProgress { private double? _previousPercentage; - private string? _previousSpeed; + private string? _downloadSpeed; + private double? _downloadPercentage; public void Begin() => progressDisplayManager.Begin(); public void Report(IProgress onOperationProgressed, ProgressArgs args) { + switch (args.ProgressEvent) { - switch (args.ProgressEvent) - { - case ProgressEvent.CacheCheck: - _previousPercentage = progressDisplayManager.CalculatePercentage(args); - break; - case ProgressEvent.DownloadBytes: - _previousSpeed = progressDisplayManager.CalculateSpeed(args); - break; - } + case ProgressEvent.CacheCheck: + _previousPercentage = progressDisplayManager.CalculatePercentage(args); + break; + case ProgressEvent.DownloadBytes: + _downloadSpeed = progressDisplayManager.CalculateSpeed(args); + break; + case ProgressEvent.DownloadObjects: + _downloadPercentage = progressDisplayManager.CalculatePercentage(args); + break; + } - if (!progressDisplayManager.ShouldUpdate()) - { - return; - } + if (!progressDisplayManager.ShouldUpdate()) + { + return; + } - switch (args.ProgressEvent) - { - case ProgressEvent.CacheCheck: - onOperationProgressed.Report(new("Checking cache... ", _previousPercentage)); - break; - case ProgressEvent.DownloadBytes: - onOperationProgressed.Report(new($"Downloading... ({_previousSpeed})", null)); - break; - case ProgressEvent.DeserializeObject: - onOperationProgressed.Report(new("Deserializing ...", progressDisplayManager.CalculatePercentage(args))); - break; - } + switch (args.ProgressEvent) + { + case ProgressEvent.CacheCheck: + onOperationProgressed.Report(new("Checking cache... ", _previousPercentage)); + break; + case ProgressEvent.DownloadBytes: + case ProgressEvent.DownloadObjects: + onOperationProgressed.Report(new($"Downloading... ({_downloadSpeed})", _downloadPercentage)); + break; + case ProgressEvent.DeserializeObject: + onOperationProgressed.Report( + new( + $"Deserializing ... ({args.Count} / {args.Total} objects)", + progressDisplayManager.CalculatePercentage(args) + ) + ); + break; } } } diff --git a/Sdk/Speckle.Connectors.Common/Operations/SendOperation.cs b/Sdk/Speckle.Connectors.Common/Operations/SendOperation.cs index 19a9d3524..c131d0058 100644 --- a/Sdk/Speckle.Connectors.Common/Operations/SendOperation.cs +++ b/Sdk/Speckle.Connectors.Common/Operations/SendOperation.cs @@ -1,6 +1,7 @@ using Speckle.Connectors.Common.Builders; using Speckle.Connectors.Common.Caching; using Speckle.Connectors.Common.Conversion; +using Speckle.Connectors.Common.Threading; using Speckle.Connectors.Logging; using Speckle.Sdk.Api; using Speckle.Sdk.Api.GraphQL.Inputs; @@ -19,7 +20,8 @@ public sealed class SendOperation( ISendProgress sendProgress, IOperations operations, IClientFactory clientFactory, - ISdkActivityFactory activityFactory + ISdkActivityFactory activityFactory, + IThreadContext threadContext ) { public async Task Execute( @@ -29,7 +31,9 @@ public async Task Execute( CancellationToken ct = default ) { - var buildResult = await rootObjectBuilder.Build(objects, sendInfo, onOperationProgressed, ct).ConfigureAwait(false); + var buildResult = await threadContext.RunOnMainAsync( + async () => await rootObjectBuilder.BuildAsync(objects, sendInfo, onOperationProgressed, ct) + ); // POC: Jonathon asks on behalf of willow twin - let's explore how this can work // buildResult.RootObject["@report"] = new Report { ConversionResults = buildResult.ConversionResults }; @@ -37,8 +41,9 @@ public async Task Execute( buildResult.RootObject["version"] = 3; // base object handler is separated, so we can do some testing on non-production databases // exact interface may want to be tweaked when we implement this - var (rootObjId, convertedReferences) = await Send(buildResult.RootObject, sendInfo, onOperationProgressed, ct) - .ConfigureAwait(false); + var (rootObjId, convertedReferences) = await threadContext.RunOnWorkerAsync( + () => Send(buildResult.RootObject, sendInfo, onOperationProgressed, ct) + ); return new(rootObjId, convertedReferences, buildResult.ConversionResults); } @@ -59,16 +64,14 @@ public async Task Send( using var activity = activityFactory.Start("SendOperation"); sendProgress.Begin(); - var sendResult = await operations - .Send2( - sendInfo.ServerUrl, - sendInfo.ProjectId, - account.token, - commitObject, - onProgressAction: new PassthroughProgress(args => sendProgress.Report(onOperationProgressed, args)), - ct - ) - .ConfigureAwait(false); + var sendResult = await operations.Send2( + sendInfo.ServerUrl, + sendInfo.ProjectId, + account.token, + commitObject, + onProgressAction: new PassthroughProgress(args => sendProgress.Report(onOperationProgressed, args)), + ct + ); sendConversionCache.StoreSendResult(sendInfo.ProjectId, sendResult.ConvertedReferences); diff --git a/Sdk/Speckle.Connectors.Common/Threading/DefaultThreadContext.cs b/Sdk/Speckle.Connectors.Common/Threading/DefaultThreadContext.cs new file mode 100644 index 000000000..1a56531ec --- /dev/null +++ b/Sdk/Speckle.Connectors.Common/Threading/DefaultThreadContext.cs @@ -0,0 +1,36 @@ +namespace Speckle.Connectors.Common.Threading; + +public class DefaultThreadContext : ThreadContext +{ + //should be always newed up on the host app's main thread + private readonly TaskScheduler _uiTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); + + protected override Task WorkerToMainAsync(Func> action) + { + var t = Task.Factory.StartNew(action, default, TaskCreationOptions.AttachedToParent, _uiTaskScheduler); + return t.Unwrap(); + } + + protected override Task MainToWorkerAsync(Func> action) + { + Task> f = Task.Factory.StartNew( + action, + default, + TaskCreationOptions.AttachedToParent, + TaskScheduler.Default + ); + return f.Unwrap(); + } + + protected override Task WorkerToMain(Func action) + { + var t = Task.Factory.StartNew(action, default, TaskCreationOptions.AttachedToParent, _uiTaskScheduler); + return t; + } + + protected override Task MainToWorker(Func action) + { + Task f = Task.Factory.StartNew(action, default, TaskCreationOptions.LongRunning, TaskScheduler.Default); + return f; + } +} diff --git a/Sdk/Speckle.Connectors.Common/Threading/TaskExtensions.cs b/Sdk/Speckle.Connectors.Common/Threading/TaskExtensions.cs new file mode 100644 index 000000000..3ebc31b8c --- /dev/null +++ b/Sdk/Speckle.Connectors.Common/Threading/TaskExtensions.cs @@ -0,0 +1,8 @@ +namespace Speckle.Connectors.Common.Threading; + +public static class TaskExtensions +{ +#pragma warning disable CA1030 + public static async void FireAndForget(this Task valueTask) => await valueTask; +#pragma warning restore CA1030 +} diff --git a/Sdk/Speckle.Connectors.Common/Threading/ThreadContext.cs b/Sdk/Speckle.Connectors.Common/Threading/ThreadContext.cs new file mode 100644 index 000000000..b109b7101 --- /dev/null +++ b/Sdk/Speckle.Connectors.Common/Threading/ThreadContext.cs @@ -0,0 +1,130 @@ +using Speckle.InterfaceGenerator; + +namespace Speckle.Connectors.Common.Threading; + +[GenerateAutoInterface] +public abstract class ThreadContext : IThreadContext +{ + private static readonly Task s_empty = Task.FromResult(null); + public static bool IsMainThread => Environment.CurrentManagedThreadId == 1; + + public async Task RunOnThread(Action action, bool useMain) + { + if (useMain) + { + if (IsMainThread) + { + RunMain(action); + } + else + { + await WorkerToMainAsync(() => + { + action(); + return s_empty; + }); + } + } + else + { + if (IsMainThread) + { + await MainToWorkerAsync(() => + { + action(); + return s_empty; + }); + } + else + { + RunMain(action); + } + } + } + + public virtual Task RunOnThread(Func action, bool useMain) + { + if (useMain) + { + if (IsMainThread) + { + return RunMainAsync(action); + } + + return WorkerToMain(action); + } + if (IsMainThread) + { + return MainToWorker(action); + } + + return RunMainAsync(action); + } + + public async Task RunOnThreadAsync(Func action, bool useMain) + { + if (useMain) + { + if (IsMainThread) + { + await RunMainAsync(action); + } + else + { + await WorkerToMainAsync(async () => + { + await action(); + return Task.FromResult(null); + }); + } + } + else + { + if (IsMainThread) + { + await MainToWorkerAsync(async () => + { + await action(); + return Task.FromResult(null); + }); + } + else + { + await RunMainAsync(action); + } + } + } + + public Task RunOnThreadAsync(Func> action, bool useMain) + { + if (useMain) + { + if (IsMainThread) + { + return RunMainAsync(action); + } + + return WorkerToMainAsync(action); + } + if (IsMainThread) + { + return MainToWorkerAsync(action); + } + return RunMainAsync(action); + } + + protected abstract Task WorkerToMainAsync(Func> action); + + protected abstract Task MainToWorkerAsync(Func> action); + protected abstract Task WorkerToMain(Func action); + + protected abstract Task MainToWorker(Func action); + + protected virtual void RunMain(Action action) => action(); + + protected virtual Task RunMainAsync(Func action) => Task.FromResult(action()); + + protected virtual Task RunMainAsync(Func action) => Task.FromResult(action()); + + protected virtual Task RunMainAsync(Func> action) => action(); +} diff --git a/Sdk/Speckle.Connectors.Common/Threading/ThreadContextExtensions.cs b/Sdk/Speckle.Connectors.Common/Threading/ThreadContextExtensions.cs new file mode 100644 index 000000000..b6dbf2c59 --- /dev/null +++ b/Sdk/Speckle.Connectors.Common/Threading/ThreadContextExtensions.cs @@ -0,0 +1,28 @@ +namespace Speckle.Connectors.Common.Threading; + +public static class ThreadContextExtensions +{ + public static Task RunOnMain(this IThreadContext threadContext, Action action) => + threadContext.RunOnThread(action, true); + + public static Task RunOnWorker(this IThreadContext threadContext, Action action) => + threadContext.RunOnThread(action, false); + + public static Task RunOnMain(this IThreadContext threadContext, Func action) => + threadContext.RunOnThread(action, true); + + public static Task RunOnWorker(this IThreadContext threadContext, Func action) => + threadContext.RunOnThread(action, false); + + public static Task RunOnMainAsync(this IThreadContext threadContext, Func action) => + threadContext.RunOnThreadAsync(action, true); + + public static Task RunOnWorkerAsync(this IThreadContext threadContext, Func action) => + threadContext.RunOnThreadAsync(action, false); + + public static Task RunOnMainAsync(this IThreadContext threadContext, Func> action) => + threadContext.RunOnThreadAsync(action, true); + + public static Task RunOnWorkerAsync(this IThreadContext threadContext, Func> action) => + threadContext.RunOnThreadAsync(action, false); +} diff --git a/Sdk/Speckle.Connectors.Common/Threading/ThreadOptions.cs b/Sdk/Speckle.Connectors.Common/Threading/ThreadOptions.cs new file mode 100644 index 000000000..3ef94b7f2 --- /dev/null +++ b/Sdk/Speckle.Connectors.Common/Threading/ThreadOptions.cs @@ -0,0 +1,12 @@ +using Speckle.InterfaceGenerator; +using Speckle.Sdk; +using Speckle.Sdk.Host; + +namespace Speckle.Connectors.Common.Threading; + +[GenerateAutoInterface] +public class ThreadOptions(ISpeckleApplication speckleApplication) : IThreadOptions +{ + public bool RunReceiveBuildOnMainThread => speckleApplication.HostApplication != HostApplications.Rhino.Name; + public bool RunCommandsOnMainThread => speckleApplication.HostApplication != HostApplications.ArcGIS.Name; +} diff --git a/Sdk/Speckle.Connectors.Common/packages.lock.json b/Sdk/Speckle.Connectors.Common/packages.lock.json index 4a25db9d2..78874f8a1 100644 --- a/Sdk/Speckle.Connectors.Common/packages.lock.json +++ b/Sdk/Speckle.Connectors.Common/packages.lock.json @@ -53,18 +53,18 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -74,14 +74,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" }, "GraphQL.Client": { "type": "Transitive", @@ -386,18 +386,18 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -406,14 +406,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" }, "GraphQL.Client": { "type": "Transitive", diff --git a/Sdk/Speckle.Connectors.Tests/ActivityScopeTests.cs b/Sdk/Speckle.Connectors.Tests/ActivityScopeTests.cs index 3305d84f4..e92d64788 100644 --- a/Sdk/Speckle.Connectors.Tests/ActivityScopeTests.cs +++ b/Sdk/Speckle.Connectors.Tests/ActivityScopeTests.cs @@ -9,7 +9,7 @@ public class ActivityScopeTests public async Task TestAsyncLocal() { Logging.ActivityScope.SetTag("test", "me"); - await Task.Delay(10).ConfigureAwait(false); + await Task.Delay(10); Logging.ActivityScope.Tags.ContainsKey("test").Should().BeTrue(); Logging.ActivityScope.Tags["test"].Should().Be("me"); } diff --git a/Sdk/Speckle.Connectors.Tests/packages.lock.json b/Sdk/Speckle.Connectors.Tests/packages.lock.json index f16c4da3b..2daff048b 100644 --- a/Sdk/Speckle.Connectors.Tests/packages.lock.json +++ b/Sdk/Speckle.Connectors.Tests/packages.lock.json @@ -324,9 +324,9 @@ "dependencies": { "Microsoft.Extensions.DependencyInjection": "[2.2.0, )", "Speckle.Connectors.Logging": "[1.0.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )", - "Speckle.Sdk": "[3.1.0-dev.219, )", - "Speckle.Sdk.Dependencies": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )", + "Speckle.Sdk": "[3.1.0-dev.228, )", + "Speckle.Sdk.Dependencies": "[3.1.0-dev.228, )" } }, "speckle.connectors.logging": { @@ -368,18 +368,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -388,14 +388,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Sdk/Speckle.Converters.Common.Tests/ConverterManagerTests.cs b/Sdk/Speckle.Converters.Common.Tests/ConverterManagerTests.cs index fedef0ee7..6cda24beb 100644 --- a/Sdk/Speckle.Converters.Common.Tests/ConverterManagerTests.cs +++ b/Sdk/Speckle.Converters.Common.Tests/ConverterManagerTests.cs @@ -36,7 +36,7 @@ public void Test_Null() [Test] public void Test_NoFallback() { - var sut = SetupManager("String", typeof(TestConverter)); + var sut = SetupManager("System.String", typeof(TestConverter)); var converter = sut.ResolveConverter(typeof(string), false); converter.Should().NotBeNull(); } @@ -44,7 +44,7 @@ public void Test_NoFallback() [Test] public void Test_Fallback() { - var sut = SetupManager("Object", typeof(TestConverter)); + var sut = SetupManager("System.Object", typeof(TestConverter)); var converter = sut.ResolveConverter(typeof(string), true); converter.Should().NotBeNull(); } diff --git a/Sdk/Speckle.Converters.Common.Tests/packages.lock.json b/Sdk/Speckle.Converters.Common.Tests/packages.lock.json index 27e69ee47..0e9d82396 100644 --- a/Sdk/Speckle.Converters.Common.Tests/packages.lock.json +++ b/Sdk/Speckle.Converters.Common.Tests/packages.lock.json @@ -332,7 +332,7 @@ "type": "Project", "dependencies": { "Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )", - "Speckle.Objects": "[3.1.0-dev.219, )" + "Speckle.Objects": "[3.1.0-dev.228, )" } }, "speckle.testing": { @@ -362,18 +362,18 @@ }, "Speckle.Objects": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -382,14 +382,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Sdk/Speckle.Converters.Common/NameAndRankValueAttribute.cs b/Sdk/Speckle.Converters.Common/NameAndRankValueAttribute.cs index 54f380eeb..cea30ccac 100644 --- a/Sdk/Speckle.Converters.Common/NameAndRankValueAttribute.cs +++ b/Sdk/Speckle.Converters.Common/NameAndRankValueAttribute.cs @@ -2,17 +2,11 @@ // POC: maybe better to put in utils/reflection [AttributeUsage(AttributeTargets.Class)] -public sealed class NameAndRankValueAttribute : Attribute +public sealed class NameAndRankValueAttribute(Type type, int rank) : Attribute { // DO NOT CHANGE! This is the base, lowest rank for a conversion public const int SPECKLE_DEFAULT_RANK = 0; - public string Name { get; private set; } - public int Rank { get; private set; } - - public NameAndRankValueAttribute(string name, int rank) - { - Name = name; - Rank = rank; - } + public Type Type { get; private set; } = type; + public int Rank { get; private set; } = rank; } diff --git a/Sdk/Speckle.Converters.Common/Registration/ConverterManager.cs b/Sdk/Speckle.Converters.Common/Registration/ConverterManager.cs index 49a1558fd..ad90785ec 100644 --- a/Sdk/Speckle.Converters.Common/Registration/ConverterManager.cs +++ b/Sdk/Speckle.Converters.Common/Registration/ConverterManager.cs @@ -1,5 +1,6 @@ using System.Collections.Concurrent; using Microsoft.Extensions.DependencyInjection; +using Speckle.Sdk.Common; using Speckle.Sdk.Common.Exceptions; namespace Speckle.Converters.Common.Registration; @@ -14,7 +15,7 @@ public T ResolveConverter(Type type, bool recursive = true) var currentType = type; while (true) { - var typeName = currentType.Name; + var typeName = currentType.FullName.NotNull(); var converter = GetConverterByType(typeName); if (converter is null && recursive) { @@ -37,9 +38,9 @@ public T ResolveConverter(Type type, bool recursive = true) } } - private T? GetConverterByType(string typeName) + private T? GetConverterByType(string fullName) { - if (converterTypes.TryGetValue(typeName, out var converter)) + if (converterTypes.TryGetValue(fullName, out var converter)) { return (T)ActivatorUtilities.CreateInstance(serviceProvider, converter); } diff --git a/Sdk/Speckle.Converters.Common/Registration/ServiceRegistration.cs b/Sdk/Speckle.Converters.Common/Registration/ServiceRegistration.cs index d294b909a..254bb2004 100644 --- a/Sdk/Speckle.Converters.Common/Registration/ServiceRegistration.cs +++ b/Sdk/Speckle.Converters.Common/Registration/ServiceRegistration.cs @@ -44,41 +44,41 @@ Assembly converterAssembly public static void AddConverters(this IServiceCollection serviceCollection, Assembly converterAssembly) { ConcurrentDictionary converterTypes = new(); - var types = converterAssembly.ExportedTypes.Where(x => x.GetInterfaces().Contains(typeof(T))); + var exportedTypes = converterAssembly.ExportedTypes.Where(x => x.GetInterfaces().Contains(typeof(T))); // we only care about named types - var byName = types + var byName = exportedTypes .Where(x => x.GetCustomAttribute() != null) .Select(x => { var nameAndRank = x.GetCustomAttribute().NotNull(); - return (name: nameAndRank.Name, rank: nameAndRank.Rank, type: x); + return (Type: nameAndRank.Type, Rank: nameAndRank.Rank, Converter: x); }) .ToList(); // we'll register the types accordingly - var names = byName.Select(x => x.name).Distinct(); - foreach (string name in names) + var types = byName.Select(x => x.Type).Distinct(); + foreach (Type type in types) { - var namedTypes = byName.Where(x => x.name == name).OrderByDescending(y => y.rank).ToList(); + var namedTypes = byName.Where(x => x.Type == type).OrderByDescending(y => y.Rank).ToList(); // first type found var first = namedTypes[0]; // POC: may need to be instance per lifecycle scope - converterTypes.TryAdd(first.name, first.type); + converterTypes.TryAdd(first.Type.FullName.NotNull(), first.Converter); // POC: not sure yet if... // * This should be an array of types // * Whether the scope should be modified or modifiable // * Whether this is in the write project... hmmm // POC: IsAssignableFrom() - var secondaryType = first.type.GetInterface(typeof(ITypedConverter<,>).Name); + var secondaryType = first.Type.GetInterface(typeof(ITypedConverter<,>).Name); // POC: should we explode if no found? if (secondaryType != null) { - converterTypes.TryAdd(first.name, secondaryType); + converterTypes.TryAdd(first.Type.FullName, secondaryType); } // register subsequent types with rank diff --git a/Sdk/Speckle.Converters.Common/packages.lock.json b/Sdk/Speckle.Converters.Common/packages.lock.json index 2df545bdb..96903d64f 100644 --- a/Sdk/Speckle.Converters.Common/packages.lock.json +++ b/Sdk/Speckle.Converters.Common/packages.lock.json @@ -50,11 +50,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -309,9 +309,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.Bcl.AsyncInterfaces": "5.0.0", @@ -321,14 +321,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } }, "net8.0": { @@ -371,11 +371,11 @@ }, "Speckle.Objects": { "type": "Direct", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "2thsMUDkRr7lR0PXZJ8k3KWZLWjz/aBY0KaO2SuXM0lIKyJw1APMJ7lXJ89e6JAjBzEbK8yLHBb0qtfcc4bNRw==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "BxtORgyOorKHmvBUldyL7t747g3wgXPhkjIKi6qVWxhPxZqzswGf9jQD1GZL57dcWkZPgdQ/vmDsowq6K89T/w==", "dependencies": { - "Speckle.Sdk": "3.1.0-dev.219" + "Speckle.Sdk": "3.1.0-dev.228" } }, "GraphQL.Client": { @@ -568,9 +568,9 @@ }, "Speckle.Sdk": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "UTgz9UgkMFGqRLmCq1HPo74MngvKbSZOFWaMRzASHrrnsBtzZatBXjoJBlvVoeBCoiea5Jj+BgZg6RvlV2m3sg==", + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "2jb3t9KoYEeqGsGLuzR/O3GefG5cs+Zxcpq6dGmHuYLa3cw3nanGJ1X0UkiKFv1CcvZ+aNHPT36QoDVtNvWfow==", "dependencies": { "GraphQL.Client": "6.0.0", "Microsoft.CSharp": "4.7.0", @@ -579,14 +579,14 @@ "Microsoft.Extensions.Logging": "2.2.0", "Speckle.DoubleNumerics": "4.0.1", "Speckle.Newtonsoft.Json": "13.0.2", - "Speckle.Sdk.Dependencies": "3.1.0-dev.219" + "Speckle.Sdk.Dependencies": "3.1.0-dev.228" } }, "Speckle.Sdk.Dependencies": { "type": "CentralTransitive", - "requested": "[3.1.0-dev.219, )", - "resolved": "3.1.0-dev.219", - "contentHash": "5hqBd9whAs5cC8S/6YUgKFOivjntAkVutKhz06XD/f3Kj6xScT3hwcUaWBxiwK3Mw7FLtiVuU1uG777pjn0PKQ==" + "requested": "[3.1.0-dev.228, )", + "resolved": "3.1.0-dev.228", + "contentHash": "Ul2flG1qAnpXYESNB2W4o3x7jxW3BFT2L/jdyO7lgsSVGiNhhVskaXVZXHvqGYwlu0y1J/fhFGANsc+1xnCoQA==" } } } diff --git a/Speckle.Connectors.sln b/Speckle.Connectors.sln index a28a14618..a767365d0 100644 --- a/Speckle.Connectors.sln +++ b/Speckle.Connectors.sln @@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{85A13E codecov.yml = codecov.yml CodeMetricsConfig.txt = CodeMetricsConfig.txt Directory.Build.props = Directory.Build.props - Directory.Build.targets = Directory.Build.targets Directory.Packages.props = Directory.Packages.props global.json = global.json README.md = README.md @@ -18,6 +17,9 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DUI", "DUI", "{FD4D6594-D81E-456F-8F2E-35B09E04A755}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Revit", "Revit", "{D92751C8-1039-4005-90B2-913E55E0B8BD}" + ProjectSection(SolutionItems) = preProject + Connectors\Revit\Directory.Build.targets = Connectors\Revit\Directory.Build.targets + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sdk", "Sdk", "{2E00592E-558D-492D-88F9-3ECEE4C0C7DA}" EndProject @@ -36,6 +38,9 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Converters.Common", "Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj", "{8AEF06C0-CA5C-4460-BC2D-ADE5F35D0434}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Rhino", "Rhino", "{9584AEE5-CD59-46E6-93E6-2DC2B5285B75}" + ProjectSection(SolutionItems) = preProject + Connectors\Rhino\Directory.Build.targets = Connectors\Rhino\Directory.Build.targets + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Connectors.Rhino7", "Connectors\Rhino\Speckle.Connectors.Rhino7\Speckle.Connectors.Rhino7.csproj", "{1E2644A9-6B31-4350-8772-CEAAD6EE0B21}" EndProject @@ -52,6 +57,9 @@ EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Connectors.AutocadShared", "Connectors\Autocad\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.shproj", "{41BC679F-887F-44CF-971D-A5502EE87DB0}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Autocad", "Autocad", "{804E065F-914C-414A-AF84-009312C3CFF6}" + ProjectSection(SolutionItems) = preProject + Connectors\Autocad\Directory.Build.targets = Connectors\Autocad\Directory.Build.targets + EndProjectSection EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Converters.AutocadShared", "Converters\Autocad\Speckle.Converters.AutocadShared\Speckle.Converters.AutocadShared.shproj", "{9ADD1B7A-6401-4202-8613-F668E2FBC0A4}" EndProject @@ -61,7 +69,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Connectors.DUI.WebV EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Build", "Build\Build.csproj", "{C50AA3E3-8C31-4131-9DEC-1D8B377D5A89}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HostApps", "HostApps", "{42826721-9A18-4762-8BA9-F1429DD5C5B1}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Connectors", "Connectors", "{42826721-9A18-4762-8BA9-F1429DD5C5B1}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{59E8E8F3-4E42-4E92-83B3-B1C2AB901D18}" ProjectSection(SolutionItems) = preProject @@ -154,6 +162,9 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Connectors.Logging", "Sdk\Speckle.Connectors.Logging\Speckle.Connectors.Logging.csproj", "{8098BAFC-DF1C-4AFA-A93E-08121E6D09D4}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tekla", "Tekla", "{696086E4-D8CC-4FE0-A9B3-5F10B9089B55}" + ProjectSection(SolutionItems) = preProject + Connectors\Tekla\Directory.Build.targets = Connectors\Tekla\Directory.Build.targets + EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Speckle.Connector.Tekla2024", "Connectors\Tekla\Speckle.Connector.Tekla2024\Speckle.Connector.Tekla2024.csproj", "{2319C00F-B268-4E4C-9F88-6B379E2BBD22}" EndProject @@ -214,6 +225,9 @@ EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Speckle.Converters.ETABSShared", "Converters\CSi\Speckle.Converters.ETABSShared\Speckle.Converters.ETABSShared.shproj", "{36377858-D696-4567-AB05-637F4EC841F5}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Navisworks", "Navisworks", "{7B95C512-C1CD-4110-A9A9-CECCD9630353}" + ProjectSection(SolutionItems) = preProject + Connectors\Navisworks\Directory.Build.targets = Connectors\Navisworks\Directory.Build.targets + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{3C54FE49-F14E-43A2-B1DF-85D5C7638117}" EndProject @@ -257,6 +271,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Connectors.Naviswor EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Connectors.Navisworks2025", "Connectors\Navisworks\Speckle.Connectors.Navisworks2025\Speckle.Connectors.Navisworks2025.csproj", "{7791806E-7531-41D8-9C9D-4A1249D9F99C}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Importers.Ifc", "Importers\Ifc\Speckle.Importers.Ifc\Speckle.Importers.Ifc.csproj", "{E6B7A640-F85C-41C9-8226-B5310A98822D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ifc", "Ifc", "{F93052A6-6937-443F-8F1F-4A967A8A2BEF}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Importers", "Importers", "{336F0341-5C39-40F7-9377-122FED4E4549}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Speckle.Importers.Ifc.Tester", "Importers\Ifc\Speckle.Importers.Ifc.Tester\Speckle.Importers.Ifc.Tester.csproj", "{FCD6CB79-6B41-4448-99E1-787408AD24B0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -648,6 +670,18 @@ Global {7791806E-7531-41D8-9C9D-4A1249D9F99C}.Local|Any CPU.Build.0 = Debug|Any CPU {7791806E-7531-41D8-9C9D-4A1249D9F99C}.Release|Any CPU.ActiveCfg = Release|Any CPU {7791806E-7531-41D8-9C9D-4A1249D9F99C}.Release|Any CPU.Build.0 = Release|Any CPU + {E6B7A640-F85C-41C9-8226-B5310A98822D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6B7A640-F85C-41C9-8226-B5310A98822D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6B7A640-F85C-41C9-8226-B5310A98822D}.Local|Any CPU.ActiveCfg = Debug|Any CPU + {E6B7A640-F85C-41C9-8226-B5310A98822D}.Local|Any CPU.Build.0 = Debug|Any CPU + {E6B7A640-F85C-41C9-8226-B5310A98822D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6B7A640-F85C-41C9-8226-B5310A98822D}.Release|Any CPU.Build.0 = Release|Any CPU + {FCD6CB79-6B41-4448-99E1-787408AD24B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FCD6CB79-6B41-4448-99E1-787408AD24B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FCD6CB79-6B41-4448-99E1-787408AD24B0}.Local|Any CPU.ActiveCfg = Debug|Any CPU + {FCD6CB79-6B41-4448-99E1-787408AD24B0}.Local|Any CPU.Build.0 = Debug|Any CPU + {FCD6CB79-6B41-4448-99E1-787408AD24B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FCD6CB79-6B41-4448-99E1-787408AD24B0}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -768,6 +802,9 @@ Global {04FC86A3-2E25-41A1-98C5-10898616CD78} = {19F15419-F493-4D53-83EA-F90869D97D6E} {FD44E1F0-D20A-49B6-ADC9-482D911A74FB} = {91DCAFB0-283B-4B07-9F6F-7335DECEEB08} {7791806E-7531-41D8-9C9D-4A1249D9F99C} = {A88CFA1F-B2D5-4DBE-8496-68D0AFA46F2D} + {E6B7A640-F85C-41C9-8226-B5310A98822D} = {F93052A6-6937-443F-8F1F-4A967A8A2BEF} + {F93052A6-6937-443F-8F1F-4A967A8A2BEF} = {336F0341-5C39-40F7-9377-122FED4E4549} + {FCD6CB79-6B41-4448-99E1-787408AD24B0} = {F93052A6-6937-443F-8F1F-4A967A8A2BEF} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EE253116-7070-4E9A-BCE8-2911C251B8C8}