Compare commits

..

60 Commits

Author SHA1 Message Date
Oğuzhan Koral 189ea3a19b Merge pull request #501 from specklesystems/dev
.NET Build and Publish / build-windows (push) Has been cancelled
.NET Build and Publish / build-linux (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update dev to release
2025-01-16 19:18:02 +03:00
Adam Hathcock db4d2f7eb0 Fix dev build (#498)
* Fix build

* gitversion doesn't want a shallow clone
2025-01-15 13:18:36 +00:00
Adam Hathcock b9d2f376d6 Fix build (#497) 2025-01-15 12:31:07 +00:00
Adam Hathcock 49baeae780 add gitversion to linux build to version nuget correctly. rename builds (#495)
* add gitversion to linux build to version nuget correctly.  rename builds

* fix naming
2025-01-15 12:18:38 +00:00
Adam Hathcock d76865e621 moving IFC to connectors repo (#488)
* First pass of moving IFC to connectors repo

* Fix some errors and ignore others

* fix namespaces and exceptions

* fix namespaces

* formatting

* Fix namespaces and move stuff

* add linux ci

* more csproj changes

* importer stuff will be the nuget

* add pack version and to Local sln

* do a nuget push on main

* fix restore
2025-01-15 12:01:45 +00:00
Adam Hathcock bedf363810 Update to SDK 228 (#494) 2025-01-15 11:30:43 +00:00
Jonathon Broughton 48670c4030 Update NavisworksDocumentModelStore.cs (#491)
- Add reference to `Autodesk.Navisworks.Api.DocumentParts.DocumentDatabase`
- Add `_lastSavedState` field to store the last saved state
- Compare current state with last saved state before saving
- Update last saved state after successful save
- Rename `ClearAndSave` method to `ClearAndSaveThisState` for clarity pseudo override
- Reset last saved state when clearing models
2025-01-14 10:52:46 +00:00
Adam Hathcock ba0cdd307f Add better progress tor receive (#487)
* update SDK

* Add better progress to receive

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-01-14 07:38:19 +00:00
Jonathon Broughton 2a508e6302 fix(Navisworks): CNX-895 - Add ColorProxy Support for 2D Linework (#492)
* Add ColorUnpacker

* Add ColorConverter helper class for Navisworks conversion

This commit adds a new file, ColorConverter.cs, to the Helpers folder in the NavisworksShared project. The ColorConverter class provides methods for converting Navisworks colors to System.Drawing.Color, generating color hash strings, and getting human-readable color names.

* Refactor NavisworksMaterialUnpacker.cs for improved color conversion

The code changes in this commit refactor the NavisworksMaterialUnpacker.cs file to improve the color conversion process. Specifically, the ColorConverter class is now used to convert Navisworks colors to standard colors. This change enhances the accuracy and reliability of color conversions throughout the codebase.

* Add NavisworksColorUnpacker class to improve color unpacking logic

The commit adds the `NavisworksColorUnpacker` class to improve the logic for unpacking colours from Navisworks objects. It introduces a new method `UnpackColor` that takes in a list of Navisworks objects and a dictionary of grouped nodes. The method iterates over the objects, skips non-2D elements, and extracts colour information based on the selected representation mode.

The commit also introduces a helper method `Is2DElement` that checks if a given model item is a 2D element by examining its geometry using the ComApi.

Additionally, a new class `PrimitiveChecker` is added to implement the callback interface for checking primitive types in Navisworks geometry.

These changes aim to enhance the accuracy and efficiency of color unpacking for Navisworks objects.

* Add NavisworksColorUnpacker to service registration

Add NavisworksColorUnpacker to service registration

This commit adds the NavisworksColorUnpacker class to the service registration in the NavisworksConnectorServiceRegistration.cs file. Additionally, it includes the necessary changes in the NavisworksRootObjectBuilder.cs file to inject the NavisworksColorUnpacker dependency.

* Refactor BuildAsync function to reduce complexity

- Validate input parameters before processing
- Initialize root collection with name and units
- Convert all model items and store results
- Validate conversion results to ensure successful conversion
- Build final elements by grouping sibling geometry nodes and adding remaining non-grouped nodes
- Add proxies (render materials and colors) to the root collection if applicable
2025-01-14 09:54:18 +03:00
Adam Hathcock 9d70579c40 add msbuild targets files that are specific to host apps (#483)
* add custom navisworks targets

* add more targets files that are specific to host apps
2025-01-13 13:03:43 +00:00
Adam Hathcock e4ac573631 Always run Main stuff on the revit message pump (#486)
* Always run Main stuff on the revit message pump

* formatting
2025-01-13 12:34:35 +00:00
Adam Hathcock 11327cf544 Update SDK to 225 (#477)
* Update SDK to 223

* update to 225
2025-01-13 12:13:22 +00:00
KatKatKateryna 029e10b661 fix path encoding (#481)
* fix path encoding

* add comments

* more compact
2025-01-13 19:22:37 +08:00
Dimitrie Stefanescu c1c8b645e0 Merge pull request #485 from specklesystems/dimitrie/cnx-124-conversion-of-areas-and-rooms-cannot-handle-more-complex
fix: ignoring extra categories we cannot support correctly
2025-01-10 20:46:29 +00:00
Dimitrie Stefanescu 49ef7d1353 fix: revit 2022 2025-01-10 20:37:51 +00:00
Dimitrie Stefanescu 745886e9dd chore: adds comment i missed out on earlier 2025-01-10 20:05:32 +00:00
Dimitrie Stefanescu 825945a547 fix: ignoring extra categories we cannot support correctly 2025-01-10 19:55:13 +00:00
Dimitrie Stefanescu e9556170f5 Merge pull request #484 from specklesystems/dimitrie/cnx-916-revit-all-conversions-pass-nothing-fails-philosophical
Dimitrie/cnx 916 revit all conversions pass nothing fails
2025-01-10 19:31:44 +00:00
Dimitrie Stefanescu 87ffe5b5f8 fix: revit 2022 error 2025-01-10 19:27:53 +00:00
Dimitrie Stefanescu 9466d8b883 fix: review comment 2025-01-10 19:26:02 +00:00
Dimitrie Stefanescu 25e37e257e fix/performance: prevents endless throws for elements with invalid locations 2025-01-10 18:52:13 +00:00
Dimitrie Stefanescu 165c0c9f0d feat: cleans up views 2025-01-10 18:51:47 +00:00
Dimitrie Stefanescu 98cfebf5bc feat: cleans up categories
and prevents (most) unsupported/unnecessary element sending
2025-01-10 18:51:05 +00:00
Claire Kuang 1d910bfc45 fix(civil): adds top level cogopoint converter (#476)
* adds top level cogopoint converter

* change to typeof

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
2025-01-10 14:22:42 +00:00
Adam Hathcock 94104c2365 NameAndRankValue now uses a type to get FullName to avoid conflicts (#475)
* NameAndRankValue now uses a type to get FullName to avoid conflicts

* Full namespace for tests
2025-01-10 13:59:59 +00:00
Adam Hathcock c5d37a1250 Add custom assembly resolve for Navisworks (#478)
* Add custom assembly resolve for Navisworks

* format
2025-01-10 09:37:15 +00:00
Dimitrie Stefanescu 5812e1c976 Merge pull request #482 from specklesystems/dimitrie/cnx-851-stacked-wall-duplicate-geometry-or-materials-not-applied
fix: stacked wall duplication when sending by view
2025-01-09 18:35:08 +00:00
Dimitrie Stefanescu 01bc8bf929 fix: stacked wall duplication when sending by view 2025-01-09 18:22:28 +00:00
Oğuzhan Koral dbefb1b290 Null check before attempt to override view options (#474) 2025-01-08 21:26:34 +03:00
Dimitrie Stefanescu b5b9d061ef Merge pull request #473 from specklesystems/dimitrie/cnx-933-model-cards-out-of-snyc-with-application-when-opening-saved
fix: expired cards on file open
2025-01-08 14:06:31 +00:00
Dimitrie Stefanescu 20e08bba76 fix: expired cards on file open 2025-01-08 13:59:24 +00:00
Dogukan Karatas 23710ee3fb adds null check (#470)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-01-08 09:30:08 +00:00
Dimitrie Stefanescu 9b5cc21aa4 Merge pull request #472 from specklesystems/dimitrie/cnx-925-object-tracking-modifying-layer-color-or-layer-name
Dimitrie/cnx 925 Invalidates model cards from layer change events (name, colour)
2025-01-07 18:48:55 +00:00
Dimitrie Stefanescu 1016c9b82b fix: more naming 2025-01-07 18:42:01 +00:00
Dimitrie Stefanescu c6b9651d08 chore: naming 2025-01-07 18:37:44 +00:00
Dimitrie Stefanescu 73302f101a feat: adds layer changes object tracking 2025-01-07 17:57:50 +00:00
Dimitrie Stefanescu 516b4d785f feat: run extra intersection checks only if needed 2025-01-07 17:49:14 +00:00
Dimitrie Stefanescu a9850c2eec feat: adds support for group selection events (#471)
* feat: adds support for group selection events

* feat: stores group objects separately so we don't reconvert them

this will be necessary as well for layer change events later down the line

* chore: comments
2025-01-07 19:29:26 +03:00
Dimitrie Stefanescu 64c5503637 Merge pull request #466 from specklesystems/update-sdk
Update SDK to 222
2025-01-07 15:48:06 +00:00
Adam Hathcock d15ea4310a Merge branch 'dev' into update-sdk 2025-01-07 15:39:41 +00:00
Dogukan Karatas 9fa3ef83e5 adds update selection (#469) 2025-01-07 14:10:58 +00:00
Dimitrie Stefanescu 724e8fe029 Dimitrie/cnx 938 did not find a layer in cache (#468)
* fix: adds a converter for displayable objects

* fix: ensures correct layer creation for collections with empty names
2025-01-07 17:03:37 +03:00
Adam Hathcock 3ea5677497 Rhino panels should be treated as if they might have been used before… (#467)
* Rhino panels should be treated as if they might have been used before as Panels.Closed isn't called

* formatting

* Only Reinitialize when Rhino 8 and greater

* format
2025-01-07 12:38:52 +00:00
Adam Hathcock a1e3e509fd Update SDK to 222 2025-01-03 15:58:10 +00:00
Adam Hathcock 95b3731df2 Fix Navisworks and others progress by yielding to UI thread (#465)
* Navisworks needs proper Async to update UI thread inline

* Tested Autocad and Rhino

* format and fix

* ArcGIS should yield too

* async/await for Tekla and ETABs
2024-12-31 15:04:25 +00:00
Jonathon Broughton dcc29f3461 Update Navisworks connector plugin bundle target and version content target paths. (#464) 2024-12-25 16:36:28 +00:00
Jonathon Broughton 13740de72f fix(Navisworks): CNX-973 Fix: Material ID Logic and Render Proxy Cache (#463) 2024-12-25 16:32:10 +00:00
Adam Hathcock f2f11c3f2b Threading revamp: add ThreadContext and remove Dataflow usage (#400)
* Navisworks Connector Init

* Build crap

* Moar Init

* WIP - not yet working

* Minor fixes

* Fix missing constuctors

* unfix

* Test commit

* Test commit

* Remove Dataflow usage

* format and remove dep

* merge fixes

* Fix serializer

* Add MainThreadContext

* add some main context detection

* add RevitMainThreadContext

* remove revit async?

* Handle Document Events

* Document Model Store

* Proper implementation

* package updates

* updated to dev

* Document Events binding ???

* registration order

* Minimised events subscribed and handle new document state to clear models

* Stub Send command

* Refactor Connector class to change access modifier of Container property

The commit modifies the access modifier of the Container property in the Connector class from public to private. This change improves encapsulation and ensures that the property can only be accessed within the class itself.

* Fix NavisworksDocumentStore model list initialization and document validation

The commit fixes the initialization of the Models list in the NavisworksDocumentStore class. Instead of assigning an empty array, it now uses the Clear() method to clear the existing models.

Additionally, the commit improves the document validation logic by checking if critical properties are accessible before considering the document valid. It also handles cases where the document is disposed.

These changes ensure proper initialization of model lists and accurate document validation in NavisworksDocumentStore.

* Effectively debouncing on the SDI changes events

* Get Selected Objects

* ElementSelectionExtension is a collection of helpers to aid the resolution of intent

* [Navisworks] Manage document and model state changes

- Refactor NavisworksDocumentEvents to manage both document and model state change notifications
- Update comments to reflect the new functionality
- Rename SubscribeToEvents method to SubscribeToDocumentModelEvents for clarity
- Add HandleDocumentModelCountChanging and HandleDocumentModelCountChanged methods to track model count changes
- Update OnDocumentModelCountChanged method name to NotifyValidModelStateChange for clarity
- Update UnsubscribeFromEvents method name to UnsubscribeFromDocumentModelEvents for clarity
- Remove unused constants from NavisworksDocumentStore class

* formatting

* use mainThreadContext

* Use more MainThreadContext

* Update Navisworks API references and fix typos

- Update references to `Autodesk.Navisworks.Api` namespace to `NAV` namespace
- Fix typo in file name: `GlobalUsings.cs` renamed to `GlobalUsing.cs`
- Update references to `ModelItem` type from `Autodesk.Navisworks.Api` namespace to `NAV.ModelItem`
- Update references to `Document` type from `Autodesk.Navisworks.Api` namespace to `NAV.Document`
- Update references to database related types from `Autodesk.Navisworks.Api.Data` namespace to `NAV.Data`
- Add new file: NavisworksRootObjectBuilder.cs
- Remove unused using statements

* Add Navisworks2024 converter dependencies and update project references

- Added "Objects.Converter.Navisworks2024" to the packages.lock.json file with dependencies on "Speckle.Converters.Common" and "Speckle.Navisworks.API"
- Updated the Speckle.Connectors.Navisworks2024.csproj file to include a reference to "Speckle.Converters.Navisworks2024.csproj" and "Speckle.Converters.Common.csproj"
- Added "speckle.converters.common" to the packages.lock.json file with dependencies on "Microsoft.Extensions.Logging.Abstractions" and "Speckle.Objects"
- Renamed files:
  - NavisworksConversionSettings.cs -> NavisworksConversionSettingsFactory.cs
  - GlobalUsings.cs -> GlobalUsing.cs
  - NavisworksConversionSettings.cs -> Settings/NavisworksConversionSettings.cs
  - NavisworksConversionSettings.cs -> Services/NavisworksToSpeckleUnitConverter.cs
  - NavisworksConversionSettings.cs -> ToSpeckle/NavisworksRootToSpeckleConverter.cs

* feat: Add NavisworksSendBinding changes

- Added Microsoft.Extensions.DependencyInjection and Microsoft.Extensions.Logging namespaces
- Added Speckle.Connectors.Common.Operations namespace
- Added Speckle.Connectors.DUI.Exceptions, Speckle.Connectors.DUI.Logging, and Speckle.Connectors.DUI.Models.Card namespaces
- Added Speckle.Sdk and Speckle.Sdk.Common namespaces
- Updated constructor of NavisworksSendBinding class to include additional parameters
- Updated Send method in NavisworksSendBinding class to include try-catch block for handling exceptions during send operation
- Updated CancelSend method in NavisworksSendBinding class to call the cancellation manager's CancelOperation method with the modelCardId parameter
- Added ResolveIndexPathToModelItem method in ElementSelectionExtension class to resolve the model item path from an index path string
- Added ResolveGeometryLeafNodes method in ElementSelectionExtension class to resolve geometry leaf nodes from a model item
- Updated Send method in NavisworksSendBinding class to use the resolved model items for sending data

* Update namespace in Navisworks plugin files

- Update namespace from "Speckle.Connector.Navisworks.NavisPlugin" to "Speckle.Connector.Navisworks.Plugin" in Commands.cs, DockableConnectorPane.cs, and NavisworksRibbon.xaml.cs files.

* Add Navisworks sending operations and converters

- Added sending operations for Navisworks models
- Registered the root object builder and send operation for Navisworks model items
- Added Navisworks converters to the service registration
- Updated the NavisworksRootToSpeckleConverter to handle null targets and validate target type before conversion

* Add folder to project items

- Added a new folder to the project items in the Navisworks converter.
- The folder includes the necessary files for extensions, global using, service registration, and conversion settings factory.

* Refactor NavisworksConversionSettings class to use properties instead of fields

- Convert fields to properties in NavisworksConversionSettings class
- Update constructor to initialize properties instead of fields

* Add Navisworks conversion settings factory and store initialization

- Add `INavisworksConversionSettingsFactory` to the constructor of `NavisworksSendBinding`
- Initialize `_conversionSettingsFactory` in the constructor of `NavisworksSendBinding`
- Initialize the conversion settings store with `_conversionSettingsFactory.Create(NavisworksApp.ActiveDocument)`

* Change element selection path separator from '.' to '/' in ElementSelectionExtension.cs

This commit updates the code in ElementSelectionExtension.cs to change the default separator used for resolving a Navisworks model item's unique index path representation. The previous separator was '.', and it has been changed to '/'. This change ensures consistency and compatibility with other parts of the codebase that rely on this representation.

* Add Navisworks model item to Speckle converter

- Add `ModelItemToSpeckleConverter.cs` file for converting Navisworks model items to Speckle objects.
- Update `GlobalUsing.cs` to include `SSM` namespace.
- Update project file `Speckle.Converters.NavisworksShared.projitems` to include the new converter file.

* some rearranging

* renaming

* Revit needs new run async

* merge fixes

* gather on worker, convert on main

* Update Speckle.Objects and Speckle.Sdk versions to 3.1.0-dev.200

- Updated the requested and resolved versions of Speckle.Objects and Speckle.Sdk to 3.1.0-dev.200 in packages.lock.json files for Connectors/Navisworks/Speckle.Connectors.Navisworks2024 and Converters/Navisworks/Speckle.Converters.Navisworks2024 directories.
- Also updated the contentHash values for both packages.

Note: This commit updates the versions of Speckle.Objects and Speckle.Sdk to 3.1.0-dev.200 in the mentioned directories' packages.lock.json files, along with their respective contentHash values being updated as well.

* operations know threading but not host apps

* Add Navisworks and 2024 projects, along with their connectors and converters

This commit adds the Navisworks project, along with the 2024 project. It also includes the connectors and converters for both projects.

* rhino options

* revit can receive

* autocad in progress

* need to yield for UI thread async

* revamp yield

* Found APIContext and removed it

* ArcGIS runs all workers on MCT thread

* Refactor ThreadContext and ArcGIS saving is always on a worker

* Revit threading is simplier?

* ArcGIS can not always go to the queued task

* format

* fix tekla compile errors

* update etabs

* thread context

* autocad threading?

* Add Navisworks conversion settings and modes

This commit adds new files for Navisworks conversion settings and modes.
- The `ConversionModes.cs` file defines enums for representation mode and origin mode used during conversion.
- The `NavisworksConversionSettings.cs` file represents the settings used for Navisworks conversions, including properties such as document, units, origin mode, hidden elements, visual representation mode, and more.
- A new factory class `NavisworksConversionSettingsFactory.cs` is added to create instances of the conversion settings with calculated values based on the active document.
- A new file `GeometryHelpers.cs` which contains a static class `GeometryHelpers`. The class provides a method `VectorMatch` that compares two vectors to determine if they are approximately equal within a given tolerance. The method takes in two vectors and an optional tolerance value, and returns true if the vectors match within the tolerance, otherwise false.

* Add ArrayExtensions.cs for converting arrays to generic type arrays

This commit adds a new file, ArrayExtensions.cs, which contains an extension method for converting arrays to generic type arrays. The method uses the `Array.Copy` function to copy the elements of the original array into a new array of the specified generic type. This allows for more flexibility when working with arrays in the codebase.

Specifically Navisworks heavily uses 1* indexed arrays which are a pain to access generically.

* Delete Navisworks converters

This commit deletes two files: ModelItemToSpeckleConverter.cs and NavisworksRootToSpeckleConverter.cs. These files contained code related to converting Navisworks models to Speckle format. The deletion of these files indicates that the functionality provided by these converters is no longer needed or has been replaced by other methods.

* Add new classes for double-precision geometric primitives and transformation matrices

- Added `Primitives.cs` file containing definitions for `PointD`, `TriangleD`, and `LineD` classes with double-precision vertex storage
- Added `TransformMatrix.cs` file containing a class for 4x4 transformation matrices
- Updated project items to include the new files in the build process

* Add NavisworksObject and NavisworksGeometryObject classes

This commit adds the NavisworksObject and NavisworksGeometryObject classes to handle non-geometry and geometry-based Speckle objects converted from Navisworks. These classes implement the INavisworksObject interface, which provides methods for adding properties to objects and retrieving property values by key. The NavisworksObject class represents a non-geometry object with a name property and a dictionary of properties, while the NavisworksGeometryObject class represents a geometry-based object with a displayValue property, name property, and a dictionary of properties.

* Add ClassPropertiesExtractor, DisplayValueExtractor, and PropertySetsExtractor classes

- Added ClassPropertiesExtractor class to extract class properties from a NAV.ModelItem
- Added DisplayValueExtractor class to extract display values from a NAV.ModelItem
- Added PropertySetsExtractor class to extract property sets from a NAV.ModelItem

* feat: Add ExcludeProperties option to NavisworksConversionSettings

This commit adds a new boolean property, ExcludeProperties, to the NavisworksConversionSettings class. This property allows users to specify whether properties should be excluded from the output. The default value is set to false.

Changes:
- Added ExcludeProperties boolean property to NavisworksConversionSettings
- Updated NavisworksConversionSettingsFactory to include _excludeProperties field and pass it to the NavisworksConversionSettings constructor

* feat: Add ModelItemTopLevelConverterToSpeckle

This commit adds the `ModelItemTopLevelConverterToSpeckle` class, which converts Navisworks `ModelItem` objects to Speckle Base objects. The converter extracts display values, class properties, and property sets from the Navisworks object and creates a corresponding Speckle Base object.

* Add ModelPropertiesExtractor to NavisworksShared

This commit adds the ModelPropertiesExtractor class to the NavisworksShared project. The ModelPropertiesExtractor is responsible for extracting model properties from a NAV.Model and adding them to a dictionary. These properties include Creator, Filename, Source Filename, Units, Transform, Guid, and Source Guid. The extracted properties are then added to the navisworks object as key-value pairs.

* Refactor PropertyHelpers to handle property conversion and sanitization

- Refactored `PropertyHelpers` class to be static
- Added a dictionary of type handlers for converting property values
- Implemented `ConvertPropertyValue` method to convert property values based on their data type
- Added support for handling different data types, including boolean, string, integer, double, datetime, named constant, and 3D point
- Implemented `SanitizePropertyName` method to replace invalid characters in property names with underscores
- Added `IsCategoryToBeSkipped` method to determine if a property category should be skipped during processing

* feat: Add property set extraction logic

This commit adds logic to extract property sets from a NAV.ModelItem. It iterates through the property categories and properties, skipping certain categories as needed. Each property is added to a dictionary with its sanitized name as the key and its converted value based on Speckle units. The resulting property sets are stored in a dictionary with the sanitized category name as the key.

* Refactor ModelItemTopLevelConverterToSpeckle: Add IRootToSpeckleConverter interface

This commit adds the `IRootToSpeckleConverter` interface to the `ModelItemTopLevelConverterToSpeckle` class. It also modifies the `Convert` method to handle null target objects and updates the implementation of the `CreateNonGeometryObject` method.

* Add Navisworks 2020 - 2025

In addition to 2024

* Update DocumentModelStore.cs

- Made `HostAppSaveState` and `LoadState` methods public
- Updated method signatures to reflect changes

* Add BoundingBoxToSpeckleRawConverter

This commit adds the BoundingBoxToSpeckleRawConverter class, which is responsible for converting NAV.BoundingBox3D objects to Box objects. It includes methods for converting the target object and a nullable version of it. The converter uses settings from the IConverterSettingsStore interface to set up the base plane and create the bounding box with appropriate units and intervals.

* Fix null reference exception in NavisworksRootObjectBuilder.cs

The code change fixes a null reference exception that occurs when checking if `navisworksModelItems` is empty or null. If it is, a `SpeckleException` is thrown with the message "No objects to convert". Additionally, a check for `sendInfo` being null has been added before continuing with the conversion process. The progress of the conversion is reported using the `onOperationProgressed` callback.

* Refactor NavisworksBasicConnectorBinding and NavisworksSendBinding

- Simplify AddModel method in NavisworksBasicConnectorBinding
- Remove unused import statements in NavisworksSendBinding
- Update initialization of conversion settings in NavisworksSendBinding

* Update NavisworksServiceRegistration.cs

- Removed unused using statements
- Updated AddDUI method to use NavisworksDocumentModelStore
- Updated DocumentModelStore registration to use NavisworksDocumentModelStore

* Refactor NavisworksDocumentModelStore to updated API

- Clear the store and save when models are removed
- Load state from the database when models are added
- Rename methods for clarity: ReadFromFile() -> LoadState(), WriteToFile() -> HostAppSaveState()
- Improve exception handling and error messages

* Refactor data extractors in Navisworks converter

- Make `GetClassProperties`, `GetDisplayValue`, `GetModelProperties`, and `GetPropertySets` methods internal
- Remove unused using statements

* Update GlobalUsing.cs: Remove unnecessary global using statement

The commit removes an unnecessary global using statement in the GlobalUsing.cs file. This change helps to clean up the code and improve readability.

* Add NavisworksPrimitiveProcessor and PrimitiveProcessor classes

- Added NavisworksPrimitiveProcessor class with methods for processing Navisworks primitives
- Added PrimitiveProcessor class with methods for processing generic primitives
- Updated the constructor of PrimitiveProcessor to accept an additional parameter for local to world transformation
- Updated the Line, Point, and Triangle methods in both classes to use the new transformation logic

* feat: Add internal modifier to VectorMatch method

- Changed the access modifier of the VectorMatch method in GeometryHelpers class from public to internal.

feat: Add sealed modifier to NavisworksObject and NavisworksGeometryObject classes

- Added the sealed modifier to the NavisworksObject and NavisworksGeometryObject classes in NavisworksObjects.cs file.

refactor: Rename enum values in ConversionModes.cs

- Renamed the enum values MODEL_ORIGIN, PROJECT_BASE_ORIGIN, and BOUNDING_BOX_ORIGIN to MODELORIGIN, PROJECTBASEORIGIN, and BOUNDINGBOXORIGIN respectively in ConversionModes.cs file.

refactor: Update CreateGeometryObject method signature

- Updated the CreateGeometryObject method signature in ModelItemTopLevelConverterToSpeckle.cs file by making it static and using DisplayValueExtractor.GetDisplayValue instead of _displayValueExtractor.GetDisplayValue.

* Change origin mode constants to use camel case and update related calculations

- Update the origin mode constant from "MODEL_ORIGIN" to "MODELORIGIN"
- Update the origin mode constant from "PROJECT_BASE_ORIGIN" to "PROJECTBASEORIGIN"
- Update the origin mode constant from "BOUNDING_BOX_ORIGIN" to "BOUNDINGBOXORIGIN"
- Update the calculation of the transformation vector based on the new origin mode constants

* Add NavisworksPrimitiveProcessor and BoundingBoxToSpeckleRawConverter

The commit adds two new files: NavisworksPrimitiveProcessor.cs and BoundingBoxToSpeckleRawConverter.cs to the project. These files are included in the compilation process.

* Add support for Speckle connectors in Navisworks versions 2020 to 2025.

- Added runtime requirements and component entries for Navisworks versions 2020 to 2025.
- Each component entry includes the module name and app description.

* Add database transaction for table creation in NavisworksDocumentModelStore.cs

This commit adds a database transaction to ensure the existence of the required table before performing any operations in NavisworksDocumentModelStore.cs. This helps maintain data integrity and prevents errors related to missing tables.

* Update Navisworks connectors to include Speckle.Connectors.DUI dependency.

- Added "Speckle.Connectors.DUI" as a dependency in the Navisworks2020, Navisworks2021, Navisworks2022, Navisworks2023, and Navisworks2024 packages.
- Updated project references in the Navisworks2024 package to include the "Speckle.Connectors.DUI" project.
- Added "Speckle.Connectors.DUI" as a dependency in the Navisworks2025 package.
- Renamed "NavisworksServiceRegistration.cs" to "NavisworksConnectorServiceRegistration.cs".
- Updated project references in the NavisworksConverters for 2020 and 2021 packages to include the "Speckle.Connectors.DUI" project.

* Refactor NavisworksSendBinding constructor parameters and dependencies

- Changed the type of `_conversionSettingsFactory` parameter in `NavisworksSendBinding` constructor from `INavisworksConversionSettingsFactory` to `NavisworksConversionSettingsFactory`.
- Removed duplicate initialization of `Parent` and `Commands` properties in the `NavisworksSendBinding` constructor.
- Moved the call to `SubscribeToNavisworksEvents()` after initializing `_conversionSettingsFactory`.

Register additional services for Navisworks connector

- Added registration for `ToSpeckleSettingsManager`.
- Added registration for `IOperationProgressManager`.

Refactor NavisworksRootObjectBuilder

- Updated access to `_converterSettings.Current.SpeckleUnits` to `_converterSettings.Current.Derived.SpeckleUnits`.

Update DockableConnectorPane.cs

- Updated the call to `services.AddNavisworksConverters()` to use the correct method name, which is now `services.AddNavisworksConverter()`.

Refactor ClassPropertiesExtractor, ModelPropertiesExtractor, and PropertySetsExtractor

- Updated access to `_settingsStore.Current.ExcludeProperties` to use `_settingsStore.Current.User.ExcludeProperties`.

Register additional services for Navisworks converter

- Added registration for `IToSpeckleSettingsManager`.
- Added registration for `INavisworksConversionSettingsFactory`.

* Bruh!!

- Update the type of _conversionSettingsFactory field from NavisworksConversionSettingsFactory to INavisworksConversionSettingsFactory.
- Update the type of conversionSettingsFactory parameter in the constructor from NavisworksConversionSettingsFactory to INavisworksConversionSettingsFactory.

* Add NavisworksRootObjectBuilder and related settings classes for sending operations

Add NavisworksRootObjectBuilder and related settings classes for sending operations

- Added NavisworksRootObjectBuilder class for sending operations
- Added ConvertHiddenElementsSetting class for sending operations
- Added IncludeInternalPropertiesSetting class for sending operations
- Added OriginModeSetting class for sending operations
- Added VisualRepresentationSetting class for sending operations

* Refactor conversion mode and origin mode enums

- Renamed "ACTIVE" to "Active"
- Renamed "ORIGINAL" to "Original"
- Renamed "PERMANENT" to "Permanent"
- Renamed "MODELORIGIN" to "ModelOrigin"
- Renamed "PROJECTBASEORIGIN" to "ProjectBasePoint"
- Renamed "BOUNDINGBOXORIGIN" to "BoundingBoxCenter"

Updated the NavisworksConversionSettingsFactory class:

- Updated references and imports
- Updated switch cases for originMode enum with new names

* feat: Add new settings to NavisworksSendBinding and remove unused import

- Added new settings to the `GetSendSettings()` method in `NavisworksSendBinding` class.
- Removed unused import of `Speckle.Connector.Navisworks.Settings` in `NavisworksConverterServiceRegistration.cs`.

* Update Navisworks connector service registration and settings manager

- Updated the service registration in `NavisworksConnectorServiceRegistration.cs` to use `ToSpeckleSettingsManagerNavisworks` instead of `ToSpeckleSettingsManager`.
- Renamed `ToSpeckleSettingsManager.cs` to `ToSpeckleSettingsManagerNavisworks.cs` in the send operations settings folder.
- Updated the project file `Speckle.Connectors.NavisworksShared.projitems` to include the renamed file.
- Added a new dependency on `speckle.connectors.dui.webview`, which includes dependencies on `Microsoft.Web.WebView2` and `Speckle.Connectors.DUI`.
- Updated the conversion settings factory in `NavisworksConversionSettingsFactory.cs` to use `IToSpeckleSettingsManagerNavisworks` instead of `IToSpeckleSettingsManager`.

* Add project references to DUI and Navisworks converters in Navisworks connectors

- Added a project reference to `Speckle.Connectors.DUI` in the Navisworks 2020, 2021, 2022, 2023, and 2025 connector projects.
- Added project references to the respective Navisworks converter projects in the Navisworks 2020, 2021, 2022, 2023, and 2025 connector projects.
- Removed a compile include for `NavisworksSelectionFilter.cs` from the shared Navisworks converter projitems file.
- Added a compile include for `NavisworksSelectionFilter.cs` in the send filters folder of the shared Navisworks converter projitems file.

* here we go again

This commit adds support for Navisworks conversion settings in the SendBinding class. It introduces a new interface, IToSpeckleSettingsManagerNavisworks, and implements it in the ToSpeckleSettingsManagerNavisworks class. The NavisworksSendBinding constructor now takes an additional parameter of type IToSpeckleSettingsManagerNavisworks.

In addition, some file and namespace renaming has been done to align with the changes made.

* FFS - Cyclical relationships or missing assemblies

* FFS

- Removed references to Navisworks2020, Navisworks2021, Navisworks2022, Navisworks2023, and Navisworks2025 connectors in packages.lock.json files
- Commented out project references to Navisworks2020, Navisworks2021, Navisworks2022, Navisworks2023, and Navisworks2025 connectors in csproj files
- Updated project reference for shared converter in shproj file

* Update NavisworksConnectorServiceRegistration.cs

- Update the registration of ToSpeckleSettingsManagerNavisworks to use the interface IToSpeckleSettingsManagerNavisworks instead of the concrete class ToSpeckleSettingsManagerNavisworks.

* Update NavisworksSendBinding to use ToSpeckleSettingsManagerNavisworks instead of IToSpeckleSettingsManagerNavisworks for conversion settings retrieval.

Update NavisworksSendBinding to use ToSpeckleSettingsManagerNavisworks instead of IToSpeckleSettingsManagerNavisworks for conversion settings retrieval.

This commit updates the NavisworksSendBinding code to replace the usage of IToSpeckleSettingsManagerNavisworks with ToSpeckleSettingsManagerNavisworks for retrieving conversion settings. This change ensures consistency and improves the overall functionality of the code.

* merge fixes

* Refactor NavisworksObjects.cs: Improve object representation and property handling

- Rename `NavisworksObject` to `NavisworksModelItem`
- Remove unused properties and suppress style warnings
- Add required parameters to constructors for `name` and `displayValue`
- Update property accessors for `elements`, `displayValue`, and `name`
- Improve implementation of `AddProperty` and `GetProperty` methods

* Refactor display value extraction and object creation in Navisworks converter

- Refactored the `GetDisplayValue` method in `DisplayValueExtractor.cs` to be an instance method instead of static.
- Updated the `CreateGeometryObject` method in `ModelItemTopLevelConverterToSpeckle.cs` to use an instance of `DisplayValueExtractor`.
- Changed the return type of `CreateNonGeometryObject` method in `ModelItemTopLevelConverterToSpeckle.cs` to match the updated class name.

These changes improve code organization and maintainability.

* Update Speckle SDK and Objects to version 3.1.0-dev.203 in Navisworks connectors for versions 2020, 2021, 2022, and 2023.

* remove more async

* clean up

* can build agian

* Use valuetask

* fmt

* fix up some bridge execution to be sync

* Refactor NavisworksRootObjectBuilder.cs: Improve initialization of root object collection

- Initialize root object collection with name and units in a more concise way
- Improve readability and maintainability of the code

* Fix logger import in NavisworksRootObjectBuilder.cs

The commit fixes an issue with the logger import in the NavisworksRootObjectBuilder.cs file. The incorrect namespace was causing a compilation error. This change ensures that the correct namespace is used for the logger, resolving the compilation error and allowing for proper logging functionality.

* Refactor ClassPropertiesExtractor to simplify GetClassProperties method

The GetClassProperties method in the ClassPropertiesExtractor class has been refactored to improve readability and reduce unnecessary code. The if statement that checks for exclusion of properties has been removed, as it is no longer needed. Instead, the ExtractClassProperties method is directly returned. This change simplifies the logic and improves code maintainability.

* Fix static method in DisplayValueExtractor

The commit fixes a bug in the DisplayValueExtractor class where the GetDisplayValue method was not declared as static. This caused a compilation error. The fix makes the method static, allowing it to be called without an instance of the class.

* Add BasePropertyHandler, HierarchicalPropertyHandler, IPropertyHandler, and StandardPropertyHandler classes for handling property assignment in Navisworks conversion.

- Added IPropertyHandler interface to define the contract for handling property assignment to Speckle objects.
- Added BasePropertyHandler class to provide common functionality for property assignment.
- Added StandardPropertyHandler class to handle standard property assignment without any merging or hierarchy processing.
- Added HierarchicalPropertyHandler class to handle property assignment with hierarchy merging for objects that require ancestor properties.

* Refactor class hierarchy and method signatures for Navisworks conversion

- Make `GetClassProperties` method in `ClassPropertiesExtractor` static
- Remove `classPropertiesExtractor` parameter from constructors in `BasePropertyHandler`, `HierarchicalPropertyHandler`, and `StandardPropertyHandler`
- Update references to `classPropertiesExtractor.GetClassProperties(modelItem)` to use the static method `ClassPropertiesExtractor.GetClassProperties(modelItem)`
- Rename private field `_properties` in classes implementing `INavisworksObject` to `Properties`
- Rename public property `elements` in class `NavisworksModelItem` to `Elements`
- Rename public property `displayValue` in class `NavisworksModelGeometry` to lowercase (`displayvalue`)
- Add missing using statements

* Add ElementSelectionHelper class for working with Navisworks ModelItem selections.

This commit adds a new file, ElementSelectionHelper.cs, which contains a static class called ElementSelectionHelper. This class provides extension methods for working with Navisworks ModelItem selections. The class includes the following significant changes:

- Added ResolveModelItemToIndexPath method: This method takes a Navisworks ModelItem and resolves it to its unique index path representation. The resulting string represents the model item's path, including the model index and a hierarchical path identifier separated by a specified separator.
- Added ResolveIndexPathToModelItem method: This method takes an index path string and resolves it to a Navisworks ModelItem. It splits the index path into parts, assigns the first part to the modelIndex variable as an integer, and joins the remaining parts as the pathId string.
- Added IsElementVisible method: This method determines whether a Navisworks ModelItem and all its ancestors are visible. It checks the visibility status for each item in the item's ancestorsAndSelf collection and returns true if none of them are hidden.
- Added ResolveGeometryLeafNodes method: This method takes a Navisworks ModelItem and returns a list of all its descendants (including itself) that have geometry.

These changes enhance functionality related to working with Navisworks ModelItems in Speckle.Converter.NavisworksShared.Helpers namespace.

* cleanup

* WIP on jsdb/navisworks
WIP on jsdb/navisworks

- Replaced `ModelItemTopLevelConverterToSpeckle` with `NavisworksRootToSpeckleConverter` in `NavisworksConverterServiceRegistration.cs`
- Added new files to the project: `BasePropertyHandler.cs`, `HieraerchicalPropertyHandler.cs`, `IPropertyHandler.cs`, and `StandardPrpertyHandler.cs`
- Updated the file path in the project items XML
- Modified `NavisworksRootToSpeckleConverter.cs` to use the updated method name

* Update Speckle.Objects to version 3.1.0-dev.205 in Navisworks connectors for versions 2020, 2021, and 2022.

- Update Speckle.Objects to version 3.1.0-dev.205
- Update Speckle.Sdk to version 3.1.0-dev.205
- Update Speckle.Sdk.Dependencies to version 3.1.0-dev.205

* Fix reserved term replacement in PropertyHelpers.cs

The commit fixes a bug in the PropertyHelpers.cs file where the reserved term "Item" was not being replaced correctly. The replacement has been changed from "Item_" to "Item".

* Refactor property handlers and model objects

- Remove unused code in ClassPropertiesExtractor.cs
- Refactor PropertySetsExtractor.cs to use dependency injection for settingsStore
- Refactor BasePropertyHandler.cs to include classPropertiesExtractor parameter
- Rename HieraerchicalPropertyHandler.cs to HierarchicalPropertyHandler.cs
- Rename StandardPrpertyHandler.cs to StandardPropertyHandler.cs
- Update NavisworksConverterServiceRegistration.cs to register the new property handlers

* Refactor model item name retrieval logic in ModelItemTopLevelConverterToSpeckle.cs

- Refactored the GetObjectName method to improve readability and maintainability.
- Updated the logic to retrieve the target object's display name, cycling through parent objects if necessary.
- Added a fallback case to return "Unnamed model item" if no valid display name is found.

* Whitespace in property name conversion to _ in PropertyHelpers.cs

The code change fixes a bug in the `PropertyHelpers.cs` file where property names were not being converted correctly. The regular expression used to replace characters now includes whitespace characters as well. This ensures that all invalid characters are replaced with underscores, allowing for proper conversion of property names.

* Add GeometryNodeMerger class to handle merging of sibling geometry nodes.

- Added `GeometryNodeMerger` class to handle grouping and merging of sibling geometry nodes.
- Updated `NavisworksRootObjectBuilderExtensions` to use `GeometryNodeMerger` for grouping and merging.
- Updated `NavisworksRootObjectBuilder` to use `ClassPropertiesExtractor` and `PropertySetsExtractor`.
- Refactored code in `NavisworksRootObjectBuilder.Build()` method to improve readability and maintainability.

* modify GeometryNodeMerger.cs and NavisworksRootObjectBuilder.cs

- Modified GeometryNodeMerger.cs to only group anonymous geometry nodes
- Modified NavisworksRootObjectBuilder.cs to refactor the Build method, handle grouped nodes first, and set the final elements list

* add some non async paths for progress

* format

* remove needless selection

* Initialize root collection, convert and store model items, process and merge grouped nodes, add remaining non-grouped nodes, finalize and return.

* Add NavisworksMaterialUnpacker class for unpacking render materials

This commit adds a new file, NavisworksMaterialUnpacker.cs, which contains the implementation of the NavisworksMaterialUnpacker class. This class is responsible for unpacking render materials from Navisworks objects.

The NavisworksMaterialUnpacker class includes methods such as UnpackRenderMaterial and ConvertRenderColorAndTransparencyToSpeckle, which handle the extraction and conversion of render material properties.

Additionally, the project file Speckle.Connectors.NavisworksShared.projitems has been updated to include the newly added NavisworksMaterialUnpacker.cs file.

* Add `NavisworksMaterialUnpacker` to `NavisworksRootObjectBuilder` constructor

- Add `NavisworksMaterialUnpacker` to the service collection in `NavisworksConnectorServiceRegistration.cs`.
- Update the constructor of `NavisworksRootObjectBuilder` to include dependencies for `IRootToSpeckleConverter`, `ISendConversionCache`, `IConverterSettingsStore<NavisworksConversionSettings>`, `ILogger<NavisworksRootObjectBuilder>`, `ISdkActivityFactory`, and `NavisworksMaterialUnpacker`.

This commit adds the registration of the `NavisworksMaterialUnpacker` class to the service collection in order to enable dependency injection. It also updates the constructor of the `NavisworksRootObjectBuilder` class to include all necessary dependencies for its functionality.

* Update Speckle.Objects to version 3.1.0-dev.212 in Navisworks connectors for versions 2020, 2021, and 2022.

The commit updates the packages.lock.json file for the Navisworks connectors for versions 2020, 2021, and 2022. It changes the requested and resolved version of Speckle.Objects from 3.1.0-dev.205 to 3.1.0-dev.212

* Add NavisworksObject to finalElements in NavisworksRootObjectBuilder

This commit adds the NavisworksObject class to the finalElements list in the NavisworksRootObjectBuilder. The NavisworksObject contains properties such as name, displayValue, properties, and units. This change improves the functionality of the code by including additional information for each element in the finalElements list.

* Add applicationId to NavisworksRootObjectBuilder

This commit adds the applicationId property to the NavisworksRootObjectBuilder class in order to include it in the finalElements list. This change ensures that the applicationId is properly assigned and included when building Navisworks objects for sending.

* RunOnMainThreadAsync implemented

- Refactored GetDocumentInfo method in NavisworksBasicConnectorBinding to run on the main thread using Parent.RunOnMainThreadAsync
- Refactored HighlightObjects method in NavisworksBasicConnectorBinding to run on the main thread using Parent.RunOnMainThreadAsync
- Refactored OnSelectionChange method in NavisworksSelectionBinding to use async/await and run UpdateSelectionAsync on the main thread using Parent.RunOnMainThreadAsync
- Added async/await to Send method in NavisworksSendBinding and refactored code inside it to use async/await for better readability
- Extracted common logic into separate methods in NavisworksSendBinding: GetModelCard, InitializeConverterSettings, GetNavisworksModelItems, ExecuteSendOperation
- Added cancellation support to CancelSend method in NavisworksSendBinding by calling _cancellationManager.CancelOperation with modelCardId as argument
- Refactored ProcessModelStateChange method in NavisworksDocumentEvents to use async/await and added check for _finalModelCount value

* Restore DocumentModelStore.cs accessibility - not sure when that changed

- Change access modifiers of HostAppSaveState and LoadState methods to protected
- Update method comments to reflect changes in access modifiers

* Refactor NavisworksConnectorServiceRegistration and NavisworksDocumentEvents

- Added NavisworksMaterialUnpacker to service collection
- Updated registration of DocumentModelStore in service collection
- Updated references to DocumentModelStore with NavisworksDocumentModelStore in NavisworksDocumentEvents
- Renamed HostAppSaveState method to protected override method in NavisworksDocumentModelStore
- Added public method ReloadState as a wrapper for LoadState in NavisworksDocumentModelStore

* Delete Navisworks solution file

The commit deletes the Navisworks solution file, which is no longer needed.

* Delete  packages.lock.json

* Remove Navisworks 2025

* Reset Navisworks project references and project names

- Updated the project reference for "Navisworks" in Local.sln to use a new GUID
- Updated the project reference for "2024" in Local.sln to use a new GUID
- Updated the project reference for "Shared" in Local.sln to use a new GUID
- Updated the project reference for "Speckle.Connectors.NavisworksShared" in Local.sln to use a new GUID
- Updated the project reference for "Speckle.Converters.NavisworksShared" in Local.sln to use a new GUID
- Updated the project name and GUID for "Navisworks" in Speckle.Connectors.sln
- Updated the project name and GUID for "Shared" in Speckle.Connectors.sln

* Update Microsoft.Web.WebView2 package to version 1.0.2088.41 in Autocad connectors for versions 2022, 2023, 2024, and 2025.

This commit updates the Microsoft.Web.WebView2 package in the Autocad connectors for versions 2022, 2023, 2024, and 2025 from version 1.0.1938.49 to version 1.0.2088.41. This change ensures compatibility with the latest version of the package and includes necessary bug fixes or improvements related to web view functionality in the connectors.

* Reset Navisworks project references and project names

- Updated the project reference for "Navisworks" in Local.sln to use a new GUID
- Updated the project reference for "2024" in Local.sln to use a new GUID
- Updated the project reference for "Shared" in Local.sln to use a new GUID
- Updated the project reference for "Speckle.Connectors.NavisworksShared" in Local.sln to use a new GUID
- Updated the project reference for "Speckle.Converters.NavisworksShared" in Local.sln to use a new GUID
- Updated the project name and GUID for "Navisworks" in Speckle.Connectors.sln
- Updated the project name and GUID for "Shared" in Speckle.Connectors.sln

* Update Microsoft.Web.WebView2 version to [1.0.1938.49, ) in Autocad and Civil3d connectors

This commit updates the version of Microsoft.Web.WebView2 to [1.0.1938.49, ) in the Autocad and Civil3d connectors packages.lock.json files. The previous version was 1.0.2088.41, and the contentHash has also been updated accordingly.

Note: This commit message is exactly 50 characters long, as per the requirement for a short description less than 50 characters.

* Refactor to avoid the early disposal of COM objects

- Remove the `GeometryNodeMerger` class from service registration in `NavisworksConnectorServiceRegistration.cs`
- Change the access modifier of `UnpackRenderMaterial` method in `NavisworksMaterialUnpacker.cs` to internal
- Change the access modifier of `ConvertRenderColorAndTransparencyToSpeckle` method in `NavisworksMaterialUnpacker.cs` to private static
- Change the access modifier of `GroupSiblingGeometryNodes` method in `GeometryNodeMerger.cs` to public static
- Add null checks for parameters in methods:
  - GetClassProperties in ClassPropertiesExtractor.cs
  - GetPropertySets and AssignProperties in BasePropertyHandler.cs
  - AssignClassProperties and ExtractClassProperties in ClassPropertiesExtractor.cs
  - GetPropertySets in PropertySetsExtractor.cs
  - AssignPropertySets, AssignModelProperties, and ExtractModelProperties in ModelPropertiesExtractor.cs
  - NavisworksRootObjectBuilder constructor

* feat: Add geometry conversion functionality

- Added `DisplayValueExtractor` class for extracting display values from Navisworks model items
- Added `GeometryToSpeckleConverter` class for converting Navisworks geometry to Speckle SDK models
- Updated dependencies in `NavisworksConverterServiceRegistration.cs` to include the new classes

* Rename GeomtryNodeMerger.cs to GeometryNodeMerger.cs

This commit renames the file GeomtryNodeMerger.cs to GeometryNodeMerger.cs.

* Remove redundant code shared by both projects

- Updated NavisworksSelectionBinding to include IElementSelectionService as a dependency in the constructor.
- Updated NavisworksSendBinding to include IElementSelectionService as a dependency in the constructor.
- Removed ElementSelectionExtension.cs file.
- Added ElementSelectionService.cs file which includes methods for getting model item path, resolving model item from path, checking visibility of model items, and getting geometry nodes.

* fix lock files

* cannot make null valuetasks

* merge fixes

* update to latest SDK

* scope the classes correctly for the deserialization process

* Navisworks proj cleanup (#443)

* Clean up projects and locks for all Navisworks

* Fix nuget error

* Fixed Local SLN and removed some runtime IDs

* add back RuntimeIdentifier

* We shouldn't be using ConfigureAwait false

* Fix lock files for NW

* Rhino doesn't need explicit run on main threads?

* add back layers and materials on ui thread with comment

* Update to SDK 3.1.0-218

* update locks

* rationalize NW and usage of cancellation token

* format

* remove .ConfigureAwait(false)

* Remove ValueTask and fix ArcGIS doc saving

* run events on the correct thread

* format

* Remove usage of sync context

---------

Co-authored-by: Jonathon Broughton <jonathon@stardotbmp.com>
Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
Co-authored-by: Jonathon Broughton <760691+jsdbroughton@users.noreply.github.com>
2024-12-20 17:12:18 +03:00
Oğuzhan Koral 370588fa89 Merge pull request #461 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update dev to release
2024-12-20 16:14:59 +03:00
Oğuzhan Koral c9802396f5 Merge pull request #448 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update dev to release
2024-12-13 01:54:05 +03:00
Oğuzhan Koral 9644444ea7 Merge pull request #437 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update dev to release
2024-12-04 22:38:16 +03:00
Alan Rynne bb0fffd4d7 Merge pull request #414 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update `release/3.0.0` with changes from `dev`
2024-11-27 16:23:50 +01:00
Alan Rynne c719cfd66f Merge pull request #383 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update `release/3.0.0` with changes from `dev`
2024-11-12 15:56:02 +01:00
Oğuzhan Koral 92435ce1a1 Merge pull request #376 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update release/3.0.0 with changes from dev
2024-11-08 18:16:16 +00:00
Oğuzhan Koral 71409e8af8 Merge pull request #374 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update release/3.0.0 with changes from dev
2024-11-08 15:13:47 +00:00
Alan Rynne 8060f46882 Merge pull request #359 from specklesystems/dev
Update `release/3.0.0` with changes from `dev`
2024-11-06 18:49:52 +01:00
Alan Rynne 6671edd36e Merge pull request #354 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update `release/3.0.0` with changes from `dev`
2024-11-06 14:22:08 +01:00
Alan Rynne bc15ff3a34 Merge pull request #347 from specklesystems/dev
Update `release/3.0.0` with changes from `dev`
2024-11-05 10:30:20 +01:00
Alan Rynne de275dcf02 Merge pull request #337 from specklesystems/dev
.NET Build and Publish / build (push) Has been cancelled
.NET Build and Publish / test (push) Has been cancelled
.NET Build and Publish / deploy-installers (push) Has been cancelled
Update `release/3.0.0` with changes from `dev`
2024-10-31 12:17:57 +01:00
Alan Rynne 6158739df0 Merge pull request #331 from specklesystems/dev
Update `release/3.0.0` with changes from `dev`
2024-10-28 13:05:26 +01:00
315 changed files with 7735 additions and 3404 deletions
+3
View File
@@ -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
+4 -1
View File
@@ -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
+18 -7
View File
@@ -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
+2 -2
View File
@@ -28,11 +28,11 @@ public static class Github
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()}"
);
}
}
+24 -1
View File
@@ -7,6 +7,7 @@ using static SimpleExec.Command;
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 @@ Target(
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 @@ Target(
}
);
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),
@@ -78,17 +78,14 @@ public sealed class ArcGISReceiveBinding : IReceiveBinding
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 @@ public sealed class ArcGISReceiveBinding : IReceiveBinding
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);
}
}
@@ -3,7 +3,6 @@ using System.Diagnostics.CodeAnalysis;
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.ArcGIS.Utils;
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<ArcGISSendBinding> _logger;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IArcGISConversionSettingsFactory _arcGISConversionSettingsFactory;
private readonly IThreadContext _threadContext;
/// <summary>
/// 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 sealed class ArcGISSendBinding : ISendBinding
IOperationProgressManager operationProgressManager,
ILogger<ArcGISSendBinding> logger,
IArcGISConversionSettingsFactory arcGisConversionSettingsFactory,
MapMembersUtils mapMemberUtils
MapMembersUtils mapMemberUtils,
IThreadContext threadContext
)
{
_store = store;
@@ -80,6 +82,7 @@ public sealed class ArcGISSendBinding : ISendBinding
_topLevelExceptionHandler = parent.TopLevelExceptionHandler;
_arcGISConversionSettingsFactory = arcGisConversionSettingsFactory;
_mapMemberUtils = mapMemberUtils;
_threadContext = threadContext;
Parent = parent;
Commands = new SendBindingUICommands(parent);
@@ -94,14 +97,16 @@ public sealed class ArcGISSendBinding : ISendBinding
{
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 @@ public sealed class ArcGISSendBinding : ISendBinding
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 @@ public sealed class ArcGISSendBinding : ISendBinding
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 @@ public sealed class ArcGISSendBinding : ISendBinding
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)
// subscribe to layers
foreach (Layer layer in MapView.Active.Map.Layers)
{
if (layer is FeatureLayer featureLayer)
{
if (layer is FeatureLayer featureLayer)
{
SubscribeToFeatureLayerDataSourceChange(featureLayer);
}
SubscribeToFeatureLayerDataSourceChange(featureLayer);
}
// subscribe to tables
foreach (StandaloneTable table in MapView.Active.Map.StandaloneTables)
{
SubscribeToTableDataSourceChange(table);
}
});
task.Wait();
}
// subscribe to tables
foreach (StandaloneTable table in MapView.Active.Map.StandaloneTables)
{
SubscribeToTableDataSourceChange(table);
}
}
private void SubscribeToFeatureLayerDataSourceChange(FeatureLayer layer)
@@ -197,7 +203,7 @@ public sealed class ArcGISSendBinding : ISendBinding
(args) =>
Parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args).ConfigureAwait(false);
await OnRowChanged(args);
}),
layerTable
);
@@ -205,7 +211,7 @@ public sealed class ArcGISSendBinding : ISendBinding
(args) =>
Parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args).ConfigureAwait(false);
await OnRowChanged(args);
}),
layerTable
);
@@ -213,7 +219,7 @@ public sealed class ArcGISSendBinding : ISendBinding
(args) =>
Parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args).ConfigureAwait(false);
await OnRowChanged(args);
}),
layerTable
);
@@ -258,7 +264,7 @@ public sealed class ArcGISSendBinding : ISendBinding
}
}
await RunExpirationChecks(false).ConfigureAwait(false);
await RunExpirationChecks(false);
}
private async Task GetIdsForLayersRemovedEvent(LayerEventsArgs args)
@@ -267,7 +273,7 @@ public sealed class ArcGISSendBinding : ISendBinding
{
ChangedObjectIds[layer.URI] = 1;
}
await RunExpirationChecks(true).ConfigureAwait(false);
await RunExpirationChecks(true);
}
private async Task GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArgs args)
@@ -276,7 +282,7 @@ public sealed class ArcGISSendBinding : ISendBinding
{
ChangedObjectIds[table.URI] = 1;
}
await RunExpirationChecks(true).ConfigureAwait(false);
await RunExpirationChecks(true);
}
private async Task GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs args)
@@ -289,7 +295,7 @@ public sealed class ArcGISSendBinding : ISendBinding
ChangedObjectIds[member.URI] = 1;
}
}
await RunExpirationChecks(false).ConfigureAwait(false);
await RunExpirationChecks(false);
}
private void GetIdsForLayersAddedEvent(LayerEventsArgs args)
@@ -339,7 +345,7 @@ public sealed class ArcGISSendBinding : ISendBinding
{
ChangedObjectIds[member.URI] = 1;
}
await RunExpirationChecks(false).ConfigureAwait(false);
await RunExpirationChecks(false);
}
}
@@ -366,64 +372,52 @@ public sealed class ArcGISSendBinding : ISendBinding
CancellationToken cancellationToken = _cancellationManager.InitCancellationTokenSource(modelCardId);
var sendResult = await QueuedTask
.Run(async () =>
using var scope = _serviceProvider.CreateScope();
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<ArcGISConversionSettings>>()
.Initialize(
_arcGISConversionSettingsFactory.Create(
Project.Current,
MapView.Active.Map,
new CRSoffsetRotation(MapView.Active.Map)
)
);
List<MapMember> 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)
{
using var scope = _serviceProvider.CreateScope();
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<ArcGISConversionSettings>>()
.Initialize(
_arcGISConversionSettingsFactory.Create(
Project.Current,
MapView.Active.Map,
new CRSoffsetRotation(MapView.Active.Map)
)
);
List<MapMember> mapMembers = modelCard
.SendFilter.NotNull()
.RefreshObjectIds()
.Select(id => (MapMember)MapView.Active.Map.FindLayer(id) ?? MapView.Active.Map.FindStandaloneTable(id))
.Where(obj => obj != null)
.ToList();
SubscribeToFeatureLayerDataSourceChange(featureLayer);
}
else if (mapMember is StandaloneTable table)
{
SubscribeToTableDataSourceChange(table);
}
}
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!"
);
}
var sendResult = await scope
.ServiceProvider.GetRequiredService<SendOperation<MapMember>>()
.Execute(
mapMembers,
modelCard.GetSendInfo("ArcGIS"), // POC: get host app name from settings? same for GetReceiveInfo
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationToken),
cancellationToken
);
// 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<SendOperation<MapMember>>()
.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);
await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
}
catch (OperationCanceledException)
{
@@ -435,7 +429,7 @@ public sealed class ArcGISSendBinding : ISendBinding
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 @@ public sealed class ArcGISSendBinding : ISendBinding
}
}
await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false);
await Commands.SetModelsExpired(expiredSenderIds);
ChangedObjectIds = new();
}
}
@@ -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 class BasicConnectorBinding : IBasicConnectorBinding
_store.DocumentChanged += (_, _) =>
parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await Commands.NotifyDocumentChanged().ConfigureAwait(false);
await Commands.NotifyDocumentChanged();
});
}
@@ -60,16 +59,19 @@ public class BasicConnectorBinding : IBasicConnectorBinding
public void RemoveModel(ModelCard model) => _store.RemoveModel(model);
public async Task HighlightObjects(IReadOnlyList<string> objectIds) =>
await HighlightObjectsOnView(objectIds.Select(x => new ObjectID(x)).ToList()).ConfigureAwait(false);
public Task HighlightObjects(IReadOnlyList<string> 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<ObjectID>();
@@ -86,26 +88,22 @@ public class BasicConnectorBinding : IBasicConnectorBinding
if (objectIds is null)
{
return;
return Task.CompletedTask;
}
await HighlightObjectsOnView(objectIds).ConfigureAwait(false);
HighlightObjectsOnView(objectIds);
return Task.CompletedTask;
}
private async Task HighlightObjectsOnView(IReadOnlyList<ObjectID> objectIds)
private void HighlightObjectsOnView(IReadOnlyList<ObjectID> objectIds)
{
MapView mapView = MapView.Active;
await QueuedTask
.Run(async () =>
{
List<MapMemberFeature> mapMembersFeatures = GetMapMembers(objectIds, mapView);
ClearSelectionInTOC();
ClearSelection();
await SelectMapMembersInTOC(mapMembersFeatures).ConfigureAwait(false);
SelectMapMembersAndFeatures(mapMembersFeatures);
mapView.ZoomToSelected();
})
.ConfigureAwait(false);
List<MapMemberFeature> mapMembersFeatures = GetMapMembers(objectIds, mapView);
ClearSelectionInTOC();
ClearSelection();
SelectMapMembersInTOC(mapMembersFeatures);
SelectMapMembersAndFeatures(mapMembersFeatures);
mapView.ZoomToSelected();
}
private List<MapMemberFeature> GetMapMembers(IReadOnlyList<ObjectID> objectIds, MapView mapView)
@@ -171,7 +169,7 @@ public class BasicConnectorBinding : IBasicConnectorBinding
}
}
private async Task SelectMapMembersInTOC(IReadOnlyList<MapMemberFeature> mapMembersFeatures)
private void SelectMapMembersInTOC(IReadOnlyList<MapMemberFeature> mapMembersFeatures)
{
List<Layer> layers = new();
List<StandaloneTable> tables = new();
@@ -187,7 +185,7 @@ public class BasicConnectorBinding : IBasicConnectorBinding
}
else
{
await QueuedTask.Run(() => layer.SetExpanded(true)).ConfigureAwait(false);
layer.SetExpanded(true);
}
}
else if (member is StandaloneTable table)
@@ -27,7 +27,7 @@ public static class ArcGISConnectorModule
public static void AddArcGIS(this IServiceCollection serviceCollection)
{
serviceCollection.AddConnectorUtils();
serviceCollection.AddDUI<ArcGISDocumentStore>();
serviceCollection.AddDUI<ArcGISThreadContext, ArcGISDocumentStore>();
serviceCollection.AddDUIView();
// Register bindings
@@ -25,7 +25,7 @@ public class ArcGISColorManager
/// </summary>
/// <param name="colorProxies"></param>
/// <param name="onOperationProgressed"></param>
public async Task ParseColors(List<ColorProxy> colorProxies, IProgress<CardProgress> onOperationProgressed)
public void ParseColors(List<ColorProxy> colorProxies, IProgress<CardProgress> onOperationProgressed)
{
// injected as Singleton, so we need to clean existing proxies first
ObjectColorsIdMap = new();
@@ -33,7 +33,6 @@ public class ArcGISColorManager
foreach (ColorProxy colorProxy in colorProxies)
{
onOperationProgressed.Report(new("Converting colors", (double)++count / colorProxies.Count));
await Task.Yield();
foreach (string objectId in colorProxy.objects)
{
Color convertedColor = Color.FromArgb(colorProxy.value);
@@ -47,10 +46,7 @@ public class ArcGISColorManager
/// </summary>
/// <param name="materialProxies"></param>
/// <param name="onOperationProgressed"></param>
public async Task ParseMaterials(
List<RenderMaterialProxy> materialProxies,
IProgress<CardProgress> onOperationProgressed
)
public void ParseMaterials(List<RenderMaterialProxy> materialProxies, IProgress<CardProgress> onOperationProgressed)
{
// injected as Singleton, so we need to clean existing proxies first
ObjectMaterialsIdMap = new();
@@ -58,7 +54,6 @@ public class ArcGISColorManager
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);
@@ -18,7 +18,7 @@ public class ArcGISLayerUnpacker
/// <param name="parentCollection"></param>
/// <returns>List of layers containing objects.</returns>
/// <exception cref="AC.CalledOnWrongThreadException">Thrown when this method is *not* called on the MCT, because this method accesses mapmember fields</exception>
public async Task<List<ADM.MapMember>> UnpackSelectionAsync(
public List<ADM.MapMember> UnpackSelection(
IEnumerable<ADM.MapMember> mapMembers,
Collection parentCollection,
List<ADM.MapMember>? 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:
@@ -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 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
_colorManager = colorManager;
}
public async Task<HostObjectBuilderResult> Build(
public HostObjectBuilderResult Build(
Base rootObject,
string projectName,
string modelName,
@@ -74,14 +73,14 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
.ToList();
if (materials != null)
{
await _colorManager.ParseMaterials(materials, onOperationProgressed).ConfigureAwait(false);
_colorManager.ParseMaterials(materials, onOperationProgressed);
}
// get colors
List<ColorProxy>? colors = (rootObject[ProxyKeys.COLOR] as List<object>)?.Cast<ColorProxy>().ToList();
if (colors != null)
{
await _colorManager.ParseColors(colors, onOperationProgressed).ConfigureAwait(false);
_colorManager.ParseColors(colors, onOperationProgressed);
}
int count = 0;
@@ -100,7 +99,7 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
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 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
// 2.1. Group conversionTrackers (to write into datasets)
onOperationProgressed.Report(new("Grouping features into layers", null));
Dictionary<string, List<(TraversalContext, ObjectConversionTracker)>> convertedGroups = await QueuedTask
.Run(async () =>
{
return await _featureClassUtils
.GroupConversionTrackers(conversionTracker, (s, progres) => onOperationProgressed.Report(new(s, progres)))
.ConfigureAwait(false);
})
.ConfigureAwait(false);
Dictionary<string, List<(TraversalContext, ObjectConversionTracker)>> 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 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
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 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
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 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
}
}
private async Task<MapMember> AddDatasetsToMap(
private MapMember AddDatasetsToMap(
ObjectConversionTracker trackerItem,
Dictionary<string, GroupLayer> 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;
// 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
}
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)
{
// 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;
throw new SpeckleException($"Layer '{shortName}' was not created");
}
layer.SetExpanded(false);
// add group for the current layer
string shortName = nestedLayerName.Split("\\")[^1];
string nestedLayerPath = string.Join("\\", nestedLayerName.Split("\\").SkipLast(1));
// 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, };
// if no general group layer found
if (createdLayerGroups.Count == 0)
// for Feature Layers
if (layer.GetDefinition() is CIMFeatureLayer cimLyr)
{
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
cimLyr.LayerElevation = layerElevationSurface;
layer.SetDefinition(cimLyr);
}
}
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)
{
StandaloneTable table = StandaloneTableFactory.Instance.CreateStandaloneTable(
uri,
groupLayer,
tableName: shortName
);
return table;
}
})
.ConfigureAwait(false);
return layer;
}
catch (ArgumentException)
{
StandaloneTable table = StandaloneTableFactory.Instance.CreateStandaloneTable(
uri,
groupLayer,
tableName: shortName
);
return table;
}
}
private GroupLayer CreateNestedGroupLayer(string nestedLayerPath, Dictionary<string, GroupLayer> createdLayerGroups)
@@ -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<ADM.MapMember>
{
private readonly IRootToSpeckleConverter _rootToSpeckleConverter;
private readonly ISendConversionCache _sendConversionCache;
private readonly ArcGISLayerUnpacker _layerUnpacker;
private readonly ArcGISColorUnpacker _colorUnpacker;
private readonly IConverterSettingsStore<ArcGISConversionSettings> _converterSettings;
@@ -34,7 +31,6 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
private readonly MapMembersUtils _mapMemberUtils;
public ArcGISRootObjectBuilder(
ISendConversionCache sendConversionCache,
ArcGISLayerUnpacker layerUnpacker,
ArcGISColorUnpacker colorUnpacker,
IConverterSettingsStore<ArcGISConversionSettings> converterSettings,
@@ -44,7 +40,6 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
MapMembersUtils mapMemberUtils
)
{
_sendConversionCache = sendConversionCache;
_layerUnpacker = layerUnpacker;
_colorUnpacker = colorUnpacker;
_converterSettings = converterSettings;
@@ -54,11 +49,11 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
_mapMemberUtils = mapMemberUtils;
}
public async Task<RootObjectBuilderResult> Build(
public async Task<RootObjectBuilderResult> BuildAsync(
IReadOnlyList<ADM.MapMember> layers,
SendInfo sendInfo,
SendInfo __,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
CancellationToken cancellationToken
)
{
// TODO: add a warning if Geographic CRS is set
@@ -103,9 +98,7 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
IEnumerable<ADM.MapMember> 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<SendConversionResult> results = new(unpackedLayers.Count);
@@ -115,7 +108,7 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
int count = 0;
foreach (ADM.MapMember layer in unpackedLayers)
{
ct.ThrowIfCancellationRequested();
cancellationToken.ThrowIfCancellationRequested();
string layerApplicationId = layer.GetSpeckleApplicationId();
try
@@ -141,21 +134,15 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
switch (layer)
{
case ADM.FeatureLayer featureLayer:
List<Base> convertedFeatureLayerObjects = await QueuedTask
.Run(() => ConvertFeatureLayerObjectsAsync(featureLayer))
.ConfigureAwait(false);
List<Base> convertedFeatureLayerObjects = ConvertFeatureLayerObjects(featureLayer);
layerCollection.elements.AddRange(convertedFeatureLayerObjects);
break;
case ADM.RasterLayer rasterLayer:
List<Base> convertedRasterLayerObjects = await QueuedTask
.Run(() => ConvertRasterLayerObjectsAsync(rasterLayer))
.ConfigureAwait(false);
List<Base> convertedRasterLayerObjects = ConvertRasterLayerObjects(rasterLayer);
layerCollection.elements.AddRange(convertedRasterLayerObjects);
break;
case ADM.LasDatasetLayer lasDatasetLayer:
List<Base> convertedLasDatasetObjects = await QueuedTask
.Run(() => ConvertLasDatasetLayerObjectsAsync(lasDatasetLayer))
.ConfigureAwait(false);
List<Base> convertedLasDatasetObjects = ConvertLasDatasetLayerObjects(lasDatasetLayer);
layerCollection.elements.AddRange(convertedLasDatasetObjects);
break;
default:
@@ -180,6 +167,7 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
}
onOperationProgressed.Report(new("Converting", (double)++count / layers.Count));
await Task.Yield();
}
}
@@ -194,96 +182,78 @@ public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
return new RootObjectBuilderResult(rootCollection, results);
}
private async Task<List<Base>> ConvertFeatureLayerObjectsAsync(ADM.FeatureLayer featureLayer)
private List<Base> ConvertFeatureLayerObjects(ADM.FeatureLayer featureLayer)
{
string layerApplicationId = featureLayer.GetSpeckleApplicationId();
List<Base> convertedObjects = new();
await QueuedTask
.Run(() =>
// 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())
{
while (rowCursor.MoveNext())
{
// 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())
// 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<List<Base>> ConvertRasterLayerObjectsAsync(ADM.RasterLayer rasterLayer)
private List<Base> ConvertRasterLayerObjects(ADM.RasterLayer rasterLayer)
{
string layerApplicationId = rasterLayer.GetSpeckleApplicationId();
List<Base> 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<List<Base>> ConvertLasDatasetLayerObjectsAsync(ADM.LasDatasetLayer lasDatasetLayer)
private List<Base> ConvertLasDatasetLayerObjects(ADM.LasDatasetLayer lasDatasetLayer)
{
string layerApplicationId = lasDatasetLayer.GetSpeckleApplicationId();
List<Base> convertedObjects = new();
try
{
await QueuedTask
.Run(() =>
// store the layer renderer for color unpacking
_colorUnpacker.StoreRenderer(lasDatasetLayer);
using (ACD.Analyst3D.LasPointCursor ptCursor = lasDatasetLayer.SearchPoints(new ACD.Analyst3D.LasPointFilter()))
{
while (ptCursor.MoveNext())
{
// store the layer renderer for color unpacking
_colorUnpacker.StoreRenderer(lasDatasetLayer);
using (
ACD.Analyst3D.LasPointCursor ptCursor = lasDatasetLayer.SearchPoints(new ACD.Analyst3D.LasPointFilter())
)
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)
{
@@ -18,7 +18,7 @@ internal sealed class SpeckleDUI3ViewModel : DockPane
/// </summary>
protected override async Task InitializeAsync()
{
await base.InitializeAsync().ConfigureAwait(false);
await base.InitializeAsync();
}
/// <summary>
@@ -26,7 +26,7 @@ internal sealed class SpeckleDUI3ViewModel : DockPane
/// </summary>
protected override async Task UninitializeAsync()
{
await base.UninitializeAsync().ConfigureAwait(false);
await base.UninitializeAsync();
}
}
@@ -2,7 +2,6 @@ using ArcGIS.Desktop.Framework;
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 @@ internal sealed class SpeckleModule : Module
services.AddArcGIS();
services.AddArcGISConverters();
Container = services.BuildServiceProvider();
Container.UseDUI();
}
private HostAppVersion GetVersion()
@@ -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<T> MainToWorkerAsync<T>(Func<Task<T>> action)
{
if (QueuedTask.OnWorker)
{
return action();
}
else
{
return QueuedTask.Run(async () => await action());
}
}
protected override Task<T> WorkerToMainAsync<T>(Func<Task<T>> action) => QueuedTask.Run(async () => await action());
protected override Task<T> MainToWorker<T>(Func<T> action)
{
if (QueuedTask.OnWorker)
{
return Task.FromResult(action());
}
else
{
return QueuedTask.Run(action);
}
}
protected override Task<T> WorkerToMain<T>(Func<T> action) => QueuedTask.Run(action);
}
@@ -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 @@ public class ArcGISDocumentStore : DocumentModelStore
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();
// Parse existing metadata
XDocument existingXmlDocument = !string.IsNullOrEmpty(existingMetadata)
? XDocument.Parse(existingMetadata)
: new XDocument(new XElement("metadata"));
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)
protected override void HostAppSaveState(string modelCardState) =>
_threadContext
.RunOnWorker(() =>
{
speckleModelCardsElement.ReplaceWith(xmlModelCards);
}
else
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"));
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);
}
map.SetMetadata(existingXmlDocument.ToString());
})
.FireAndForget();
protected override void LoadState() =>
_threadContext
.RunOnWorker(() =>
{
existingXmlDocument.Root?.Add(xmlModelCards);
}
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;
}
map.SetMetadata(existingXmlDocument.ToString());
});
}
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)
{
ClearAndSave();
return;
}
string modelsString = element.Value;
LoadFromString(modelsString);
});
}
string modelsString = element.Value;
LoadFromString(modelsString);
})
.FireAndForget();
}
@@ -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": {
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target AfterTargets="Clean" Name="CleanAddinAutocad" Condition="'$(AutoCADVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<RemoveDir Directories="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad$(AutoCADVersion);" />
</Target>
<Target AfterTargets="Build" Name="AfterBuildAutoCAD" Condition="'$(AutoCADVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<ItemGroup>
<AutoCADDLLs Include="$(TargetDir)\**\*.*" />
</ItemGroup>
<Message Text="AutoCAD Version $(AutoCADVersion)" Importance="high"/>
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad$(AutoCADVersion)\%(RecursiveDir)" SourceFiles="@(AutoCADDLLs)" />
</Target>
<Target AfterTargets="Clean" Name="CleanAddinCivil3D" Condition="'$(Civil3DVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<RemoveDir Directories="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d$(Civil3DVersion);" />
</Target>
<Target AfterTargets="Build" Name="AfterBuildCivil3D" Condition="'$(Civil3DVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<ItemGroup>
<Civil3DDLLs Include="$(TargetDir)\**\*.*" />
</ItemGroup>
<Message Text="Civil3D Version $(Civil3DVersion)" Importance="high"/>
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d$(Civil3DVersion)\%(RecursiveDir)" SourceFiles="@(Civil3DDLLs)" />
</Target>
</Project>
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -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": {
@@ -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<AutocadBasicConnectorBinding> _logger;
public BasicConnectorBindingCommands Commands { get; }
@@ -28,7 +30,8 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
IBrowserBridge parent,
IAccountManager accountManager,
ISpeckleApplication speckleApplication,
ILogger<AutocadBasicConnectorBinding> logger
ILogger<AutocadBasicConnectorBinding> logger,
IThreadContext threadContext
)
{
_store = store;
@@ -39,9 +42,10 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
_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 class AutocadBasicConnectorBinding : IBasicConnectorBinding
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 class AutocadBasicConnectorBinding : IBasicConnectorBinding
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<ObjectId>()); // Deselects
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();
var tr = doc.TransactionManager.StartTransaction();
foreach (ObjectId objectId in objectIds)
{
try
{
doc.Editor.SetImpliedSelection(objectIds);
var entity = (Entity?)tr.GetObject(objectId, OpenMode.ForRead);
if (entity?.GeometricExtents != null)
{
selectedExtents.AddExtents(entity.GeometricExtents);
}
}
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.
// 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.UpdateScreen();
Extents3d selectedExtents = new();
var tr = doc.TransactionManager.StartTransaction();
foreach (ObjectId objectId in objectIds)
{
try
{
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
}
}
doc.Editor.Zoom(selectedExtents);
tr.Commit();
Autodesk.AutoCAD.Internal.Utils.FlushGraphics();
}
catch (Exception ex) when (!ex.IsFatal())
doc.Editor.Zoom(selectedExtents);
tr.Commit();
Autodesk.AutoCAD.Internal.Utils.FlushGraphics();
}
catch (Exception ex) when (!ex.IsFatal())
{
if (modelCardId != null)
{
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;
}
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;
}
}
});
}
}
@@ -81,12 +81,13 @@ public sealed class AutocadReceiveBinding : IReceiveBinding
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 @@ public sealed class AutocadReceiveBinding : IReceiveBinding
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
{
@@ -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<Document> _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 @@ public class AutocadSelectionBinding : ISelectionBinding
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 @@ public class AutocadSelectionBinding : ISelectionBinding
private async Task OnSelectionChanged()
{
_selectionInfo = GetSelectionInternal();
await Parent.Send(SELECTION_EVENT, _selectionInfo).ConfigureAwait(false);
await Parent.Send(SELECTION_EVENT, _selectionInfo);
}
public SelectionInfo GetSelection() => _selectionInfo;
@@ -8,6 +8,7 @@ using Speckle.Connectors.Autocad.Operations.Send;
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<AutocadSendBinding> _logger;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly ISpeckleApplication _speckleApplication;
private readonly IThreadContext _threadContext;
/// <summary>
/// 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 @@ public abstract class AutocadSendBaseBinding : ISendBinding
ISendConversionCache sendConversionCache,
IOperationProgressManager operationProgressManager,
ILogger<AutocadSendBinding> logger,
ISpeckleApplication speckleApplication
ISpeckleApplication speckleApplication,
IThreadContext threadContext
)
{
_store = store;
@@ -69,6 +72,7 @@ public abstract class AutocadSendBaseBinding : ISendBinding
_operationProgressManager = operationProgressManager;
_logger = logger;
_speckleApplication = speckleApplication;
_threadContext = threadContext;
_topLevelExceptionHandler = parent.TopLevelExceptionHandler;
Parent = parent;
Commands = new SendBindingUICommands(parent);
@@ -111,10 +115,7 @@ public abstract class AutocadSendBaseBinding : ISendBinding
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 @@ public abstract class AutocadSendBaseBinding : ISendBinding
}
}
await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false);
await Commands.SetModelsExpired(expiredSenderIds);
ChangedObjectIds = new();
}
@@ -144,9 +145,7 @@ public abstract class AutocadSendBaseBinding : ISendBinding
public List<ICardSetting> 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 @@ public abstract class AutocadSendBaseBinding : ISendBinding
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 @@ public abstract class AutocadSendBaseBinding : ISendBinding
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
{
@@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging;
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 sealed class AutocadSendBinding : AutocadSendBaseBinding
IOperationProgressManager operationProgressManager,
ILogger<AutocadSendBinding> logger,
IAutocadConversionSettingsFactory autocadConversionSettingsFactory,
ISpeckleApplication speckleApplication
ISpeckleApplication speckleApplication,
IThreadContext threadContext
)
: base(
store,
@@ -40,7 +42,8 @@ public sealed class AutocadSendBinding : AutocadSendBaseBinding
sendConversionCache,
operationProgressManager,
logger,
speckleApplication
speckleApplication,
threadContext
)
{
_autocadConversionSettingsFactory = autocadConversionSettingsFactory;
@@ -10,6 +10,7 @@ using Speckle.Connectors.Common.Builders;
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<AutocadDocumentStore>();
serviceCollection.AddDUI<DefaultThreadContext, AutocadDocumentStore>();
serviceCollection.AddDUIView();
// Register other connector specific types
@@ -43,10 +44,10 @@ public static class SharedRegistration
serviceCollection.AddScoped<AutocadGroupBaker>();
serviceCollection.AddScoped<AutocadColorUnpacker>();
serviceCollection.AddScoped<AutocadColorBaker>();
serviceCollection.AddScoped<IAutocadColorBaker, AutocadColorBaker>();
serviceCollection.AddScoped<AutocadMaterialUnpacker>();
serviceCollection.AddScoped<AutocadMaterialBaker>();
serviceCollection.AddScoped<IAutocadMaterialBaker, AutocadMaterialBaker>();
serviceCollection.AddSingleton<IAppIdleManager, AutocadIdleManager>();
@@ -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;
/// <summary>
/// Expects to be a scoped dependency for a given operation and helps with layer creation and cleanup.
/// </summary>
public class AutocadColorBaker
[GenerateAutoInterface]
public class AutocadColorBaker(ILogger<AutocadColorBaker> logger) : IAutocadColorBaker
{
private readonly ILogger<AutocadColorBaker> _logger;
public AutocadColorBaker(ILogger<AutocadColorBaker> logger)
{
_logger = logger;
}
/// <summary>
/// For receive operations
/// </summary>
@@ -59,7 +54,7 @@ public class AutocadColorBaker
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogError(ex, "Failed parsing color proxy");
logger.LogError(ex, "Failed parsing color proxy");
}
}
}
@@ -26,16 +26,16 @@ namespace Speckle.Connectors.Autocad.HostApp;
public class AutocadInstanceBaker : IInstanceBaker<IReadOnlyCollection<Entity>>
{
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<AutocadInstanceBaker> _logger;
private readonly IConverterSettingsStore<AutocadConversionSettings> _converterSettings;
public AutocadInstanceBaker(
AutocadLayerBaker layerBaker,
AutocadColorBaker colorBaker,
AutocadMaterialBaker materialBaker,
IAutocadColorBaker colorBaker,
IAutocadMaterialBaker materialBaker,
AutocadContext autocadContext,
ILogger<AutocadInstanceBaker> logger,
IConverterSettingsStore<AutocadConversionSettings> converterSettings
@@ -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<string> _uniqueLayerNames = new();
public AutocadLayerBaker(
AutocadContext autocadContext,
AutocadMaterialBaker materialBaker,
AutocadColorBaker colorBaker
IAutocadMaterialBaker materialBaker,
IAutocadColorBaker colorBaker
)
{
_autocadContext = autocadContext;
@@ -4,6 +4,7 @@ using Autodesk.AutoCAD.GraphicsInterface;
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;
/// <summary>
/// Expects to be a scoped dependency for a given operation and helps with layer creation and cleanup.
/// </summary>
public class AutocadMaterialBaker
[GenerateAutoInterface]
public class AutocadMaterialBaker : IAutocadMaterialBaker
{
private readonly ILogger<AutocadMaterialBaker> _logger;
private readonly AutocadContext _autocadContext;
@@ -20,86 +20,44 @@ namespace Speckle.Connectors.Autocad.Operations.Receive;
/// <summary>
/// <para>Expects to be a scoped dependency per receive operation.</para>
/// </summary>
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<HostObjectBuilderResult> Build(
public HostObjectBuilderResult Build(
Base rootObject,
string projectName,
string modelName,
IProgress<CardProgress> 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<CardProgress> 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 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
// 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 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
if (unpackedRoot.ColorProxies != null)
{
_colorBaker.ParseColors(unpackedRoot.ColorProxies, onOperationProgressed);
colorBaker.ParseColors(unpackedRoot.ColorProxies, onOperationProgressed);
}
// 5 - Convert atomic objects
@@ -134,6 +92,7 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
{
string objectId = atomicObject.applicationId ?? atomicObject.id.NotNull();
onOperationProgressed.Report(new("Converting objects", (double)++count / atomicObjects.Count));
cancellationToken.ThrowIfCancellationRequested();
try
{
IReadOnlyCollection<Entity> convertedObjects = ConvertObject(atomicObject, layerPath, baseLayerPrefix);
@@ -158,7 +117,7 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
}
// 6 - Convert instances
var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = _instanceBaker.BakeInstances(
var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = instanceBaker.BakeInstances(
instanceComponentsWithPath,
applicationIdMap,
baseLayerPrefix,
@@ -173,7 +132,7 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
// 7 - Create groups
if (unpackedRoot.GroupProxies != null)
{
IReadOnlyCollection<ReceiveConversionResult> groupResults = _groupBaker.CreateGroups(
IReadOnlyCollection<ReceiveConversionResult> groupResults = groupBaker.CreateGroups(
unpackedRoot.GroupProxies,
applicationIdMap
);
@@ -185,20 +144,20 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
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<Entity> ConvertObject(Base obj, Collection[] layerPath, string baseLayerNamePrefix)
{
string layerName = _layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix);
string layerName = layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix);
var convertedEntities = new HashSet<Entity>();
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 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
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 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
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})"
);
@@ -16,7 +16,7 @@ using Speckle.Sdk.Models.Instances;
namespace Speckle.Connectors.Autocad.Operations.Send;
public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadRootObject>
public abstract class AutocadRootObjectBaseBuilder : RootObjectBuilderBase<AutocadRootObject>
{
private readonly IRootToSpeckleConverter _converter;
private readonly string[] _documentPathSeparator = ["\\"];
@@ -49,13 +49,6 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
_activityFactory = activityFactory;
}
public Task<RootObjectBuilderResult> Build(
IReadOnlyList<AutocadRootObject> objects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
) => Task.FromResult(BuildSync(objects, sendInfo, onOperationProgressed, ct));
[SuppressMessage(
"Maintainability",
"CA1506:Avoid excessive class coupling",
@@ -65,11 +58,11 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
proxy classes yet. So I'm supressing this one now!!!
"""
)]
private RootObjectBuilderResult BuildSync(
public override RootObjectBuilderResult Build(
IReadOnlyList<AutocadRootObject> objects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
CancellationToken cancellationToken
)
{
// 0 - Init the root
@@ -101,7 +94,7 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
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.
@@ -3,7 +3,6 @@ using Autodesk.AutoCAD.Runtime;
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 class AutocadCommand
services.AddCivil3dConverters();
#endif
Container = services.BuildServiceProvider();
Container.UseDUI();
var panelWebView = Container.GetRequiredService<DUI3ControlWebView>();
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -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": {
@@ -4,6 +4,7 @@ using Speckle.Connectors.Autocad.Bindings;
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 sealed class Civil3dSendBinding : AutocadSendBaseBinding
ILogger<AutocadSendBinding> logger,
ICivil3dConversionSettingsFactory civil3dConversionSettingsFactory,
IAutocadConversionSettingsFactory autocadConversionSettingsFactory,
ISpeckleApplication speckleApplication
ISpeckleApplication speckleApplication,
IThreadContext threadContext
)
: base(
store,
@@ -44,7 +46,8 @@ public sealed class Civil3dSendBinding : AutocadSendBaseBinding
sendConversionCache,
operationProgressManager,
logger,
speckleApplication
speckleApplication,
threadContext
)
{
_civil3dConversionSettingsFactory = civil3dConversionSettingsFactory;
@@ -107,12 +107,9 @@ public sealed class CsiSharedSendBinding : ISendBinding
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 @@ public sealed class CsiSharedSendBinding : ISendBinding
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogModelCardHandledError(ex);
await Commands.SetModelError(modelCardId, ex).ConfigureAwait(false);
await Commands.SetModelError(modelCardId, ex);
}
}
@@ -42,11 +42,11 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
_csiApplicationService = csiApplicationService;
}
public async Task<RootObjectBuilderResult> Build(
public async Task<RootObjectBuilderResult> BuildAsync(
IReadOnlyList<ICsiWrapper> csiObjects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken = default
CancellationToken cancellationToken
)
{
using var activity = _activityFactory.Start("Build");
@@ -62,14 +62,15 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
{
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 class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
throw new SpeckleException("Failed to convert all objects.");
}
await Task.Yield();
return new RootObjectBuilderResult(rootObjectCollection, results);
}
@@ -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.CSiShared.HostApp;
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 class ServiceRegistration
services.AddSingleton<ICsiApplicationService, CsiApplicationService>();
services.AddConnectorUtils();
services.AddDUI<CsiDocumentModelStore>();
services.AddDUI<DefaultThreadContext, CsiDocumentModelStore>();
services.AddDUIView();
services.AddSingleton<DocumentModelStore, CsiDocumentModelStore>();
services.AddSingleton<IBinding, TestBinding>();
services.AddSingleton<IBinding, ConfigBinding>();
services.AddSingleton<IBinding, AccountBinding>();
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<UseWpf>true</UseWpf>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworks.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworks.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
<RootNamespace>Speckle.Connector.Navisworks</RootNamespace>
</PropertyGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<Message Text="Navisworks Version $(NavisworksVersion)" Importance="high"/>
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -8,16 +8,7 @@
<NavisworksBuildNumber>v17</NavisworksBuildNumber>
<NavisworksVersion>2020</NavisworksVersion>
<UseWpf>true</UseWpf>
<DefineConstants>$(DefineConstants);TRACE;NAVIS2020;NAVIS</DefineConstants>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
</PropertyGroup>
<Import Project="..\Speckle.Connectors.NavisworksShared\Speckle.Connectors.NavisworksShared.projitems" Label="Shared"/>
@@ -32,25 +23,5 @@
<ProjectReference Include="..\..\..\Converters\Navisworks\Speckle.Converters.Navisworks2020\Speckle.Converters.Navisworks2020.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Common\Speckle.Connectors.Common.csproj"/>
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj"/>
</ItemGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -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": {
@@ -8,16 +8,7 @@
<NavisworksBuildNumber>v18</NavisworksBuildNumber>
<NavisworksVersion>2021</NavisworksVersion>
<UseWpf>true</UseWpf>
<DefineConstants>$(DefineConstants);TRACE;NAVIS2021;NAVIS</DefineConstants>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
</PropertyGroup>
<Import Project="..\Speckle.Connectors.NavisworksShared\Speckle.Connectors.NavisworksShared.projitems" Label="Shared"/>
@@ -32,25 +23,5 @@
<ProjectReference Include="..\..\..\Converters\Navisworks\Speckle.Converters.Navisworks2021\Speckle.Converters.Navisworks2021.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Common\Speckle.Connectors.Common.csproj"/>
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj"/>
</ItemGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -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": {
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
@@ -9,16 +8,7 @@
<NavisworksBuildNumber>v19</NavisworksBuildNumber>
<NavisworksVersion>2022</NavisworksVersion>
<UseWpf>true</UseWpf>
<DefineConstants>$(DefineConstants);TRACE;NAVIS2022;NAVIS</DefineConstants>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
</PropertyGroup>
<Import Project="..\Speckle.Connectors.NavisworksShared\Speckle.Connectors.NavisworksShared.projitems" Label="Shared"/>
@@ -33,25 +23,5 @@
<ProjectReference Include="..\..\..\Converters\Navisworks\Speckle.Converters.Navisworks2022\Speckle.Converters.Navisworks2022.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Common\Speckle.Connectors.Common.csproj"/>
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj"/>
</ItemGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -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": {
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
@@ -9,20 +8,9 @@
<NavisworksBuildNumber>v20</NavisworksBuildNumber>
<NavisworksVersion>2023</NavisworksVersion>
<UseWpf>true</UseWpf>
<DefineConstants>$(DefineConstants);TRACE;NAVIS2023;NAVIS</DefineConstants>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
<RootNamespace>Speckle.Connector.Navisworks</RootNamespace>
</PropertyGroup>
<!-- Includes -->
<Import Project="..\Speckle.Connectors.NavisworksShared\Speckle.Connectors.NavisworksShared.projitems" Label="Shared"/>
<ItemGroup>
@@ -35,25 +23,5 @@
<ProjectReference Include="..\..\..\Converters\Navisworks\Speckle.Converters.Navisworks2023\Speckle.Converters.Navisworks2023.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Common\Speckle.Connectors.Common.csproj"/>
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj"/>
</ItemGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -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": {
@@ -1,5 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
@@ -9,19 +8,9 @@
<NavisworksBuildNumber>v21</NavisworksBuildNumber>
<NavisworksVersion>2024</NavisworksVersion>
<UseWpf>true</UseWpf>
<DefineConstants>$(DefineConstants);TRACE;NAVIS2024;NAVIS</DefineConstants>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
<RootNamespace>Speckle.Connector.Navisworks</RootNamespace>
</PropertyGroup>
<Import Project="..\Speckle.Connectors.NavisworksShared\Speckle.Connectors.NavisworksShared.projitems" Label="Shared"/>
<ItemGroup>
@@ -34,25 +23,5 @@
<ProjectReference Include="..\..\..\Converters\Navisworks\Speckle.Converters.Navisworks2024\Speckle.Converters.Navisworks2024.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Common\Speckle.Connectors.Common.csproj"/>
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj"/>
</ItemGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -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": {
@@ -8,16 +8,7 @@
<NavisworksBuildNumber>v22</NavisworksBuildNumber>
<NavisworksVersion>2025</NavisworksVersion>
<UseWpf>true</UseWpf>
<DefineConstants>$(DefineConstants);TRACE;NAVIS2025;NAVIS</DefineConstants>
<Description>NextGen Speckle Connector for Autodesk Navisworks Manage</Description>
<Authors>$(Authors) jonathon@speckle.systems</Authors>
<PackageTags>$(PackageTags) connector nwd nwc nwf navisworks manage</PackageTags>
<PluginBundleTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle</PluginBundleTarget>
<PluginVersionContentTarget>$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Navisworksv3.bundle\Contents\$(NavisworksVersion)</PluginVersionContentTarget>
</PropertyGroup>
<Import Project="..\Speckle.Connectors.NavisworksShared\Speckle.Connectors.NavisworksShared.projitems" Label="Shared"/>
@@ -34,23 +25,4 @@
<ProjectReference Include="..\..\..\Sdk\Speckle.Connectors.Common\Speckle.Connectors.Common.csproj"/>
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj"/>
</ItemGroup>
<!-- Post Builds -->
<ItemGroup>
<RibbonFiles Include="$(OutDir)Plugin\NavisworksRibbon.*"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.png"/>
<ResourceFiles Include="$(OutDir)Resources\**\*.ico"/>
<AllFiles Include="$(OutDir)*"/>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="Build">
<RemoveDir Directories="$(PluginVersionContentTarget)" Condition="Exists('$(PluginVersionContentTarget)')"/>
<Copy SourceFiles="$(OutDir)Plugin\PackageContents.xml" DestinationFolder="$(PluginBundleTarget)\"/>
<Copy SourceFiles="@(RibbonFiles)" DestinationFolder="$(PluginVersionContentTarget)\en-US\"/>
<Copy SourceFiles="@(ResourceFiles)" DestinationFolder="$(PluginVersionContentTarget)\Resources\"/>
<Copy SourceFiles="@(AllFiles)" DestinationFolder="$(PluginVersionContentTarget)\" />
</Target>
</Project>
@@ -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": {
@@ -42,20 +42,13 @@ public class NavisworksBasicConnectorBinding : IBasicConnectorBinding
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 @@ public class NavisworksBasicConnectorBinding : IBasicConnectorBinding
public Task HighlightModel(string modelCardId) => Task.CompletedTask;
public async Task HighlightObjects(IReadOnlyList<string> 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;
}
@@ -26,24 +26,12 @@ public class NavisworksSelectionBinding : ISelectionBinding
}
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<SelectionInfo>(() => Task.FromResult(GetSelection()))
.ConfigureAwait(false);
await Parent.Send<SelectionInfo>(SELECTION_EVENT, selInfo).ConfigureAwait(false);
var selInfo = GetSelection();
await Parent.Send<SelectionInfo>(SELECTION_EVENT, selInfo);
}
public SelectionInfo GetSelection()
@@ -87,27 +87,19 @@ public class NavisworksSendBinding : ISendBinding
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 @@ public class NavisworksSendBinding : ISendBinding
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 @@ public class NavisworksSendBinding : ISendBinding
.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);
@@ -9,6 +9,7 @@ using Speckle.Connectors.Common;
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 class NavisworksConnectorServiceRegistration
{
// Register Core functionality
serviceCollection.AddConnectorUtils();
serviceCollection.AddDUI<NavisworksDocumentModelStore>();
serviceCollection.AddDUI<DefaultThreadContext, NavisworksDocumentModelStore>();
serviceCollection.AddDUIView();
// Register bindings
@@ -50,6 +51,7 @@ public static class NavisworksConnectorServiceRegistration
>();
serviceCollection.AddScoped<NavisworksMaterialUnpacker>();
serviceCollection.AddScoped<NavisworksColorUnpacker>();
// Sending operations
serviceCollection.AddScoped<IRootObjectBuilder<NAV.ModelItem>, NavisworksRootObjectBuilder>();
@@ -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<NavisworksColorUnpacker> logger,
IConverterSettingsStore<NavisworksConversionSettings> converterSettings,
IElementSelectionService selectionService
)
{
private static T Select<T>(RepresentationMode mode, T active, T permanent, T original, T defaultValue) =>
mode switch
{
RepresentationMode.Active => active,
RepresentationMode.Permanent => permanent,
RepresentationMode.Original => original,
_ => defaultValue,
};
internal List<ColorProxy> UnpackColor(
IReadOnlyList<NAV.ModelItem> navisworksObjects,
Dictionary<string, List<NAV.ModelItem>> groupedNodes
)
{
if (navisworksObjects == null)
{
throw new ArgumentNullException(nameof(navisworksObjects));
}
if (groupedNodes == null)
{
throw new ArgumentNullException(nameof(groupedNodes));
}
Dictionary<string, ColorProxy> colorProxies = [];
Dictionary<string, string> 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;
}
@@ -84,10 +84,7 @@ public sealed class NavisworksDocumentEvents : IDisposable
_topLevelExceptionHandler.CatchUnhandled(
() =>
_idleManager.SubscribeToIdle(
nameof(NavisworksDocumentEvents),
async () => await ProcessModelStateChangeAsync().ConfigureAwait(false)
)
_idleManager.SubscribeToIdle(nameof(NavisworksDocumentEvents), async () => await ProcessModelStateChangeAsync())
);
}
@@ -102,29 +99,24 @@ public sealed class NavisworksDocumentEvents : IDisposable
try
{
await _parent
.RunOnMainThreadAsync(async () =>
{
var store = _serviceProvider.GetRequiredService<NavisworksDocumentModelStore>();
var basicBinding = _serviceProvider.GetRequiredService<IBasicConnectorBinding>();
var commands = (basicBinding as NavisworksBasicConnectorBinding)?.Commands;
var store = _serviceProvider.GetRequiredService<NavisworksDocumentModelStore>();
var basicBinding = _serviceProvider.GetRequiredService<IBasicConnectorBinding>();
var commands = (basicBinding as NavisworksBasicConnectorBinding)?.Commands;
switch (_finalModelCount)
{
case 0 when _priorModelCount > 0:
store.ClearAndSave();
break;
case > 0 when _priorModelCount == 0:
store.ReloadState();
break;
}
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);
if (commands != null)
{
await commands.NotifyDocumentChanged();
}
}
finally
{
@@ -164,7 +156,7 @@ public sealed class NavisworksDocumentEvents : IDisposable
if (commands != null)
{
await commands.NotifyDocumentChanged().ConfigureAwait(false);
await commands.NotifyDocumentChanged();
}
}
finally
@@ -2,6 +2,7 @@ using System.Data;
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 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore
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 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore
{
if (!IsActiveDocumentValid())
{
ClearAndSave();
ClearAndSaveThisState();
return;
}
@@ -62,16 +71,23 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore
{
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 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore
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();
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 = $"DELETE FROM {TABLE_NAME} WHERE key = @key";
command.Parameters.AddWithValue("@key", KEY_NAME);
command.ExecuteNonQuery();
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 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore
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 @@ public sealed class NavisworksDocumentModelStore : DocumentModelStore
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;
}
}
@@ -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 @@ public class NavisworksMaterialUnpacker(
_ => defaultValue,
};
internal List<RenderMaterialProxy> UnpackRenderMaterial(IReadOnlyList<NAV.ModelItem> navisworksObjects)
internal List<RenderMaterialProxy> UnpackRenderMaterial(
IReadOnlyList<NAV.ModelItem> navisworksObjects,
Dictionary<string, List<NAV.ModelItem>> groupedNodes
)
{
if (navisworksObjects == null)
{
throw new ArgumentNullException(nameof(navisworksObjects));
}
if (groupedNodes == null)
{
throw new ArgumentNullException(nameof(groupedNodes));
}
Dictionary<string, RenderMaterialProxy> renderMaterialProxies = [];
Dictionary<string, string> 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 @@ public class NavisworksMaterialUnpacker(
}
var navisworksObjectId = selectionService.GetModelItemPath(navisworksObject);
var finalId = mergedIds.TryGetValue(navisworksObjectId, out var mergedId) ? mergedId : navisworksObjectId;
var geometry = navisworksObject.Geometry;
// Extract the current visual representation mode
var mode = converterSettings.Current.User.VisualRepresentationMode;
using var defaultColor = new NAV.Color(1.0, 1.0, 1.0);
// Assign properties using the selector
var renderColor = Select(
mode,
geometry.ActiveColor,
@@ -70,15 +87,16 @@ public class NavisworksMaterialUnpacker(
var renderMaterialId = Select(
mode,
geometry.ActiveColor.GetHashCode(),
geometry.PermanentColor.GetHashCode(),
geometry.OriginalColor.GetHashCode(),
$"{geometry.ActiveColor.GetHashCode()}_{geometry.ActiveTransparency}".GetHashCode(),
$"{geometry.PermanentColor.GetHashCode()}_{geometry.PermanentTransparency}".GetHashCode(),
$"{geometry.OriginalColor.GetHashCode()}_{geometry.OriginalTransparency}".GetHashCode(),
0
);
var materialName = $"NavisworksMaterial_{Math.Abs(NavisworksColorToColor(renderColor).ToArgb())}";
var materialName =
$"NavisworksMaterial_{Math.Abs(ColorConverter.NavisworksColorToColor(renderColor).ToArgb())}";
// Alternatively the material could be stored on the Item property
// Check Item category for material name
var itemCategory = navisworksObject.PropertyCategories.FindCategoryByDisplayName("Item");
if (itemCategory != null)
{
@@ -90,7 +108,7 @@ public class NavisworksMaterialUnpacker(
}
}
// Or in a Material property
// Check Material category for material name
var materialPropertyCategory = navisworksObject.PropertyCategories.FindCategoryByDisplayName("Material");
if (materialPropertyCategory != null)
{
@@ -104,22 +122,19 @@ public class NavisworksMaterialUnpacker(
if (renderMaterialProxies.TryGetValue(renderMaterialId.ToString(), out RenderMaterialProxy? value))
{
value.objects.Add(navisworksObjectId);
value.objects.Add(finalId);
}
else
{
renderMaterialProxies[renderMaterialId.ToString()] = new RenderMaterialProxy()
{
// For now, we will just use the color and transparency to create a new material
// There is more information that is in the Material object that could be used to create a more accurate material
// But is constant regardless of the user settings
value = ConvertRenderColorAndTransparencyToSpeckle(
materialName,
renderTransparency,
renderColor,
renderMaterialId
),
objects = [navisworksObjectId]
objects = [finalId]
};
}
}
@@ -139,7 +154,7 @@ public class NavisworksMaterialUnpacker(
int applicationId
)
{
var color = NavisworksColorToColor(navisworksColor);
var color = ColorConverter.NavisworksColorToColor(navisworksColor);
var speckleRenderMaterial = new RenderMaterial()
{
@@ -154,11 +169,4 @@ public class NavisworksMaterialUnpacker(
return speckleRenderMaterial;
}
private static System.Drawing.Color NavisworksColorToColor(NAV.Color color) =>
System.Drawing.Color.FromArgb(
Convert.ToInt32(color.R * 255),
Convert.ToInt32(color.G * 255),
Convert.ToInt32(color.B * 255)
);
}
@@ -23,49 +23,101 @@ public class NavisworksRootObjectBuilder(
ILogger<NavisworksRootObjectBuilder> logger,
ISdkActivityFactory activityFactory,
NavisworksMaterialUnpacker materialUnpacker,
NavisworksColorUnpacker colorUnpacker,
IElementSelectionService elementSelectionService
) : IRootObjectBuilder<NAV.ModelItem>
{
private bool SkipNodeMerging { get; set; }
internal NavisworksConversionSettings GetCurrentSettings() => converterSettings.Current;
public Task<RootObjectBuilderResult> Build(
/// <summary>
/// Asynchronously builds a Speckle object hierarchy from Navisworks model items.
/// </summary>
/// <param name="navisworksModelItems">The list of Navisworks items to convert.</param>
/// <param name="sendInfo">Information about the send operation.</param>
/// <param name="onOperationProgressed">Progress reporting callback.</param>
/// <param name="cancellationToken">Token to cancel the operation.</param>
/// <returns>A result containing the root collection and conversion results.</returns>
/// <exception cref="SpeckleException">Thrown when no objects can be converted.</exception>
public async Task<RootObjectBuilderResult> BuildAsync(
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
SendInfo sendInfo,
IProgress<CardProgress> 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<NAV.ModelItem> navisworksModelItems,
SendInfo sendInfo,
IProgress<CardProgress> 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<SendConversionResult> results = new(navisworksModelItems.Count);
if (onOperationProgressed == null || sendInfo == null)
{
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<string, Base?> converted, List<SendConversionResult> results)> ConvertModelItemsAsync(
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
var results = new List<SendConversionResult>(navisworksModelItems.Count);
var convertedBases = new Dictionary<string, Base?>();
int processedCount = 0;
int totalCount = navisworksModelItems.Count;
if (onOperationProgressed == null || sendInfo == null)
{
throw new ArgumentNullException(nameof(onOperationProgressed));
}
foreach (var item in navisworksModelItems)
{
cancellationToken.ThrowIfCancellationRequested();
@@ -75,85 +127,143 @@ public class NavisworksRootObjectBuilder(
onOperationProgressed.Report(new CardProgress("Converting", (double)processedCount / totalCount));
}
return Task.FromResult((convertedBases, results));
}
private static void ValidateConversionResults(List<SendConversionResult> 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<Base> BuildFinalElements(
Dictionary<string, Base?> convertedBases,
Dictionary<string, List<NAV.ModelItem>> groupedNodes
)
{
var finalElements = new List<Base>();
var groupedNodes = GroupSiblingGeometryNodes(navisworksModelItems);
var processedPaths = new HashSet<string>();
// 5. Process and merge grouped nodes
AddGroupedElements(finalElements, convertedBases, groupedNodes, processedPaths);
AddRemainingElements(finalElements, convertedBases, processedPaths);
return finalElements;
}
private void AddGroupedElements(
List<Base> finalElements,
Dictionary<string, Base?> convertedBases,
Dictionary<string, List<NAV.ModelItem>> groupedNodes,
HashSet<string> processedPaths
)
{
foreach (var group in groupedNodes)
{
var siblingBases = new List<Base>();
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;
}
var navisworksObject = new NavisworksObject
{
name = elementSelectionService.GetModelItemFromPath(group.Key).DisplayName ?? string.Empty,
displayValue = siblingBases.SelectMany(b => b["displayValue"] as List<Base> ?? []).ToList(),
properties = siblingBases.First()["properties"] as Dictionary<string, object?> ?? [],
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)))
{
if (!convertedBases.TryGetValue(result.SourceId, out var convertedBase) || convertedBase == null)
{
continue;
}
// 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<Base> ?? [],
properties = convertedBase["properties"] as Dictionary<string, object?> ?? [],
units = converterSettings.Current.Derived.SpeckleUnits,
applicationId = convertedBase.applicationId
};
finalElements.Add(navisworksObject);
finalElements.Add(CreateNavisworksObject(group.Key, siblingBases));
}
}
using (var _ = activityFactory.Start("UnpackRenderMaterials"))
{
// 7. - Unpack the render material proxies
rootObjectCollection[ProxyKeys.RENDER_MATERIAL] = materialUnpacker.UnpackRenderMaterial(navisworksModelItems);
}
// 8. Finalize and return
rootObjectCollection.elements = finalElements;
return Task.FromResult(new RootObjectBuilderResult(rootObjectCollection, results));
}
private void AddRemainingElements(
List<Base> finalElements,
Dictionary<string, Base?> convertedBases,
HashSet<string> processedPaths
)
{
foreach (var kvp in convertedBases.Where(kvp => !processedPaths.Contains(kvp.Key)))
{
switch (kvp.Value)
{
case null:
continue;
case Collection collection:
finalElements.Add(collection);
break;
default:
finalElements.Add(CreateNavisworksObject(kvp.Value));
break;
}
}
}
/// <summary>
/// Processes and adds any remaining non-grouped elements.
/// </summary>
/// <remarks>
/// Handles both Collection and Base type elements differently.
/// Only processes elements that weren't handled in grouped processing.
/// </remarks>
private NavisworksObject CreateNavisworksObject(string groupKey, List<Base> siblingBases) =>
new()
{
name = elementSelectionService.GetModelItemFromPath(groupKey).DisplayName ?? string.Empty,
displayValue = siblingBases.SelectMany(b => b["displayValue"] as List<Base> ?? []).ToList(),
properties = siblingBases.First()["properties"] as Dictionary<string, object?> ?? [],
units = converterSettings.Current.Derived.SpeckleUnits,
applicationId = groupKey
};
/// <summary>
/// Creates a NavisworksObject from a single converted base.
/// </summary>
/// <param name="convertedBase">The converted Speckle Base object.</param>
/// <returns>A new NavisworksObject containing the converted data.</returns>
private NavisworksObject CreateNavisworksObject(Base convertedBase) =>
new()
{
name = convertedBase["name"] as string ?? string.Empty,
displayValue = convertedBase["displayValue"] as List<Base> ?? [],
properties = convertedBase["properties"] as Dictionary<string, object?> ?? [],
units = converterSettings.Current.Derived.SpeckleUnits,
applicationId = convertedBase.applicationId
};
private Task AddProxiesToCollection(
Collection rootCollection,
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
Dictionary<string, List<NAV.ModelItem>> groupedNodes
)
{
using var _ = activityFactory.Start("UnpackProxies");
var renderMaterials = materialUnpacker.UnpackRenderMaterial(navisworksModelItems, groupedNodes);
if (renderMaterials.Count > 0)
{
rootCollection[ProxyKeys.RENDER_MATERIAL] = renderMaterials;
}
var colors = colorUnpacker.UnpackColor(navisworksModelItems, groupedNodes);
if (colors.Count > 0)
{
rootCollection[ProxyKeys.COLOR] = colors;
}
return Task.CompletedTask;
}
/// <summary>
/// Converts a single Navisworks item to a Speckle object.
/// </summary>
/// <remarks>
/// Attempts to retrieve from cache first.
/// Falls back to fresh conversion if not cached.
/// Logs errors but doesn't throw exceptions.
/// </remarks>
/// <returns>A SendConversionResult indicating success or failure.</returns>
private SendConversionResult ConvertNavisworksItem(
NAV.ModelItem navisworksItem,
Dictionary<string, Base?> convertedBases,
@@ -4,7 +4,6 @@ using System.Windows.Forms.Integration;
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<Connector>;
var services = new ServiceCollection();
services.Initialize(HostApplications.Navisworks, HostAppVersion.v2024);
@@ -42,8 +43,6 @@ internal sealed class Connector : NAV.Plugins.DockPanePlugin
Container = services.BuildServiceProvider();
Container.UseDUI();
var u = Container.GetRequiredService<DUI3ControlWebView>();
var speckleHost = new ElementHost { AutoSize = true, Child = u };
@@ -15,6 +15,7 @@
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\NavisworksConnectorServiceRegistration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ElementSelectionService.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GlobalUsing.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\NavisworksColorUnpacker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\NavisworksDocumentEvents.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\NavisworksDocumentModelStore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\NavisworksIdleManager.cs" />
@@ -54,7 +55,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)Operations\_Receive\" />
</ItemGroup>
</Project>
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target AfterTargets="Clean" Name="CleanAddinsRevit" Condition="'$(RevitVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<RemoveDir Directories="$(TargetDir);$(ProjectDir)\..\Release\Release$(RevitVersion);$(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\Speckle.Connectors.Revit$(RevitVersion);" />
<Delete Files="$(AppData)\Autodesk\Revit\Addins\$(RevitVersion)\Speckle.Connectors.Revit$(RevitVersion).addin" />
</Target>
<Target AfterTargets="Build" Name="AfterBuildRevit" Condition="'$(RevitVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<ItemGroup>
<RevitDLLs Include="$(TargetDir)\**\*.*" Exclude="$(TargetDir)*.addin" />
<SourceManifest Include="$(TargetDir)\Plugin\Speckle.Connectors.Revit$(RevitVersion).addin" />
</ItemGroup>
<Message Text="Revit Version $(RevitVersion)" Importance="high"/>
<Copy DestinationFolder="$(AppData)\Autodesk\REVIT\Addins\$(RevitVersion)\Speckle.Connectors.Revit$(RevitVersion)\%(RecursiveDir)" SourceFiles="@(RevitDLLs)" />
<Copy DestinationFolder="$(AppData)\Autodesk\REVIT\Addins\$(RevitVersion)\" SourceFiles="@(SourceManifest)" />
</Target>
</Project>
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -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": {
@@ -13,15 +13,9 @@ public partial class CefSharpPanel : Page, Autodesk.Revit.UI.IDockablePaneProvid
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;
@@ -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 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
{
Name = "baseBinding";
Parent = parent;
_apiContext = apiContext;
_store = store;
_revitContext = revitContext;
_speckleApplication = speckleApplication;
@@ -45,7 +40,7 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
_store.DocumentChanged += (_, _) =>
parent.TopLevelExceptionHandler.FireAndForget(async () =>
{
await Commands.NotifyDocumentChanged().ConfigureAwait(false);
await Commands.NotifyDocumentChanged();
});
}
@@ -97,21 +92,16 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
{
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 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
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);
}
/// <summary>
/// Highlights the objects from the given ids.
/// </summary>
/// <param name="objectIds"> UniqueId's of the DB.Elements.</param>
public async Task HighlightObjects(IReadOnlyList<string> objectIds)
public Task HighlightObjects(IReadOnlyList<string> 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<ElementId>()
.ToList()
)
.ConfigureAwait(false);
;
HighlightObjectsOnView(
objectIds
.Select(uid => ElementIdHelper.GetElementIdFromUniqueId(activeUIDoc.Document, uid))
.Where(el => el is not null)
.Cast<ElementId>()
.ToList()
);
return Task.CompletedTask;
}
private async Task HighlightObjectsOnView(List<ElementId> objectIds)
private void HighlightObjectsOnView(List<ElementId> 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);
;
}
}
@@ -83,13 +83,14 @@ internal sealed class RevitReceiveBinding : IReceiveBinding
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 @@ internal sealed class RevitReceiveBinding : IReceiveBinding
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
{
@@ -16,7 +16,6 @@ using Speckle.Connectors.DUI.Models.Card.SendFilter;
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<ElementId, byte> ChangedObjectIds { get; set; } = new();
public RevitSendBinding(
IRevitIdleManager idleManager,
IAppIdleManager idleManager,
RevitContext revitContext,
APIContext apiContext,
DocumentModelStore store,
CancellationManager cancellationManager,
IBrowserBridge bridge,
@@ -67,7 +64,6 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
: base("sendBinding", store, bridge, revitContext)
{
_idleManager = idleManager;
_apiContext = apiContext;
_cancellationManager = cancellationManager;
_serviceProvider = serviceProvider;
_sendConversionCache = sendConversionCache;
@@ -82,20 +78,17 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
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<ISendFilter> GetSendFilters() =>
[
new RevitSelectionFilter() { IsDefault = true },
new RevitViewsFilter(RevitContext, _apiContext),
new RevitCategoriesFilter(RevitContext, _apiContext)
new RevitViewsFilter(RevitContext),
new RevitCategoriesFilter(RevitContext)
];
public List<ICardSetting> GetSendSettings() =>
@@ -133,7 +126,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
)
);
List<Element> elements = await RefreshElementsOnSender(modelCard.NotNull()).ConfigureAwait(false);
List<Element> elements = await RefreshElementsOnSender(modelCard.NotNull());
List<ElementId> elementIds = elements.Select(el => el.Id).ToList();
if (elementIds.Count == 0)
@@ -149,12 +142,9 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
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 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
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 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
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<Element> elements = selectedObjects
.Select(uid => activeUIDoc.Document.GetElement(uid))
@@ -204,9 +192,11 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
}
// 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 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
{
foreach (var sender in Store.GetSenders().ToList())
{
await RefreshElementsOnSender(sender).ConfigureAwait(false);
await RefreshElementsOnSender(sender);
}
}
@@ -330,12 +320,12 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
// 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 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
{
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 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
}
}
await Commands.SetModelsExpired(expiredSenderIds).ConfigureAwait(false);
await Commands.SetModelsExpired(expiredSenderIds);
ChangedObjectIds = new();
}
@@ -419,13 +409,11 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
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!"
);
}
}
}
@@ -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 @@ internal sealed class SelectionBinding : RevitBaseBinding, ISelectionBinding, ID
_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
}
@@ -25,7 +25,7 @@ public static class ServiceRegistration
public static void AddRevit(this IServiceCollection serviceCollection)
{
serviceCollection.AddConnectorUtils();
serviceCollection.AddDUI<RevitDocumentStore>();
serviceCollection.AddDUI<RevitThreadContext, RevitDocumentStore>();
RegisterUiDependencies(serviceCollection);
// Storage Schema
@@ -41,7 +41,7 @@ public static class ServiceRegistration
serviceCollection.AddSingleton<IBinding, SelectionBinding>();
serviceCollection.AddSingleton<IBinding, RevitSendBinding>();
serviceCollection.AddSingleton<IBinding, RevitReceiveBinding>();
serviceCollection.AddSingleton<IRevitIdleManager, RevitIdleManager>();
serviceCollection.AddSingleton<IAppIdleManager, RevitIdleManager>();
serviceCollection.RegisterTopLevelExceptionHandler();
@@ -69,9 +69,6 @@ public static class ServiceRegistration
// operation progress manager
serviceCollection.AddSingleton<IOperationProgressManager, OperationProgressManager>();
// API context helps us to run functions on Revit UI Thread (main)
serviceCollection.AddSingleton<APIContext>();
}
public static void RegisterUiDependencies(IServiceCollection serviceCollection)
@@ -1,130 +0,0 @@
using Autodesk.Revit.UI;
namespace Speckle.Connectors.Revit.HostApp;
/// <summary>
/// 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
/// </summary>
public sealed class APIContext : IDisposable
{
private readonly SemaphoreSlim _semaphore = new(1, 1);
private readonly UIControlledApplication _uiApplication;
private readonly ExternalEventHandler<IExternalEventHandler, ExternalEvent> _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<TResult> Run<TResult>(Func<UIControlledApplication, TResult> func)
{
await _semaphore.WaitAsync().ConfigureAwait(false);
try
{
var handler = new ExternalEventHandler<UIControlledApplication, TResult>(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<UIControlledApplication> action) =>
await Run<object>(app =>
{
action(app);
return null!;
})
.ConfigureAwait(false);
public async Task Run(Action action) =>
await Run<object>(_ =>
{
action();
return null!;
})
.ConfigureAwait(false);
private async Task<TResult> Run<TParameter, TResult>(
ExternalEventHandler<TParameter, TResult> 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<TParameter, TResult> : IExternalEventHandler
{
private TaskCompletionSource<TResult> Result { get; set; }
public Task<TResult> GetTask(TParameter parameter)
{
Parameter = parameter;
Result = new TaskCompletionSource<TResult>();
return Result.Task;
}
private readonly Func<TParameter, TResult> _func;
public ExternalEventHandler(Func<TParameter, TResult> 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";
}
@@ -31,7 +31,8 @@ public class ElementUnpacker
// 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);
}
/// <summary>
@@ -90,7 +91,7 @@ public class ElementUnpacker
return unpackedElements.GroupBy(el => el.Id).Select(g => g.First()).ToList(); // no disinctBy in here sadly.
}
private List<Element> PackCurtainWallElements(List<Element> elements)
private List<Element> PackCurtainWallElementsAndStackedWalls(List<Element> elements)
{
var ids = elements.Select(el => el.Id).ToArray();
var doc = _revitContext.UIApplication?.ActiveUIDocument.Document!;
@@ -102,6 +103,12 @@ public class ElementUnpacker
&& 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;
}
@@ -2,11 +2,9 @@ using Autodesk.Revit.DB;
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 @@ internal sealed class RevitDocumentStore : DocumentModelStore
_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 @@ internal sealed class RevitDocumentStore : DocumentModelStore
{
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 idEntity = new(_idStorageSchema.GetSchema());
idEntity.Set("Id", s_revitDocumentStoreId);
using Entity stateEntity = new(_documentModelStorageSchema.GetSchema());
string serializedModels = Serialize();
stateEntity.Set("contents", serializedModels);
ds.SetEntity(idEntity);
ds.SetEntity(stateEntity);
t.Commit();
});
using Entity idEntity = new(_idStorageSchema.GetSchema());
idEntity.Set("Id", s_revitDocumentStoreId);
ds.SetEntity(idEntity);
ds.SetEntity(stateEntity);
t.Commit();
}
protected override void LoadState()
@@ -0,0 +1,29 @@
using Autodesk.Revit.DB;
namespace Speckle.Connectors.Revit.HostApp;
public static class SupportedCategoriesUtils
{
/// <summary>
/// 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.
/// </summary>
/// <param name="category"></param>
/// <returns></returns>
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;
}
}
@@ -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 @@ using Transform = Speckle.Objects.Other.Transform;
namespace Speckle.Connectors.Revit.Operations.Receive;
internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
{
private readonly IRootToHostConverter _converter;
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings;
private readonly RevitToHostCacheSingleton _revitToHostCacheSingleton;
private readonly ITransactionManager _transactionManager;
private readonly ILocalToGlobalUnpacker _localToGlobalUnpacker;
private readonly RevitGroupBaker _groupBaker;
private readonly RevitMaterialBaker _materialBaker;
private readonly ILogger<RevitHostObjectBuilder> _logger;
private readonly ITypedConverter<
public sealed class RevitHostObjectBuilder(
IRootToHostConverter converter,
IConverterSettingsStore<RevitConversionSettings> converterSettings,
ITransactionManager transactionManager,
ISdkActivityFactory activityFactory,
ILocalToGlobalUnpacker localToGlobalUnpacker,
RevitGroupBaker groupManager,
RevitMaterialBaker materialBaker,
RootObjectUnpacker rootObjectUnpacker,
ILogger<RevitHostObjectBuilder> logger,
RevitToHostCacheSingleton revitToHostCacheSingleton,
ITypedConverter<
(Base atomicObject, IReadOnlyCollection<Matrix4x4> matrix),
DirectShape
> _localToGlobalDirectShapeConverter;
private readonly RootObjectUnpacker _rootObjectUnpacker;
private readonly ISdkActivityFactory _activityFactory;
public RevitHostObjectBuilder(
IRootToHostConverter converter,
IConverterSettingsStore<RevitConversionSettings> converterSettings,
ITransactionManager transactionManager,
ISdkActivityFactory activityFactory,
ILocalToGlobalUnpacker localToGlobalUnpacker,
RevitGroupBaker groupManager,
RevitMaterialBaker materialBaker,
RootObjectUnpacker rootObjectUnpacker,
ILogger<RevitHostObjectBuilder> logger,
RevitToHostCacheSingleton revitToHostCacheSingleton,
ITypedConverter<
(Base atomicObject, IReadOnlyCollection<Matrix4x4> 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<HostObjectBuilderResult> Build(
Base rootObject,
string projectName,
string modelName,
IProgress<CardProgress> 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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
// 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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
CancellationToken cancellationToken
)
{
using var _ = _activityFactory.Start("BakeObjects");
using var _ = activityFactory.Start("BakeObjects");
var conversionResults = new List<ReceiveConversionResult>();
var bakedObjectIds = new List<string>();
int count = 0;
@@ -182,7 +141,7 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
}
// 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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
{
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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
{
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 @@ internal sealed class RevitHostObjectBuilder : IHostObjectBuilder, IDisposable
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();
}
@@ -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);
}
@@ -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 @@ public class RevitCategoriesFilter : DiscriminatedObject, ISendFilter, IRevitSen
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 @@ public class RevitCategoriesFilter : DiscriminatedObject, ISendFilter, IRevitSen
/// NOTE: this is needed since we need doc on `GetObjectIds()` function after it deserialized.
/// DI doesn't help here to pass RevitContext from constructor.
/// </summary>
public void SetContext(RevitContext revitContext, APIContext apiContext)
public void SetContext(RevitContext revitContext)
{
_revitContext = revitContext;
_apiContext = apiContext;
_doc = _revitContext.UIApplication?.ActiveUIDocument.Document;
}
}
@@ -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 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
.OfClass(typeof(View))
.Cast<View>()
.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 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
/// NOTE: this is needed since we need doc on `GetObjectIds()` function after it deserialized.
/// DI doesn't help here to pass RevitContext from constructor.
/// </summary>
public void SetContext(RevitContext revitContext, APIContext apiContext)
public void SetContext(RevitContext revitContext)
{
_revitContext = revitContext;
_apiContext = apiContext;
_doc = _revitContext.UIApplication?.ActiveUIDocument.Document;
}
}
@@ -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.Connectors.Revit.HostApp;
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<ElementId>
public class RevitRootObjectBuilder(
IRootToSpeckleConverter converter,
IConverterSettingsStore<RevitConversionSettings> converterSettings,
ISendConversionCache sendConversionCache,
ElementUnpacker elementUnpacker,
SendCollectionManager sendCollectionManager,
ILogger<RevitRootObjectBuilder> logger,
RevitToSpeckleCacheSingleton revitToSpeckleCacheSingleton
) : RootObjectBuilderBase<ElementId>
{
// POC: SendSelection and RevitConversionContextStack should be interfaces, former needs interfaces
private readonly IRootToSpeckleConverter _converter;
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings;
private readonly ISendConversionCache _sendConversionCache;
private readonly ElementUnpacker _elementUnpacker;
private readonly SendCollectionManager _sendCollectionManager;
private readonly RevitToSpeckleCacheSingleton _revitToSpeckleCacheSingleton;
private readonly ILogger<RevitRootObjectBuilder> _logger;
private readonly ParameterDefinitionHandler _parameterDefinitionHandler;
public RevitRootObjectBuilder(
IRootToSpeckleConverter converter,
IConverterSettingsStore<RevitConversionSettings> converterSettings,
ISendConversionCache sendConversionCache,
ElementUnpacker elementUnpacker,
SendCollectionManager sendCollectionManager,
ILogger<RevitRootObjectBuilder> logger,
ParameterDefinitionHandler parameterDefinitionHandler,
RevitToSpeckleCacheSingleton revitToSpeckleCacheSingleton
)
{
_converter = converter;
_converterSettings = converterSettings;
_sendConversionCache = sendConversionCache;
_elementUnpacker = elementUnpacker;
_sendCollectionManager = sendCollectionManager;
_revitToSpeckleCacheSingleton = revitToSpeckleCacheSingleton;
_logger = logger;
_parameterDefinitionHandler = parameterDefinitionHandler;
}
public async Task<RootObjectBuilderResult> Build(
public override RootObjectBuilderResult Build(
IReadOnlyList<ElementId> objects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
) => await RevitTask.RunAsync(() => BuildSync(objects, sendInfo, onOperationProgressed, ct)).ConfigureAwait(false);
private RootObjectBuilderResult BuildSync(
IReadOnlyList<ElementId> objects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken ct = default
CancellationToken cancellationToken
)
{
var doc = _converterSettings.Current.Document;
var doc = converterSettings.Current.Document;
if (doc.IsFamilyDocument)
{
@@ -74,61 +44,80 @@ public class RevitRootObjectBuilder : IRootObjectBuilder<ElementId>
// 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<Element>();
List<SendConversionResult> 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<SendConversionResult> 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 @@ public class RevitRootObjectBuilder : IRootObjectBuilder<ElementId>
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
@@ -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;
}
@@ -2,7 +2,6 @@ using Autodesk.Revit.UI;
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 @@ internal sealed class RevitExternalApplication : IExternalApplication
services.AddRevitConverters();
services.AddSingleton(application);
_container = services.BuildServiceProvider();
_container.UseDUI();
// resolve root object
_revitPlugin = _container.GetRequiredService<IRevitPlugin>();
@@ -6,12 +6,7 @@ using Speckle.Sdk.Common;
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 @@ public sealed class RevitIdleManager : AppIdleManager, IRevitIdleManager
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
}
}
@@ -0,0 +1,22 @@
using Revit.Async;
using Speckle.Connectors.Common.Threading;
namespace Speckle.Connectors.Revit.Plugin;
public class RevitThreadContext : ThreadContext
{
protected override Task<T> MainToWorkerAsync<T>(Func<Task<T>> action) => action();
protected override Task<T> WorkerToMainAsync<T>(Func<Task<T>> action) =>
RevitTask.RunAsync(async () => await action());
protected override Task<T> MainToWorker<T>(Func<T> action) => Task.FromResult(action());
protected override Task<T> WorkerToMain<T>(Func<T> action) => RevitTask.RunAsync(action);
protected override Task RunMainAsync(Func<Task> action) => RevitTask.RunAsync(action);
protected override Task<T> RunMainAsync<T>(Func<T> action) => RevitTask.RunAsync(action);
protected override Task<T> RunMainAsync<T>(Func<Task<T>> action) => RevitTask.RunAsync(action);
}
@@ -19,10 +19,10 @@
<Compile Include="$(MSBuildThisFileDirectory)Bindings\SelectionBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\RevitSendBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ElementIdHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\APIContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\DocumentModelStorageSchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Elements.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\RevitMaterialBaker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\SupportedCategoriesUtils.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\HideWarningsFailuresPreprocessor.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\IdStorageSchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\IStorageSchema.cs" />
@@ -47,7 +47,8 @@
<Compile Include="$(MSBuildThisFileDirectory)Plugin\IRevitPlugin.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitCommand.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitExternalApplication.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitIdleManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitIdleManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitThreadContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitCefPlugin.cs" />
</ItemGroup>
</Project>
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target AfterTargets="Clean" Name="CleanAddinRhino" Condition="'$(RhinoVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<RemoveDir Directories="$(AppData)\McNeel\Rhinoceros\$(RhinoVersion).0\Plug-ins\Speckle.Connectors.Rhino$(RhinoVersion) (8dd5f30b-a13d-4a24-abdc-3e05c8c87144)" />
</Target>
<Target AfterTargets="Build" Name="AfterBuildRhino" Condition="'$(RhinoVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true'">
<Message Text="Rhino Version $(RhinoVersion)" Importance="high"/>
</Target>
</Project>
@@ -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=="
}
}
}
@@ -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=="
}
}
}
@@ -38,7 +38,7 @@ public sealed class RhinoBasicConnectorBinding : IBasicConnectorBinding
_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 sealed class RhinoBasicConnectorBinding : IBasicConnectorBinding
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 @@ public sealed class RhinoBasicConnectorBinding : IBasicConnectorBinding
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;
}
@@ -77,13 +77,14 @@ public class RhinoReceiveBinding : IReceiveBinding
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 @@ public class RhinoReceiveBinding : IReceiveBinding
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);
}
}

Some files were not shown because too many files have changed in this diff Show More