Compare commits

...

479 Commits

Author SHA1 Message Date
Jedd Morgan b485a4ff6f Don't build everything when zero changes (#715)
.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
2025-03-26 15:21:12 +00:00
Jedd Morgan 5697afc292 fix(ifc): Fixed regression with IFC Site geometry not being converted (#712)
* IFC spatial elements now attach geometry as separate data object

* removed unnecessary attribute

* Updated tester for faster testing
2025-03-26 14:57:50 +00:00
Adam Hathcock 4ec45d3cd5 Merge pull request #709 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
Bump sdk to 3.1.7 (#708)
2025-03-25 12:14:05 +00:00
Oğuzhan Koral 939c710bf2 Bump sdk to 3.1.7 (#708)
* Bump sdk to 3.1.7

* missing lock file changes

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
2025-03-25 12:05:00 +00:00
Jedd Morgan ac1345bbaf Merge pull request #703 from specklesystems/dev
Update dev into main
2025-03-25 11:54:03 +00:00
Jedd Morgan 95a7bdb81f Merge pull request #707 from specklesystems/main
Main to dev
2025-03-25 11:46:27 +00:00
Jedd Morgan b1a5824bcd Update pr.yml (#706) 2025-03-25 11:44:08 +00:00
Dimitrie Stefanescu 09f9b1ee51 Revit linked models (#699)
* Bjorn/cnx 1359 have a setting in UI whether include or not (#646)

* feat(revit): linked model settings

* docs: cache invalidation note

* Feat(revit): linked models POC (#656)

* cleanup on RefreshElementsIdsOnSender

* POC for multiple and copied linked models

* fix render materials for copied linked models

* comment

* comment

* split linked models with collections

* style: ci potential null on key

* style: not null

---------

Co-authored-by: Björn <steinhagen.bjoern@gmail.com>

* feat(revit): sending linked model poc round two (#657)

* Added IFC app name (#648)

* test: add tests for threadcontext (#651)

* add tests for threadcontext

* add test for extensions

* remove needed usage

* fix for looking for model store (#654)

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>

* test: Send Operation tests (#652)

* add tests for threadcontext

* add test for extensions

* remove needed usage

* move cancellation

* Only add send operation tests

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>

* chore (autocad/civil): add regen after receive (#650)

* regenerates doc

* moves regen to receive base binding

* Update AutocadReceiveBaseBinding.cs

* feat: linked model send responsive to ui

- current throw just a placeholder
- small variable name refactor

* fix: object reference not set to an instance of an object

* fix: display value extractor

* refactor: converterSettings as readonly field

* feat: warning in response to ui setting not enabled

* docs: todos etc.

* Revert "Merge branch 'dev' into bjorn/cnx-1360-get-linked-models-on-send-function-according-to-setting"

This reverts commit 7202058a98, reversing
changes made to 4bc9ec2352.

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
Co-authored-by: Claire Kuang <kuang.claire@gmail.com>

* fix: transform needed to be inversed (#659)

* feat(revit): linked models send by category (#666)

* docs: notes on collection filtering

* feature: RevitCategoriesFilter with linked models too

poc

* docs: notes

* feat(revit): commit structure (#675)

* feat: collection structure switch

- poc
- if linked models, send nested
- if not linked, send flat

* docs: comments on updates

* docs: comment on exception swallowing

* fix: nullability

* refactor: linked model helper class and refactor (#682)

* fix: premature processing of linked models

- add early check for linked models setting
- skips expensive element collection for linked models when disabled
- add empty document contexts for linked models when disabled to maintain warning generation (HACK)
- improve code readability with clearer variable names and comments

* refactor: category ids outside of linked model processing

- inefficient to repeat for every document

* fix: improve separation of concerns for linked model handling

- extract linked model processing to a dedicated method
- add IsLinkedDocument flag to DocumentToConvert class
- move linked model warning generation to RevitRootObjectBuilder
- make RevitSendBinding responsible only for element collection

* refactor: dedicated LinkedModelHandler class for linked model processing

- extract linked model element collection logic to a separate class
- improve separation of concerns between flow control and element collection
- add clear documentation explaining the responsibility boundaries

* fix: duplicate if check still floating around

* docs: over-explaining myself

* Fix(revit): do not use converter settings in element unpacker (#687)

* fix resetting the selected object ids after collecting the elements

* Pass document to element unpacker for the sake of linked models

* fix: send by categories mode

---------

Co-authored-by: Björn <steinhagen.bjoern@gmail.com>

* fix(revit): handle multiple linked model instances with transform hashing (#688)

* feat: linked model transform caching in RevitRootObjectBuilder

Add transform-specific hashing to properly handle multiple instances of the same linked model. Uses transform properties to create a unique suffix for the applicationId, preventing cached objects from being incorrectly reused across different transform contexts.

* more comments

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>

* fix: handle null elements when unpacking linked model groups

- add null element check before GroupBy in ElementUnpacker to prevent NullReferenceException
- improve robustness when processing groups in linked models
- add documentation explaining linked model element handling throughout UnpackElements method
- edge case where group member elements might not resolve properly in linked contexts

* make linked model setting true by default

* Fix(revit): illegal attempt to modify document (#700)

* Run refresh object ids in revit task

* Proper not null

* await instead .result

* feat(revit): collection structure for multiple linked model instances  (#701)

* feat: suffix for instances of linked model

* Extract out GetIdFromDocumentToConvert

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>

* Correct receive default setting for linked models even if irrevelant

* Fix post conflict

* Cleanup the code

* Add comment

---------

Co-authored-by: Björn Steinhagen <steinhagen.bjoern@gmail.com>
Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-25 11:02:29 +00:00
KatKatKateryna 1a687fb188 ignore helper objects on selection (#689) 2025-03-25 00:02:14 +08:00
Dimitrie Stefanescu 30e050fff2 Merge pull request #698 from specklesystems/dimitrie/cnx-614-rhino-8-to-rhino-8-breps-not-working
fix: filter out elems with null geometry
2025-03-24 12:37:57 +00:00
Dimitrie Stefanescu 30ab3b108e fix: filter out elems with null geometry
this is a blind fix: works on bilal's computer, i could not reproduce
2025-03-24 12:29:33 +00:00
Adam Hathcock 1f3ac7a5ad Exclude library assets for all host applications for connectors/converters (#697)
* Exclude runtime assets from autocad 2022-2025

* add exclude to navisworks too

* exclude from remaining csprojs
2025-03-24 11:02:07 +00:00
KatKatKateryna 33e515efb6 feat(rhino): sending region display values as meshes (#685)
* send meshes

* comment

* refactor displayMeshExtractor

* comment

* error message

* comments

* Update HatchToSpeckleConverter.cs

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-22 09:21:15 +00:00
jhdempsey86 4a5c91231d Caught error with SpiralDirection (#692)
Caught error with SpiralDirection

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-21 09:04:41 +00:00
KatKatKateryna 97a8df93d9 Arcgis send regions (#678)
* send regions

* send meshes

* comment

* typo

* adjust jsons

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-19 23:09:55 +08:00
Adam Hathcock 0106befa7d Caches visibility for the lifetime of the send (#672)
* Add selection progress and try/finally for exceptions

* format

* Caches visibility for the lifetime of the send

* clean up
2025-03-18 08:37:46 +00:00
KatKatKateryna ef87d5838b Rhino region conversions (#643)
* rhino hatch; autocad regions

* rhino: attempting to extract mesh

* stick to curves

* POC sending hatches

* receive region

* add tolerance

* change displayValue to curves

* revert autocad changes

* switch to curveConverter, add bbox

* lock files

* remove unused converter

* Revert "lock files"

This reverts commit 9ff42c00fe.

* comment

* remove checks, fix displayValue

* address comments

* remove displayValue

* bbox not required

* update nuget

* Revert "update nuget"

This reverts commit 28e6c30b2c.

* upgraded nuget

* convert Regions from DataObjects on Receive

* small fixes

* check result hatches

* json update

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-17 17:16:10 +00:00
Oğuzhan Koral 295162127a Merge pull request #684 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
Merge dev into main
2025-03-17 17:41:55 +03:00
jhdempsey86 6d336fbac4 fix(Civil3D): Update CorridorDisplayValueExtractor.cs to fix PropertySetDefinitionName error (#669)
* Update CorridorDisplayValueExtractor.cs

For unknown reasons, sometimes trying to get the PropertySetDefinitionName throws an exception.
Updated to catch this, ignore that propery set, and move to the next one. It is never the "Corridor Identity" property set that has this issue, so there should be no missing data.

* .

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-17 14:04:36 +00:00
Adam Hathcock 6b2078fadb (feat/fix) Navisworks: Add selection progress and try/finally for exceptions (#671)
* Add selection progress and try/finally for exceptions

* format

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-03-17 13:53:08 +00:00
Adam Hathcock bfd465449a Bump SDK to 3.1.4 (#683) 2025-03-17 13:00:08 +00:00
Adam Hathcock a9a4893bdb test: Send/Receive Progress tests (#662)
* add tests for receive progress

* add send progress tests

* fmt
2025-03-17 15:09:04 +03:00
Adam Hathcock 21066eebbb Add tests for send caching (#660) 2025-03-17 11:51:07 +00:00
Claire Kuang 9d5ff85cff feat(revit): adds level extractor and levels to revit objects (#679)
* adds level extractor and levels to revit objects

* changes return to null when no level

* bumps sdk
2025-03-17 14:43:30 +03:00
Adam Hathcock 64befa758d fix(Revit) improving revit selection perf (#623)
* Revit allocation improvements

* fmt

* Don't use concurrent bag
2025-03-17 14:31:44 +03:00
Adam Hathcock d9a0cbb4bf Build everything always, only zip affected groups (#677)
* Build everything always, only zip affected groups

* get the dependencies right

* try dependencies again

* can't use affected in enums
2025-03-17 11:02:44 +00:00
Oğuzhan Koral 50807b1e88 Feat(accounts): Add remove account to binding (#680)
* Add remove account to binding

* Remove models as batch
2025-03-15 21:29:36 +03:00
Oğuzhan Koral 7780071073 Fix(autocad): Remove circular dependency (#676)
* Remove circular dependency

* removes polycurve to spline raw converter

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-14 20:02:45 +03:00
Jedd Morgan be63b4ab55 public release on tag (#674)
.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
* public release on tag

* and nuget
2025-03-14 13:36:32 +00:00
Jedd Morgan 63c5bb26cb Added quotes escape in build (#673) 2025-03-14 13:29:57 +00:00
Adam Hathcock f7a1d98d8a feat: building/publish only affected projects (#665)
.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
* Add affected usage with tag math

* use this branch as a test branch

* adjust test

* fix github action

* build refactor to get affected work

* Lazy affected

* put if statement on job

* add conditions around build and publish for linux

* affected tests and small refactor

* fmt

* verbose

* full checkout

* more testing and made things more clear

* adjust installer test branch

* add comments

* use zip on release

* detect main release

* use right trigger for release

* fix build

* maybe fix if statement...version env var don't work

* use current branch, not target branch

* test installer should be stored

* write to github action env vars

* use the env var correctly

* format

* set the output version as before

---------

Co-authored-by: Jedd Morgan <45512892+JR-Morgan@users.noreply.github.com>
2025-03-14 12:37:49 +00:00
Jedd Morgan a14de5bdde File import service now creates branch if one doesn't already exist (#670) 2025-03-14 12:03:11 +00:00
Jedd Morgan a89407ae3c Ignore null properties and empty psets (#668) 2025-03-12 17:51:57 +00:00
Jedd Morgan a3285a4f67 Use 3 instead of 0 for cardinality indicator of triangle faces (#667) 2025-03-12 14:28:49 +00:00
Jedd Morgan ae4b1b0ab5 Merge pull request #655 from specklesystems/jrm/ifc-collections-data-objects
Send IfcProjects, IfcSites, IfcBuildings, and IfcStoreys as Collections
2025-03-12 08:32:30 +00:00
Jedd Morgan ed9d81d206 Better exception messages for breps that fail to meshify (#634) 2025-03-11 16:08:05 +00:00
Adam Hathcock a2fc846613 Remove stack usage to hash (#663) 2025-03-11 12:26:38 +00:00
Adam Hathcock 184953f5f0 Update to SDK 3.1.1 (#658) 2025-03-10 12:52:44 +03:00
Adam Hathcock d71b36c2f7 Sped up Rhino receive hot spots (#596)
* Sped up Rhino receive hot spots

* formatting

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-09 17:42:22 +00:00
Claire Kuang f152cff619 chore (autocad/civil): add regen after receive (#650)
* regenerates doc

* moves regen to receive base binding

* Update AutocadReceiveBaseBinding.cs
2025-03-07 14:33:15 +00:00
Adam Hathcock 4aed602089 test: Send Operation tests (#652)
* add tests for threadcontext

* add test for extensions

* remove needed usage

* move cancellation

* Only add send operation tests

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-03-07 16:44:21 +03:00
Adam Hathcock 63c4d31467 fix for looking for model store (#654)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-03-07 13:32:28 +00:00
Adam Hathcock b807be35ff test: add tests for threadcontext (#651)
* add tests for threadcontext

* add test for extensions

* remove needed usage
2025-03-07 16:27:58 +03:00
Jedd Morgan 32ea041c5e Added IFC app name (#648) 2025-03-06 16:22:47 +00:00
Adam Hathcock 950c8373d9 fix: Autocad perf - Adds early exit to idle manager to shortcut call check (#609)
* Refactors idle manager to shortcut call check

* fix tests

* Match the id of idle action with the function name

it is more safe with this way bc we might accidentially skip some deferred actions if we use class name

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
2025-03-06 15:10:24 +03:00
Adam Hathcock 9d5faa92e8 feat: Perf testing helpers for Jetbrains (#635)
* add perf project

* formatting

* add perf project to local
2025-03-06 11:04:14 +00:00
KatKatKateryna fd88fc2eeb stop color unpacking (#638)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-03-05 20:31:02 +00:00
Jonathon Broughton 9d2ae1ca55 Fix(Navisworks): CNX-1329 - Fix Saved Sets Filter to Properly Handle Nested Folders (#631)
* Improve error messages for object conversion

- Updated exception messages to be more informative based on visibility settings.
- Simplified the logic for throwing exceptions when no model items are found.

* Refactor saved sets filter logic

- Introduced new methods for collecting saved sets and building hierarchical names.
- Simplified selection set resolution with a more concise approach.
- Updated initialisation of items to use arrays instead of lists.
- Improved error handling when resolving GUIDs for selection sets.
2025-03-05 20:25:35 +00:00
Claire Kuang 670a562d48 feat(civil3d): add civil3d receive (#644)
* adds receive to civil3d

* Update AutocadReceiveBaseBinding.cs

* remove usings

* Update Civil3dReceiveBinding.cs
2025-03-05 15:08:46 +00:00
Adam Hathcock e6d983302c Do some stack work to speed up Rhino hotspots (#590)
Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-03-05 14:34:39 +00:00
Jedd Morgan fe5b77e766 Nuget publish only on release (#647) 2025-03-05 12:46:30 +00:00
Björn Steinhagen 663fe445bf Revert "feat(revit): linked model settings (#641)" (#645)
This reverts commit 74d2d2860c.
2025-03-05 15:03:59 +03:00
Björn Steinhagen 74d2d2860c feat(revit): linked model settings (#641)
* feat(revit): linked model settings

* docs: cache invalidation note
2025-03-04 16:35:22 +01:00
Jedd Morgan 2e405b2f28 Don't skip server from IFC importer (#640) 2025-03-04 13:54:50 +00:00
Adam Hathcock 331c631b35 fix: Update SDK to 276 (#637)
* Update SDK to 247

* update to SDK 276
2025-03-04 08:44:23 +00:00
Adam Hathcock ddd6039722 Change targets of common assemblies from NET Standard to platform specific. (#597)
* Update SDK to 257

* remove netstandard2 target from (most) things.  Target net48, net6, and net8

* update to SDK 267

* adjust ifc tester

* Update to SDK 268

* merge fixes
2025-02-27 15:46:15 +00:00
Jedd Morgan 835e3ba005 No files, no success (#608) 2025-02-27 15:04:35 +00:00
Jedd Morgan af548ba626 Fixed duplicate elements (#604)
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2025-02-27 14:08:10 +00:00
Jedd Morgan 3ff40757e0 Corrected tekla structures slug (#632) 2025-02-27 10:52:55 +00:00
Claire Kuang a8571fdd61 detaches featurelines so they are queryable (#627) 2025-02-27 13:41:59 +03:00
Oğuzhan Koral f8a6d27c6d revert revit task back for highlight view (#629) 2025-02-26 18:29:56 +00:00
Dogukan Karatas 4e1604f77e updates after build (#628) 2025-02-26 18:17:44 +00:00
Adam Hathcock 00af4ad338 fix: Use a concurrent dictionary to cache types since the converter is effectively a singleton (#624)
* Use a concurrent dictionary to cache types since the converter is effectively a singleton

* Don't modify the collection in the getter

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-26 20:34:06 +03:00
Jonathon Broughton 7fed9e03e9 enhancement(Navisworks): CNX-972 - less aggressive object merging (#622)
* Remove unused path constants and update namespace

Deleted an unnecessary file for path constants. Updated the namespace in the remaining file to better reflect its purpose and added a new constant for material separation.

* Remove unused send filters

- Deleted the send filters list and related parameters from the constructor.
- Cleaned up code to streamline the binding process.
- Updated comments for clarity on behaviour expectations.

* Update Navisworks object creation logic

- Added extraction of parent path from the group key.
- Changed applicationId to use the parent path instead of the group key.

* Add path cleaning method and simplify geometry resolution

- Introduced `GetCleanPath` to remove material signatures from paths.
- Updated `ResolveIndexPathToModelItem` to use the new path cleaning method.
- Simplified `ResolveGeometryLeafNodes` to use expression-bodied member syntax.

* Improve geometry node grouping logic

- Added material signature handling for merging nodes.
- Enhanced grouping to only include anonymous geometry nodes.
- Introduced a method to create material signatures based on properties.
- Updated the parent path extraction from composite keys.

* Added an extendable signature generation pattern

- Simplified the grouping of anonymous geometry nodes.
- Replaced material signature generation with a new method for better clarity.
- Added functionality to include additional material properties in the signature.
- Improved hash generation for consistent property representation.

* Update material separator in path constants

Changed the material separator from "::MATERIAL::" to "::". This simplifies the constant and may improve compatibility with other components.

* Changed how the parent path is derived from the group key.

- Introduced a cleaner method to get the parent path.
- Updated applicationId to use the full composite key for uniqueness.

* Updated node path retrieval to use a more concise method.

- Simplified the creation of `mergedIds` by using a single variable for group keys.
- Removed unnecessary comments and whitespace for cleaner code.

* Add missing import for Navisworks constants

Included the Navisworks constants import to ensure proper functionality.

* Replaced custom hash function with MD5, suppressing related warnings.
2025-02-26 14:25:09 +00:00
KatKatKateryna e9c2c85a7f Arcgis detailed progress and cancellation (#614)
* pass cancellation token to individual features

* move count to a separate function

* remove per-layer progress report

* fix count

* reorder

* count layers only once

* move count to "unpacking selection" activityFactory

* remove outdated comment
2025-02-26 18:16:00 +08:00
Jonathon Broughton 82c7877425 Refine property handling logic (#621)
- Excluded "Transform" category from processing.
- Added a list of excluded properties: "Hidden", "Required", "Internal_Type".
- Improved handling for the "Item" category to add non-excluded properties directly to root level.
- Ensured only non-empty property dictionaries are processed.
2025-02-25 14:52:48 +00:00
Jonathon Broughton 2338be46c2 feat(Navisworks): CNX-1065 Enable optional full hierarchy mode (#616)
* Add preserve model hierarchy feature

- Introduced PreserveModelHierarchySetting to manage hierarchy preservation.
- Updated NavisworksSendBinding to include new setting.
- Added HierarchyBuilder class for future functionality.
- Enhanced ToSpeckleSettingsManagerNavisworks with caching for the new setting.
- Modified conversion settings to support model hierarchy preservation.

* Add Navisworks hierarchy builder class

Implemented a new class to rebuild the Navisworks document hierarchy from geometry leaves, maintaining parent-child relationships. Key updates include:
- Added constructor and private fields for managing geometry and conversion services.
- Developed a method to build the hierarchical structure of Speckle objects.
- Implemented logic for climbing up the document structure to resolve missing ancestors.
- Introduced methods for converting model items and pruning empty collections.

* Refactor hierarchy handling in object builder

- Added support for preserving model hierarchy.
- Introduced a new hierarchy builder for nested structures.
- Adjusted flow to handle flat mode when hierarchy is not needed.

* Refactor model item conversion logic

- Simplified the conversion method for Navisworks ModelItem.
- Consolidated geometry and non-geometry object creation into single methods.
- Added parameter for property handler to streamline property retrieval.
- Improved clarity by reducing redundancy in code structure.

* Refactor hierarchy builder for cleaner conversion

- Replaced custom conversion method with a direct call to the converter.
- Removed redundant code related to converting ModelItem to Speckle Collection.
- Streamlined the process of handling model items in the hierarchy.

* Remove unnecessary comment in hierarchy builder

Cleaned up the code by deleting a redundant comment about resolving ModelItem from a path string. This helps improve readability without losing any functionality.
2025-02-25 14:40:52 +00:00
Adam Hathcock 8f72eb35d3 fix(Revit): Catch exceptions and reprocess them around RevitTask (#617)
* Catch exceptions and reprocess them around RevitTask

* Added SpeckleRevitTaskException to know when exceptions are jumping over revit task to handle the UI

* add comments

* Add fatch when

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-25 16:54:10 +03:00
Oğuzhan Koral a3f7069c37 Feat(navis): send filter dropdown navis poc (#619)
* Add Saved Sets Filter

* formatting

* !!!

* fml

* Unclear why formatting rules are not being applied

* !!!

* !

* fixed?

* Add new filter for saved sets in Navisworks

- Included a new file for NavisworksSavedSetsFilter.

* POC ISendFilterSelect

* Align saved sets filtler with ISendFilterSelect

* No DI for send filters

* reverse condition

* Remove ISendFilterSelect from revit views

* Add notes

* Improve object selection error handling

- Updated logic for retrieving model items to use selected paths.
- Enhanced error messages based on visibility settings of objects.
- Simplified null checks for selected items in filters.

---------

Co-authored-by: Jonathon Broughton <jonathon@stardotbmp.com>
2025-02-25 12:56:38 +00:00
Dogukan Karatas 3842e109b6 feat(tekla): speckle ribbon (#612)
* adds a ribbon

* updates speckle.svg

* updates logo

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-25 08:14:17 +01:00
Claire Kuang 4ae2106608 fixes pointcloud plane bug (#615) 2025-02-21 17:30:25 +00:00
Claire Kuang 3656587081 fix(autocad/Rhino): add support for receiving any convertible geometry in dataobject display values (#599)
* adds additional geometry conversions to autocad and rhino

* removes unused converters

* fixes zip bug

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-21 19:17:23 +03:00
Claire Kuang b315cebf3a fix(revit): missing directshape geo and other geometry fixes (#611)
* Claire/revit areas curves fix (#610)

* fixes display values for get_geometry method, and changes modelcurves to be sent as revitobject

also removes `level` prop in objects and adds the units and elevation to the level collection instead

* Update Speckle.Converters.RevitShared.projitems

* removes top level pointcloud converter

* Update RevitElementTopLevelConverterToSpeckle.cs
2025-02-21 18:18:07 +03:00
Oğuzhan Koral fb18466aba Source application should be app name and version (#613) 2025-02-20 21:30:23 +03:00
Jonathon Broughton b721c2fb31 fix(Navisworks): CNX-1299 Navisworks properties cleanup and NavisworksObject adoption (#607)
* Update property handling interface

Changed method to retrieve properties from Navisworks model items. Updated the method signature for clarity and improved functionality.

* Add property retrieval method to handler

Implemented a new method for getting properties from model items. It processes property sets and returns a dictionary of category values, enhancing the functionality of the property handler.

* Fix namespace formatting and improve property handling

- Cleaned up the namespace declaration.
- Added a check to ensure properties are a dictionary before processing.
- Streamlined property validation logic for better clarity.

* Simplified the `AddModelProperties` method signature by reducing parameters.

* Refactor property handling in base class

- Added a new method to retrieve properties from model items.
- Simplified the structure of processed property sets by removing nested dictionaries.

* Add hierarchical property retrieval method

Implemented a new method to get properties from model items.
- Introduced `GetProperties` to collect and filter hierarchical properties.
- Enhanced data handling with improved dictionary management for properties.

* Fix namespace formatting issues

Updated the namespace declarations in property handler files to ensure proper formatting.

* Refactor model item conversion logic

- Updated the method for converting Navisworks ModelItems.
- Simplified the creation of non-geometry objects.
- Removed unnecessary property handling code.
- Enhanced clarity by restructuring return values.

* Refactor model item conversion logic

- Simplified the conversion method for model items.
- Added a new method to handle geometry objects.
- Introduced property handling based on user settings.
- Improved clarity and maintainability of the code.

* Refactor geometry property handling

- Updated comments to clarify property merging rules.
- Removed unused methods for creating geometry and non-geometry objects.
- Simplified code structure for better readability.

* Refactor conversion method for brevity

Streamlined the `Convert` method to use an expression-bodied member. Removed unnecessary null check block and simplified the logic for better readability.

* Fix import statement formatting

Updated the import statement for consistency by removing an invisible character.

* Add class properties handling to property dictionaries

- Integrated class properties extraction into both property handlers.
- Updated logic to add or update entries in the property dictionaries based on extracted class properties.
- Ensured null checks for class properties before processing.

* Refactor property handling methods

- Removed the AssignPropertySets method for simplification.
- Streamlined GetProperties to directly return processed property sets.
- Cleaned up unnecessary checks and loops for better readability.

* Add ClassPropertiesExtractor to service registration

- Registered a new ClassPropertiesExtractor for better property handling.
- Kept existing property handlers and settings management intact.

* Refactor HierarchicalPropertyHandler for clarity

- Removed redundant property assignment logic.
- Integrated class properties extraction directly into the main method.
- Simplified error handling by eliminating unnecessary checks.

* Refactor property assignment methods

Removed the AssignProperties and AssignClassProperties methods to streamline property handling. Kept the abstract method for getting properties while maintaining the overall structure of the class.

* Refactor ClassPropertiesExtractor to instance method

Changed ClassPropertiesExtractor from static to instance class. Updated GetClassProperties method to be an instance method, allowing for better flexibility and potential state management in the future.
2025-02-20 09:52:30 +00:00
Claire Kuang 76aa953210 moves class properties to top level of properties dictionary (#606) 2025-02-19 17:05:38 +00:00
Jedd Morgan 52d15dc827 add support for vertex normals in rhino (#605) 2025-02-19 12:11:06 +00:00
Björn Steinhagen dbbc4f7fcd fix(revit): use correct unit-specific scaling for material quantities (#602) 2025-02-19 08:21:19 +00:00
Oğuzhan Koral 85b4a88407 Merge pull request #600 from specklesystems/dogukan/tekla-runtime-fix
fix(tekla): remove runtime identifier
2025-02-19 03:04:59 +03:00
Dogukan Karatas 65a2e674bb removes runtime identifier 2025-02-19 00:58:30 +01:00
Dimitrie Stefanescu 9a84e4469e Merge pull request #598 from specklesystems/dimitrie/cnx-1186-revit-rooms-not-visible-in-the-viewer
feat: moving back to translucid rooms.
2025-02-18 17:07:42 +00:00
Dimitrie Stefanescu b8a49d5fed feat: moving back to translucid rooms.
now people will be angry they cannot select furniture in some cases.
2025-02-18 17:01:36 +00:00
Dogukan Karatas 12dcf471d3 fix (tekla): updates the vebview2 dependency (#562)
* updates webview dependencies

* updates csproj

---------

Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-18 19:08:26 +03:00
Claire Kuang 42e45affbd refactor(civil3d): properties cleanup (#588)
* Cleans civil3d props

also removes catchment and network proxies. this info is now captured in assignments

* Update ClassPropertiesExtractor.cs

* some bug fixes

* Update PartDataExtractor.cs

* adds parcel areas and excludes labels
2025-02-18 16:38:20 +01:00
Dimitrie Stefanescu fcce4e3f63 feat: adds support for formulas in user strings (#594)
Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-02-18 15:15:08 +00:00
Claire Kuang 370c5b2064 adds area boundary segments to display value of area (#592) 2025-02-18 15:06:54 +00:00
Claire Kuang 39dfb0f426 removes assignment of bearing to z (#593) 2025-02-18 14:53:58 +00:00
Adam Hathcock 1c62fbbe99 Update SDK to 268 (#567)
* Update SDK to 257

* update to SDK 267

* adjust ifc tester

* Update to SDK 268

* update SDK version to 270
2025-02-18 10:14:55 +00:00
Jedd Morgan 6f03aa8678 Jedd's IFC improvements (#510)
* ifc safe

* reverted LibraryImport as it would need more testing

* IFC app ids
2025-02-17 16:35:26 +00:00
Björn Steinhagen f882b0f5bd fix(etabs): ensure csi operations run on main thread to prevent etabs exceptions (#589)
* fix: ensure operations run on main thread to prevent etabsexceptions

* pr comments

* fix: ensure consistent exception handler usage in selection binding
2025-02-17 11:53:21 +01:00
Björn Steinhagen 4ffe9fe4b0 feat(revit): extract material type enum on structural asset (#586)
* feat: material type distinction

* refactor: mixed concerns

Some structural asset stuff was in the MaterialQuantitiesToSpeckle.cs

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-02-14 11:24:24 +00:00
Claire Kuang d50b095683 refactor(revit): properties cleanup (#581)
* clean properties in revit

also adds properties to non-dataobjects and changes grids to have a curve display value after removing curve prop on grids

* removes number from room since this is included in params

* refactors supported categories and throws when all selected objects are unsupported categories

* stupid typos

---------

Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2025-02-14 09:49:51 +00:00
Dimitrie Stefanescu daebbbef1c Merge pull request #587 from specklesystems/adam/cnx-1238-rhino-8-restarting-during-an-operation-throws-with-key-not
fix: (cancellation manager should return cancelled token instead of throwing exception)
2025-02-13 12:18:05 +00:00
Adam Hathcock b43631e46b fix and add tests 2025-02-13 10:54:49 +00:00
Adam Hathcock ea9768b1f2 check tokens more aggressively when doing operations 2025-02-13 10:50:12 +00:00
Adam Hathcock 2756555eb9 Cancellation manager shouldn't throw on get 2025-02-13 10:49:15 +00:00
Adam Hathcock 1f1422900e Adam/cnx 1217 arcgis toc not unblocked after cancellation during (#580)
* Send with QueuedTask

* more QueuedTask usage and format

* Fix highlight/selection changes
2025-02-13 09:32:10 +00:00
Dimitrie Stefanescu 45a76eada4 Dimitrie/cnx 1240 receiving materials in rhino 8 broken for layers (#585)
* reverts previous fix

* fix: applies the minimal fix

* chore: adds comment for future

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-02-12 18:54:16 +00:00
Björn Steinhagen 0e65b6aa57 feat(etabs): geometric properties through new cDatabaseTable extractor (#584)
* feature: database table extractor

* feature: frame length extraction

* feat: shell area extraction

* feat: frame length extraction

* feat: shell area extraction

* docs: cleaned up object extractors

* refactor: extensible database table extraction

* flexible indexing (can be defined by user, defaults to typical use-case of "UniqueName")
* better variable naming and more descriptive (better than csi's api)
* some fail safes e.g. when forgetting to put indexingColumn in array of columns to fetch

* refactor: using DatabaseTableExtractor for material name lookup

* lookup for material name of a shell can use the database table extractor and simplifies EtabsShellPropertiesExtractor a lot

* fix: openings shouldn't look for material assignments

Frustrating way Etabs handles openings - they shouldn't be a SHELL. Anyways. Rant over

* refactor: database table extractor handles dictionary lookups
2025-02-12 18:43:44 +00:00
Dimitrie Stefanescu 5c2c0ff303 Merge pull request #582 from specklesystems/dimitrie/cnx-1239-rhino-fix-the-documentisinit-post-copy-paste
Rhino: fixes change detection post copy paste events
2025-02-12 15:00:32 +00:00
Dimitrie Stefanescu a6fd4547ea feat: adds previous dix 2025-02-12 14:38:47 +00:00
Adam Hathcock 0d27eadfeb add deep clean local docs (#579) 2025-02-11 14:06:12 +00:00
Dimitrie Stefanescu 0b26e021cd fix: prevents fatal crash on old model cards (#548)
* fix: prevents fatal crash on old model cards

* fix: formatting

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-10 20:33:42 +03:00
Claire Kuang a0d5e3b2d4 fix(Autocad): missing solids on receive (#576)
* Fix threading bug

* untangle revit

* adds brepx converter

also changes groups to not be created if list conversion returns 1 or less objects

* revert rhino

* revert autocad

* revert rest

* remove event agg and rhino implementation

* remove event aggr from revit

* remove event aggr from autocad and civil

* remove event aggr tests

* remove event aggr from tekla

* Remove event aggr for navis

* remove event aggr from csi etabs

* remove event aggr for arcgis

* remove remaining pieces

* adds brep converter

* push autocad to run operations on main thread

* adds teklaidlemanager

* bring navis idle manager back

* run send on main

* adds extrusionx and subdx support

* adjusts converter return types to fallback case

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
Co-authored-by: Dogukan Karatas <karatasdogukan@gmail.com>
2025-02-10 20:25:24 +03:00
Claire Kuang 1ebc32f07e feat(autocad/rhino): add name and properties (#556)
* adds name and properties to rhino and autocad

* move properties extractor to converter and updates attributes event listener

* moves name and properties back to connector because abstract rhinoobjectconverter doesn't capture all top level converters

* Update RhinoObjectToSpeckleTopLevelConverter.cs

* Update ServiceRegistration.cs

* adds explicit conditions for object attribute change event

* feat: simplifies rhino implementation

* fix: comments out acad usage as we can't test it

* fix: civil services (removal of acad props extraction)

* Update RhinoSendBinding.cs

* Update PropertiesExtractor.cs

---------

Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2025-02-10 19:59:46 +03:00
Claire Kuang a3b1cd52ad fix(rhino): bakes render materials on receive instead of materials (#564)
* switches to baking render materials instead of materials

* makes sure to purge render materials before receive
2025-02-10 15:17:14 +00:00
Dogukan Karatas c7cfb8c6c7 feature (tekla): extract user-defined attributes (#566)
* adds uda's to the properties

* reformatted

* updates entry structure

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-02-10 15:06:34 +00:00
Oğuzhan Koral 93246157c7 Fix: threading on browser bridge + remove event aggr (#574)
* Fix threading bug

* untangle revit

* revert rhino

* revert autocad

* revert rest

* remove event agg and rhino implementation

* remove event aggr from revit

* remove event aggr from autocad and civil

* remove event aggr tests

* remove event aggr from tekla

* Remove event aggr for navis

* remove event aggr from csi etabs

* remove event aggr for arcgis

* remove remaining pieces

* push autocad to run operations on main thread

* adds teklaidlemanager

* bring navis idle manager back

* run send on main

* remove unused function

---------

Co-authored-by: Dogukan Karatas <karatasdogukan@gmail.com>
2025-02-10 17:50:26 +03:00
Oğuzhan Koral 18499bdc69 Chore: update code ownership (#575)
* update code ownership

* fix typo for claire :)
2025-02-07 10:35:08 +00:00
Jedd Morgan feaae9e5ee Event Aggregator Deadlock Fix (#568)
* deadlock fix

* Changed list construction

* typo
2025-02-06 12:07:23 +00:00
Björn Steinhagen 4ee48bdfae feat(revit): add density to material quantities (#558)
* feat: thermal and structural asset extraction initial scope

* feat: thermal and structural asset extraction poc

* feat: property set extraction (1/3)

* feat: property set extraction (2/3)

- scaling internal units can't be so complicated?
- to discuss :(

* feat: property set extraction (3/3)

- Simplification to just extract density from structural asset (if present)
- Just one property extraction => no need to create material proxy
- Scaled from internal units to match scaling to model units which occurs on other material quantities

* feat: display parameter unit with associated quantities

* feat: added name of structuralAsset to material quantities

* fix: safe string conversions

* fix: explicitly returning cached value

* fix: validation before dict insertion

* style: dict access

* fix: nullability

---------

Co-authored-by: KatKatKateryna <89912278+KatKatKateryna@users.noreply.github.com>
2025-02-06 08:49:28 +01:00
Adam Hathcock 1c11e4a6c5 Add Local to relevant csprojs and use local config in Local sln (#563) 2025-02-05 15:41:45 +00:00
Dimitrie Stefanescu 413c1ad562 Merge pull request #565 from specklesystems/dimitrie/cnx-1180-v3-send-stuck-sending-forever-for-curtain-walls-and-model
fix: ensures we don't go crazy on null categories
2025-02-05 15:51:34 +01:00
Dimitrie Stefanescu d9adca0154 fix: make ci happy - push and see 2025-02-05 14:43:40 +00:00
Dimitrie Stefanescu 74870a6a8e fix: formatting 2025-02-05 13:25:25 +00:00
Dimitrie Stefanescu cba391081c fix: ensures we don't go crazy on null categories 2025-02-05 13:18:13 +00:00
Dimitrie Stefanescu ccc3187e78 fix(rhino): only create groups if needed (#561) 2025-02-04 17:33:58 +00:00
Adam Hathcock 1e8ad93dbe Update to SDK 255 (#557) 2025-02-04 15:58:55 +00:00
kekesidavid a2b01c0bbb switched from trianglenet to libtessdotnet (#559) 2025-02-04 16:09:47 +01:00
kekesidavid a70a894089 extrude simple holed surfaces in tekla (#550)
* extrude simple holed surfaces in tekla

* typo

* units fix
2025-02-04 15:33:30 +01:00
Dimitrie Stefanescu 65baf4221d Merge pull request #555 from specklesystems/fix-clean
Add deep-clean-local.
2025-02-04 12:25:45 +01:00
Adam Hathcock 2a4b5f7218 add build and restore functions with output 2025-02-04 10:00:17 +00:00
Adam Hathcock cfa723d164 Add deep-clean-local. Be more explicit about what solution is being cleaned 2025-02-04 09:52:50 +00:00
Adam Hathcock 143da829d8 Revert to SDK 251 to avoid potential issues (#554) 2025-02-04 09:23:02 +00:00
Adam Hathcock a8a98fe824 Update to SDK 254 (#551) 2025-02-03 17:54:13 +00:00
Adam Hathcock efadfdc479 Update to SDK 252 (#546) 2025-02-03 14:08:53 +00:00
Dimitrie Stefanescu f7ee2555f4 Merge pull request #547 from specklesystems/dimitrie/cnx-1086-stuck-at-publish-when-trying-to-publish-not-supported-array
fix/feat: adds support for arrays (radial and linear) in revit
2025-02-03 14:42:34 +01:00
Dimitrie Stefanescu 286a1c070c Merge branch 'dev' into dimitrie/cnx-1086-stuck-at-publish-when-trying-to-publish-not-supported-array 2025-02-03 14:34:48 +01:00
Claire Kuang 4af90950ff fix(rhino): colors and materials are preserved on empty layers (#542)
* Update RhinoLayerBaker.cs

* fixes color and material assignment to layers with no objects

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2025-02-03 13:14:21 +00:00
Dimitrie Stefanescu a23f9c1ffa Merge remote-tracking branch 'origin/dimitrie/cnx-1086-stuck-at-publish-when-trying-to-publish-not-supported-array' into dimitrie/cnx-1086-stuck-at-publish-when-trying-to-publish-not-supported-array 2025-02-03 12:57:53 +00:00
Dimitrie Stefanescu 64dfa44692 fix: formatting 2025-02-03 12:57:44 +00:00
Dimitrie Stefanescu 573c63fa62 Merge branch 'dev' into dimitrie/cnx-1086-stuck-at-publish-when-trying-to-publish-not-supported-array 2025-02-03 13:57:05 +01:00
Dimitrie Stefanescu 52aeb36f19 fix/feat: adds support for arrays (radial and linear) in revit 2025-02-03 12:49:47 +00:00
Jedd Morgan 593f95daf6 Fix codecov reports (#545) 2025-02-03 12:43:57 +00:00
Adam Hathcock e5e02bdab1 Cancellationmanager revamp (#527)
* rhino and arc fix usage

* fix registration

* fix the rest

* use interface

* don't use rhino layer if there is no name

* formatting

* add tests

* formatting

* add to local and move

* Update OTEL to remove grpc dependency

* Fix deprecated method

* really fixed with no incremental builds for tests

* Fix references and lock

* Update nuggets
2025-02-03 12:11:09 +00:00
Dimitrie Stefanescu e9f3701a86 feat(rhino): wraps receive in an undo operation (#544)
* feat(rhino): wraps receive in an undo operation

* fix: formatting
2025-02-01 19:43:22 +03:00
Dimitrie Stefanescu 3a7baf0659 Merge pull request #543 from specklesystems/dimitrie/cnx-1152-rhino-change-tracking-not-working-in-first-open-doc
fix(rhino): isDocumentInit is set to true even on paste operations
2025-02-01 14:10:42 +01:00
Dimitrie Stefanescu 24bff4b1ce fix: isDocumentInit is set to true even on paste operations 2025-02-01 13:04:11 +00:00
Dimitrie Stefanescu 184c53c3a2 fix: exceptions on null layers (#540)
it does seem like a rhino layer can have null full name in some cases

Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2025-01-30 16:41:57 +00:00
Björn Steinhagen 16ce6ac09f fix: catch tendon and link as warning (#538) 2025-01-30 16:46:11 +01:00
Adam Hathcock f379996f31 Better handle UnobservedTaskExceptions without the Event Aggregator. … (#539)
* Better handle UnobservedTaskExceptions without the Event Aggregator.  Logs will have them.

* formatting
2025-01-30 13:55:18 +00:00
kekesidavid 48e66f9084 Mesh generator logic to triangulate 2D and 3D surfaces (#529)
* added mesh generator logic to triangulate 2D and 3D surfaces from polygon inputs

* removed empty folder

* checking hole polygon vertex order, added comments

* csharpier

* added MeshTriangulation project to Local sln

* added reference to MeshTriangulator in Tekla Converters
2025-01-29 15:27:09 +01:00
Jedd Morgan f2249356d8 Add to build (#525) 2025-01-29 14:02:07 +00:00
Björn Steinhagen f4765b9e82 bjorn/cnx-1133-user-facing-attributes-not-consistent-for-joints (#536)
* style: user facing attributes for joint

* bug: using old strings
2025-01-29 14:46:29 +01:00
Claire Kuang e4a29085f3 chore(template): amends pr template to be more descriptive (#535)
* Update pull_request_template.md

* Update pull_request_template.md
2025-01-29 12:56:17 +00:00
Jonathon Broughton 462d01a3b2 feat(Navisworks): CNX-1043 Enable shared ribbon for v2 and v3 Navisworks connectors (#504)
* Add Speckle v2 and v3 launch buttons to the Navisworks ribbon

- Added `LaunchSpeckleConnector` class with constants for command and plugin names
- Updated `NavisworksRibbon.name` file to include display names for Speckle v2 and v3
- Updated `NavisworksRibbon.xaml` file to include ribbon panels and buttons for Speckle v2 and v3
- Updated `NavisworksRibbon.xaml.cs` file to include commands for launching Speckle v2 and v3 connectors
- Added resources for the icons of the new buttons

* Delete AppUtils.cs and Commands.cs, add Utilities.cs

- Delete AppUtils.cs and Commands.cs (Replaced by v2 and v3 Tools)
- Add Utilities.cs for plugin utilities functionality

* Update Speckle Connector for Navisworks to use the new SpeckleV3Tool plugin and developer ID. Also, initialize the services with the correct version of Navisworks.

* Update RibbonHandler class in Navisworks connector plugin:
- Refactor the CanExecuteCommand method to handle different commandIds.
- Add a static constructor to subscribe to the PluginRecordsChanged event.
- Implement OnPluginRecordsChanged method to reset the cached state of V2 plugin availability.
- Modify ExecuteCommand method to load and activate the appropriate plugin based on the commandId.
- Add a new IsValidVersion method to check if the current version of Navisworks is compatible with the plugin.

* Update ribbon handling logic in NavisworksRibbon.xaml.cs

- Find the v2 plugin and update the availability state
- Hide the v2 ribbon tab if it exists

* Fix ribbon handling for Speckle v3 and v2 tools

Refactor the code in `RibbonHandler` to improve the handling of commands for Speckle v3 and v2 tools. The changes include:
- Extracting a new method `HandleCommand` to handle the loading and activation of plugins
- Removing duplicated code by calling `HandleCommand` for both Speckle v3 and v2 tools
- Adding null checks when finding plugin records
- Returning early if plugin loading should be skipped

* XMLDOC comments added

- Added two summary comments to describe the purpose of the methods `CanExecuteCommand()` and `ExecuteCommand()`.

* Add Speckle V2 and V3 tools to Navisworks plugin

- Added `SpeckleV2Tool.cs` file with constants for Speckle V2 tool
- Added `SpeckleV3Tool.cs` file with constants for Speckle V3 tool

* Refactor Utilities.cs for Navisworks plugin

- Add conditional compilation for DEBUG mode

* Remove debug code and comments in Utilities.cs

- Remove debug code that prints available plugins to the Debug output window
- Remove unused using statement for System.Text

* Refactor plugin activation logic in NavisworksRibbon.xaml.cs and Utilities.cs

- Simplify ActivatePluginPane method in Utilities.cs
- Remove unused parameter 'command' from ActivatePluginPane method

* Update Speckle branding and UI elements

- Changed display names for Speckle versions to reflect beta status.
- Updated XAML to simplify ribbon panel structure.
- Adjusted constants in the tool class for consistency with new naming.

* Fix formatting and improve error messages

- Added missing newlines for better readability in code.
- Updated error message to enhance clarity for users.
- Cleaned up XML formatting in project files for consistency.
- Ensured all package references are properly formatted.

* Add missing namespace for Navisworks integration

- Included the HostApp namespace to improve functionality.
- Ensures better access to required classes and methods.

* Fix message box formatting in Navisworks plugin

Updated the message box string concatenation for better readability.
2025-01-29 10:57:44 +00:00
Jonathon Broughton 8ca43a1ad5 feat(Navisworks): CNX-1064 - Add hierarchy path property to converted Navisworks objects (#500)
* Add DisplayPathHelper class for generating display paths in Navisworks

This commit adds a new file, `DisplayPathHelper.cs`, which contains a helper class for generating display paths by traversing Navisworks model item ancestors. The `GenerateDisplayPath` method takes a `ModelItem` as input and returns a string representing the full path of display names from ancestors, stopping at the first object ancestor. If no first object ancestor is found, it returns just the model item's display name.

The helper class uses a constant `PATH_DELIMITER` to separate the display names in the generated path. It throws an exception if the input `modelItem` is null.

The algorithm works by starting from the first object ancestor and traversing backwards to the root, collecting non-empty display names along the way. Finally, it reverses the collected names and joins them with the delimiter to form the final display path string.

These changes improve code reusability and readability by encapsulating logic related to generating display paths in Navisworks models.

* Update NavisworksRootObjectBuilder.cs

- Modified the CreateNavisworksObject method to handle cases where the convertedBase or groupKey is null and return null in those cases
- Added a new private method GetDisplayPath to retrieve the modelItem and displayPath based on the applicationId
- Updated the CreateNavisworksObject methods to include the displayNamePath property in the returned NavisworksObject

* Refactor NavisworksRootObjectBuilder.cs: Add FindMeaningfulAncestorName method

This commit adds a new private method, FindMeaningfulAncestorName, to the NavisworksRootObjectBuilder class. This method is used to find the name of the most meaningful ancestor of a given NAV.ModelItem object. It iterates through the ancestors until it finds an ancestor with a non-empty DisplayName and no geometry. The found name is then used as the "name" property in the created NavisworksObject instances. Additionally, the "displayNamePath" property has been renamed to "path" for consistency.

* Refactor display path generation for Navisworks model items

- Update the helper class to generate display paths by traversing meaningful Navisworks model item ancestors.
- Skip nodes without meaningful names or geometry nodes when generating the display path.
- Reverse the collected names to build the path from root to leaf.

* Rename DisplayPathHelper.cs to HierarchyHelper.cs
- Renamed the file from "DisplayPathHelper.cs" to "HierarchyHelper.cs"
- Updated all references to the renamed file

Refactor helper class for generating display paths
- Refactored the helper class to extract hierarchical context from Navisworks model items in a single traversal
- Changed the method name from "GenerateDisplayPath" to "ExtractContext"
- Modified the method signature to return a tuple of strings (Name, Path)
- Updated the implementation logic accordingly

Improve traversal and extraction logic
- Improved the traversal logic by collecting both name and path information while traversing up the tree once
- Extracted meaningful name and path information from model items in a more efficient way
- Handled cases where model item has no meaningful name or is a geometry node

* Refactor NavisworksRootObjectBuilder.cs for improved context extraction

- Extracted the GetContext method to retrieve the name and path of a model item
- Replaced calls to GetDisplayPath with calls to GetContext for consistency
- Updated CreateNavisworksObject and ConvertBase methods to use the extracted context information instead of finding meaningful ancestor names
- Updated the "path" property in the returned NavisworksObject instances with the extracted path
2025-01-29 10:48:34 +00:00
Björn Steinhagen bb252a5115 bjorn/cnx-1112-get-user-facing-names-of-properties (#526)
* style: user facing names for frames

* style: user facing names for shells

* styling: user facing names for proxies

* style: dict utils as extension methods
2025-01-29 11:25:15 +01:00
Björn Steinhagen 4d7225fab4 bjorn/cnx-1119-remove-caching-from-progress (#534)
* Add PeriodicThreadedEvent to EA and use it

* All timers gone

* add tests

* bug: build issues

* bug: form not being disposed properly

* feat: remove caching

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
2025-01-29 11:08:02 +01:00
Adam Hathcock 9219cdfc53 Add PeriodicThreadedEvent to EA and use it (#530)
* Add PeriodicThreadedEvent to EA and use it

* All timers gone

* add tests

* bug: build issues

* bug: form not being disposed properly

---------

Co-authored-by: Björn <steinhagen.bjoern@gmail.com>
2025-01-29 09:28:03 +00:00
Björn Steinhagen 03f0b1fc56 bjorn/cnx-1111-switching-documents-does-not-invalidate-active-connector (#528)
* bug: close plugin when user switches model

* bug: refresh plugin when model changes

* style: remove log information
2025-01-28 15:43:42 +00:00
Adam Hathcock 9e18134c5e Use Event Aggregator with Navisworks (#523)
* Convert selection and idle events

* init NW2025

* testing NW

* formatting
2025-01-28 15:25:19 +00:00
Claire Kuang 67c7ddbf0a fix(all): aligns all panel, button, and tooltip text across connectors (#521)
* updates button labels and panel text

* adds rhino toolbar

* removes unnecessary images

* feat: Add rui to Rhino projects with AssemblyName as filename

---------

Co-authored-by: Alan Rynne <alan@speckle.systems>
2025-01-28 15:07:49 +00:00
Adam Hathcock 79a6062923 Use Event Aggregator with Autocad/Civil (#517)
* Rework doc selection

* add more events

* use idle events

* Fix autocad events and format
2025-01-28 10:12:29 +00:00
Jedd Morgan 81c3c420a7 added workflow back into sln (#524) 2025-01-27 15:38:22 +00:00
Björn Steinhagen 315a0cbf5e bjorn/cnx-1105-add-dynamic-setselection-support-no-events-available (#522)
* refresh GetSelection and UI icon

- refreshing GetSelection based on RVT22 approach
- adding Speckle Beta icon to the UI

* feat: changing default plugin size
2025-01-27 11:37:04 +01:00
Jedd Morgan d753ea47e2 Renamed CI workflows for clarity (#519) 2025-01-24 15:44:16 +00:00
Jedd Morgan da5caa8319 bump sdk (#515)
* bump sdk

* bump sdk for exception handling

* adjust tester

* update SDK

* fix tester again

* fix import

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
2025-01-24 14:04:06 +00:00
Adam Hathcock ca7714a8a3 Use Event Aggregator with Revit (#513)
* This is a workaround for Revit's order of operations when initializing

* Fix event listening

* Only allow methods on classes as opposed to anonymous lambdas

* formatting

* moved revit changed to fresh branch

* fix tests

* weakreference found should remove subscription

* Fix anonymous lambdas

* allow for static handlers and add tests

* Clean up

* formatting

* Change publish to avoid reentrancy issues.  Change from semaphore to lock statement
2025-01-24 13:12:43 +00:00
Adam Hathcock 4b5f3981d3 Some clean up for ETABs (#518)
* Some clean up

* have a model and resizable dialog
2025-01-23 15:50:01 +00:00
Björn Steinhagen 7eb1de4709 bjorn/cnx-880-add-sections-and-materials-as-proxies (#499)
* HostAppVersion

v21 and v22 following SDK updates

* Working POC for material and section proxies

* Refactoring section unpacking

Refactoring in accordance with PropertiesExtractor example

* Material unpackers

* Notes and documentation

* More explanations

* materialId

- Interim solution for viewer filtering is appending the materialId to assignments for each object
- For FRAME this was easy
- For SHELL not so easy. No GetMaterial method avaiable given a AreaObj sectionName. Implemented lightweight materialCache based on cDatabaseTable. Marked as temporary based on previous discussions

* Explicit dictionary entries

* Repeated property strings as consts

- Fair point for repeated strings in the CsiMaterialPropertyExtractor.cs
- Even more reason to include this across all repeated strings. Categories of properties screaming out for this. Added additionally

* PR review comments

- Dictionary lookups for material and section proxies
- Only create proxies for assigned sections and materials (not pretty)

* refactor(etabs): adds singleton converter cache for material and section relationships (#514)

* This is a workaround for Revit's order of operations when initializing (#511)

* This is a workaround for Revit's order of operations when initializing

* Fix event listening

* adds a singleton cache for material and section relationships to csishared

* updating extraction results and simplifying classes

* Only allow methods on classes as opposed to anonymous lambdas for Event Subscription (#512)

* This is a workaround for Revit's order of operations when initializing

* Fix event listening

* Only allow methods on classes as opposed to anonymous lambdas

* formatting

* fix tests

* weakreference found should remove subscription

* doument model store fix (#516)

* testing commit

---------

Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
Co-authored-by: Björn <steinhagen.bjoern@gmail.com>

* resolving conflicts, testing and small tweaks

- merged dev into branch
- added "type" parameter to group proxies for sections in order to distinguish between frame sections and shell sections

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2025-01-22 22:43:47 +01:00
Björn Steinhagen e52df074a1 doument model store fix (#516) 2025-01-22 19:46:11 +01:00
Adam Hathcock 9846817c7f Only allow methods on classes as opposed to anonymous lambdas for Event Subscription (#512)
* This is a workaround for Revit's order of operations when initializing

* Fix event listening

* Only allow methods on classes as opposed to anonymous lambdas

* formatting

* fix tests

* weakreference found should remove subscription
2025-01-22 15:19:48 +00:00
Adam Hathcock c9ca1c0a25 This is a workaround for Revit's order of operations when initializing (#511)
* This is a workaround for Revit's order of operations when initializing

* Fix event listening
2025-01-22 10:44:31 +00:00
Claire Kuang fd2dd9a165 Update DisplayValueExtractor.cs (#509) 2025-01-21 16:38:57 +00:00
Adam Hathcock 83efebfed9 Introduce Event aggregator (#417)
* Remove Dataflow usage

* format and remove dep

* merge fixes

* Fix serializer

* Add MainThreadContext

* add some main context detection

* add RevitMainThreadContext

* remove revit async?

* formatting

* use mainThreadContext

* Use more MainThreadContext

* some rearranging

* renaming

* Revit needs new run async

* merge fixes

* gather on worker, convert on main

* operations know threading but not host apps

* 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

* Use EventAggregator to decouple exception handler and UI

* it's ALIVE

* regenerate locks

* Add Prism Evening to DUI

* clean up

* always run on background thread

* Clean up to be specific

* update etabs

* thread context

* autocad threading?

* merge fixes

* remove more async

* clean up

* fix build issues

* Do top level handling in event aggregator

* add some rhino events

* add more Rhino events and do Idle as OneTime with Id

* fix up rhino idle usages

* fmt

* can build agian

* Use valuetask

* fmt

* fix up some bridge execution to be sync

* cleanup

* add some non async paths for progress

* format

* remove needless selection

* Fixes

* Convert tekla

* selection event is used without idle

* Build fixes from merge

* Fix tests and clean up

* Add new events

* Properly dispose one time events

* Minor tekla updates
2025-01-21 14:20:01 +00:00
Claire Kuang 00669ea3c5 fix(civil3d): handles property exceptions for corridor elements (#508)
* Update GeneralPropertiesExtractor.cs

* Update GeneralPropertiesExtractor.cs

* Update CorridorDisplayValueExtractor.cs
2025-01-20 16:59:49 +00:00
Jedd Morgan f02bf2630a Required Keyword changes (#496)
* Required Keyword changes

* Bump deps

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2025-01-20 14:12:43 +00: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
Jonathon Broughton abc2d9b517 Merge pull request #459 from specklesystems/jonathon/cnx-971-update-apputilscs-to-include-support-for-additional-versions
CNX-971 - Update AppUtils.cs to include support for additional versions of Navisworks.
2024-12-20 11:58:08 +00:00
Jonathon Broughton dc93a688f5 Merge branch 'dev' into jonathon/cnx-971-update-apputilscs-to-include-support-for-additional-versions 2024-12-20 11:54:28 +00:00
Oğuzhan Koral 737195e2b1 Add 2025 (#460) 2024-12-20 11:51:15 +00:00
Jonathon Broughton 9964ec9ff5 Update AppUtils.cs to include support for Navisworks as the host application.
- Add a new property `App` that returns the host application based on the platform.
- Update the `Version` property to return the correct version for Navisworks 2020.
2024-12-20 11:50:52 +00:00
Jonathon Broughton 08d1cc1881 Merge branch 'dev' into jonathon/cnx-971-update-apputilscs-to-include-support-for-additional-versions 2024-12-20 11:47:15 +00:00
Jonathon Broughton 960044556d Update AppUtils.cs to include support for additional versions of Navisworks.
- Add support for Navisworks 2020, 2021, 2022, 2023, 2025, and 2026.
- Throw a NotSupportedException for unsupported versions.
2024-12-20 11:43:47 +00:00
Adam Hathcock 629378e5a9 Fix pathing for Navisworks (#458) 2024-12-20 11:32:51 +00:00
Oğuzhan Koral 33a4e0b910 Add navisworks installer assests (#457) 2024-12-20 10:34:24 +00:00
Jonathon Broughton f674024673 Removed shortcut from plugin registration (#453) 2024-12-20 08:59:32 +00:00
Dimitrie Stefanescu f10a5475c3 Merge pull request #455 from specklesystems/update-sdk
Update SDK to 219
2024-12-19 18:47:49 +00:00
Dimitrie Stefanescu 6c8fc5bd88 fix: rider borked this one up 2024-12-19 18:20:23 +00:00
Dimitrie Stefanescu 5a9846600c Merge pull request #456 from specklesystems/dim/dataobject-conversions
Fallback conversions based on the sdk changes
2024-12-19 18:12:05 +00:00
Dimitrie Stefanescu e855f92c35 chore: cleanup 2024-12-19 18:06:15 +00:00
Dimitrie Stefanescu 0a7d8474b1 feat(autocad): adds direct converter by repupurposing the old fallback converter 2024-12-19 18:04:02 +00:00
Dimitrie Stefanescu 7f6d23f006 feat(rhino): shapes the data object converter from the ashes of the fallback converter 2024-12-19 17:12:34 +00:00
Adam Hathcock ee71915590 Need explicit conversion 2024-12-19 16:12:55 +00:00
Adam Hathcock 68b8848d4a somehow forgot this too 2024-12-19 15:12:41 +00:00
Adam Hathcock d6d16e5967 correct updates 2024-12-19 15:09:36 +00:00
Adam Hathcock ee0724aedd Update SDK to 219 2024-12-19 15:02:18 +00:00
Jonathon Broughton f924a5903a Navisworks! (#438)
* Navisworks Connector Init

* Build crap

* Moar Init

* WIP - not yet working

* Minor fixes

* Fix missing constuctors

* unfix

* Test commit

* Test commit

* 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

* 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.

* 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.

* 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.

* 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.

* 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.

* 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.

* 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

* 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.

* 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

* Fix lock files for NW

* Update to SDK 3.1.0-218

* update locks

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
Co-authored-by: Adam Hathcock <adam@hathcock.uk>
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2024-12-17 14:40:56 +00:00
Adam Hathcock 1171638f2a Update to SDK 3.1.0-218 (#451) 2024-12-17 17:27:48 +03:00
KatKatKateryna bc4757bfc5 Arcgis refactor (#416)
* registed layer unpacker

* nested layers logic moved to layerUnpacker

* killed VectorLayerConverter

* exposed Feature converter and Attributes in RootObjBuilder

* send clean GisObject

* refactor Rasters and PointClouds

* send everything through 1 converter

* proper object type

* clean GIS objects and conversions

* better layer names on Receive

* fix raster position on send

* switching to GIS layer, removing native geometry type checks (but keeping field check)

* fix revit materials on child objects

* remove IGisFeature interface

* typo

* remove empty converter

* switch from attributes to properties

* add required keyword

* required attribute fix

* attach dynamic "geometry" field to converted Polygons

* refactor(arcgis): overhaul of arcgis connector and converter patterns to enable data extraction (#439)

* rework 1

* additional restructuring of root object builder and converters

* finalizes classes and patterns for converter and connector

* fixes build errors

* Update ArcGISHostObjectBuilder.cs

* fixes some polygon conversions

* refactor color manager to separate color unpacker

* Delete GISLayerGeometryType.cs

* disables receive

* pr review issues

* Update ArcGISRootObjectBuilder.cs

* Update ArcGISRootObjectBuilder.cs

* Update ArcGISRootObjectBuilder.cs

* Update ArcGISRootObjectBuilder.cs

* fixed color bugs

* Update ArcGISLayerUnpacker.cs

* don't cache repeated layers

* Revert "don't cache repeated layers"

This reverts commit 48af025829.

* remove flattened layers from root commit builder

* Revert "remove flattened layers from root commit builder"

This reverts commit e0e7b1fb42.

* layer order and duplication fixed

* fix applicationIds

* fix raster appId

* yield; add comment

* move appId to extensions

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-12-17 11:47:33 +00:00
Adam Hathcock 744ba6163c Update SDK to use replacement function for sqlite and settings (#450)
* Use new method to store settings

* update SDK
2024-12-16 13:37:42 +00:00
Dimitrie Stefanescu 2c7e8796b6 Merge pull request #447 from specklesystems/dimitrie/cnx-917-steel-proxy-elements-do-not-get-converted-out
Dimitrie/cnx 917 steel proxy elements do not get converted out
2024-12-13 14:35:38 +00:00
Dimitrie Stefanescu 647ebdcc9c Merge branch 'dev' into dimitrie/cnx-917-steel-proxy-elements-do-not-get-converted-out 2024-12-13 14:26:17 +00:00
Adam Hathcock 34a5acdc41 update to latest SDK (#449) 2024-12-13 14:23:59 +00:00
Dimitrie Stefanescu 8276cf6d60 chore: comment 2024-12-12 19:49:10 +00:00
Dimitrie Stefanescu 0d0331ca2f cleanup: extracts view options override logic into one place 2024-12-12 19:48:00 +00:00
Dimitrie Stefanescu e2423700ea formatting 2024-12-12 19:23:33 +00:00
Dimitrie Stefanescu 9b7f11d6dd Merge branch 'dev' into dimitrie/cnx-917-steel-proxy-elements-do-not-get-converted-out 2024-12-12 19:21:54 +00:00
Dimitrie Stefanescu 7f179fc2af feat: adds columns and framing to escaped elements
reason: joined up beams would export wrong geometry
2024-12-12 19:08:49 +00:00
Dimitrie Stefanescu 3e91040017 Dimitrie/cnx 917 steel proxy elements do not get converted out (#445)
* feat: fixes issue, WIP local dependencies

i will remove them

* feat: relies on built in categories rather than casting (possibly less reliable?)

and removes local dependency refs
2024-12-12 02:52:50 +03:00
Dimitrie Stefanescu b47dea38e5 feat: relies on built in categories rather than casting (possibly less reliable?)
and removes local dependency refs
2024-12-11 22:27:08 +00:00
Dimitrie Stefanescu 3defd285e9 feat: fixes issue, WIP local dependencies
i will remove them
2024-12-11 22:12:09 +00:00
Adam Hathcock 90a09fad44 Add Net8 targets for common and fix revit 2025 (#444)
* Dual target for net8.0 projects (Revit2025)

* Revit25 doesn't depend on webview anymore

* formatting
2024-12-11 12:42:37 +00:00
Björn Steinhagen 196c503789 bjorn/cnx 882 send etabsobjects with their properties (#442)
* trying a bold refactoring

ETABSShared and CSiShared is strictly correct, but just looks horrible EtabsShared and CsiShared looks better

* refactor: improve

* property extraction foundation

- better architectural approach for property extraction depending on csi product and wrapper type
- correctly configures return type depending on the product (e.g. EtabsObject)

* refactor(props): streamline property extraction across CSi and ETABS

Reorganizes property extraction to better handle base and product-specific properties:
- Introduces PropertyExtractionResult for cleaner property management
- Separates shared CSi properties from product-specific ones
- Implements dedicated extractors for Frame, Joint, and Shell
- Standardizes property extraction patterns between CSi and ETABS
- Removes property redundancy and improves null safety

* frame data extraction 1/2

* remaining data extraction

- finished data extraction for frames
- added data extraction for joints and shells
- re-instated collections

* documentation

- added some updates to the documentation

* SpeckleApplicationIdExtensions

- Extension methods for speckle applicationIds

* IApplicationPropertiesExtractorConcretization

- Renamed GeneralPropertiesExtractor to SharedPropertiesExtractor
- Renamed EtabsClassPropertiesExtractor to ApplicationPropertiesExtractor
- Removed PropertiesExtractor file
- Enforced injection of shared properties extractor to application specific extractor
- Output of Extract() of type PropertyExtractorResult
- Application property extractor mutates dictionary

* applicationId simplification

* review comments

- directly assigning applicationId to base
- rename ApplicationPropertiesExtractor to EtabsPropertiesExtractor

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-12-11 10:08:15 +00:00
Adam Hathcock 0e0dd81b56 Fix sending caching (#441)
* Fix upload speed calculation

* Better progress for humans?

* format

* add percentage to caching

* Update SDK
2024-12-10 11:49:53 +00:00
Björn Steinhagen 0341ebc953 bjorn/cnx 829 add root object builder and create collection structure (#435)
* ETABSShared

- Implemented ETABSShared projects for Connectors and Converters to account for ETABS specific things that SAP 2000 doesn't account for  such as levels or frames being further classified as Column, Beam or Brace or shells as wall or floor

* collection poc

- POC for ETABS collection structure
- Logic for getting further classificiations of Frames as either Column, Beam or Brace
- Same for Shells: either Wall or Floor etc.
- Placeholders for object properties

* documentation

- Putting thoughts to "paper"
- A lot of the TODOs will be part of next milestone

* adding new projects to local.sln

* csharpier

got deactivated and wasn't formatting on save anymore :(

* unnecessary registration

* using directives

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-12-05 23:21:09 +03:00
Oğuzhan Koral f0e54ca883 Merge pull request #427 from specklesystems/claire/cnx-849-change-civil3d-and-tekla-to-align-with-idataobject
refactor(civil3d/tekla/revit): aligns send with new DataObjects
2024-12-05 20:20:18 +03:00
Claire Kuang 6bfd6749e1 Merge branch 'dev' into claire/cnx-849-change-civil3d-and-tekla-to-align-with-idataobject 2024-12-05 15:32:05 +00:00
Adam Hathcock 7c28a9f9d2 Add Comments about TransformTo (#436) 2024-12-05 11:18:17 +00:00
Claire Kuang 040d8c1feb Delete Speckle.Converters.TeklaShared.projitems.Backup.tmp 2024-12-05 10:24:42 +00:00
Claire Kuang f1f5403132 bumps sdk version 2024-12-04 16:30:21 +00:00
Claire Kuang d63ebf9268 Merge branch 'dev' into claire/cnx-849-change-civil3d-and-tekla-to-align-with-idataobject 2024-12-03 22:21:24 +00:00
Claire Kuang 9a148b96c0 removes categories classes 2024-12-03 22:09:45 +00:00
Claire Kuang 15579fa702 updates civil3d, revit, and tekla to use their data object classes
also refactors properties as a separate class
2024-12-03 19:53:23 +00:00
Dimitrie Stefanescu c2bafc6613 Dim/type change cach invalidation (#391)
* feat: handles changing an element type in revit via the edit type dialog

looks for any types in the modified object list and adds all objects that have that type as modified

* feat: minor cleanup

* feat: naming, comments

* fix: minor linq changes

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-12-03 20:02:10 +03:00
Adam Hathcock 1ba3f890e7 Fix transform temp (#434)
* Update SDK to 205

* Use NotNull

* fmt

* Temporary ITransformable fix for Revit
2024-12-03 15:12:12 +00:00
Adam Hathcock 48096fbbe1 Update sdks to 205 (HashCode fix and nullability) (#433)
* Update SDK to 205

* Use NotNull

* fmt
2024-12-03 15:04:17 +00:00
Claire Kuang f53e52bbfe feat(autocad): adds surface and region converters (#428)
* adds surface and region converter

also adds brep raw converter and refactors existing converters to avoid duplicate logic

* Update Speckle.Connectors.sln

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-12-03 13:39:41 +00:00
Adam Hathcock 332ab25e64 Use Sets and Freezing to make conversions faster (#430)
* Use Sets and Freezing to make conversions faster

* fmt

* move class to own file
2024-12-03 13:32:27 +00:00
Dimitrie Stefanescu 792bd9305c Merge pull request #425 from specklesystems/dimitrie/cnx-850-pipe-fittings-not-exported
fix: forces detail level to fine for specific elements
2024-12-03 11:25:08 +00:00
Oğuzhan Koral c3f2115fb2 Merge branch 'dev' into dimitrie/cnx-850-pipe-fittings-not-exported 2024-12-03 14:19:51 +03:00
Björn Steinhagen 2cc09d43ac bjorn/cnx-835-add-converter-projects-and-top-level-converter (#429)
* Initial commit

- Project setup and basic definitions
- Waiting for SDK update

* CSiObjectToSpeckleConverter

- Abstract TopLevel converter
- Requiring a lot of wrappers and addtional steps to get to converted CSiObject

* ICSiWrapper with factory

* raw conversion placeholders

* service registration

* root to speckle

* type registration and resolution

CSiWrapperBase instead of ICSiWrapper correctly resolves all types

* Setting up object level converters

* some basic conversions

* units framework

* raw conversion placeholders

these are gross (just a poc for first send)

* CollectionManager

Simple organization

* Comments

* back to BASE-ics

* local

* csharpier

Missing blank line

* newline

* AddObjectCollectionToRoot

PR comments:
- Updated GetAndCreateObjectHostCollection to more descriptive name of AddObjectCollectionToRoot
- Removing unnecessary rootObject = childCollection line

* cleaning locks

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-12-03 12:18:51 +01:00
Claire Kuang 18140fe4af Merge branch 'dev' into claire/cnx-849-change-civil3d-and-tekla-to-align-with-idataobject 2024-12-03 10:18:18 +00:00
Dimitrie Stefanescu 437e948052 Merge branch 'dev' into dimitrie/cnx-850-pipe-fittings-not-exported 2024-12-02 20:19:24 +00:00
Dimitrie Stefanescu e777a2572d fix(rhino): more lenient creation for failed/partial instances (#431) 2024-12-02 17:01:43 +00:00
Adam Hathcock 6dd9b31108 Use ISqLiteJsonCacheManagerFactory (#411)
* Use ISqLiteJsonCacheManagerFactory

* update SDK

* 201 to 203 SDK

* made db centralized

* fix model key generation
2024-12-02 16:15:47 +00:00
Adam Hathcock 10055aa06e Fix for Autocad receive speed (#424)
* update UI only every 50 times

* Fix up browser to fire and forget

* Autocad doesn't need to be async.  Fixed up Rhino

* Always invoke
2024-12-02 18:52:33 +03:00
Claire Kuang 481f81fe6e changes civil and tekla to send dataobjects 2024-11-30 21:33:37 +00:00
Dimitrie Stefanescu 0100c67a33 Merge branch 'dev' into dimitrie/cnx-850-pipe-fittings-not-exported 2024-11-29 17:39:31 +00:00
Dimitrie Stefanescu 0a0a1358cb fix: forces detail level to fine for specific elements 2024-11-29 17:38:03 +00:00
Jedd Morgan 2e41d15f0d top level exception handler give a better exception when toasts fail (#423) 2024-11-29 13:57:39 +00:00
Dimitrie Stefanescu d0e77d29ec Merge pull request #421 from specklesystems/dimitrie/cnx-855-rhino-changing-a-material-does-not-invalidate-the-objects
Dimitrie/cnx 855 rhino changing a material does not invalidate the objects
2024-11-29 09:02:30 +00:00
Dimitrie Stefanescu 4880d41e5a Merge branch 'dev' into dimitrie/cnx-855-rhino-changing-a-material-does-not-invalidate-the-objects 2024-11-29 08:57:54 +00:00
Dimitrie Stefanescu 92a8cf1510 fix: performs expiration checks if actually any materials/objects have changed 2024-11-29 08:56:40 +00:00
Oğuzhan Koral 7639259c43 Clear token after every operation to prevent annoying message (#422) 2024-11-29 11:49:49 +03:00
Dimitrie Stefanescu 262062464e chore: comments 2024-11-28 20:11:47 +00:00
Dimitrie Stefanescu 474b9eb364 feat: closes off cnx-855
wraps event in topLevelExceptionHandler and reinits changed material ids
2024-11-28 20:10:22 +00:00
Dimitrie Stefanescu e5a1f62ccf feat: wip invalidates objects whose materials have changed 2024-11-28 19:39:36 +00:00
Dimitrie Stefanescu eea6924e17 Merge pull request #420 from specklesystems/dimitrie/cnx-391-assigning-material-doesnt-trigger-object-tracking-in-rhino
Dimitrie/cnx 391 assigning material doesnt trigger object tracking in rhino
2024-11-28 19:15:58 +00:00
Oğuzhan Koral 0ae1ec0236 Merge branch 'dev' into dimitrie/cnx-391-assigning-material-doesnt-trigger-object-tracking-in-rhino 2024-11-28 22:11:05 +03:00
Dimitrie Stefanescu ace52876ac feat: wraps up fix 2024-11-28 19:07:14 +00:00
Dimitrie Stefanescu 467db204a8 wip: adds event handlers for material changes 2024-11-28 18:57:39 +00:00
Björn Steinhagen 0be8897dd6 bjorn/cnx-828-shared-projects-for-connector (#419)
* ETABS21

- Shared project for converters
- ETABS21 support

* 21 and 22 Support

- cPlugin.cs and Form1.cs in Shared defined as interfaces. Version specific implementations (basically just the namespaces) created in proj specific files
- Plugins load and selection works in both ETABS versions

* Form1 -> SpeckleForm

* cPlugin base class

- Better to have a cPlugin base class which ETABS21 and 22 inherit. Reduced code duplication
- Better project namespace structure

* s_modality
2024-11-28 19:34:01 +01:00
Dimitrie Stefanescu 13f48d95e1 Merge pull request #418 from specklesystems/dimitrie/cnx-795-did-not-find-layer-in-the-cache
Fixes instance receiving in some edge cases
2024-11-28 17:43:16 +00:00
Dimitrie Stefanescu f194448d94 fix: rhino is now ok 2024-11-28 17:06:31 +00:00
Dogukan Karatas a99083f03f Dogukan/etabs connector poc (#406)
* dui3 integration

* registers necessary classes

* adds solution to local

* updates packages.lock

* v3 Kick-Off

- Migrated the proof-of-concept to a Shared project
- Some renaming headache
- Use of Speckle.CSI.API NGet package (thanks Jedd)
- Basic selection info works
- Ready for CNX-828 and CNX-835

* Renaming

- Renaming of the solution structure(s) outdated in the Local.sln

* Local.sln Updates

* SDK 3.1.0-dev.200 changes

* s_modality

Code style error

* Remove launchSettings.json from shared

* Removing null supression

---------

Co-authored-by: Björn <steinhagen.bjoern@gmail.com>
2024-11-28 13:40:40 +01:00
Dogukan Karatas 85bd01790e corrected namespaces (#415) 2024-11-27 16:43:38 +00:00
KatKatKateryna 0ccefeaa99 receive colors with fallback conversions (#408)
* receive colors with fallback conversions

* don't pass Base unnecessarily

* material fix

* only pass applicationId

* note for the new variable

* typo

* typo2

* typo3

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-27 14:58:05 +00:00
Dogukan Karatas 3ad4d46993 fix (tekla): greyscaled objects in the viewer (#412)
* adds teklamaterialcahce

* Revert "adds teklamaterialcahce"

This reverts commit 3fbba01bb0.

* detach applicationids from displayvalue

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-27 14:50:20 +00:00
Adam Hathcock 9d6c7decbc Rework progress to try to be better 😬 (#405)
* Use SuspendingObservableCollection

* updates

* Use thread-safe models

* handle loading

* fix up tekla

* remove option

* fix suspension

* Revit shouldn't register changed twice.  top level goes to base class

* use suspension when loading

* forgot include

* lock saving like loading

* Remove public accessor

* Require a document store for each DUI usage

* simpify load and state saving since we don't need to observe the collection externally

* added back property for javascript UI

* fmt

* move progress handling to own classes

* fmt

* fmt

* fix up diff

* Fix merge

* adjust sending progress

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-27 17:44:48 +03:00
KatKatKateryna 329315f461 removing redundant loop (#413) 2024-11-27 20:00:56 +08:00
Claire Kuang c5e14e78f0 refactor(revit): aligns revit send for data extraction workflow (#399)
* moves all built elements conversions to top level element converter and class property extractor

* adds safeguards to properties, parameters, and display value extractors

* Update ParameterExtractor.cs

* fixes family prop

* adds type as prop to all elements

* WIP: Various level fixes (#402)

* feat: makes levels dicts and memoizes converter

* feat: makes top level props also not detached

* feat: unifies `level` extraction in top level

* fix: linting

* refactors local function in tekla model object to speckle converter

* update revit element converter to use revitobject

* adds grids to class properties extractor

* Update Speckle.Converters.RevitShared.projitems

* updates to nuget version dev.199

* moves category assignment to all top level converters

* reverts to send 2, removes profile props

---------

Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2024-11-26 13:53:15 +00:00
Adam Hathcock 92acb31ece Fix(store): lock list modifications on DocumentModelStore (#388)
* Use SuspendingObservableCollection

* updates

* Use thread-safe models

* handle loading

* fix up tekla

* remove option

* fix suspension

* Revit shouldn't register changed twice.  top level goes to base class

* use suspension when loading

* forgot include

* lock saving like loading

* Remove public accessor

* Require a document store for each DUI usage

* simpify load and state saving since we don't need to observe the collection externally

* added back property for javascript UI

* fmt

* fmt

* fix up diff

* add clear for autocad loading

* always clear before adding all

* use list instead

* be more explicit with naming

* fmt

* Clear regardless, it was an issue on rhino

* Correct remove cards

* Rename tekla folder name for now

* Use first or default instead first

* Find model cards by FindIndex

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
2024-11-26 13:37:42 +00:00
Adam Hathcock 2688546c7a Revert to Send1 (#409) 2024-11-26 10:18:11 +00:00
Adam Hathcock 7c346a3ac5 update SDK to fix local sln (#404)
* update SDK to fix local

* fix using new types from sdk
2024-11-22 12:43:37 +00:00
Adam Hathcock abcf58d369 DiscriminatedObjectConverter needs DI (#363)
* DiscriminatedObjectConverter needs DI

* settings shouldn't be injected...use injected serializer

* format

* make the factory a singleton

* fix build issue
2024-11-22 15:16:19 +03:00
Dimitrie Stefanescu 2211428614 Merge pull request #401 from specklesystems/oguzhan/fix-unnecessary-expiration-triggers
Fix(revit): escape fast from doc change event handler after WriteToFile
2024-11-21 12:12:24 +00:00
oguzhankoral 08d31ff0d6 Adjust if check more specific 2024-11-21 14:58:37 +03:00
oguzhankoral e055030291 We escape fast from doc change event handler 2024-11-21 14:47:16 +03:00
Dogukan Karatas 1e5cca5ffb adds object tracking (#398)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-21 11:12:03 +03:00
Björn Steinhagen 85abeaf7f0 Bjorn/cnx 798 rendermaterialproxy owerritten (#397)
* renderMaterial overwrites

Avoiding type booleanPart alleviates the problem of renderMaterial being overwritten

* logging

Adding a LogError should the problem be not just related to BooelanPart. This won't break the send though and user won't be prompted

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-21 11:01:13 +03:00
Adam Hathcock 47480809d0 Avoiding some reference null exceptions (#394) 2024-11-20 16:09:04 +00:00
Adam Hathcock 885bb41f27 Update SDK reference to fix external references (#396) 2024-11-20 13:06:17 +03:00
Oğuzhan Koral c74e92fb2e Fix(tekla): Read write model cards to/from appdata + fixes double UI (#395)
* Fix multiple problems

* Connect windows each other

* Add note
2024-11-20 12:14:10 +03:00
Dogukan Karatas a4f27b5c1d dogukan/cnx-744-model-card-highlight-in-tekla (#392)
* adds highlighting methods

* clears selection before highlighting

* adds a functionality to zoom selected

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-19 23:15:49 +03:00
Adam Hathcock a7941bb4c8 update SDK (#393) 2024-11-19 19:42:14 +03:00
Jedd Morgan 13c29412eb Use of obsolete members now generates warning (#378)
* Use of obsolete members now generates warning

* format

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-11-19 13:18:47 +00:00
dependabot[bot] 774e24d441 chore(deps): bump codecov/codecov-action from 4 to 5 (#390)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2024-11-19 09:51:22 +00:00
Björn Steinhagen 8822761c48 CNX-751: Add Units to reportProperties (#389)
* Datatype

Main change is the switch from Tekla.Structures.Drawing to Tekla.Structures.Datatype for units. Problem is, that Settings > Options > Units and decimals don't seem to affect API returns. Will confirm with Tekla team. Rudimentary fix applied for now.

* Weight Unit

* Weight Unit

* Consisten representation of internal units

* Distance.CurrentUnitType

As discussed

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-19 09:38:39 +00:00
Björn Steinhagen 4215f90456 CNX-755: Create Collections by Category (#387)
* sendCollectionManager

* path Builder

Removing iteration where path (currently) only contains 1 item

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-18 17:06:13 +01:00
Adam Hathcock c8ac385b88 Use Send2 again! (#372)
* Use Send2 again!

* tweaking progress

* Update SDK

* format
2024-11-18 12:29:56 +00:00
Dogukan Karatas b1ef5c74c8 Dogukan/cnx 790 version independent plugin icon (#386)
* adds decimal agnostic grid conversion

* fixes versioning in icon

* formatting

* adds notes

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-17 21:39:43 +00:00
Oğuzhan Koral a5ff2ca780 Attach parent applicationId to meshes (#385)
- seems like TSM.Solid object doesn't have any Identifier
2024-11-15 15:07:35 +00:00
Jedd Morgan f84c4b2d31 Bump SDK and enforce msbuild warnings (#379)
* Bump SDK

* Updated Tekla structures nugets

* Tekla architecture targeting

* Fixed remaining warnings
2024-11-14 21:16:46 +00:00
Oğuzhan Koral b03e848669 Handle unit changes (#384) 2024-11-13 18:59:10 +00:00
Dogukan Karatas 76ea67af54 dogukan/tekla2023 installer (#382)
* build for 2023

* fix: Delete Assets/*.bmp from csproj as it is referenced in shproj now

* updates the icon

* fix: Revert changes to build.sh

* adds notes

---------

Co-authored-by: Alan Rynne <alan@speckle.systems>
2024-11-12 15:47:06 +01:00
Oğuzhan Koral 12c80e2d40 Fix(dui3): do not pass selectedobjectids from idmap (#380)
* Do not reset selectedObjectIds from IdMap

* Format
2024-11-11 15:19:17 +00:00
Dogukan Karatas c013953368 Dogukan/cnx 679 double UI at the first plugin button click (#381)
* tracks ui instances

* adds icon to the plugin form
2024-11-11 13:59:22 +00:00
Oğuzhan Koral 34457ead0a remove useless code (#377) 2024-11-08 18:06:07 +00:00
Dimitrie Stefanescu 5e92889825 Rhino stability fixes (#375)
* fix: (wip) ensures layer creation is happening where it should (InvokeAndWait)

* fix: ensures polylines with null domains still convert ok

* feat: comments and makes non-public function private

* feat: wraps up fixes

makes layer purging quiet, and removes stale comments
2024-11-08 17:54:41 +00:00
Oğuzhan Koral b2606d209d Feat(revit): CNX-543 category filter (#373)
* POC categories filter

* Set context regardless

* WIP

* More WIP

* More more WIP

* Fix highlight

* Remove RevitSenderModelCard

* Make all working

* Rename SetObjectIds to RefreshObjectIds

* Rename the function for Tekla

* Remove ObjectIds from filters

* Fix RefreshObjectIds return
2024-11-08 13:34:16 +00:00
Dogukan Karatas a18beeca1b Oguzhan/cnx 747 add support for tekla 2023 (#371)
* Create shared project for Tekla connector

* adds shared project

* sync w/ local

* update csproj

* update csproj

---------

Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-08 12:22:16 +00:00
Jedd Morgan c1293ff395 Fixed autocad async (#370)
Co-authored-by: Alan Rynne <alan@speckle.systems>
2024-11-07 18:49:47 +00:00
Dimitrie Stefanescu bc6f6c4c39 Merge pull request #369 from specklesystems/dimitrie/cnx-643-arcs-in-blocks-are-not-received
Dimitrie/cnx 643 arcs in blocks are not received
2024-11-07 18:43:25 +00:00
Dimitrie Stefanescu befb84db5f chore: comments 2024-11-07 17:46:53 +00:00
Dimitrie Stefanescu 2403288678 fix: allows pre-transformation of all ITransformable objects 2024-11-07 17:46:37 +00:00
Dogukan Karatas cac8e1ba18 adds a setting to send rebars as line or solid (#367)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-07 16:54:23 +00:00
Adam Hathcock 06255370f7 Update SDK and dependencies (#366)
* Use new send to have new sqlite paths

* update SDK and dependencies

* fix microsoft.build
2024-11-07 16:04:38 +00:00
Jedd Morgan 6ba70a76c2 Jrm/parameter extraction (#365)
* follow pattern from receive for async

* category can be null

* optimization for try get

* fmt

* Optimised Revit Parameter extraction

* returned the basic solid invalid check

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2024-11-07 12:03:50 +00:00
Dogukan Karatas dd53b70b36 dogukan/cnx-753-normals-are-flipped (#364)
* flips the normals

* adds note
2024-11-07 11:17:49 +00:00
Dogukan Karatas 6873af5ac3 Dogukan/cnx 691 extract appropriate class properties by type (#352)
* adds new properties

* displayValue updated

* adds report properties

* updates report properties

* removes the null parameters

* resolves a conflict

* renames the report property extractor

* updates csproj

* Revert "updates csproj"

This reverts commit b42a21f151.

* updates csproj

* updates rebar displayValue
2024-11-07 10:12:24 +00:00
Adam Hathcock 35d8c41a2b Revit async fix for sending (#362)
* follow pattern from receive for async

* category can be null

* optimization for try get

* fmt
2024-11-07 09:37:21 +00:00
Dimitrie Stefanescu 5f4eebe536 Merge pull request #361 from specklesystems/dimitrie/cnx-634-some-elements-are-received-as-generic-models-ignoring
Dimitrie/cnx 634 some elements are received as generic models ignoring
2024-11-06 19:51:48 +00:00
Dimitrie Stefanescu ba4cfca45b Merge branch 'dev' into dimitrie/cnx-634-some-elements-are-received-as-generic-models-ignoring 2024-11-06 19:27:26 +00:00
Dimitrie Stefanescu f6e4fcd2d0 feat: adds top level converter for railings
and fixes a different bug
2024-11-06 19:26:14 +00:00
Dogukan Karatas d5f1f76e24 dogukan/cnx-748-send-grids-from-tekla (#353)
* create displayValue for grids

* injects gridToSpeckleConverter

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-06 19:15:37 +00:00
Dimitrie Stefanescu 8a0c9d0128 fix: adds built in category for setting ds cat on receive reliably
note: this is not backwards compatible
2024-11-06 18:33:11 +00:00
Alan Rynne a1ff69502a feat: CXPLA-120 Added tekla zip packaging prior to installers (#357)
* feat: Added tekla zip packaging

Plus tekla Icon and postbuild action refactor

* fix: teaks to post build event

* Make all tekla dependencies private

* fix: update logo
2024-11-06 18:38:18 +01:00
KatKatKateryna b06cf0a06b add appId (#358) 2024-11-07 01:14:06 +08:00
Dogukan Karatas 5d976141fc adds logic for rendering rebars as lines and arcs (#356)
Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-11-06 16:26:33 +00:00
Jedd Morgan be8f9e2b5a Fixed test failing on german culture (#355) 2024-11-06 13:25:22 +00:00
KatKatKateryna 6bf18096e7 CNX-501 Temp folder arcgis (#351)
* fixed path

* fixes
2024-11-05 18:15:17 +00:00
KatKatKateryna b7f0f5df90 receive operation fix (#350) 2024-11-06 01:45:13 +08:00
KatKatKateryna c4c06f0dc4 supporting ICurves as fallback (#339)
Co-authored-by: Alan Rynne <alan@speckle.systems>
2024-11-05 16:31:20 +00:00
Claire Kuang ed569cde55 fix(revit): handles plane origin out of bounds and creating group with no elements exceptions (#346)
* handles plane origin out of bounds exception and does not create group when no objects have been successfully converted

also makes room display values transparent

* fixes transparent render material for rooms

* Update DisplayValueExtractor.cs
2024-11-05 16:22:11 +00:00
Claire Kuang 558a16d273 moves pointcloud converter to top level (#349) 2024-11-05 16:54:48 +01:00
Dimitrie Stefanescu 9290261fef Merge pull request #348 from specklesystems/oguzhan/cnx-680-warn-users-on-receiving-v2-commits-in-v3
Chore: Add version info to root object
2024-11-05 13:07:53 +00:00
Dimitrie Stefanescu e2251c111c Merge branch 'dev' into oguzhan/cnx-680-warn-users-on-receiving-v2-commits-in-v3 2024-11-05 13:02:09 +00:00
Claire Kuang 21ed17bb2c refactor(objects): cnx 687 purge unused classes from objects (#333)
* updates constructors and deprecates any unused code & functionality

* updates arcs and polycurves

* removes set only circle props

* updates box conversions

* fixes model curves and transforms

* Update ModelCurveToSpeckleTopLevelConverter.cs

* bumps nugets

* fixes package locks and arc

* updates rhino arc test
2024-11-05 19:59:29 +08:00
Claire Kuang 8cfe0bfe11 removes start angle and end angle reliance in revit arc converter (#345) 2024-11-04 12:01:24 +00:00
Claire Kuang 54ce865e45 Updates README.md to align with github repo (#343)
https://linear.app/speckle/issue/CNX-699/update-github-links-to-point-to-v3
2024-11-01 16:50:15 +00:00
Dogukan Karatas ae6d788aff adds vertices every edge of a face (#342) 2024-11-01 15:20:05 +00:00
Dogukan Karatas f0cfc860a1 Feat(tekla): cnx 703 add color proxies (#341)
* adds geometry conversions and colors

* build fix

* Update ModelObjectToSpeckleConverter.cs

* fixes app id bug in connector

* Update ModelObjectToSpeckleConverter.cs

* excludes unnecessary object types

* adds rendermaterialproxy

* TeklaMaterialUnpacker

* updates argb values

* adds extensions and removes colorhandler

* adds excluded types as a list

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
Co-authored-by: oguzhankoral <oguzhankoral@gmail.com>
2024-11-01 16:02:48 +01:00
Adam Hathcock becdc060e9 Update SDK (#336)
* Update SDK

* update sqlite to match v2
2024-10-31 15:41:34 +00:00
Oğuzhan Koral 9d25e61043 Feat(revit): view filter (#322)
* POC view filter

* Use only view dropdown

* Init selection filters as default

* 2nd option for views

* Do not use WhereElementIsNotElementType

* Refresh send filters if elements modified

* Remove experimental view selection send filter

* chore: fixes expiration changes for view filters

* Remove everything filter

* Drop note for not using DI on deserialization

* Note about CheckFilterExpiration

* Fix cathastrophic failure on debugger

* Idle subscriptions on another event to fix main thread problems

* Implement APIContext

* APIContext in revit views filter

* Call GetObjectIds as async

* Remove CheckExpiry from everywhere

* Format

* Add ids to IdMap for newly added elements

* Await Commands.RefreshSendFilters

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
Co-authored-by: Dimitrie Stefanescu <didimitrie@gmail.com>
2024-10-30 21:04:08 +03:00
Claire Kuang 0debe8f7f9 feat(tekla): adds component unpacker to tekla connector (#335)
* adds component unpacker to tekla connector

* removes model object converter

* Update ComponentUnpacker.cs

* Update ComponentUnpacker.cs
2024-10-30 17:47:38 +00:00
Dogukan Karatas 9e68b55018 Dogukan/cnx 690 create top level converters for all tekla objects (#334)
* adds top level modelobject converter

* adds contour plate converter

* simpler approach for mesh extractor

* adds exception for unsupported types

* add default properties to root

* adds property extractor

* formats files

* adds lineToSpeckleConverter
2024-10-30 16:15:41 +00:00
Dogukan Karatas 5783b83168 Dogukan/cnx 646 - Tekla Converter Project (#328)
* creates tekla converter

* adds send operation

* services registrated

* updates the panel host

* adds beam converter

* updates beam converter

* basic info attached

* creates the mesh from solid

* updates the mesh converter

* attachs colors to mesh

* updates formatting

* updates formatting again

* updates assemblyinfo

* clean locks

* Merge branch 'dogukan/cnx-646-set-up-tekla-converter-project' of https://github.com/specklesystems/speckle-sharp-connectors into dogukan/cnx-646-set-up-tekla-converter-project

* updates package.lock

* adds global using

* formats and cleans latest dev

* updates teklasendbinding

* update csproj

* adds converter project to Local.sln

* update packages

* updates csproj

* objects package removed

* Revert "adds converter project to Local.sln"

This reverts commit 94fa0a2d7a.

* updates local.sln

* removed unnecessary container initialization

* deactivated the argb attach to mesh

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-10-28 19:58:56 +00:00
Alan Rynne f7060c7287 Merge pull request #330 from specklesystems/release/3.0.0
Update dev with changes from release branch
2024-10-28 12:30:52 +01:00
Claire Kuang e2866d2595 chore(civil3d): refactor to yield return (#329)
* processes basecurves to appropriate display values in autocad and adds arcs to supported fallback curves in rhino

* turns on recursive conversion resolution by default

* minor refactor

---------

Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com>
2024-10-28 09:55:29 +00:00
Claire Kuang 76701627b6 adds missing surface properties and extension dictionaries (#324) 2024-10-28 10:48:41 +01:00
oguzhankoral 7f91ac734a Add version info to root object 2024-10-26 22:26:58 +03:00
Claire Kuang af7bc47cbf fix(civil3d/rhino): adds correct curves to displayvalue and receiving arcs as fallback in rhino (#326)
* processes basecurves to appropriate display values in autocad and adds arcs to supported fallback curves in rhino

* turns on recursive conversion resolution by default
2024-10-25 15:07:45 +01:00
Claire Kuang a14b0a6fd0 feat(rhino): adds names to all objects on bake (#327)
* adds names to all objects on bake

* Update RhinoHostObjectBuilder.cs

* refactors to pass in attributes for bake from parent

* adds name property to all rhino objects on send
2024-10-25 14:43:37 +03:00
Alan Rynne 855fedf3aa feat: CXPLA-119 Adds civil3d to CI build job (#323) 2024-10-25 09:32:14 +01:00
Claire Kuang 900427ad30 fix(autocad): arc to host conversions fixed to remove dependency on incoming arc plane and angle props (#325)
* removes dependencies on incoming arc plane and angle props

* fixes incorrect root to speckle naming

* Update Speckle.Converters.AutocadShared.projitems
2024-10-24 17:22:54 +01:00
Adam Hathcock 08bf19f74f Use new Deserialization with Tasks (#308)
* Fixes for new Deserialization usage

* Use new serialization from nuget

* format

* better progress when checking cache and downloading

* remove the speed as it's inaccurate

* update sdk dependencies
2024-10-24 14:14:18 +00:00
Claire Kuang 68f7cb8f41 fix(civil3d): refactors corridors to only use extracted solids once (#318)
* refactors corridors to only use extracted solids once

changes applied assemblies and subassemblies to dicts

* Update CorridorHandler.cs

* refactors corridor display value extractor to its own class

* changes scope
2024-10-24 14:04:20 +01:00
Claire Kuang 3088fae8a2 adds basecurves as display value when no display value exists (#321) 2024-10-24 10:38:52 +00:00
Claire Kuang 6d375312ae fix(civil3d): alignment arc logic fixed (#320)
* fixing alignment arc calculations

* fixes alignment arc conversions

* adds units
2024-10-24 11:33:31 +01:00
Claire Kuang 797a2b70f3 adds basecurves for parcel segments (#319) 2024-10-23 12:25:16 +01:00
Oğuzhan Koral 29cf1327ff Fix(revit): CNX-657 revit expiration checks seem to be not fully working for (#316)
* Map element id to unique id

* Evict sub elements too

* Document IdMap

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-10-22 16:58:31 +03:00
Claire Kuang 613d45da37 chore(civil3d): constants fixes and additional conversion polishing (#317)
* adds featurelines and additional subassembly info

* some constants fixes
2024-10-22 09:35:12 +01:00
Dogukan Karatas f29926748c Dogukan/cnx 642 detect selections in Tekla (#312)
* added tekla send binding and necessary updates about selection

* TeklaSelectionFilter registered

* resolved injections

* build props added

* formatted

* deep clean

---------

Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
2024-10-21 16:21:19 +02:00
Alan Rynne 9855ca8c15 Merge pull request #315 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-21 14:07:09 +02:00
Adam Hathcock 7644decc64 Update SDK to get tracing to backend (#313)
* Update SDK to get tracing to backend

* Update Civil versions
2024-10-21 13:18:46 +02:00
Claire Kuang 81bf501c85 feat(civil3d): adds 2022, 2023, and 2025 versions (#306)
* adds 2022,2023,and 2025 versions for civil3d

* removes unnecessary assembly info

* fixes version api issues

* fixes more version api issues

* Update CivilEntityToSpeckleTopLevelConverter.cs

* more fixes

* updates local
2024-10-21 10:14:47 +01:00
Dimitrie Stefanescu ecf508ca93 Merge pull request #311 from specklesystems/dimitrie/cnx-659-rhino-expiration-checks-might-not-run-given-inconsistent-doc
chore(rhino): ensure more robust expiration checks in rhino
2024-10-18 16:56:57 +01:00
Dimitrie Stefanescu 2724b03301 Merge branch 'dev' into dimitrie/cnx-659-rhino-expiration-checks-might-not-run-given-inconsistent-doc 2024-10-18 16:52:49 +01:00
Dimitrie Stefanescu b2eb5efa12 Merge pull request #310 from specklesystems/dimitrie/cnx-653-rhino-incorrect-transformation-applied-rename-ticket-as-you
fix(rh): scaling incorrectly when copy pasting from one doc to another
2024-10-18 16:52:34 +01:00
Dimitrie Stefanescu 661273f7bd chore(rhino): ensure more robust expiration checks in rhino 2024-10-18 16:48:53 +01:00
Dimitrie Stefanescu 5e37195591 fix(rh): scaling incorrectly when copy pasting from one doc to another 2024-10-18 16:41:03 +01:00
Dimitrie Stefanescu 0d85ad48de Merge pull request #309 from specklesystems/dimitrie/cnx-635-curtain-wall-doors-duplicated-geometry
Dimitrie/cnx 635 curtain wall doors duplicated geometry
2024-10-18 14:50:03 +01:00
Dimitrie Stefanescu 02ad0445b9 Merge branch 'dev' into dimitrie/cnx-635-curtain-wall-doors-duplicated-geometry 2024-10-18 14:36:28 +01:00
Dimitrie Stefanescu 2bfe780faf chore: removes using statement 2024-10-18 14:29:22 +01:00
Dimitrie Stefanescu 284c1cfaf6 chore: comment 2024-10-18 14:14:05 +01:00
Dimitrie Stefanescu a37d1c5f85 fix: card preview not working on deleted element ids 2024-10-18 12:22:27 +01:00
Dimitrie Stefanescu 639e2c05bf fix(revit): send fail on deleted elements CNX-656
cc @bimgeek -> we should probably catch this in tests
2024-10-18 12:09:11 +01:00
Dimitrie Stefanescu 7e5fb055c8 fix: handles families hosted on curtain wall elements
weirdness of revit api continues to impress
2024-10-18 11:53:39 +01:00
Dimitrie Stefanescu 528c692f13 Merge pull request #307 from specklesystems/dimitrie/cnx-649-assembly-structure-two-layers-with-the-same-material-name
fix(dui3): ensures we don't override structure layers
2024-10-18 11:39:41 +01:00
Dimitrie Stefanescu dd17d364c7 fix(dui3): ensures we don't override structure layers
where there's two materials of the same type in the same type, they would override each other; nevertheless, having two plywood layers for one wall is totally acceptable.
2024-10-17 16:53:45 +01:00
Claire Kuang 6e56c3c190 feat(civil3d): adds subassembly and parcel props (#305)
* adds general and class properties extractors

* Update Speckle.Converters.Civil3dShared.projitems

* adds class properties for catchments

* adds catchment group proxies

* catchment proxy bug fix

* adds site props

* Update ClassPropertiesExtractor.cs

* Update ClassPropertiesExtractor.cs

* adds network, structure, and pipes

* registers pipe network

* adds alignment basecurves and properties

* adds profiles to alignments

* adds corridors

* fixes di and other corridor bugs

* parses corridor solid property sets

* Update CorridorHandler.cs

* Update CorridorHandler.cs

* adds body raw converter to autocad

* adds calculated info

* adds subassembly props

* adds subassemblies, and parcels

* adds volume surface stats

* removes unnecessary

* resolve merge conflict

* handles name exception from some entity types

* Update DBBodyToSpeckleRawConverter.cs
2024-10-16 17:57:49 +02:00
Claire Kuang 617bb5f12d feat(civil3d): adds corridors (#302)
* adds general and class properties extractors

* Update Speckle.Converters.Civil3dShared.projitems

* adds class properties for catchments

* adds catchment group proxies

* catchment proxy bug fix

* adds site props

* Update ClassPropertiesExtractor.cs

* Update ClassPropertiesExtractor.cs

* adds network, structure, and pipes

* registers pipe network

* adds alignment basecurves and properties

* adds profiles to alignments

* adds corridors

* fixes di and other corridor bugs

* parses corridor solid property sets

* Update CorridorHandler.cs

* Update CorridorHandler.cs

* adds body raw converter to autocad

* adds calculated info

* Update PropertySetDefinitionHandler.cs

* Update DBBodyToSpeckleRawConverter.cs
2024-10-16 14:31:17 +00:00
Alan Rynne fa1fa359fc Refactor usage of exceptions in converters/connectors (#286)
* feat: Non-controversial rebased changes from alan/exception-handling

* fix: Fixed all other usages after rebase

* fix: Re-added exception throw on 0 objects converted

* fix: Missing using statement

* fix: Converter manager

* fix: Using statements

* fix: Exception usages coming in from merge
2024-10-16 12:01:21 +02:00
Alan Rynne e9084847cf Merge pull request #304 from specklesystems/dev
Update release/3.0.0 branch with changes from dev
2024-10-15 10:57:41 +02:00
Alan Rynne da0a35a5d1 added store_artifacts input to build installers trigger (#303) 2024-10-15 10:49:13 +02:00
Claire Kuang 5fb3616c1a feat(civil3d): adds all properties for sites, catchments, surfaces, and network parts (#301)
* adds general and class properties extractors

* Update Speckle.Converters.Civil3dShared.projitems

* adds class properties for catchments

* adds catchment group proxies

* catchment proxy bug fix

* adds site props

* Update ClassPropertiesExtractor.cs

* Update ClassPropertiesExtractor.cs

* adds network, structure, and pipes

* registers pipe network

* renamed proxy handlers with cache property

* updates part dictionary props
2024-10-14 18:19:01 +01:00
Adam Hathcock 4f04e9e1b5 Use Metrics in Connectors (#296)
* add metrics to host apps

* merge fixes and compiles

* Use ME.Console and OTel for logging to correlate

* clean up

* clean up for metrics

* fix self-review comments

* fix seq initialization

* clean up for http traces and rhino 8

* use latest SDK

* formatting
2024-10-14 13:36:07 +00:00
Dimitrie Stefanescu 0c5b5ed59c Merge pull request #278 from specklesystems/dim/brep-exp
wip: better rhino > revit brep support
2024-10-14 09:44:08 +01:00
Dimitrie Stefanescu de167cdfb6 Merge branch 'dev' into dim/brep-exp 2024-10-14 09:39:16 +01:00
Dimitrie Stefanescu 0a27fc1c2b Merge pull request #300 from specklesystems/dimitrie/cnx-510-revit-parameter-exports-perfection
Dimitrie/cnx 510 revit parameter exports perfection
2024-10-12 11:27:39 +01:00
Claire Kuang 1e537009e0 Merge branch 'dev' into dimitrie/cnx-510-revit-parameter-exports-perfection 2024-10-12 11:23:03 +01:00
Dimitrie Stefanescu 188f23faf4 Merge pull request #290 from specklesystems/bilal/cnx-569-element-id-not-set
added elementId
2024-10-11 14:32:47 +01:00
Dimitrie Stefanescu dca243825a chore: fmt 2024-10-11 14:27:34 +01:00
Dimitrie Stefanescu 650022ee10 chore: adds comment 2024-10-11 14:27:00 +01:00
Dimitrie Stefanescu 98a7064f43 Merge branch 'dev' into bilal/cnx-569-element-id-not-set 2024-10-11 14:26:28 +01:00
Dimitrie Stefanescu 9804acd10c feat: makes material quantities a map (used to a be a list)
tbh, this just makes it easier to show in the frontend - but worthwhile for now
2024-10-11 14:14:23 +01:00
Dimitrie Stefanescu 51550c96a6 feat: adds support for assembly structure (CNX-570)
(extracting material thickness and composition)
2024-10-11 13:59:44 +01:00
Dimitrie Stefanescu 491490c559 fix: CNX-565 and CNX-564 2024-10-11 13:14:21 +01:00
Dimitrie Stefanescu ec1f13754d Merge branch 'dev' into dimitrie/cnx-510-revit-parameter-exports-perfection 2024-10-11 11:54:36 +01:00
Dimitrie Stefanescu b840988bbe Merge branch 'dev' into dim/brep-exp 2024-10-11 11:53:36 +01:00
Adam Hathcock bd4b565799 Fix activity scope (#299)
* AsyncLocal in activity scope needs proper initialization

* add tests

* Fix Scope for real
2024-10-11 10:53:28 +00:00
Dimitrie Stefanescu 102a7cbd9e fix: fmt 2024-10-11 11:53:02 +01:00
Claire Kuang 8c34416b1a feat(civil3d): adds property sets and parts data to all civil objects (#297)
* adds parts data and better display mesh and base curve conversions

* fixes di issues

* removes arc pipes for now

* Update BaseCurveExtractor.cs

* Update PartDataExtractor.cs

* adds property sets and defs

* additional bug fixes

* renames parameters folder to properties

* Update Speckle.Converters.Civil3dShared.projitems

---------

Co-authored-by: Adam Hathcock <adamhathcock@users.noreply.github.com>
2024-10-11 11:10:52 +01:00
Dimitrie Stefanescu 77af0b4ae4 Merge branch 'dev' into dimitrie/cnx-510-revit-parameter-exports-perfection 2024-10-11 11:07:23 +01:00
Adam Hathcock ed2d3ed931 AsyncLocal in activity scope needs proper initialization (#298) 2024-10-11 09:28:59 +01:00
Dimitrie Stefanescu 0d584bb0ac fix: CNX-559 2024-10-10 18:12:06 +01:00
Dimitrie Stefanescu a95e7cc225 fix: CNX-556 2024-10-10 17:41:37 +01:00
Dimitrie Stefanescu c2caeb5900 fix: CNX-567 2024-10-10 16:56:50 +01:00
Dimitrie Stefanescu fe6e195c0a Merge branch 'dev' into dim/brep-exp 2024-10-10 16:54:25 +01:00
Dimitrie Stefanescu 027a550c97 Merge branch 'dev' into bilal/cnx-569-element-id-not-set 2024-10-10 14:45:02 +01:00
Dimitrie Stefanescu 1074932eb5 fix: review comments
- split classes into separate files
- fixed namespacing in revit
- adds note on brep converter's repair call
2024-10-10 12:34:50 +01:00
Dimitrie Stefanescu 9f0b0837d8 Merge pull request #295 from specklesystems/fix-brep-revamp
Fix brep revamp
2024-10-10 11:50:30 +01:00
Adam Hathcock d3f32288bf fix test references 2024-10-10 10:41:08 +01:00
Adam Hathcock c251db709e update sdk reference 2024-10-10 10:38:32 +01:00
KatKatKateryna 56d0eb0d0b ArcGIS GroupLayers (#293)
* treat all LayerContainers as Collections

* account for all Symbols null exceptions

* documenting the change
2024-10-10 16:41:35 +08:00
Dimitrie Stefanescu bbd4beeafe fix: adds using statements to correctly dispose at end of the scope 2024-10-10 09:34:42 +01:00
Adam Hathcock 460719e0f0 Clean up attributes for logs/traces and user id correlation (#285)
* Clean up attributes for logs/traces

* fmt

* add tags for factory

* builds

* Move sending activity to get account info centralized

* formatting

* remove global user id

* use AsyncLocal and scope to scope userId

* remove user id as we don't know at initialization time
2024-10-10 08:21:05 +00:00
Dimitrie Stefanescu eed7f913e5 chore: more formatting 2024-10-09 18:37:42 +01:00
Dimitrie Stefanescu e153eebe87 chore: formatting 2024-10-09 18:34:50 +01:00
Dimitrie Stefanescu c7eee14f7c Merge branch 'dev' into dim/brep-exp 2024-10-09 18:12:22 +01:00
KatKatKateryna 48b4be68bd add await (#294) 2024-10-09 17:09:15 +00:00
Dimitrie Stefanescu 685da9af3e chore: package locks push 2024-10-09 18:08:18 +01:00
Dimitrie Stefanescu ddaf329167 Merge branch 'dev' into dim/brep-exp 2024-10-09 17:14:00 +01:00
Dimitrie Stefanescu 794af5e501 fix: adds whatever support we can for curves inside blocks
by pre transforming the raw elements
2024-10-09 16:59:30 +01:00
Jedd Morgan 3028e9e29d Asyicify ExecuteScriptAsync calls (#240)
* First pass adding async

* Updated Idle manager to work with async Tasks

* CA1506

* missing async

* Fixed tests

* Really fixed tests

* CA2201

* Really fixed the tests

* remaining awaits

* Async everywhere!

* Fixed merge errors

* fix: Missing imports

* IProgress sync used

* rename progress

* format

* Remove empty files

* update sdk

* convert progress

* use FireAndForget and readonly struct

* revert revit to use RevitTask

* don't use sync to UI thread for progress

* Fixes autocad loop to update UI with Task.Delay instead of Task.Yield

* format

* merge fixes

* update nugets

* fix imports for exceptions

* fix import

---------

Co-authored-by: Alan Rynne <alan@speckle.systems>
Co-authored-by: Adam Hathcock <adam@hathcock.uk>
2024-10-09 16:10:13 +01:00
Claire Kuang 704a75a2b4 feat(civil): adds basic element converter and fixes DI (#292)
* splits autocad and civil registration for root object builder

* Update Speckle.Connectors.AutocadShared.projitems

* adds civil top level converter

* add civil3d connector

* fixes as was on wrong branch

* fixed solution for new shared project

* default registration for autocad/civil

* some fixes

* moved classes around

* adds basic civil element converter

* csharpier reformat

* removes units from root collection, restructures civil shared project

* Update AutocadConnectorModule.cs

* refactors root object builder to be abstract

* removes unnecessary usings

---------

Co-authored-by: Adam Hathcock <adam@hathcock.uk>
2024-10-09 14:19:01 +02:00
Dimitrie Stefanescu 63ae8e3ca5 fix: adds back support for non-instanced curves 2024-10-08 20:15:16 +01:00
Dimitrie Stefanescu 0f09a15f20 fix: improves performance for fallback scenarios 2024-10-08 16:26:40 +01:00
Dimitrie Stefanescu 23fbe106a7 fix: removes fallback for meshes due to performance reasons 2024-10-08 15:52:58 +01:00
Dimitrie Stefanescu c7665a7845 feat: adds fallback checking in importer and assign materials
f
2024-10-08 11:01:14 +01:00
Dimitrie Stefanescu 41da92e43a feat: faster mesh scaling 2024-10-08 11:00:45 +01:00
Dimitrie Stefanescu 9780cb6e35 feat: minor cleanup 2024-10-08 11:00:26 +01:00
Dimitrie Stefanescu 7d2f5a4385 feat: adds userland controllable transaction names 2024-10-08 11:00:02 +01:00
Dimitrie Stefanescu 7144d81059 feat(dui3): pinns created groups 2024-10-08 10:59:32 +01:00
Dimitrie Stefanescu ae162e3a46 fix: clears direct shape lib to fix second receive and catches objs with no material 2024-10-07 18:08:19 +01:00
Mucahit Bilal GOKER 311963f8ea added elementId 2024-10-07 17:49:11 +03:00
Dimitrie Stefanescu 2e70c24f29 Merge pull request #289 from specklesystems/oguzhan/brep-exp
Oguzhan/brep exp
2024-10-07 11:20:06 +01:00
Dimitrie Stefanescu 7300d53a50 Merge pull request #288 from specklesystems/oguzhan/cnx-549-set-selected-account-to-be-the-default-account
Feat(Config): Accounts config to keep latest user selected account persistent on UI
2024-10-07 11:18:15 +01:00
oguzhankoral b338f7750d Format 2024-10-03 11:49:27 +03:00
oguzhankoral b9bb8d52f4 Remove unused file 2024-10-02 20:59:17 +03:00
oguzhankoral 48396e7eaa Fix pre-existing parent group id in the list of ids to delete 2024-10-02 14:52:14 +03:00
oguzhankoral 27f959990f Remove invalid chars from group name 2024-10-02 14:45:35 +03:00
oguzhankoral e7d165d99b Bake single group for received version 2024-10-02 14:43:06 +03:00
oguzhankoral 7df01df8fc More cleanup 2024-10-02 14:23:01 +03:00
oguzhankoral 896de431be Clean up 2024-10-02 14:01:34 +03:00
oguzhankoral e0e6f416c0 Format 2024-10-01 18:41:55 +03:00
oguzhankoral 07ded4986d Fix the transform object 2024-10-01 18:39:26 +03:00
oguzhankoral 0eb2b867c8 Clean up on host object builder 2024-10-01 12:18:03 +03:00
oguzhankoral aaf6759075 Accounts config to keep latest user selected account persistent on UI 2024-10-01 00:01:36 +03:00
oguzhankoral bce9ed7a6f Create direct shape definitions 2024-09-30 16:53:23 +03:00
oguzhankoral 9edba5d992 Dev mode active in Local env 2024-09-30 12:37:18 +03:00
Oğuzhan Koral f9bcb47903 Merge branch 'dev' into dim/brep-exp 2024-09-30 11:58:07 +03:00
Dimitrie Stefanescu 4333bfbeb3 wip: revit materials hack for painting post conversion 2024-09-27 17:01:51 +01:00
Dimitrie Stefanescu 5b2ab8b401 Merge branch 'dev' into dim/brep-exp 2024-09-27 15:57:16 +01:00
Dimitrie Stefanescu 7bf287f706 wip 2024-09-27 15:32:09 +01:00
Alan Rynne 94117e0345 Merge pull request #247 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 branch with latest dev changes
2024-09-25 11:49:43 +02:00
Dimitrie Stefanescu 6defdbe353 wip: better rhino > revit brep support 2024-09-24 22:38:34 +01:00
Alan Rynne ac1e402d1d fix: Prevent increment when release commit is tagged (#246) 2024-09-18 10:35:22 +02:00
Alan Rynne d358a75769 Merge pull request #235 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-09-11 14:26:50 +02:00
Alan Rynne c42ad3f042 chore(ci): Add release branches to CI trigger
.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
2024-09-10 18:19:16 +02:00
Alan Rynne e75ca72abd Merge branch 'dev' into release/3.0.0 2024-09-10 17:21:59 +02:00
906 changed files with 48594 additions and 11977 deletions
+3 -3
View File
@@ -9,10 +9,10 @@
],
"rollForward": false
},
"gitversion.tool": {
"version": "6.0.2",
"dotnet-affected": {
"version": "5.0.0",
"commands": [
"dotnet-gitversion"
"dotnet-affected"
],
"rollForward": false
}
+3 -2
View File
@@ -254,9 +254,10 @@ 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
dotnet_diagnostic.CS0809.severity = suggestion # obsolete errors
dotnet_diagnostic.CS0618.severity = suggestion # obsolete errors
# Performance rules
+29 -26
View File
@@ -4,33 +4,36 @@
# * @specklesystems/connectors
# Core
# Not needed, falls back on team approval
# Objects
# Converters require product owner approval, anything else falls back to team approval
Objects/ConverterAutocadCivil/* @clairekuang @connorivy
Objects/ConverterCSI/* @connorivy
Objects/ConverterDynamo/* @teocomi @alanrynne
Objects/ConverterMicrostation/* @connorivy
Objects/ConverterRevit/* @connorivy @teocomi
Objects/ConverterRhinoGh/* @alanrynne @clairekuang
Objects/ConverterTeklaStructures/* @connorivy
Objects/StructuralUtilities/PolygonMesher/* @connorivy
# Connectors
ConnectorAutocadCivil/* @clairekuang
ConnectorArchicad/* @jozseflkiss
ConnectorCSI/* @connorivy
ConnectorDynamo/* @teocomi @alanrynne
ConnectorGrasshopper/* @alanrynne @clairekuang
ConnectorMicrostation/* @clairekuang
ConnectorRevit/* @teocomi @connorivy
ConnectorRhino/* @clairekuang @alanrynne
ConnectorTeklaStructures/* @connorivy
/Connectors/ArcGIS/* @KatKatKateryna
/Connectors/Autocad/* @clairekuang @oguzhankoral @didimitrie
/Connectors/Civil3d/* @clairekuang @oguzhankoral @didimitrie
/Connectors/CSi/* @bjoernsteinhagen @dogukankaratas
/Connectors/Navisworks/* @jsdbroughton
/Connectors/Revit/* @clairekuang @oguzhankoral @didimitrie
/Connectors/Rhino/* @clairekuang @oguzhankoral @didimitrie
/Connectors/Tekla/* @bjoernsteinhagen @dogukankaratas
# DesktopUI
# Converters
/Convertors/ArcGIS/* @KatKatKateryna
/Convertors/Autocad/* @clairekuang @oguzhankoral @didimitrie
/Convertors/Civil3d/* @clairekuang @oguzhankoral @didimitrie
/Convertors/CSi/* @bjoernsteinhagen @dogukankaratas
/Convertors/Navisworks/* @jsdbroughton
/Convertors/Revit/* @clairekuang @oguzhankoral @didimitrie
/Convertors/Rhino/* @clairekuang @oguzhankoral @didimitrie
/Convertors/Tekla/* @bjoernsteinhagen @dogukankaratas
DesktopUI2/* @teocomi @clairekuang
# DUI
/DUI3/* @clairekuang @oguzhankoral @didimitrie
# Importers
/Importers/* @JR-Morgan @didimitrie @oguzhankoral @adamhathcock
# SDK
/SDK/* @JR-Morgan @clairekuang @didimitrie @oguzhankoral @adamhathcock
# Build
/Build/* @JR-Morgan @oguzhankoral @adamhathcock
+29 -38
View File
@@ -1,30 +1,46 @@
<!---
Provide a short summary in the Title above. Examples of good PR titles:
Provide a short summary in the Title above. Use the following template:
* "Feature: adds metrics to component"
category(project): summary
* "Fix: resolves duplication in comment thread"
Categories:
* "Update: apollo v2.34.0"
* feat: (new feature for the user, not a new feature for build script)
* fix: (bug fix for the user, not a fix to a build script)
* docs: (changes to the documentation)
* style: (formatting, missing semi colons, etc; no production code change)
* refactor: (refactoring production code, eg. renaming a variable)
* test: (adding missing tests, refactoring tests; no production code change)
* chore: (updating grunt tasks etc; no production code change)
Example:
feat(revit): added category filter to send
-->
## Description & motivation
## Description
<!---
Describe your changes, and why you're making them. What benefit will this have to others?
Describe your changes, and why you're making them.
Is this linked to an open Github issue, a thread in Speckle community,
or another pull request? Link it here.
If it is related to a Github issue, and resolves it, please link to the issue number, e.g.:
Fixes #85, Fixes #22, Fixes username/repo#123
Connects #123
Link related github issues here ->
Fixes #85, Fixes #22, Connects #123
-->
## User Value
<!---
Describe in 1 sentence the user value.
This can also be a link to the relevant thread in Speckle community, or a link to the Linear issue.
-->
## Changes:
<!---
@@ -68,35 +84,10 @@ Describe what tests have been added or amended, and why these demonstrate it wor
<!---
This checklist is mostly useful as a reminder of small things that can easily be
forgotten it is meant as a helpful tool rather than hoops to jump through.
Put an `x` between the square brackets, e.g. [x], for all the items that apply,
make notes next to any that haven't been addressed, and remove any items that are not relevant to this PR.
This checklist is a useful reminder of related tasks to uphold our repo quality. Amend this list as needed for the pr.
-->
- [ ] My pull request follows the guidelines in the [Contributing guide](https://github.com/specklesystems/speckle-server/blob/main/CONTRIBUTING.md)?
- [ ] My pull request does not duplicate any other open [Pull Requests](../../pulls) for the same update/change?
- [ ] My commits are related to the pull request and do not amend unrelated code or documentation.
- [ ] My code follows a similar style to existing code.
- [ ] I have added appropriate tests.
- [ ] I have updated or added relevant documentation.
## References
<!---
(Optional -- remove this section if not needed )
Include **important** links regarding the implementation of this PR.
This usually includes a RFC or an aggregation of issues and/or individual conversations
that helped put this solution together. This helps ensure we retain and share knowledge
regarding the implementation, and may help others understand motivation and design decisions etc..
-->
@@ -1,9 +1,7 @@
name: .NET Build
on:
pull_request: # Run build on every pull request that is not to main
branches-ignore:
- main
pull_request
jobs:
build:
@@ -19,7 +17,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
- name: Cache Nuget
uses: actions/cache@v4
@@ -34,11 +32,13 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
- name: Cache Nuget
uses: actions/cache@v4
@@ -46,11 +46,14 @@ 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
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
file: Converters/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
@@ -2,12 +2,14 @@ name: .NET Build and Publish
on:
push:
branches: ["main", "dev"] # Continuous delivery on every long-lived branch
branches: ["main", "installer-test/**"]
tags: ["v3.*"] # Manual delivery on every 3.x tag
jobs:
build:
build-windows:
runs-on: windows-latest
env:
SPECKLE_VERSION: "unset"
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
@@ -19,7 +21,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
- name: Cache Nuget
uses: actions/cache@v4
@@ -27,37 +29,35 @@ jobs:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: ⚒️ Run GitVersion
run: ./build.ps1 build-server-version
- name: ⚒️ Run build
run: ./build.ps1
- name: ⚒️ Run build on Windows
run: ./build.ps1 zip
- name: ⬆️ Upload artifacts
uses: actions/upload-artifact@v4
with:
name: output-${{ env.GitVersion_FullSemVer }}
name: output-${{ env.SPECKLE_VERSION }}
path: output/*.*
compression-level: 0 # no compression
if-no-files-found: error
retention-days: 1
compression-level: 0 # no compression
- id: set-version
name: Set version to output
run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
run: echo "version=${{ env.SPECKLE_VERSION }}" >> "$Env:GITHUB_OUTPUT"
deploy-installers:
runs-on: ubuntu-latest
needs: build
needs: build-windows
env:
IS_TAG_BUILD: ${{ github.ref_type == 'tag' }}
IS_PUBLIC_RELEASE: ${{ github.ref_type == 'tag' }}
IS_TEST_INSTALLER: ${{ github.ref_type != 'tag' }}
steps:
- name: 🔫 Trigger Build Installers
uses: ALEEF02/workflow-dispatch@v3.0.0
continue-on-error: true
with:
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 }} }'
inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build-windows.outputs.version }}", "public_release": ${{ env.IS_PUBLIC_RELEASE }}, "store_artifacts": ${{ env.IS_TEST_INSTALLER }} }'
ref: main
wait-for-completion: true
wait-for-completion-interval: 10s
@@ -69,16 +69,18 @@ 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
with:
dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules)
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
- name: Cache Nuget
uses: actions/cache@v4
@@ -86,11 +88,18 @@ jobs:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
- name: ⚒️ Run build
- 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@v4
uses: codecov/codecov-action@v5
with:
file: Converters/**/coverage.xml
files: Converters/**/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
- name: Push to nuget.org
if: (github.ref_type == 'tag')
run: dotnet nuget push output/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.CONNECTORS_NUGET_TOKEN }} --skip-duplicate
+2 -1
View File
@@ -19,4 +19,5 @@ tools
.DS_Store
*.snupkg
coverage.xml
output/
output/
Images/Thumbs.db
+116
View File
@@ -0,0 +1,116 @@
using GlobExpressions;
using Microsoft.Build.Construction;
using static SimpleExec.Command;
namespace Build;
public static class Affected
{
public static readonly string Root = Environment.CurrentDirectory;
public const string AFFECTED_PROJECT = "affected.proj";
private static IEnumerable<string> GetAffectedProjects()
{
var projFile = Path.Combine(Root, AFFECTED_PROJECT);
Console.WriteLine("Affected project file: " + projFile);
var project = ProjectRootElement.Open(projFile) ?? throw new InvalidOperationException();
var references = project.ItemGroups.SelectMany(x => x.Items).Where(x => x.ItemType == "ProjectReference");
foreach (var refe in references)
{
var referencePath = refe.Include[(Root.Length + 1)..];
referencePath = Path.GetDirectoryName(referencePath) ?? throw new InvalidOperationException();
if (Path.DirectorySeparatorChar != '/')
{
referencePath = referencePath.Replace(Path.DirectorySeparatorChar, '/');
}
yield return referencePath;
}
}
public static async Task<IEnumerable<string>> GetTestProjects()
{
await ComputeAffected();
var projFile = Path.Combine(Root, AFFECTED_PROJECT);
if (File.Exists(projFile))
{
var references = GetAffectedProjects();
return references.Where(x => x.Contains("Tests"));
}
return Glob.Files(Root, "**/*.Tests.csproj");
}
public static async Task<ProjectGroup[]> GetAffectedProjectGroups()
{
await ComputeAffected();
var projFile = Path.Combine(Root, AFFECTED_PROJECT);
if (File.Exists(projFile))
{
var references = GetAffectedProjects().ToList();
var groups = new List<ProjectGroup>();
foreach (var projectGroup in Consts.ProjectGroups)
{
foreach (var referencePath in references)
{
if (projectGroup.Projects.Any(x => x.ProjectPath.Contains(referencePath)))
{
groups.Add(projectGroup);
break;
}
}
}
foreach (var group in groups)
{
Console.WriteLine("Affected project group being built: " + group.HostAppSlug);
}
return groups.ToArray();
}
Console.WriteLine("Using all project groups: " + string.Join(',', Consts.ProjectGroups));
return Consts.ProjectGroups;
}
private static bool s_affectedComputed;
public static async Task ComputeAffected()
{
if (s_affectedComputed)
{
return;
}
var currentTag = await Versions.GetCurrentTag();
var currentVersion = await Versions.ComputeVersion();
var lastTag = await Versions.GetPreviousTag(currentTag);
var lastVersion = await Versions.ComputePreviousVersion(currentTag);
Console.WriteLine($"Last tag: {lastTag}, Current tag: {currentTag}");
Console.WriteLine($"Last parsed version: {lastVersion}, Current parsed version: {currentVersion}");
var sort = currentVersion.CompareSortOrderTo(lastVersion);
if (sort == -1)
{
Console.WriteLine($"Current version {currentVersion} is less than: {lastVersion}");
s_affectedComputed = true;
return;
}
var majorEquals = currentVersion.Major == lastVersion.Major;
if (!majorEquals)
{
Console.WriteLine($"Current version {currentVersion} is not matching major version: {lastVersion}");
s_affectedComputed = true;
return;
}
//use tags no matter the version if major versions match
var (currentCommit, _) = await ReadAsync("git", $"rev-list -n 1 {currentTag}");
var (lastCommit, _) = await ReadAsync("git", $"rev-list -n 1 {lastTag}");
await RunAsync("dotnet", $"affected -v --from {currentCommit.Trim()} --to {lastCommit.Trim()}", Root);
s_affectedComputed = true;
}
}
+1
View File
@@ -10,6 +10,7 @@
<PackageReference Include="Bullseye" />
<PackageReference Include="Glob" />
<PackageReference Include="Microsoft.Build" />
<PackageReference Include="Semver" />
<PackageReference Include="SimpleExec" />
</ItemGroup>
</Project>
+36 -2
View File
@@ -4,7 +4,7 @@ public static class Consts
{
public static readonly string[] Solutions = ["Speckle.Connectors.sln"];
public static readonly InstallerProject[] InstallerManifests =
public static readonly ProjectGroup[] ProjectGroups =
{
new("arcgis", [new("Connectors/ArcGIS/Speckle.Connectors.ArcGIS3", "net6.0-windows")]),
new(
@@ -31,11 +31,45 @@ public static class Consts
new("Connectors/Autocad/Speckle.Connectors.Autocad2024", "net48"),
new("Connectors/Autocad/Speckle.Connectors.Autocad2025", "net8.0-windows")
]
),
new(
"civil3d",
[
new("Connectors/Autocad/Speckle.Connectors.Civil3d2022", "net48"),
new("Connectors/Autocad/Speckle.Connectors.Civil3d2023", "net48"),
new("Connectors/Autocad/Speckle.Connectors.Civil3d2024", "net48"),
new("Connectors/Autocad/Speckle.Connectors.Civil3d2025", "net8.0-windows")
]
),
new(
"navisworks",
[
new("Connectors/Navisworks/Speckle.Connectors.Navisworks2020", "net48"),
new("Connectors/Navisworks/Speckle.Connectors.Navisworks2021", "net48"),
new("Connectors/Navisworks/Speckle.Connectors.Navisworks2022", "net48"),
new("Connectors/Navisworks/Speckle.Connectors.Navisworks2023", "net48"),
new("Connectors/Navisworks/Speckle.Connectors.Navisworks2024", "net48"),
new("Connectors/Navisworks/Speckle.Connectors.Navisworks2025", "net48")
]
),
new(
"teklastructures",
[
new("Connectors/Tekla/Speckle.Connector.Tekla2023", "net48"),
new("Connectors/Tekla/Speckle.Connector.Tekla2024", "net48")
]
),
new(
"etabs",
[
new("Connectors/CSi/Speckle.Connectors.ETABS21", "net48"),
new("Connectors/CSi/Speckle.Connectors.ETABS22", "net8.0-windows"),
]
)
};
}
public readonly record struct InstallerProject(string HostAppSlug, IReadOnlyList<InstallerAsset> Projects)
public readonly record struct ProjectGroup(string HostAppSlug, IReadOnlyList<InstallerAsset> Projects)
{
public override string ToString() => $"{HostAppSlug}";
}
+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()}"
);
}
}
+154 -94
View File
@@ -7,16 +7,17 @@ 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";
const string ZIP = "zip";
const string VERSION = "version";
const string RESTORE_TOOLS = "restore-tools";
const string BUILD_SERVER_VERSION = "build-server-version";
const string CLEAN_LOCKS = "clean-locks";
const string CHECK_SOLUTIONS = "check-solutions";
const string DEEP_CLEAN = "deep-clean";
const string DEEP_CLEAN_LOCAL = "deep-clean-local";
const string DETECT_AFFECTED = "detect-affected";
//need to pass arguments
/*var arguments = new List<string>();
@@ -26,18 +27,59 @@ if (args.Length > 1)
args = new[] { arguments.First() };
//arguments = arguments.Skip(1).ToList();
}*/
void Build(string solution, string configuration)
{
Console.WriteLine();
Console.WriteLine();
Console.WriteLine($"Building solution '{solution}' as '{configuration}'");
Console.WriteLine();
Run("dotnet", $"build \".\\{solution}\" --configuration {configuration} --no-restore");
}
void Restore(string solution)
{
Console.WriteLine();
Console.WriteLine($"Restoring solution '{solution}'");
Console.WriteLine();
Run("dotnet", $"restore \".\\{solution}\" --no-cache");
}
void DeleteFiles(string pattern)
{
foreach (var f in Glob.Files(".", pattern))
{
Console.WriteLine("Found and will delete: " + f);
File.Delete(f);
}
}
void DeleteDirectories(string pattern)
{
foreach (var f in Glob.Directories(".", pattern))
{
if (f.StartsWith("Build"))
{
continue;
}
Console.WriteLine("Found and will delete: " + f);
Directory.Delete(f, true);
}
}
void CleanSolution(string solution, string configuration)
{
Console.WriteLine("Cleaning solution: " + solution);
DeleteDirectories("**/bin");
DeleteDirectories("**/obj");
DeleteFiles("**/*.lock.json");
Restore(solution);
Build(solution, configuration);
}
Target(
CLEAN_LOCKS,
() =>
{
foreach (var f in Glob.Files(".", "**/*.lock.json"))
{
Console.WriteLine("Found and will delete: " + f);
File.Delete(f);
}
Console.WriteLine("Running restore now.");
Run("dotnet", "restore .\\Speckle.Connectors.sln --no-cache");
DeleteFiles("**/*.lock.json");
Restore("Speckle.Connectors.sln");
}
);
@@ -45,26 +87,14 @@ Target(
DEEP_CLEAN,
() =>
{
foreach (var f in Glob.Directories(".", "**/bin"))
{
if (f.StartsWith("Build"))
{
continue;
}
Console.WriteLine("Found and will delete: " + f);
Directory.Delete(f, true);
}
foreach (var f in Glob.Directories(".", "**/obj"))
{
if (f.StartsWith("Build"))
{
continue;
}
Console.WriteLine("Found and will delete: " + f);
Directory.Delete(f, true);
}
Console.WriteLine("Running restore now.");
Run("dotnet", "restore .\\Speckle.Connectors.sln --no-cache");
CleanSolution("Speckle.Connectors.sln", "debug");
}
);
Target(
DEEP_CLEAN_LOCAL,
() =>
{
CleanSolution("Local.sln", "local");
}
);
@@ -94,17 +124,6 @@ Target(
}
);
Target(
VERSION,
async () =>
{
var (output, _) = await ReadAsync("dotnet", "minver -v w").ConfigureAwait(false);
output = output.Trim();
Console.WriteLine($"Version: {output}");
Run("echo", $"\"version={output}\" >> $GITHUB_OUTPUT");
}
);
Target(
RESTORE_TOOLS,
() =>
@@ -113,6 +132,18 @@ Target(
}
);
Target(
DETECT_AFFECTED,
DependsOn(RESTORE_TOOLS),
async () =>
{
foreach (var group in await Affected.GetAffectedProjectGroups())
{
Console.WriteLine("Affected project group being built: " + group.HostAppSlug);
}
}
);
Target(
FORMAT,
DependsOn(RESTORE_TOOLS),
@@ -124,20 +155,14 @@ Target(
Target(
RESTORE,
DependsOn(FORMAT),
DependsOn(FORMAT, DETECT_AFFECTED),
Consts.Solutions,
s =>
async s =>
{
Run("dotnet", $"restore {s} --locked-mode");
}
);
Target(
BUILD_SERVER_VERSION,
DependsOn(RESTORE_TOOLS),
() =>
{
Run("dotnet", "tool run dotnet-gitversion /output json /output buildserver");
var version = await Versions.ComputeVersion();
var fileVersion = await Versions.ComputeFileVersion();
Console.WriteLine($"Restoring: {s} - Version: {version} & {fileVersion}");
await RunAsync("dotnet", $"restore \"{s}\" --locked-mode");
}
);
@@ -145,12 +170,15 @@ Target(
BUILD,
DependsOn(RESTORE),
Consts.Solutions,
s =>
async s =>
{
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 {s} -c Release --no-restore -p:Version={version} -p:FileVersion={fileVersion} -v:m");
var version = await Versions.ComputeVersion();
var fileVersion = await Versions.ComputeFileVersion();
Console.WriteLine($"Restoring: {s} - Version: {version} & {fileVersion}");
await RunAsync(
"dotnet",
$"build \"{s}\" -c Release --no-restore -warnaserror -p:Version={version} -p:FileVersion={fileVersion} -v:m"
);
}
);
@@ -159,23 +187,48 @@ Target(CHECK_SOLUTIONS, Solutions.CompareConnectorsToLocal);
Target(
TEST,
DependsOn(BUILD, CHECK_SOLUTIONS),
Glob.Files(".", "**/*.Tests.csproj"),
file =>
async () =>
{
Run("dotnet", $"test {file} -c Release --no-build --no-restore --verbosity=minimal");
foreach (var s in await Affected.GetTestProjects())
{
await RunAsync("dotnet", $"test \"{s}\" -c Release --no-build --no-restore --verbosity=minimal");
}
}
);
//all tests on purpose
Target(
TEST_ONLY,
DependsOn(FORMAT),
Glob.Files(".", "**/*.Tests.csproj"),
file =>
{
Run("dotnet", $"restore {file} --locked-mode");
Run("dotnet", $"build \"{file}\" -c Release --no-incremental");
Run(
"dotnet",
$"test {file} -c Release --no-restore --verbosity=minimal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage /p:AltCoverVerbosity=Warning"
$"test \"{file}\" -c Release --no-build --verbosity=minimal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage /p:AltCoverVerbosity=Warning"
);
}
);
Target(
BUILD_LINUX,
DependsOn(FORMAT),
Glob.Files(".", "**/Speckle.Importers.Ifc.csproj"),
async file =>
{
await RunAsync("dotnet", $"restore \"{file}\" --locked-mode");
var version = await Versions.ComputeVersion();
var fileVersion = await Versions.ComputeFileVersion();
Console.WriteLine($"Version: {version} & {fileVersion}");
await RunAsync(
"dotnet",
$"build \"{file}\" -c Release --no-restore -warnaserror -p:Version={version} -p:FileVersion={fileVersion} -v:m"
);
await RunAsync(
"dotnet",
$"pack \"{file}\" -c Release -o output --no-build -p:Version={version} -p:FileVersion={fileVersion} -v:m"
);
}
);
@@ -183,47 +236,54 @@ Target(
Target(
ZIP,
DependsOn(TEST),
Consts.InstallerManifests,
x =>
async () =>
{
var outputDir = Path.Combine(".", "output");
var slugDir = Path.Combine(outputDir, x.HostAppSlug);
Directory.CreateDirectory(outputDir);
Directory.CreateDirectory(slugDir);
foreach (var asset in x.Projects)
var version = await Versions.ComputeVersion();
foreach (var group in await Affected.GetAffectedProjectGroups())
{
var fullPath = Path.Combine(".", asset.ProjectPath, "bin", "Release", asset.TargetName);
if (!Directory.Exists(fullPath))
Console.WriteLine($"Zipping: {group.HostAppSlug} as {version}");
var outputDir = Path.Combine(".", "output");
var slugDir = Path.Combine(outputDir, group.HostAppSlug);
Directory.CreateDirectory(outputDir);
Directory.CreateDirectory(slugDir);
foreach (var asset in group.Projects)
{
throw new InvalidOperationException("Could not find: " + fullPath);
var fullPath = Path.Combine(".", asset.ProjectPath, "bin", "Release", asset.TargetName);
if (!Directory.Exists(fullPath))
{
throw new InvalidOperationException("Could not find: " + fullPath);
}
var assetName = Path.GetFileName(asset.ProjectPath);
var connectorDir = Path.Combine(slugDir, assetName);
Directory.CreateDirectory(connectorDir);
foreach (var directory in Directory.EnumerateDirectories(fullPath, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(directory.Replace(fullPath, connectorDir));
}
foreach (var file in Directory.EnumerateFiles(fullPath, "*", SearchOption.AllDirectories))
{
Console.WriteLine(file);
File.Copy(file, file.Replace(fullPath, connectorDir), true);
}
}
var assetName = Path.GetFileName(asset.ProjectPath);
var connectorDir = Path.Combine(slugDir, assetName);
Directory.CreateDirectory(connectorDir);
foreach (var directory in Directory.EnumerateDirectories(fullPath, "*", SearchOption.AllDirectories))
{
Directory.CreateDirectory(directory.Replace(fullPath, connectorDir));
}
foreach (var file in Directory.EnumerateFiles(fullPath, "*", SearchOption.AllDirectories))
{
Console.WriteLine(file);
File.Copy(file, file.Replace(fullPath, connectorDir), true);
}
var outputPath = Path.Combine(outputDir, $"{group.HostAppSlug}.zip");
File.Delete(outputPath);
Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'");
ZipFile.CreateFromDirectory(slugDir, outputPath);
}
var outputPath = Path.Combine(outputDir, $"{x.HostAppSlug}.zip");
File.Delete(outputPath);
Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'");
ZipFile.CreateFromDirectory(slugDir, outputPath);
// Directory.Delete(slugDir, true);
string githubEnv = Environment.GetEnvironmentVariable("GITHUB_ENV") ?? "Unset";
Console.WriteLine($"GITHUB_ENV: {githubEnv}");
File.AppendAllText(githubEnv, $"SPECKLE_VERSION={version}{Environment.NewLine}");
}
);
Target("default", DependsOn(FORMAT, ZIP), () => Console.WriteLine("Done!"));
Target("default", DependsOn(TEST), () => Console.WriteLine("Done!"));
await RunTargetsAndExitAsync(args).ConfigureAwait(true);
+1
View File
@@ -45,6 +45,7 @@ public static class Solutions
CheckAndRemoveKnown("Speckle.Objects");
CheckAndRemoveKnown("Speckle.Sdk");
CheckAndRemoveKnown("Speckle.Sdk.Dependencies");
if (localProjects.Count != 0)
{
throw new InvalidOperationException(
+79
View File
@@ -0,0 +1,79 @@
using Semver;
using static SimpleExec.Command;
namespace Build;
public static class Versions
{
private static string? s_currentTag;
private static SemVersion? s_currentVersion;
public static async Task<string> GetCurrentTag()
{
if (s_currentTag is not null)
{
return s_currentTag;
}
//finds current tag or makes one
var (currentTag, _) = await ReadAsync("git", "describe --tags");
currentTag = currentTag.Trim();
s_currentTag = currentTag;
return s_currentTag;
}
public static async Task<SemVersion> ComputeVersion()
{
if (s_currentVersion is not null)
{
return s_currentVersion;
}
var currentTag = await GetCurrentTag();
if (!SemVersion.TryParse(currentTag, SemVersionStyles.AllowLowerV, out var currentVersion))
{
throw new InvalidOperationException($"Could not parse version: '{currentTag}'");
}
s_currentVersion = currentVersion;
return s_currentVersion;
}
private static string? s_currentFileVersion;
public static async Task<string> ComputeFileVersion()
{
if (s_currentFileVersion is not null)
{
return s_currentFileVersion;
}
var currentVersion = await ComputeVersion();
s_currentFileVersion = currentVersion.WithoutPrereleaseOrMetadata() + ".0";
return s_currentFileVersion;
}
public static async Task<string> GetPreviousTag(string currentTag)
{
//finds a tag starting with current tag and adds no abbrevation
var (lastTag, _) = await ReadAsync("git", $"describe --abbrev=0 --tags {currentTag}^");
lastTag = lastTag.Trim();
return lastTag;
}
private static SemVersion? s_previousVersion;
public static async Task<SemVersion> ComputePreviousVersion(string currentTag)
{
if (s_previousVersion is not null)
{
return s_previousVersion;
}
var lastTag = await GetPreviousTag(currentTag);
if (!SemVersion.TryParse(lastTag, SemVersionStyles.AllowLowerV, out var lastVersion))
{
throw new InvalidOperationException($"Could not parse version: '{lastTag}'");
}
s_previousVersion = lastVersion;
return s_previousVersion;
}
}
+24 -23
View File
@@ -16,18 +16,16 @@
},
"Microsoft.Build": {
"type": "Direct",
"requested": "[17.10.4, )",
"resolved": "17.10.4",
"contentHash": "ZmGA8vhVXFzC4oo48ybQKlEybVKd0Ntfdr+Enqrn5ES1R6e/krIK9hLk0W33xuT0/G6QYd3YdhJZh+Xle717Ag==",
"requested": "[17.11.4, )",
"resolved": "17.11.4",
"contentHash": "UMC7DfeFEHY2GGHHaghybUuUlLaByFHEFudR2PehMgDBuRuLAUePp1iaa4eFtVzepRzMtIbeSCVJCzzX3NV2Gg==",
"dependencies": {
"Microsoft.Build.Framework": "17.10.4",
"Microsoft.NET.StringTools": "17.10.4",
"Microsoft.Build.Framework": "17.11.4",
"Microsoft.NET.StringTools": "17.11.4",
"System.Collections.Immutable": "8.0.0",
"System.Configuration.ConfigurationManager": "8.0.0",
"System.Reflection.Metadata": "8.0.0",
"System.Reflection.MetadataLoadContext": "8.0.0",
"System.Security.Principal.Windows": "5.0.0",
"System.Threading.Tasks.Dataflow": "8.0.0"
"System.Reflection.MetadataLoadContext": "8.0.0"
}
},
"Microsoft.NETFramework.ReferenceAssemblies": {
@@ -55,6 +53,15 @@
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"Semver": {
"type": "Direct",
"requested": "[3.0.0, )",
"resolved": "3.0.0",
"contentHash": "9jZCicsVgTebqkAujRWtC9J1A5EQVlu0TVKHcgoCuv345ve5DYf4D1MjhKEnQjdRZo6x/vdv6QQrYFs7ilGzLA==",
"dependencies": {
"Microsoft.Extensions.Primitives": "5.0.1"
}
},
"SimpleExec": {
"type": "Direct",
"requested": "[12.0.0, )",
@@ -69,18 +76,23 @@
},
"Microsoft.Build.Framework": {
"type": "Transitive",
"resolved": "17.10.4",
"contentHash": "4qXCwNOXBR1dyCzuks9SwTwFJQO/xmf2wcMislotDWJu7MN/r3xDNoU8Ae5QmKIHPaLG1xmfDkYS7qBVzxmeKw=="
"resolved": "17.11.4",
"contentHash": "u28uDihlqxtt8h2dL1ZJOZ7TRkxBK+HGr+3FgQpILVo7Q7gErkw8mYW9R+RM5PtxvZTdYb/4MWDL66vdIsANBQ=="
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "5.0.1",
"contentHash": "5WPSmL4YeP7eW+Vc8XZ4DwjYWBAiSwDV9Hm63JJWcz1Ie3Xjv4KuJXzgCstj48LkLfVCYa7mLcx7y+q6yqVvtw=="
},
"Microsoft.NET.StringTools": {
"type": "Transitive",
"resolved": "17.10.4",
"contentHash": "wyABaqY+IHCMMSTQmcc3Ca6vbmg5BaEPgicnEgpll+4xyWZWlkQqUwafweUd9VAhBb4jqplMl6voUHQ6yfdUcg=="
"resolved": "17.11.4",
"contentHash": "mudqUHhNpeqIdJoUx2YDWZO/I9uEDYVowan89R6wsomfnUJQk6HteoQTlNjZDixhT2B4IXMkMtgZtoceIjLRmA=="
},
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
"type": "Transitive",
@@ -132,17 +144,6 @@
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "+TUFINV2q2ifyXauQXRwy4CiBhqvDEDZeVJU7qfxya4aRYOKzVBpN+4acx25VcPB9ywUN6C0n8drWl110PhZEg=="
},
"System.Security.Principal.Windows": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "t0MGLukB5WAVU9bO3MGzvlGnyJPgUlcwerXn1kzBRjwLKixT96XV0Uza41W49gVd8zEMFu9vQEFlv0IOrytICA=="
},
"System.Threading.Tasks.Dataflow": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "8.0.0",
"contentHash": "7V0I8tPa9V7UxMx/+7DIwkhls5ouaEMQx6l/GwGm1Y8kJQ61On9B/PxCXFLbgu5/C47g0BP2CUYs+nMv1+Oaqw=="
}
}
}
@@ -19,7 +19,7 @@ namespace Speckle.Connectors.ArcGIS.Bindings;
public sealed class ArcGISReceiveBinding : IReceiveBinding
{
public string Name { get; } = "receiveBinding";
private readonly CancellationManager _cancellationManager;
private readonly ICancellationManager _cancellationManager;
private readonly DocumentModelStore _store;
private readonly IServiceProvider _serviceProvider;
private readonly IOperationProgressManager _operationProgressManager;
@@ -32,7 +32,7 @@ public sealed class ArcGISReceiveBinding : IReceiveBinding
public ArcGISReceiveBinding(
DocumentModelStore store,
IBrowserBridge parent,
CancellationManager cancellationManager,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
IOperationProgressManager operationProgressManager,
ILogger<ArcGISReceiveBinding> logger,
@@ -60,7 +60,7 @@ public sealed class ArcGISReceiveBinding : IReceiveBinding
throw new InvalidOperationException("No download model card was found.");
}
CancellationToken cancellationToken = _cancellationManager.InitCancellationTokenSource(modelCardId);
using var cancellationItem = _cancellationManager.GetCancellationItem(modelCardId);
using var scope = _serviceProvider.CreateScope();
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<ArcGISConversionSettings>>()
@@ -76,19 +76,12 @@ public sealed class ArcGISReceiveBinding : IReceiveBinding
.ServiceProvider.GetRequiredService<ReceiveOperation>()
.Execute(
modelCard.GetReceiveInfo("ArcGIS"), // POC: get host app name from settings? same for GetSendInfo
cancellationToken,
(status, progress) =>
_operationProgressManager.SetModelProgress(
Parent,
modelCardId,
new ModelCardProgress(modelCardId, status, progress),
cancellationToken
)
)
.ConfigureAwait(false);
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationItem.Token),
cancellationItem.Token
);
modelCard.BakedObjectIds = receiveOperationResults.BakedObjectIds.ToList();
Commands.SetModelReceiveResult(
await Commands.SetModelReceiveResult(
modelCardId,
receiveOperationResults.BakedObjectIds,
receiveOperationResults.ConversionResults
@@ -104,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);
Commands.SetModelError(modelCardId, ex);
await Commands.SetModelError(modelCardId, ex);
}
}
@@ -1,5 +1,6 @@
using ArcGIS.Desktop.Mapping;
using ArcGIS.Desktop.Mapping.Events;
using Speckle.Connectors.ArcGIS.Utils;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Bridge;
@@ -7,17 +8,22 @@ namespace Speckle.Connectors.ArcGIS.Bindings;
public class ArcGISSelectionBinding : ISelectionBinding
{
private readonly MapMembersUtils _mapMemberUtils;
public string Name => "selectionBinding";
public IBrowserBridge Parent { get; }
public ArcGISSelectionBinding(IBrowserBridge parent)
public ArcGISSelectionBinding(
IBrowserBridge parent,
MapMembersUtils mapMemberUtils,
ITopLevelExceptionHandler topLevelExceptionHandler
)
{
_mapMemberUtils = mapMemberUtils;
Parent = parent;
var topLevelHandler = parent.TopLevelExceptionHandler;
// example: https://github.com/Esri/arcgis-pro-sdk-community-samples/blob/master/Map-Authoring/QueryBuilderControl/DefinitionQueryDockPaneViewModel.cs
// MapViewEventArgs args = new(MapView.Active);
TOCSelectionChangedEvent.Subscribe(_ => topLevelHandler.CatchUnhandled(OnSelectionChanged), true);
TOCSelectionChangedEvent.Subscribe(_ => topLevelExceptionHandler.CatchUnhandled(OnSelectionChanged), true);
}
private void OnSelectionChanged()
@@ -50,17 +56,8 @@ public class ArcGISSelectionBinding : ISelectionBinding
selectedMembers.AddRange(mapView.GetSelectedStandaloneTables());
List<MapMember> allNestedMembers = new();
foreach (MapMember member in selectedMembers)
{
if (member is GroupLayer group)
{
GetLayersFromGroup(group, allNestedMembers);
}
else
{
allNestedMembers.Add(member);
}
}
var layerMapMembers = _mapMemberUtils.UnpackMapLayers(selectedMembers);
allNestedMembers.AddRange(layerMapMembers);
List<string> objectTypes = allNestedMembers
.Select(o => o.GetType().ToString().Split(".").Last())
@@ -9,9 +9,11 @@ using ArcGIS.Desktop.Mapping.Events;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.ArcGIS.Filters;
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;
@@ -37,12 +39,14 @@ public sealed class ArcGISSendBinding : ISendBinding
private readonly DocumentModelStore _store;
private readonly IServiceProvider _serviceProvider;
private readonly List<ISendFilter> _sendFilters;
private readonly CancellationManager _cancellationManager;
private readonly ICancellationManager _cancellationManager;
private readonly ISendConversionCache _sendConversionCache;
private readonly IOperationProgressManager _operationProgressManager;
private readonly ILogger<ArcGISSendBinding> _logger;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IArcGISConversionSettingsFactory _arcGISConversionSettingsFactory;
private readonly IThreadContext _threadContext;
private readonly ISpeckleApplication _speckleApplication;
/// <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:
@@ -54,17 +58,22 @@ public sealed class ArcGISSendBinding : ISendBinding
private List<FeatureLayer> SubscribedLayers { get; set; } = new();
private List<StandaloneTable> SubscribedTables { get; set; } = new();
private readonly MapMembersUtils _mapMemberUtils;
public ArcGISSendBinding(
DocumentModelStore store,
IBrowserBridge parent,
IEnumerable<ISendFilter> sendFilters,
IServiceProvider serviceProvider,
CancellationManager cancellationManager,
ICancellationManager cancellationManager,
ISendConversionCache sendConversionCache,
IOperationProgressManager operationProgressManager,
ILogger<ArcGISSendBinding> logger,
IArcGISConversionSettingsFactory arcGisConversionSettingsFactory
IArcGISConversionSettingsFactory arcGisConversionSettingsFactory,
MapMembersUtils mapMemberUtils,
IThreadContext threadContext,
ISpeckleApplication speckleApplication,
ITopLevelExceptionHandler topLevelExceptionHandler
)
{
_store = store;
@@ -74,8 +83,11 @@ public sealed class ArcGISSendBinding : ISendBinding
_sendConversionCache = sendConversionCache;
_operationProgressManager = operationProgressManager;
_logger = logger;
_topLevelExceptionHandler = parent.TopLevelExceptionHandler;
_topLevelExceptionHandler = topLevelExceptionHandler;
_arcGISConversionSettingsFactory = arcGisConversionSettingsFactory;
_mapMemberUtils = mapMemberUtils;
_threadContext = threadContext;
_speckleApplication = speckleApplication;
Parent = parent;
Commands = new SendBindingUICommands(parent);
@@ -86,30 +98,48 @@ public sealed class ArcGISSendBinding : ISendBinding
};
}
private void OnDocumentStoreChangedEvent(object _) => _sendConversionCache.ClearCache();
private void SubscribeToArcGISEvents()
{
LayersRemovedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForLayersRemovedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await QueuedTask.Run(async () => await GetIdsForLayersRemovedEvent(a))
),
true
);
StandaloneTablesRemovedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForStandaloneTablesRemovedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await QueuedTask.Run(async () => await GetIdsForStandaloneTablesRemovedEvent(a))
),
true
);
MapPropertyChangedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForMapPropertyChangedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await QueuedTask.Run(async () => await GetIdsForMapPropertyChangedEvent(a))
),
true
); // Map units, CRS etc.
MapMemberPropertiesChangedEvent.Subscribe(
a => _topLevelExceptionHandler.CatchUnhandled(() => GetIdsForMapMemberPropertiesChangedEvent(a)),
a =>
_topLevelExceptionHandler.FireAndForget(
async () => await QueuedTask.Run(async () => await GetIdsForMapMemberPropertiesChangedEvent(a))
),
true
); // e.g. Layer name
ActiveMapViewChangedEvent.Subscribe(
_ => _topLevelExceptionHandler.CatchUnhandled(SubscribeToMapMembersDataSourceChange),
_ =>
_topLevelExceptionHandler.FireAndForget(async () =>
{
await QueuedTask.Run(SubscribeToMapMembersDataSourceChange);
}),
true
);
@@ -125,28 +155,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)
@@ -181,28 +207,31 @@ public sealed class ArcGISSendBinding : ISendBinding
{
RowCreatedEvent.Subscribe(
(args) =>
{
OnRowChanged(args);
},
_topLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args);
}),
layerTable
);
RowChangedEvent.Subscribe(
(args) =>
{
OnRowChanged(args);
},
_topLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args);
}),
layerTable
);
RowDeletedEvent.Subscribe(
(args) =>
{
OnRowChanged(args);
},
_topLevelExceptionHandler.FireAndForget(async () =>
{
await OnRowChanged(args);
}),
layerTable
);
}
private void OnRowChanged(RowChangedEventArgs args)
private async Task OnRowChanged(RowChangedEventArgs args)
{
if (args == null || MapView.Active == null)
{
@@ -241,60 +270,38 @@ public sealed class ArcGISSendBinding : ISendBinding
}
}
RunExpirationChecks(false);
await RunExpirationChecks(false);
}
private void GetIdsForLayersRemovedEvent(LayerEventsArgs args)
private async Task GetIdsForLayersRemovedEvent(LayerEventsArgs args)
{
foreach (Layer layer in args.Layers)
{
ChangedObjectIds[layer.URI] = 1;
}
RunExpirationChecks(true);
await RunExpirationChecks(true);
}
private void GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArgs args)
private async Task GetIdsForStandaloneTablesRemovedEvent(StandaloneTableEventArgs args)
{
foreach (StandaloneTable table in args.Tables)
{
ChangedObjectIds[table.URI] = 1;
}
RunExpirationChecks(true);
await RunExpirationChecks(true);
}
private void AddChangedNestedObjectIds(GroupLayer group)
private async Task GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs args)
{
ChangedObjectIds[group.URI] = 1;
foreach (var member in group.Layers)
foreach (Map map in args.Maps)
{
if (member is GroupLayer subGroup)
{
AddChangedNestedObjectIds(subGroup);
}
else
List<MapMember> allMapMembers = _mapMemberUtils.GetAllMapMembers(map);
foreach (MapMember member in allMapMembers)
{
ChangedObjectIds[member.URI] = 1;
}
}
}
private void GetIdsForMapPropertyChangedEvent(MapPropertyChangedEventArgs args)
{
foreach (Map map in args.Maps)
{
foreach (MapMember member in map.Layers)
{
if (member is GroupLayer group)
{
AddChangedNestedObjectIds(group);
}
else
{
ChangedObjectIds[member.URI] = 1;
}
}
}
RunExpirationChecks(false);
await RunExpirationChecks(false);
}
private void GetIdsForLayersAddedEvent(LayerEventsArgs args)
@@ -316,7 +323,7 @@ public sealed class ArcGISSendBinding : ISendBinding
}
}
private void GetIdsForMapMemberPropertiesChangedEvent(MapMemberPropertiesChangedEventArgs args)
private async Task GetIdsForMapMemberPropertiesChangedEvent(MapMemberPropertiesChangedEventArgs args)
{
// don't subscribe to all events (e.g. expanding group, changing visibility etc.)
bool validEvent = false;
@@ -344,7 +351,7 @@ public sealed class ArcGISSendBinding : ISendBinding
{
ChangedObjectIds[member.URI] = 1;
}
RunExpirationChecks(false);
await RunExpirationChecks(false);
}
}
@@ -369,70 +376,61 @@ public sealed class ArcGISSendBinding : ISendBinding
throw new InvalidOperationException("No publish model card was found.");
}
CancellationToken cancellationToken = _cancellationManager.InitCancellationTokenSource(modelCardId);
using var cancellationItem = _cancellationManager.GetCancellationItem(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()
.GetObjectIds()
.Select(id => (MapMember)MapView.Active.Map.FindLayer(id) ?? MapView.Active.Map.FindStandaloneTable(id))
.Where(obj => obj != null)
.ToList();
if (mapMembers.Count == 0)
{
// Handle as CARD ERROR in this function
throw new SpeckleSendFilterException(
"No objects were found to convert. Please update your publish filter!"
);
}
// subscribe to the selected layer events
foreach (MapMember mapMember in mapMembers)
{
if (mapMember is FeatureLayer featureLayer)
{
SubscribeToFeatureLayerDataSourceChange(featureLayer);
}
else if (mapMember is StandaloneTable table)
{
SubscribeToTableDataSourceChange(table);
}
}
var result = await scope
.ServiceProvider.GetRequiredService<SendOperation<MapMember>>()
.Execute(
mapMembers,
modelCard.GetSendInfo("ArcGIS"), // POC: get host app name from settings? same for GetReceiveInfo
(status, progress) =>
_operationProgressManager.SetModelProgress(
Parent,
modelCardId,
new ModelCardProgress(modelCardId, status, progress),
cancellationToken
),
cancellationToken
using var scope = _serviceProvider.CreateScope();
List<MapMember> mapMembers = await QueuedTask.Run(() =>
{
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<ArcGISConversionSettings>>()
.Initialize(
_arcGISConversionSettingsFactory.Create(
Project.Current,
MapView.Active.Map,
new CRSoffsetRotation(MapView.Active.Map)
)
.ConfigureAwait(false);
);
return result;
})
.ConfigureAwait(false);
return modelCard
.SendFilter.NotNull()
.RefreshObjectIds()
.Select(id => (MapMember)MapView.Active.Map.FindLayer(id) ?? MapView.Active.Map.FindStandaloneTable(id))
.Where(obj => obj != null)
.ToList();
});
Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
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!");
}
await QueuedTask.Run(() =>
{
// 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 sendResult = await scope
.ServiceProvider.GetRequiredService<SendOperation<MapMember>>()
.Execute(
mapMembers,
modelCard.GetSendInfo(_speckleApplication.ApplicationAndVersion),
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationItem.Token),
cancellationItem.Token
);
await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
}
catch (OperationCanceledException)
{
@@ -444,7 +442,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);
Commands.SetModelError(modelCardId, ex);
await Commands.SetModelError(modelCardId, ex);
}
}
@@ -453,7 +451,7 @@ public sealed class ArcGISSendBinding : ISendBinding
/// <summary>
/// Checks if any sender model cards contain any of the changed objects. If so, also updates the changed objects hashset for each model card - this last part is important for on send change detection.
/// </summary>
private void RunExpirationChecks(bool idsDeleted)
private async Task RunExpirationChecks(bool idsDeleted)
{
var senders = _store.GetSenders();
List<string> expiredSenderIds = new();
@@ -463,9 +461,9 @@ public sealed class ArcGISSendBinding : ISendBinding
foreach (SenderModelCard sender in senders)
{
var objIds = sender.SendFilter.NotNull().GetObjectIds();
var objIds = sender.SendFilter.NotNull().RefreshObjectIds();
var intersection = objIds.Intersect(objectIdsList).ToList();
bool isExpired = sender.SendFilter.NotNull().CheckExpiry(objectIdsList);
bool isExpired = intersection.Count != 0;
if (isExpired)
{
expiredSenderIds.Add(sender.ModelCardId.NotNull());
@@ -479,7 +477,7 @@ public sealed class ArcGISSendBinding : ISendBinding
}
}
Commands.SetModelsExpired(expiredSenderIds);
await Commands.SetModelsExpired(expiredSenderIds);
ChangedObjectIds = new();
}
}
@@ -21,18 +21,26 @@ public class BasicConnectorBinding : IBasicConnectorBinding
public BasicConnectorBindingCommands Commands { get; }
private readonly DocumentModelStore _store;
private readonly ISpeckleApplication _speckleApplication;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
public BasicConnectorBinding(DocumentModelStore store, IBrowserBridge parent, ISpeckleApplication speckleApplication)
public BasicConnectorBinding(
DocumentModelStore store,
IBrowserBridge parent,
ISpeckleApplication speckleApplication,
ITopLevelExceptionHandler topLevelExceptionHandler
)
{
_store = store;
_speckleApplication = speckleApplication;
_topLevelExceptionHandler = topLevelExceptionHandler;
Parent = parent;
Commands = new BasicConnectorBindingCommands(parent);
_store.DocumentChanged += (_, _) =>
{
Commands.NotifyDocumentChanged();
};
_topLevelExceptionHandler.FireAndForget(async () =>
{
await Commands.NotifyDocumentChanged();
});
}
public string GetSourceApplicationName() => _speckleApplication.Slug;
@@ -53,16 +61,20 @@ public class BasicConnectorBinding : IBasicConnectorBinding
public DocumentModelStore GetDocumentState() => _store;
public void AddModel(ModelCard model) => _store.Models.Add(model);
public void AddModel(ModelCard model) => _store.AddModel(model);
public void UpdateModel(ModelCard model) => _store.UpdateModel(model);
public void RemoveModel(ModelCard model) => _store.RemoveModel(model);
public void HighlightObjects(List<string> objectIds) =>
HighlightObjectsOnView(objectIds.Select(x => new ObjectID(x)).ToList());
public void RemoveModels(List<ModelCard> models) => _store.RemoveModels(models);
public void HighlightModel(string modelCardId)
public async Task HighlightObjects(IReadOnlyList<string> objectIds)
{
await HighlightObjectsOnView(objectIds.Select(x => new ObjectID(x)).ToList());
}
public async Task HighlightModel(string modelCardId)
{
var model = _store.GetModelById(modelCardId);
@@ -75,7 +87,7 @@ public class BasicConnectorBinding : IBasicConnectorBinding
if (model is SenderModelCard senderModelCard)
{
objectIds = senderModelCard.SendFilter.NotNull().GetObjectIds().Select(x => new ObjectID(x)).ToList();
objectIds = senderModelCard.SendFilter.NotNull().RefreshObjectIds().Select(x => new ObjectID(x)).ToList();
}
if (model is ReceiverModelCard receiverModelCard)
@@ -87,27 +99,25 @@ public class BasicConnectorBinding : IBasicConnectorBinding
{
return;
}
HighlightObjectsOnView(objectIds);
await HighlightObjectsOnView(objectIds);
}
private async void HighlightObjectsOnView(List<ObjectID> objectIds)
private async Task HighlightObjectsOnView(IReadOnlyList<ObjectID> objectIds)
{
MapView mapView = MapView.Active;
await QueuedTask.Run(() =>
{
MapView mapView = MapView.Active;
await QueuedTask
.Run(() =>
{
List<MapMemberFeature> mapMembersFeatures = GetMapMembers(objectIds, mapView);
ClearSelectionInTOC();
ClearSelection();
SelectMapMembersInTOC(mapMembersFeatures);
SelectMapMembersAndFeatures(mapMembersFeatures);
mapView.ZoomToSelected();
})
.ConfigureAwait(false);
List<MapMemberFeature> mapMembersFeatures = GetMapMembers(objectIds, mapView);
ClearSelectionInTOC();
ClearSelection();
SelectMapMembersInTOC(mapMembersFeatures);
SelectMapMembersAndFeatures(mapMembersFeatures);
mapView.ZoomToSelected();
});
}
private List<MapMemberFeature> GetMapMembers(List<ObjectID> objectIds, MapView mapView)
private List<MapMemberFeature> GetMapMembers(IReadOnlyList<ObjectID> objectIds, MapView mapView)
{
// find the layer on the map (from the objectID) and add the featureID is available
List<MapMemberFeature> mapMembersFeatures = new();
@@ -145,7 +155,7 @@ public class BasicConnectorBinding : IBasicConnectorBinding
MapView.Active.ClearTOCSelection();
}
private void SelectMapMembersAndFeatures(List<MapMemberFeature> mapMembersFeatures)
private void SelectMapMembersAndFeatures(IReadOnlyList<MapMemberFeature> mapMembersFeatures)
{
foreach (MapMemberFeature mapMemberFeat in mapMembersFeatures)
{
@@ -170,7 +180,7 @@ public class BasicConnectorBinding : IBasicConnectorBinding
}
}
private void SelectMapMembersInTOC(List<MapMemberFeature> mapMembersFeatures)
private void SelectMapMembersInTOC(IReadOnlyList<MapMemberFeature> mapMembersFeatures)
{
List<Layer> layers = new();
List<StandaloneTable> tables = new();
@@ -186,7 +196,7 @@ public class BasicConnectorBinding : IBasicConnectorBinding
}
else
{
QueuedTask.Run(() => layer.SetExpanded(true));
layer.SetExpanded(true);
}
}
else if (member is StandaloneTable table)
@@ -20,7 +20,7 @@
<ArcGIS defaultAssembly="Speckle.Connectors.ArcGIS3.dll" defaultNamespace="Speckle.Connectors.ArcGIS" xmlns="http://schemas.esri.com/DADF/Registry" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.esri.com/DADF/Registry file:///C:/Program%20Files/ArcGIS/Pro/bin/ArcGIS.Desktop.Framework.xsd">
<AddInInfo id="{6CB1D25C-B8BF-4A33-9099-C1F8D1B32EFC}" version="1.0" desktopVersion="3.0.34047">
<Name>Speckle</Name>
<Description>Speckle connector for ArcGIS</Description>
<Description>Next Gen Speckle Connector (Beta) for ArcGIS</Description>
<Image>Images\AddinDesktop32.png</Image>
<Author>Speckle Systems</Author>
<Company>Speckle Systems</Company>
@@ -33,14 +33,14 @@
<insertModule id="ConnectorArcGIS_Module" className="SpeckleModule" autoLoad="false" caption="SpeckleModule">
<!-- uncomment to have the control hosted on a separate tab-->
<tabs>
<!--<tab id="Speckle_Tab1" caption="New Tab">
<tab id="Speckle_Tab1" caption="Speckle">
<group refID="Speckle_Group1"/>
</tab>-->
</tab>
</tabs>
<groups>
<!-- comment this out if you have no controls on the Addin tab to avoid
an empty group-->
<group id="Speckle_Group1" caption="Speckle" appearsOnAddInTab="true" keytip="G1">
an empty group. change appearsOnAddinTab to "True" if control is to be in the addin tab-->
<group id="Speckle_Group1" caption="Speckle" appearsOnAddInTab="false" keytip="G1">
<!-- host controls within groups -->
<button refID="SpeckleDUI3_SpeckleDUI3OpenButton" size="large" />
</group>
@@ -59,7 +59,7 @@
</controls>
<dockPanes>
<dockPane id="SpeckleDUI3_SpeckleDUI3" caption="Speckle (Beta) for ArcGIS" className="SpeckleDUI3ViewModel" keytip="DockPane" initiallyVisible="true" dock="group" dockWith="esri_core_projectDockPane">
<dockPane id="SpeckleDUI3_SpeckleDUI3" caption="Speckle (Beta)" className="SpeckleDUI3ViewModel" keytip="DockPane" initiallyVisible="true" dock="group" dockWith="esri_core_projectDockPane">
<content className="SpeckleDUI3Wrapper" />
</dockPane>
</dockPanes>
@@ -10,9 +10,9 @@ using Speckle.Connectors.Common;
using Speckle.Connectors.Common.Builders;
using Speckle.Connectors.Common.Caching;
using Speckle.Connectors.Common.Operations;
using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.WebView;
using Speckle.Converters.Common;
@@ -28,41 +28,38 @@ public static class ArcGISConnectorModule
public static void AddArcGIS(this IServiceCollection serviceCollection)
{
serviceCollection.AddConnectorUtils();
serviceCollection.AddDUI();
serviceCollection.AddDUI<DefaultThreadContext, ArcGISDocumentStore>();
serviceCollection.AddDUIView();
serviceCollection.AddSingleton<DocumentModelStore, ArcGISDocumentStore>();
// Register bindings
serviceCollection.AddSingleton<IBinding, TestBinding>();
serviceCollection.AddSingleton<IBinding, ConfigBinding>();
serviceCollection.AddSingleton<IBinding, AccountBinding>();
serviceCollection.RegisterTopLevelExceptionHandler();
serviceCollection.AddSingleton<IBinding>(sp => sp.GetRequiredService<IBasicConnectorBinding>());
serviceCollection.AddSingleton<IBasicConnectorBinding, BasicConnectorBinding>();
serviceCollection.AddSingleton<IBinding, ArcGISSelectionBinding>();
serviceCollection.AddSingleton<IBinding, ArcGISSendBinding>();
serviceCollection.AddSingleton<IBinding, ArcGISReceiveBinding>();
serviceCollection.AddTransient<ISendFilter, ArcGISSelectionFilter>();
serviceCollection.AddScoped<IHostObjectBuilder, ArcGISHostObjectBuilder>();
serviceCollection.AddSingleton(DefaultTraversal.CreateTraversalFunc());
// register send operation and dependencies
serviceCollection.AddSingleton<IBinding, ArcGISSendBinding>();
serviceCollection.AddScoped<SendOperation<MapMember>>();
serviceCollection.AddSingleton<IBinding, ArcGISSelectionBinding>();
serviceCollection.AddTransient<ISendFilter, ArcGISSelectionFilter>();
serviceCollection.AddScoped<ArcGISRootObjectBuilder>();
serviceCollection.AddScoped<IRootObjectBuilder<MapMember>, ArcGISRootObjectBuilder>();
serviceCollection.AddScoped<LocalToGlobalConverterUtils>();
serviceCollection.AddScoped<ArcGISColorManager>();
serviceCollection.AddScoped<MapMembersUtils>();
serviceCollection.AddScoped<ArcGISLayerUnpacker>();
serviceCollection.AddScoped<ArcGISColorUnpacker>();
// register send conversion cache
serviceCollection.AddSingleton<ISendConversionCache, SendConversionCache>();
// register receive operation and dependencies
// serviceCollection.AddSingleton<IBinding, ArcGISReceiveBinding>(); // POC: disabled until receive code is refactored
serviceCollection.AddScoped<LocalToGlobalConverterUtils>();
serviceCollection.AddScoped<ArcGISColorManager>();
serviceCollection.AddScoped<IHostObjectBuilder, ArcGISHostObjectBuilder>();
serviceCollection.AddScoped<MapMembersUtils>();
// operation progress manager
serviceCollection.AddSingleton<IOperationProgressManager, OperationProgressManager>();
}
@@ -154,7 +154,6 @@
Log.LogErrorFromException(ex);
return false;
}
return Success;
]]>
</Code>
</Task>
@@ -190,7 +189,7 @@
{
Log.LogMessage(MessageImportance.Low, "RelativePaths: " + i.ToString());
}
return true;
Success = true;
]]>
</Code>
</Task>
@@ -266,7 +265,6 @@
CleanInfo = AssemblyName + extension;
}
Success = true;
return Success;
]]>
</Code>
</Task>
@@ -1,10 +0,0 @@
using Speckle.Connectors.DUI.Models.Card.SendFilter;
namespace Speckle.Connectors.ArcGIS.Filters;
public class ArcGISEverythingFilter : EverythingSendFilter
{
public override List<string> GetObjectIds() => new(); // TODO
public override bool CheckExpiry(string[] changedObjectIds) => true;
}
@@ -4,7 +4,10 @@ namespace Speckle.Connectors.ArcGIS.Filters;
public class ArcGISSelectionFilter : DirectSelectionSendFilter
{
public override List<string> GetObjectIds() => SelectedObjectIds;
public ArcGISSelectionFilter()
{
IsDefault = true;
}
public override bool CheckExpiry(string[] changedObjectIds) => SelectedObjectIds.Intersect(changedObjectIds).Any();
public override List<string> RefreshObjectIds() => SelectedObjectIds;
}
@@ -0,0 +1,3 @@
global using AC = ArcGIS.Core;
global using ACD = ArcGIS.Core.Data;
global using ADM = ArcGIS.Desktop.Mapping;
@@ -1,68 +1,38 @@
using System.Drawing;
using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using ArcGIS.Desktop.Mapping;
using Speckle.Connectors.Common.Operations;
using Speckle.Converters.ArcGIS3.Utils;
using Speckle.Objects;
using Speckle.Objects.Other;
using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.Extensions;
using Speckle.Sdk.Models.GraphTraversal;
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Connectors.ArcGIS.HostApp;
/// <summary>
/// TODO: definitely need to refactor this, probably will collect colors during layer iteration in the root object builder.
/// </summary>
public class ArcGISColorManager
{
private Dictionary<string, ColorProxy> ColorProxies { get; set; } = new();
public Dictionary<string, Color> ObjectColorsIdMap { get; set; } = new();
public Dictionary<string, Color> ObjectMaterialsIdMap { get; set; } = new();
/// <summary>
/// Iterates through a given set of arcGIS map members (layers containing objects) and collects their colors.
/// </summary>
/// <param name="mapMembersWithDisplayPriority"></param>
/// <returns>A list of color proxies, where the application Id is argb value + display priority</returns>
/// <remarks>
/// In ArcGIS, map members contain a formula, which individual features contained in map members will use to calculate their color.
/// Since display priority is important for ArcGIS layers, we are creating different Color Proxies for eg the same argb color value but different display priority.
/// </remarks>
public List<ColorProxy> UnpackColors(List<(MapMember, int)> mapMembersWithDisplayPriority)
{
// injected as Singleton, so we need to clean existing proxies first
ColorProxies = new();
foreach ((MapMember mapMember, int priority) in mapMembersWithDisplayPriority)
{
switch (mapMember)
{
// FeatureLayer colors will be processed per feature object
case FeatureLayer featureLayer:
ProcessFeatureLayerColors(featureLayer, priority);
break;
// RasterLayer object colors are converted as mesh vertex colors, but we need to store displayPriority on the raster layer. Default color is used for all rasters.
case RasterLayer rasterLayer:
ProcessRasterLayerColors(rasterLayer, priority);
break;
}
}
return ColorProxies.Values.ToList();
}
/// <summary>
/// Parse Color Proxies and stores in ObjectColorsIdMap the relationship between object ids and colors
/// </summary>
/// <param name="colorProxies"></param>
/// <param name="onOperationProgressed"></param>
public void ParseColors(List<ColorProxy> colorProxies, Action<string, double?>? onOperationProgressed)
public void ParseColors(List<ColorProxy> colorProxies, IProgress<CardProgress> onOperationProgressed)
{
// injected as Singleton, so we need to clean existing proxies first
ObjectColorsIdMap = new();
var count = 0;
foreach (ColorProxy colorProxy in colorProxies)
{
onOperationProgressed?.Invoke("Converting colors", (double)++count / colorProxies.Count);
onOperationProgressed.Report(new("Converting colors", (double)++count / colorProxies.Count));
foreach (string objectId in colorProxy.objects)
{
Color convertedColor = Color.FromArgb(colorProxy.value);
@@ -76,14 +46,14 @@ public class ArcGISColorManager
/// </summary>
/// <param name="materialProxies"></param>
/// <param name="onOperationProgressed"></param>
public void ParseMaterials(List<RenderMaterialProxy> materialProxies, Action<string, double?>? onOperationProgressed)
public void ParseMaterials(List<RenderMaterialProxy> materialProxies, IProgress<CardProgress> onOperationProgressed)
{
// injected as Singleton, so we need to clean existing proxies first
ObjectMaterialsIdMap = new();
var count = 0;
foreach (RenderMaterialProxy colorProxy in materialProxies)
{
onOperationProgressed?.Invoke("Converting materials", (double)++count / materialProxies.Count);
onOperationProgressed.Report(new("Converting materials", (double)++count / materialProxies.Count));
foreach (string objectId in colorProxy.objects)
{
Color convertedColor = Color.FromArgb(colorProxy.value.diffuse);
@@ -92,6 +62,14 @@ public class ArcGISColorManager
}
}
public int CIMColorToInt(CIMColor color)
{
return (255 << 24)
| ((int)Math.Round(color.Values[0]) << 16)
| ((int)Math.Round(color.Values[1]) << 8)
| (int)Math.Round(color.Values[2]);
}
/// <summary>
/// Create a new CIMUniqueValueClass for UniqueRenderer per each object ID
/// </summary>
@@ -105,6 +83,7 @@ public class ArcGISColorManager
{
// declare default white color
Color color = Color.FromArgb(255, 255, 255, 255);
bool colorFound = false;
// get color moving upwards from the object
foreach (var parent in tc.GetAscendants())
@@ -114,16 +93,43 @@ public class ArcGISColorManager
if (ObjectMaterialsIdMap.TryGetValue(appId, out Color objColorMaterial))
{
color = objColorMaterial;
colorFound = true;
break;
}
if (ObjectColorsIdMap.TryGetValue(appId, out Color objColor))
{
color = objColor;
colorFound = true;
break;
}
}
}
// handling Revit case, where child objects have separate colors/materials
if (!colorFound && tc.Current is IDataObject)
{
var displayable = tc.Current.TryGetDisplayValue();
if (displayable != null)
{
foreach (var childObj in displayable)
{
if (childObj.applicationId is string appId)
{
if (ObjectMaterialsIdMap.TryGetValue(appId, out Color objColorMaterial))
{
color = objColorMaterial;
break;
}
if (ObjectColorsIdMap.TryGetValue(appId, out Color objColor))
{
color = objColor;
break;
}
}
}
}
}
CIMSymbolReference symbol = CreateSymbol(speckleGeometryType, color);
// First create a "CIMUniqueValueClass"
@@ -190,7 +196,7 @@ public class ArcGISColorManager
}
// declare default grey color, create default symbol for the given layer geometry type
var color = Color.FromArgb(ColorFactory.Instance.GreyRGB.CIMColorToInt());
var color = Color.FromArgb(CIMColorToInt(ColorFactory.Instance.GreyRGB));
CIMSymbolReference defaultSymbol = CreateSymbol(fLayer.ShapeType, color);
// get existing renderer classes
@@ -221,7 +227,10 @@ public class ArcGISColorManager
foreach (var tContext in traversalContexts)
{
// get unique label
string uniqueLabel = tContext.Current.id;
string? uniqueLabel = tContext.Current?.id;
// remove any GIS-specific classes for now
/*
if (tContext.Current is IGisFeature gisFeat)
{
var existingLabel = gisFeat.attributes["Speckle_ID"];
@@ -229,9 +238,9 @@ public class ArcGISColorManager
{
uniqueLabel = stringLabel;
}
}
}*/
if (!listUniqueValueClasses.Select(x => x.Label).Contains(uniqueLabel))
if (uniqueLabel is not null && !listUniqueValueClasses.Select(x => x.Label).Contains(uniqueLabel))
{
CIMUniqueValueClass newUniqueValueClass = CreateColorCategory(tContext, fLayer.ShapeType, uniqueLabel);
listUniqueValueClasses.Add(newUniqueValueClass);
@@ -253,356 +262,4 @@ public class ArcGISColorManager
};
return uvr;
}
private string GetColorApplicationId(int argb, double order) => $"{argb}_{order}";
// Adds the element id to the color proxy based on colorId if it exists in ColorProxies,
// otherwise creates a new Color Proxy with the element id in the objects property
private void AddElementIdToColorProxy(string elementAppId, int colorValue, string colorId, int displayPriority)
{
if (ColorProxies.TryGetValue(colorId, out ColorProxy? colorProxy))
{
colorProxy.objects.Add(elementAppId);
}
else
{
ColorProxy newProxy =
new()
{
value = colorValue,
applicationId = colorId,
objects = new() { elementAppId },
name = colorId
};
newProxy["displayOrder"] = displayPriority; // 0 - top layer (top display priority), 1,2,3.. decreasing priority
ColorProxies.Add(colorId, newProxy);
}
}
private void ProcessRasterLayerColors(RasterLayer rasterLayer, int displayPriority)
{
string elementAppId = $"{rasterLayer.URI}_0"; // POC: explain why count = 0 here
int argb = -1;
string colorId = GetColorApplicationId(argb, displayPriority); // We are using a default color of -1 for all raster layers
AddElementIdToColorProxy(elementAppId, argb, colorId, displayPriority);
}
/// <summary>
/// Record colors from every feature of the layer into ColorProxies
/// </summary>
/// <param name="layer"></param>
/// <param name="displayPriority"></param>
private void ProcessFeatureLayerColors(FeatureLayer layer, int displayPriority)
{
// first get a list of layer fields
// field names are unique, but often their alias is used instead by renderer headings
// so we are storing both names and alieas in this dictionary for fast lookup
// POC: adding aliases are not optimal, because they do not need to be unique && they can be the same as the name of another field
Dictionary<string, FieldDescription> layerFieldDictionary = new();
foreach (FieldDescription field in layer.GetFieldDescriptions())
{
layerFieldDictionary.TryAdd(field.Name, field);
layerFieldDictionary.TryAdd(field.Alias, field);
}
CIMRenderer layerRenderer = layer.GetRenderer();
int count = 1;
using (RowCursor rowCursor = layer.Search())
{
while (rowCursor.MoveNext())
{
string elementAppId = $"{layer.URI}_{count}";
using (Row row = rowCursor.Current)
{
// get row color
int argb = GetLayerColorByRendererAndRow(layerRenderer, row, layerFieldDictionary);
string colorId = GetColorApplicationId(argb, displayPriority);
AddElementIdToColorProxy(elementAppId, argb, colorId, displayPriority);
}
count++;
}
}
}
// Attempts to retrieve the color from a CIMSymbol
private bool TryGetSymbolColor(CIMSymbol symbol, out int symbolColor)
{
symbolColor = -1;
if (symbol.GetColor() is CIMColor cimColor)
{
switch (cimColor)
{
case CIMRGBColor rgbColor:
symbolColor = rgbColor.CIMColorToInt();
return true;
case CIMHSVColor hsvColor:
symbolColor = RgbFromHsv(hsvColor);
return true;
case CIMCMYKColor cmykColor:
symbolColor = RgbFromCmyk(cmykColor);
return true;
default:
return false;
}
}
else
{
return false;
}
}
private int RbgToInt(int a, int r, int g, int b)
{
return (a << 24) | (r << 16) | (g << 8) | b;
}
private int RgbFromCmyk(CIMCMYKColor cmykColor)
{
float c = cmykColor.C;
float m = cmykColor.M;
float y = cmykColor.Y;
float k = cmykColor.K;
int r = Convert.ToInt32(255 * (1 - c) * (1 - k));
int g = Convert.ToInt32(255 * (1 - m) * (1 - k));
int b = Convert.ToInt32(255 * (1 - y) * (1 - k));
return RbgToInt(255, r, g, b);
}
private int RgbFromHsv(CIMHSVColor hsvColor)
{
// Translates HSV color to RGB color
// H: 0.0 - 360.0, S: 0.0 - 100.0, V: 0.0 - 100.0
// R, G, B: 0.0 - 1.0
float hue = hsvColor.H;
float saturation = hsvColor.S;
float value = hsvColor.V;
float c = (value / 100) * (saturation / 100);
float x = c * (1 - Math.Abs(((hue / 60) % 2) - 1));
float m = (value / 100) - c;
float r = 0;
float g = 0;
float b = 0;
if (hue >= 0 && hue < 60)
{
r = c;
g = x;
b = 0;
}
else if (hue >= 60 && hue < 120)
{
r = x;
g = c;
b = 0;
}
else if (hue >= 120 && hue < 180)
{
r = 0;
g = c;
b = x;
}
else if (hue >= 180 && hue < 240)
{
r = 0;
g = x;
b = c;
}
else if (hue >= 240 && hue < 300)
{
r = x;
g = 0;
b = c;
}
else if (hue >= 300 && hue < 360)
{
r = c;
g = 0;
b = x;
}
r += m;
g += m;
b += m;
// convert rgb 0.0-1.0 float to int
int red = (int)Math.Round(r * 255);
int green = (int)Math.Round(g * 255);
int blue = (int)Math.Round(b * 255);
return RbgToInt(255, red, green, blue);
}
private bool TryGetUniqueRendererColor(
CIMUniqueValueRenderer uniqueRenderer,
Row row,
Dictionary<string, FieldDescription> fields,
out int color
)
{
if (!TryGetSymbolColor(uniqueRenderer.DefaultSymbol.Symbol, out color)) // get default color
{
return false;
}
// note: usually there is only 1 group
foreach (CIMUniqueValueGroup group in uniqueRenderer.Groups)
{
string[] fieldNames = uniqueRenderer.Fields;
List<string> usedFields = new();
foreach (string fieldName in fieldNames)
{
if (fields.TryGetValue(fieldName, out FieldDescription? headingField))
{
usedFields.Add(headingField.Name);
}
}
// loop through all values in groups to see if any have met conditions that result in a different color
foreach (CIMUniqueValueClass groupClass in group.Classes)
{
bool groupConditionsMet = true;
foreach (CIMUniqueValue value in groupClass.Values)
{
// all field values have to match the row values
for (int i = 0; i < usedFields.Count; i++)
{
string groupValue = value.FieldValues[i].Replace("<Null>", "");
object? rowValue = row[usedFields[i]];
(string newRowValue, string newGroupValue) = MakeValuesComparable(rowValue, groupValue);
if (newGroupValue != newRowValue)
{
groupConditionsMet = false;
break;
}
}
}
// set the group color to class symbol color if conditions are met
if (groupConditionsMet)
{
if (!TryGetSymbolColor(groupClass.Symbol.Symbol, out color))
{
return false;
}
}
}
}
return true;
}
/// <summary>
/// Make comparable the Label string of a UniqueValueRenderer (groupValue), and a Feature Attribute value (rowValue)
/// </summary>
/// <param name="rowValue"></param>
/// <param name="groupValue"></param>
private (string, string) MakeValuesComparable(object? rowValue, string groupValue)
{
string newGroupValue = groupValue;
string newRowValue = Convert.ToString(rowValue) ?? "";
// int, doubles are tricky to compare with strings, trimming both to 5 digits
if (rowValue is int or short or long)
{
newRowValue = newRowValue.Split(".")[0];
newGroupValue = newGroupValue.Split(".")[0];
}
else if (rowValue is double || rowValue is float)
{
newRowValue = string.Concat(
newRowValue.Split(".")[0],
".",
newRowValue.Split(".")[^1].AsSpan(0, Math.Min(5, newRowValue.Split(".")[^1].Length))
);
newGroupValue = string.Concat(
newGroupValue.Split(".")[0],
".",
newGroupValue.Split(".")[^1].AsSpan(0, Math.Min(5, newGroupValue.Split(".")[^1].Length))
);
}
return (newRowValue, newGroupValue);
}
private bool TryGetGraduatedRendererColor(
CIMClassBreaksRenderer graduatedRenderer,
Row row,
Dictionary<string, FieldDescription> fields,
out int color
)
{
if (!TryGetSymbolColor(graduatedRenderer.DefaultSymbol.Symbol, out color)) // get default color
{
return false;
}
string? usedField = null;
if (fields.TryGetValue(graduatedRenderer.Field, out FieldDescription? field))
{
usedField = field.Name;
}
List<CIMClassBreak> reversedBreaks = new(graduatedRenderer.Breaks);
reversedBreaks.Reverse();
foreach (var rBreak in reversedBreaks)
{
// keep looping until the last matching condition
if (Convert.ToDouble(row[usedField]) <= rBreak.UpperBound)
{
if (!TryGetSymbolColor(rBreak.Symbol.Symbol, out color)) // get default color
{
return false;
}
}
}
return true;
}
// Tries to retrieve the feature layer color by renderer and row, or a default color of -1
private int GetLayerColorByRendererAndRow(CIMRenderer renderer, Row row, Dictionary<string, FieldDescription> fields)
{
// default color to white. this will be used if the renderer is not supported.
int color = -1;
// get color depending on renderer type
switch (renderer)
{
case CIMSimpleRenderer simpleRenderer:
if (!TryGetSymbolColor(simpleRenderer.Symbol.Symbol, out color))
{
// POC: report CONVERTED WITH WARNING when implemented
}
break;
// unique renderers have groups of conditions that may affect the color of a feature
// resulting in a different color than the default renderer symbol color
case CIMUniqueValueRenderer uniqueRenderer:
if (!TryGetUniqueRendererColor(uniqueRenderer, row, fields, out color)) // get default color
{
// POC: report CONVERTED WITH WARNING when implemented
}
break;
case CIMClassBreaksRenderer graduatedRenderer:
if (!TryGetGraduatedRendererColor(graduatedRenderer, row, fields, out color)) // get default color
{
// POC: report CONVERTED WITH WARNING when implemented
}
break;
default:
// POC: report CONVERTED WITH WARNING when implemented, unsupported renderer e.g. CIMProportionalRenderer
break;
}
return color;
}
}
@@ -0,0 +1,461 @@
using ArcGIS.Desktop.Mapping;
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Connectors.ArcGIS.HostApp;
public class ArcGISColorUnpacker
{
/// <summary>
/// Cache of all color proxies for converted features. Key is the Color proxy argb value.
/// </summary>
public Dictionary<int, ColorProxy> ColorProxyCache { get; } = new();
/// <summary>
/// Stores the current renderer (determined by mapMember)
/// </summary>
private AC.CIM.CIMRenderer? StoredRenderer { get; set; }
/// <summary>
/// Stores the current renderer (determined by tin mapmember)
/// </summary>
private AC.CIM.CIMTinRenderer? StoredTinRenderer { get; set; }
/// <summary>
/// Stores the used renderer fields from the layer
/// </summary>
private List<string> StoredRendererFields { get; set; }
/// <summary>
/// Stores an already processed color for current mapMember, to dbe used by all mapMember objects. Only applies to simple type renderers
/// </summary>
private int? StoredColor { get; set; }
/// <summary>
/// Stores a feature layer renderer to be used by <see cref="ProcessFeatureLayerColor"/> in <see cref="StoredRenderer"/>, any fields used by the renderer from the layer, and resets the <see cref="StoredColor"/> and <see cref="StoredRendererFields"/>
/// </summary>
/// <param name="featureLayer"></param>
/// <exception cref="AC.CalledOnWrongThreadException">Must be called on MCT.</exception>
public void StoreRendererAndFields(ADM.FeatureLayer featureLayer)
{
// field names are unique, but often their alias is used instead by renderer headings
// so we are storing both names and alias in this dictionary for fast lookup
// POC: adding aliases are not optimal, because they do not need to be unique && they can be the same as the name of another field
Dictionary<string, string> layerFieldDictionary = new();
foreach (ADM.FieldDescription field in featureLayer.GetFieldDescriptions())
{
layerFieldDictionary.TryAdd(field.Name, field.Name);
layerFieldDictionary.TryAdd(field.Alias, field.Name);
}
// clear stored values
StoredRendererFields = new();
StoredColor = null;
StoredRenderer = null;
AC.CIM.CIMRenderer layerRenderer = featureLayer.GetRenderer();
List<string> fields = new();
bool isSupported = false;
switch (layerRenderer)
{
case AC.CIM.CIMSimpleRenderer:
isSupported = true;
break;
case AC.CIM.CIMUniqueValueRenderer uniqueValueRenderer:
isSupported = true;
fields = uniqueValueRenderer.Fields.ToList();
break;
case AC.CIM.CIMClassBreaksRenderer classBreaksRenderer:
isSupported = true;
fields.Add(classBreaksRenderer.Field);
break;
default:
// TODO: log error here that a renderer is unsupported
break;
}
if (isSupported)
{
StoredRenderer = layerRenderer;
foreach (string field in fields)
{
if (layerFieldDictionary.TryGetValue(field, out string? fieldName))
{
StoredRendererFields.Add(fieldName);
}
}
}
}
/// <summary>
/// Stores a las layer renderer to be used by <see cref="ProcessLasLayerColor"/> in <see cref="StoredTinRenderer"/>
/// </summary>
/// <param name="lasLayer"></param>
/// <exception cref="AC.CalledOnWrongThreadException">Must be called on MCT.</exception>
public void StoreRenderer(ADM.LasDatasetLayer lasLayer)
{
// clear stored values
StoredTinRenderer = null;
// POC: not sure why we are only using the first renderer here
AC.CIM.CIMTinRenderer layerRenderer = lasLayer.GetRenderers()[0];
bool isSupported = false;
switch (layerRenderer)
{
case AC.CIM.CIMTinUniqueValueRenderer:
isSupported = true;
break;
default:
// TODO: log error here that a renderer is unsupported
break;
}
if (isSupported)
{
StoredTinRenderer = layerRenderer;
}
}
/// <summary>
/// Processes a las layer's point color by the stored <see cref="StoredRenderer"/>, and stores the point's id and color proxy to the <see cref="ColorProxyCache"/>.
/// POC: logic probably can be combined with ProcessFeatureLayerColor.
/// </summary>
/// <param name="point"></param>
public void ProcessLasLayerColor(ACD.Analyst3D.LasPoint point, string pointApplicationId)
{
// get the color from the renderer and point
AC.CIM.CIMColor? color;
switch (StoredTinRenderer)
{
case AC.CIM.CIMTinUniqueValueRenderer uniqueValueRenderer:
color = GetPointColorByUniqueValueRenderer(uniqueValueRenderer, point);
break;
default:
return;
}
// get or create the color proxy for the point
int argb = CIMColorToInt(color ?? point.RGBColor);
AddObjectIdToColorProxyCache(pointApplicationId, argb);
}
// Retrieves the las point color from a unique value renderer
// unique renderers have groups of conditions that may affect the color of a feature
// resulting in a different color than the default renderer symbol color
private AC.CIM.CIMColor? GetPointColorByUniqueValueRenderer(
AC.CIM.CIMTinUniqueValueRenderer renderer,
ACD.Analyst3D.LasPoint point
)
{
foreach (AC.CIM.CIMUniqueValueGroup group in renderer.Groups)
{
foreach (AC.CIM.CIMUniqueValueClass groupClass in group.Classes)
{
foreach (AC.CIM.CIMUniqueValue value in groupClass.Values)
{
// all field values have to match the row values
for (int i = 0; i < value.FieldValues.Length; i++)
{
string groupValue = value.FieldValues[i].Replace("<Null>", "");
object? pointValue = point.ClassCode;
if (ValuesAreEqual(groupValue, pointValue))
{
return groupClass.Symbol.Symbol.GetColor();
}
}
}
}
}
return null;
}
/// <summary>
/// Processes a feature layer's row color by the stored <see cref="StoredRenderer"/>, and stores the row's id and color proxy to the <see cref="ColorProxyCache"/>.
/// </summary>
/// <param name="row"></param>
/// <returns></returns>
/// <exception cref="ACD.Exceptions.GeodatabaseException"></exception>
public void ProcessFeatureLayerColor(ACD.Row row, string rowApplicationId)
{
// if stored color is not null, this means the renderer was a simple renderer that applies to the entire layer, and was already created.
// just add the row application id to the color proxy.
if (StoredColor is int existingColorProxyId)
{
AddObjectIdToColorProxyCache(rowApplicationId, existingColorProxyId);
return;
}
// get the color from the renderer and row
AC.CIM.CIMColor? color = null;
switch (StoredRenderer)
{
// simple renderers do not rely on fields, so the color can be retrieved from the renderer directly
case AC.CIM.CIMSimpleRenderer simpleRenderer:
color = simpleRenderer.Symbol.Symbol.GetColor();
break;
case AC.CIM.CIMUniqueValueRenderer uniqueValueRenderer:
color = GetRowColorByUniqueValueRenderer(uniqueValueRenderer, row);
break;
case AC.CIM.CIMClassBreaksRenderer classBreaksRenderer:
color = GetRowColorByClassBreaksRenderer(classBreaksRenderer, row);
break;
}
if (color is null)
{
// TODO: log error or throw exception that color could not be retrieved
return;
}
// get or create the color proxy for the row
int argb = CIMColorToInt(color);
AddObjectIdToColorProxyCache(rowApplicationId, argb);
// store color if from simple renderer
if (StoredRenderer is AC.CIM.CIMSimpleRenderer)
{
StoredColor = argb;
}
}
// Retrieves the row color from a class breaks renderer
// unique renderers have groups of conditions that may affect the color of a feature
// resulting in a different color than the default renderer symbol color
private AC.CIM.CIMColor? GetRowColorByClassBreaksRenderer(AC.CIM.CIMClassBreaksRenderer renderer, ACD.Row row)
{
AC.CIM.CIMColor? color = null;
// get the default symbol color
if (renderer.DefaultSymbol?.Symbol.GetColor() is AC.CIM.CIMColor defaultColor)
{
color = defaultColor;
}
// get the first stored field, since this renderer should only have 1 field
double storedFieldValue = Convert.ToDouble(row[StoredRendererFields.First()]);
List<AC.CIM.CIMClassBreak> reversedBreaks = new(renderer.Breaks);
reversedBreaks.Reverse();
foreach (var rBreak in reversedBreaks)
{
// keep looping until the last matching condition
if (storedFieldValue <= rBreak.UpperBound)
{
if (rBreak.Symbol.Symbol.GetColor() is AC.CIM.CIMColor breakColor)
{
color = breakColor;
}
else
{
// TODO: log error here, could not retrieve break color from symbol
}
}
}
return color;
}
// Retrieves the row color from a unique value renderer
// unique renderers have groups of conditions that may affect the color of a feature
// resulting in a different color than the default renderer symbol color
private AC.CIM.CIMColor? GetRowColorByUniqueValueRenderer(AC.CIM.CIMUniqueValueRenderer renderer, ACD.Row row)
{
AC.CIM.CIMColor? color = null;
// get the default symbol color
if (renderer.DefaultSymbol?.Symbol.GetColor() is AC.CIM.CIMColor defaultColor)
{
color = defaultColor;
}
// note: usually there is only 1 group
foreach (AC.CIM.CIMUniqueValueGroup group in renderer.Groups)
{
// loop through all values in groups to see if any have met conditions that result in a different color
foreach (AC.CIM.CIMUniqueValueClass groupClass in group.Classes)
{
bool groupConditionsMet = true;
foreach (AC.CIM.CIMUniqueValue value in groupClass.Values)
{
// all field values have to match the row values
for (int i = 0; i < StoredRendererFields.Count; i++)
{
string groupValue = value.FieldValues[i];
object? rowValue = row[StoredRendererFields[i]];
if (!ValuesAreEqual(groupValue, rowValue))
{
groupConditionsMet = false;
break;
}
}
}
// set the group color to class symbol color if conditions are met
if (groupConditionsMet)
{
if (groupClass.Symbol.Symbol.GetColor() is AC.CIM.CIMColor groupColor)
{
color = groupColor;
}
else
{
// TODO: log error here, could not retrieve group color from symbol
}
}
}
}
return color;
}
/// <summary>
/// Compares the label string of a UniqueValueRenderer (groupValue), and an object value (row, las point), to determine if they are equal
/// </summary>
/// <param name="objectValue"></param>
/// <param name="groupValue"></param>
private bool ValuesAreEqual(string groupValue, object? objectValue)
{
switch (objectValue)
{
case int:
case short:
case long:
case byte:
string objectValueString = Convert.ToString(objectValue) ?? "";
return groupValue.Equals(objectValueString);
case string:
return groupValue.Equals(objectValue);
// POC: these are tricky to compare with the label strings accurately, so will trim both values to 5 decimal places.
case double d:
return double.TryParse(groupValue, out double groupDouble) && groupDouble - d < 0.000001;
case float f:
return float.TryParse(groupValue, out float groupFloat) && groupFloat - f < 0.000001;
default:
return false;
}
}
private void AddObjectIdToColorProxyCache(string objectId, int argb)
{
if (ColorProxyCache.TryGetValue(argb, out ColorProxy? colorProxy))
{
colorProxy.objects.Add(objectId);
}
else
{
ColorProxy newColorProxy =
new()
{
name = argb.ToString(),
objects = new() { objectId },
value = argb,
applicationId = argb.ToString()
};
ColorProxyCache.Add(argb, newColorProxy);
}
}
private int ArgbToInt(int a, int r, int g, int b)
{
return (a << 24) | (r << 16) | (g << 8) | b;
}
// Gets the argb int from a CIMColor
// Defaults to assuming CIMColor.Values represent the red, green, and blue channels.
private int CIMColorToInt(AC.CIM.CIMColor color)
{
switch (color)
{
case AC.CIM.CIMHSVColor hsv:
(float hsvR, float hsvG, float hsvB) = RgbFromHsv(hsv.H, hsv.S, hsv.V);
return ArgbToInt(
(int)Math.Round(hsv.Alpha),
(int)Math.Round(hsvR * 255),
(int)Math.Round(hsvG * 255),
(int)Math.Round(hsvB * 255)
);
case AC.CIM.CIMCMYKColor cmyk:
float k = cmyk.K;
int cmykR = Convert.ToInt32(255 * (1 - cmyk.C) * (1 - k));
int cmykG = Convert.ToInt32(255 * (1 - cmyk.M) * (1 - k));
int cmykB = Convert.ToInt32(255 * (1 - cmyk.Y) * (1 - k));
return ArgbToInt((int)Math.Round(cmyk.Alpha), cmykR, cmykG, cmykB);
default:
return ArgbToInt(
(int)Math.Round(color.Alpha),
(int)Math.Round(color.Values[0]),
(int)Math.Round(color.Values[1]),
(int)Math.Round(color.Values[2])
);
}
}
private (float, float, float) RgbFromHsv(float hue, float saturation, float value)
{
// Translates HSV color to RGB color
// H: 0.0 - 360.0, S: 0.0 - 100.0, V: 0.0 - 100.0
// R, G, B: 0.0 - 1.0
float c = (value / 100) * (saturation / 100);
float x = c * (1 - Math.Abs(((hue / 60) % 2) - 1));
float m = (value / 100) - c;
float r = 0;
float g = 0;
float b = 0;
if (hue >= 0 && hue < 60)
{
r = c;
g = x;
b = 0;
}
else if (hue >= 60 && hue < 120)
{
r = x;
g = c;
b = 0;
}
else if (hue >= 120 && hue < 180)
{
r = 0;
g = c;
b = x;
}
else if (hue >= 180 && hue < 240)
{
r = 0;
g = x;
b = c;
}
else if (hue >= 240 && hue < 300)
{
r = x;
g = 0;
b = c;
}
else if (hue >= 300 && hue < 360)
{
r = c;
g = 0;
b = x;
}
r += m;
g += m;
b += m;
return (r, g, b);
}
}
@@ -0,0 +1,97 @@
using Speckle.Connectors.ArcGIS.HostApp.Extensions;
using Speckle.Sdk.Models.Collections;
namespace Speckle.Connectors.ArcGIS.HostApp;
public class ArcGISLayerUnpacker
{
/// <summary>
/// Cache of all collections created by unpacked Layer MapMembers. Key is the Speckle applicationId (Layer URI).
/// </summary>
public Dictionary<string, Collection> CollectionCache { get; } = new();
/// <summary>
/// Mapmembers can be layers containing objects, or LayerContainers containing other layers.
/// Unpacks selected mapMembers and creates their corresponding collection on the root collection.
/// </summary>
/// <param name="mapMembers"></param>
/// <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 List<ADM.MapMember> UnpackSelection(
IEnumerable<ADM.MapMember> mapMembers,
Collection parentCollection,
List<ADM.MapMember>? objects = null
)
{
if (objects is null)
{
objects = new();
}
foreach (ADM.MapMember mapMember in mapMembers)
{
switch (mapMember)
{
case ADM.ILayerContainer container:
Collection containerCollection = CreateAndCacheMapMemberCollection(mapMember, true);
parentCollection.elements.Add(containerCollection);
UnpackSelection(container.Layers, containerCollection, objects);
break;
default:
if (!(objects.Contains(mapMember)))
{
Collection collection = CreateAndCacheMapMemberCollection(mapMember);
parentCollection.elements.Add(collection);
objects.Add(mapMember);
}
break;
}
}
return objects;
}
private Collection CreateAndCacheMapMemberCollection(ADM.MapMember mapMember, bool isLayerContainer = false)
{
string mapMemberApplicationId = mapMember.GetSpeckleApplicationId();
Collection collection =
new()
{
name = mapMember.Name,
applicationId = mapMemberApplicationId,
["type"] = mapMember.GetType().Name
};
switch (mapMember)
{
case ADM.IDisplayTable displayTable: // get fields from layers that implement IDisplayTable, eg FeatureLayer or StandaloneTable
Dictionary<string, string>? fields = displayTable
.GetFieldDescriptions()
.ToDictionary(field => field.Name, field => field.Type.ToString());
collection["fields"] = fields;
if (mapMember is ADM.BasicFeatureLayer basicFeatureLayer)
{
collection["shapeType"] = basicFeatureLayer.ShapeType.ToString();
}
break;
case ADM.Layer layer:
collection["mapLayerType"] = layer.MapLayerType.ToString();
break;
case ADM.ILayerContainer:
default:
break;
}
if (!isLayerContainer) // do not cache layer containers, since these won't contain any objects
{
CollectionCache.Add(mapMemberApplicationId, collection);
}
return collection;
}
}
@@ -0,0 +1,31 @@
using ArcGIS.Core.Data.Raster;
namespace Speckle.Connectors.ArcGIS.HostApp.Extensions;
public static class SpeckleApplicationIdExtensions
{
/// <summary>
/// Retrieves the Speckle application id for map members
/// </summary>
public static string GetSpeckleApplicationId(this ADM.MapMember mapMember) => mapMember.URI;
/// <summary>
/// Constructs the Speckle application id for Features as a concatenation of the layer URI (applicationId)
/// and the row OID (index of row in layer).
/// </summary>
/// <exception cref="ACD.Exceptions.GeodatabaseException">Throws when this is *not* called on MCT. Use QueuedTask.Run.</exception>
public static string GetSpeckleApplicationId(this ACD.Row row, string layerApplicationId) =>
$"{layerApplicationId}_{row.GetObjectID()}";
/// <summary>
/// Constructs the Speckle application id for Raster as a concatenation of the layer URI (applicationId) and 0-index
/// </summary>
public static string GetSpeckleApplicationId(this Raster _, string layerApplicationId) => $"{layerApplicationId}_0";
/// <summary>
/// Constructs the Speckle application id for LasDatasets as a concatenation of the layer URI (applicationId)
/// and point OID.
/// </summary>
public static string GetSpeckleApplicationId(this ACD.Analyst3D.LasPoint point, string layerApplicationId) =>
$"{layerApplicationId}_{point.PointID}";
}
@@ -1,9 +0,0 @@
using ArcGIS.Desktop.Framework.Threading.Tasks;
using Speckle.Connectors.Common.Operations;
namespace Speckle.Connectors.ArcGIS.HostApp;
public class SyncToQueuedTask : ISyncToThread
{
public Task<T> RunOnThread<T>(Func<T> func) => QueuedTask.Run(func);
}
@@ -12,7 +12,7 @@ using Speckle.Connectors.Common.Operations;
using Speckle.Converters.ArcGIS3;
using Speckle.Converters.ArcGIS3.Utils;
using Speckle.Converters.Common;
using Speckle.Objects.GIS;
using Speckle.Objects.Data;
using Speckle.Objects.Other;
using Speckle.Sdk;
using Speckle.Sdk.Models;
@@ -20,7 +20,6 @@ using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.GraphTraversal;
using Speckle.Sdk.Models.Instances;
using Speckle.Sdk.Models.Proxies;
using RasterLayer = Speckle.Objects.GIS.RasterLayer;
namespace Speckle.Connectors.ArcGIS.Operations.Receive;
@@ -30,7 +29,6 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
private readonly IFeatureClassUtils _featureClassUtils;
private readonly ILocalToGlobalUnpacker _localToGlobalUnpacker;
private readonly LocalToGlobalConverterUtils _localToGlobalConverterUtils;
private readonly ICrsUtils _crsUtils;
// POC: figure out the correct scope to only initialize on Receive
private readonly IConverterSettingsStore<ArcGISConversionSettings> _settingsStore;
@@ -43,7 +41,6 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
IFeatureClassUtils featureClassUtils,
ILocalToGlobalUnpacker localToGlobalUnpacker,
LocalToGlobalConverterUtils localToGlobalConverterUtils,
ICrsUtils crsUtils,
GraphTraversal traverseFunction,
ArcGISColorManager colorManager
)
@@ -55,14 +52,26 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
_localToGlobalConverterUtils = localToGlobalConverterUtils;
_traverseFunction = traverseFunction;
_colorManager = colorManager;
_crsUtils = crsUtils;
}
public async Task<HostObjectBuilderResult> Build(
public Task<HostObjectBuilderResult> Build(
Base rootObject,
string projectName,
string modelName,
Action<string, double?>? onOperationProgressed,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
return QueuedTask.Run(
() => BuildInternal(rootObject, projectName, modelName, onOperationProgressed, cancellationToken)
);
}
private HostObjectBuilderResult BuildInternal(
Base rootObject,
string projectName,
string modelName,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
@@ -70,7 +79,7 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
// ATM, GIS commit CRS is stored per layer (in FeatureClass converter), but should be moved to the Root level too
// Prompt the UI conversion started. Progress bar will swoosh.
onOperationProgressed?.Invoke("Converting", null);
onOperationProgressed.Report(new("Converting", null));
// get materials
List<RenderMaterialProxy>? materials = (rootObject[ProxyKeys.RENDER_MATERIAL] as List<object>)
@@ -89,7 +98,7 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
}
int count = 0;
List<LocalToGlobalMap> objectsToConvert = GetObjectsToConvert(rootObject);
IReadOnlyCollection<LocalToGlobalMap> objectsToConvert = GetObjectsToConvert(rootObject);
Dictionary<TraversalContext, ObjectConversionTracker> conversionTracker = new();
// 1. convert everything
@@ -104,13 +113,15 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
try
{
obj = _localToGlobalConverterUtils.TransformObjects(objectToConvert.AtomicObject, objectToConvert.Matrix);
object? conversionResult =
obj is GisNonGeometricFeature
? null
: await QueuedTask.Run(() => _converter.Convert(obj)).ConfigureAwait(false);
object conversionResult = _converter.Convert(obj);
string nestedLayerPath = $"{string.Join("\\", path)}";
if (objectToConvert.TraversalContext.Parent?.Current is not VectorLayer)
if (obj is ArcgisObject gisObj)
{
nestedLayerPath += $"\\{gisObj.name}";
}
else
{
nestedLayerPath += $"\\{obj.speckle_type.Split(".")[^1]}"; // add sub-layer by speckleType, for non-GIS objects
}
@@ -125,26 +136,25 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
{
results.Add(new(Status.ERROR, obj, null, null, ex));
}
onOperationProgressed?.Invoke("Converting", (double)++count / objectsToConvert.Count);
onOperationProgressed.Report(new("Converting", (double)++count / objectsToConvert.Count));
}
// 2.1. Group conversionTrackers (to write into datasets)
onOperationProgressed?.Invoke("Grouping features into layers", null);
Dictionary<string, List<(TraversalContext, ObjectConversionTracker)>> convertedGroups = await QueuedTask
.Run(() =>
{
return _featureClassUtils.GroupConversionTrackers(conversionTracker, onOperationProgressed);
})
.ConfigureAwait(false);
onOperationProgressed.Report(new("Grouping features into layers", null));
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?.Invoke("Writing to Database", null);
await QueuedTask
.Run(() =>
{
_featureClassUtils.CreateDatasets(conversionTracker, convertedGroups, onOperationProgressed);
})
.ConfigureAwait(false);
onOperationProgressed.Report(new("Writing to Database", null));
_featureClassUtils.CreateDatasets(
conversionTracker,
convertedGroups,
(s, progres) => onOperationProgressed.Report(new(s, progres))
);
// 3. add layer and tables to the Map and Table Of Content
@@ -153,7 +163,7 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
int bakeCount = 0;
Dictionary<string, (MapMember, CIMUniqueValueRenderer?)> bakedMapMembers = new();
onOperationProgressed?.Invoke("Adding to Map", bakeCount);
onOperationProgressed.Report(new("Adding to Map", bakeCount));
foreach (var item in conversionTracker)
{
@@ -196,8 +206,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);
@@ -215,7 +224,8 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
// add report item
AddResultsFromTracker(trackerItem, results);
}
onOperationProgressed?.Invoke("Adding to Map", (double)++bakeCount / conversionTracker.Count);
onOperationProgressed.Report(new("Adding to Map", (double)++bakeCount / conversionTracker.Count));
}
// apply renderers to baked layers
@@ -224,24 +234,20 @@ 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));
// TODO: validated a correct set regarding bakedobject ids
return new(bakedObjectIds, results);
return new HostObjectBuilderResult(bakedObjectIds, results);
}
private List<LocalToGlobalMap> GetObjectsToConvert(Base rootObject)
private IReadOnlyCollection<LocalToGlobalMap> GetObjectsToConvert(Base rootObject)
{
// keep GISlayers in the list, because they are still needed to extract CRS of the commit (code below)
List<TraversalContext> objectsToConvertTc = _traverseFunction.Traverse(rootObject).ToList();
// get CRS from any present VectorLayer
Base? vLayer = objectsToConvertTc.FirstOrDefault(x => x.Current is VectorLayer)?.Current;
using var crs = _crsUtils.FindSetCrsDataOnReceive(vLayer); // TODO help
// now filter the objects
objectsToConvertTc = objectsToConvertTc.Where(ctx => ctx.Current is not Collection).ToList();
@@ -295,78 +301,72 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
}
}
private Task<MapMember> AddDatasetsToMap(
private MapMember AddDatasetsToMap(
ObjectConversionTracker trackerItem,
Dictionary<string, GroupLayer> createdLayerGroups,
string projectName,
string modelName
)
{
return 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)
{
// 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;
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
}
// add group for the current layer
string shortName = nestedLayerName.Split("\\")[^1];
string nestedLayerPath = string.Join("\\", nestedLayerName.Split("\\").SkipLast(1));
var groupLayer = CreateNestedGroupLayer(nestedLayerPath, createdLayerGroups);
// if no general group layer found
if (createdLayerGroups.Count == 0)
// 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)
{
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
throw new SpeckleException($"Layer '{shortName}' was not created");
}
layer.SetExpanded(false);
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
// 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 layer = LayerFactory.Instance.CreateLayer(uri, groupLayer, layerName: shortName);
if (layer == null)
var groundSurfaceLayer = _settingsStore.Current.Map.GetGroundElevationSurfaceLayer();
var layerElevationSurface = new CIMLayerElevationSurface { ElevationSurfaceLayerURI = groundSurfaceLayer.URI, };
// for Feature Layers
if (layer.GetDefinition() is CIMFeatureLayer cimLyr)
{
throw new SpeckleException($"Layer '{shortName}' was not created");
cimLyr.LayerElevation = layerElevationSurface;
layer.SetDefinition(cimLyr);
}
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;
}
});
return layer;
}
catch (ArgumentException)
{
StandaloneTable table = StandaloneTableFactory.Instance.CreateStandaloneTable(
uri,
groupLayer,
tableName: shortName
);
return table;
}
}
private GroupLayer CreateNestedGroupLayer(string nestedLayerPath, Dictionary<string, GroupLayer> createdLayerGroups)
@@ -408,17 +408,4 @@ public class ArcGISHostObjectBuilder : IHostObjectBuilder
var originalPath = reverseOrderPath.Reverse().ToArray();
return originalPath.Where(x => !string.IsNullOrEmpty(x)).ToArray();
}
[Pure]
private static bool HasGISParent(TraversalContext context)
{
List<Base> gisLayers = context.GetAscendants().Where(IsGISType).Where(obj => obj != context.Current).ToList();
return gisLayers.Count > 0;
}
[Pure]
private static bool IsGISType(Base obj)
{
return obj is RasterLayer or VectorLayer;
}
}
@@ -1,206 +1,362 @@
using System.Diagnostics;
using ArcGIS.Core.Data.Raster;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping;
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;
using Speckle.Converters.ArcGIS3;
using Speckle.Converters.Common;
using Speckle.Objects.GIS;
using Speckle.Sdk;
using Speckle.Sdk.Logging;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Connectors.ArcGis.Operations.Send;
/// <summary>
/// Stateless builder object to turn an ISendFilter into a <see cref="Base"/> object
/// </summary>
public class ArcGISRootObjectBuilder : IRootObjectBuilder<MapMember>
public class ArcGISRootObjectBuilder : IRootObjectBuilder<ADM.MapMember>
{
private readonly IRootToSpeckleConverter _rootToSpeckleConverter;
private readonly ISendConversionCache _sendConversionCache;
private readonly ArcGISColorManager _colorManager;
private readonly ArcGISLayerUnpacker _layerUnpacker;
private readonly ArcGISColorUnpacker _colorUnpacker;
private readonly IConverterSettingsStore<ArcGISConversionSettings> _converterSettings;
private readonly MapMembersUtils _mapMemberUtils;
private readonly ILogger<ArcGISRootObjectBuilder> _logger;
private readonly ISdkActivityFactory _activityFactory;
private readonly MapMembersUtils _mapMemberUtils;
public ArcGISRootObjectBuilder(
ISendConversionCache sendConversionCache,
ArcGISColorManager colorManager,
ArcGISLayerUnpacker layerUnpacker,
ArcGISColorUnpacker colorUnpacker,
IConverterSettingsStore<ArcGISConversionSettings> converterSettings,
IRootToSpeckleConverter rootToSpeckleConverter,
MapMembersUtils mapMemberUtils,
ILogger<ArcGISRootObjectBuilder> logger,
ISdkActivityFactory activityFactory
ISdkActivityFactory activityFactory,
MapMembersUtils mapMemberUtils
)
{
_sendConversionCache = sendConversionCache;
_colorManager = colorManager;
_layerUnpacker = layerUnpacker;
_colorUnpacker = colorUnpacker;
_converterSettings = converterSettings;
_rootToSpeckleConverter = rootToSpeckleConverter;
_mapMemberUtils = mapMemberUtils;
_logger = logger;
_activityFactory = activityFactory;
_mapMemberUtils = mapMemberUtils;
}
#pragma warning disable CA1506
public async Task<RootObjectBuilderResult> Build(
#pragma warning restore CA1506
IReadOnlyList<MapMember> objects,
SendInfo sendInfo,
Action<string, double?>? onOperationProgressed = null,
CancellationToken ct = default
public Task<RootObjectBuilderResult> Build(
IReadOnlyList<ADM.MapMember> layers,
SendInfo __,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
) => QueuedTask.Run(() => BuildInternal(layers, __, onOperationProgressed, cancellationToken));
private async Task<RootObjectBuilderResult> BuildInternal(
IReadOnlyList<ADM.MapMember> layers,
SendInfo __,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
// TODO: add a warning if Geographic CRS is set
// "Data has been sent in the units 'degrees'. It is advisable to set the project CRS to Projected type (e.g. EPSG:32631) to be able to receive geometry correctly in CAD/BIM software"
int count = 0;
Collection rootObjectCollection = new() { name = MapView.Active.Map.Name }; //TODO: Collections
rootObjectCollection["units"] = _converterSettings.Current.SpeckleUnits;
List<SendConversionResult> results = new(objects.Count);
var cacheHitCount = 0;
List<(GroupLayer, Collection)> nestedGroups = new();
// reorder selected layers by Table of Content (TOC) order
List<(MapMember, int)> layersWithDisplayPriority = _mapMemberUtils.GetLayerDisplayPriority(
MapView.Active.Map,
objects
);
onOperationProgressed?.Invoke("Converting", null);
using (var __ = _activityFactory.Start("Converting objects"))
{
foreach ((MapMember mapMember, _) in layersWithDisplayPriority)
// 0 - Create Root collection and attach CRS properties
// CRS properties are useful for data based workflows coming out of gis applications
SpatialReference sr = _converterSettings.Current.ActiveCRSoffsetRotation.SpatialReference;
Dictionary<string, object?> spatialReference =
new()
{
ct.ThrowIfCancellationRequested();
["name"] = sr.Name,
["unit"] = sr.Unit.Name,
["wkid"] = sr.Wkid,
["wkt"] = sr.Wkt,
};
using (var convertingActivity = _activityFactory.Start("Converting object"))
Dictionary<string, object?> crs =
new()
{
["trueNorthRadians"] = _converterSettings.Current.ActiveCRSoffsetRotation.TrueNorthRadians,
["latOffset"] = _converterSettings.Current.ActiveCRSoffsetRotation.LatOffset,
["lonOffset"] = _converterSettings.Current.ActiveCRSoffsetRotation.LonOffset,
["spatialReference"] = spatialReference
};
Collection rootCollection =
new()
{
name = ADM.MapView.Active.Map.Name,
["units"] = _converterSettings.Current.SpeckleUnits,
["crs"] = crs
};
// 1 - Unpack the selected mapmembers
// In Arcgis, mapmembers are collections of other mapmember or objects.
// We need to unpack the selected mapmembers into all leaf-level mapmembers (containing just objects) and build the root collection structure during unpacking.
// Mapmember dynamically attached properties are also added at this step.
List<ADM.MapMember> unpackedLayers;
Dictionary<ADM.MapMember, long> layersWithFeatureCount;
long allFeaturesCount;
ADM.Map map = ADM.MapView.Active.Map;
IEnumerable<ADM.MapMember> layersOrdered = _mapMemberUtils.GetMapMembersInOrder(map, layers);
using (var _ = _activityFactory.Start("Unpacking selection"))
{
unpackedLayers = _layerUnpacker.UnpackSelection(layersOrdered, rootCollection);
// count number of features to convert. Raster layers are counter as 1 feature for now (not ideal)
layersWithFeatureCount = CountAllFeaturesInLayers(unpackedLayers);
allFeaturesCount = layersWithFeatureCount.Values.Sum();
}
List<SendConversionResult> results = new(unpackedLayers.Count);
onOperationProgressed.Report(new("Converting", null));
using (var convertingActivity = _activityFactory.Start("Converting objects"))
{
long count = 0;
foreach (var (layer, layerFeatureCount) in layersWithFeatureCount)
{
cancellationToken.ThrowIfCancellationRequested();
string layerApplicationId = layer.GetSpeckleApplicationId();
try
{
var collectionHost = rootObjectCollection;
string applicationId = mapMember.URI;
string sourceType = mapMember.GetType().Name;
Base converted;
try
// get the corresponding collection for this layer - we'll add all converted objects to the collection
if (_layerUnpacker.CollectionCache.TryGetValue(layerApplicationId, out Collection? layerCollection))
{
int groupCount = nestedGroups.Count; // bake here, because count will change in the loop
// if the layer is not a part of the group, reset groups
for (int i = 0; i < groupCount; i++)
var status = Status.SUCCESS;
var sdkStatus = SdkActivityStatusCode.Ok;
// TODO: check cache first to see if this layer was previously converted
/*
if (_sendConversionCache.TryGetValue(
sendInfo.ProjectId,
layerApplicationId,
out ObjectReference? value
))
{
if (nestedGroups.Count > 0 && !nestedGroups[0].Item1.Layers.Select(x => x.URI).Contains(applicationId))
{
nestedGroups.RemoveAt(0);
}
else
{
// break at the first group, which contains current layer
}
*/
switch (layer)
{
case ADM.FeatureLayer featureLayer:
List<Base> convertedFeatureLayerObjects = ConvertFeatureLayerObjects(
featureLayer,
count,
allFeaturesCount,
onOperationProgressed,
cancellationToken
);
layerCollection.elements.AddRange(convertedFeatureLayerObjects);
break;
case ADM.RasterLayer rasterLayer:
List<Base> convertedRasterLayerObjects = ConvertRasterLayerObjects(
rasterLayer,
count,
allFeaturesCount,
onOperationProgressed,
cancellationToken
);
layerCollection.elements.AddRange(convertedRasterLayerObjects);
break;
case ADM.LasDatasetLayer lasDatasetLayer:
List<Base> convertedLasDatasetObjects = ConvertLasDatasetLayerObjects(
lasDatasetLayer,
count,
allFeaturesCount,
onOperationProgressed,
cancellationToken
);
layerCollection.elements.AddRange(convertedLasDatasetObjects);
break;
default:
status = Status.ERROR;
sdkStatus = SdkActivityStatusCode.Error;
break;
}
}
// don't use cache for group layers
if (
mapMember is not GroupLayer
&& _sendConversionCache.TryGetValue(sendInfo.ProjectId, applicationId, out ObjectReference? value)
)
{
converted = value;
cacheHitCount++;
}
else
{
if (mapMember is GroupLayer group)
{
// group layer will always come before it's contained layers
// keep active group last in the list
converted = new Collection();
nestedGroups.Insert(0, (group, (Collection)converted));
}
else
{
converted = await QueuedTask
.Run(() => (Collection)_rootToSpeckleConverter.Convert(mapMember))
.ConfigureAwait(false);
// get units & Active CRS (for writing geometry coords)
converted["units"] = _converterSettings.Current.SpeckleUnits;
var spatialRef = _converterSettings.Current.ActiveCRSoffsetRotation.SpatialReference;
converted["crs"] = new CRS
{
wkt = spatialRef.Wkt,
name = spatialRef.Name,
offset_y = Convert.ToSingle(_converterSettings.Current.ActiveCRSoffsetRotation.LatOffset),
offset_x = Convert.ToSingle(_converterSettings.Current.ActiveCRSoffsetRotation.LonOffset),
rotation = Convert.ToSingle(_converterSettings.Current.ActiveCRSoffsetRotation.TrueNorthRadians),
units_native = _converterSettings.Current.SpeckleUnits
};
}
// other common properties for layers and groups
converted["name"] = mapMember.Name;
converted.applicationId = applicationId;
}
if (
nestedGroups.Count == 0
|| nestedGroups.Count == 1 && nestedGroups[0].Item2.applicationId == applicationId
)
{
// add to host if no groups, or current root group
collectionHost.elements.Add(converted);
}
else
{
// if we are adding a layer inside the group
var parentCollection = nestedGroups.FirstOrDefault(x =>
x.Item1.Layers.Select(y => y.URI).Contains(applicationId)
);
parentCollection.Item2.elements.Add(converted);
}
results.Add(new(Status.SUCCESS, applicationId, sourceType, converted));
convertingActivity?.SetStatus(SdkActivityStatusCode.Ok);
count += layerFeatureCount;
results.Add(new(status, layerApplicationId, layer.GetType().Name, layerCollection));
convertingActivity?.SetStatus(sdkStatus);
}
catch (Exception ex) when (!ex.IsFatal())
else
{
_logger.LogSendConversionError(ex, sourceType);
results.Add(new(Status.ERROR, applicationId, sourceType, null, ex));
convertingActivity?.SetStatus(SdkActivityStatusCode.Error);
convertingActivity?.RecordException(ex);
throw new SpeckleException($"No converted Collection found for layer {layerApplicationId}.");
}
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogSendConversionError(ex, layer.GetType().Name);
results.Add(new(Status.ERROR, layerApplicationId, layer.GetType().Name, null, ex));
convertingActivity?.SetStatus(SdkActivityStatusCode.Error);
convertingActivity?.RecordException(ex);
}
onOperationProgressed?.Invoke("Converting", (double)++count / objects.Count);
await Task.Yield();
}
}
if (results.All(x => x.Status == Status.ERROR))
{
throw new SpeckleConversionException("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."); // fail fast instead creating empty commit! It will appear as model card error with red color.
}
// POC: Add Color Proxies
List<ColorProxy> colorProxies = _colorManager.UnpackColors(layersWithDisplayPriority);
rootObjectCollection[ProxyKeys.COLOR] = colorProxies;
// 3 - Add Color Proxies
rootCollection[ProxyKeys.COLOR] = _colorUnpacker.ColorProxyCache.Values.ToList();
// POC: Log would be nice, or can be removed.
Debug.WriteLine(
$"Cache hit count {cacheHitCount} out of {objects.Count} ({(double)cacheHitCount / objects.Count})"
);
return new RootObjectBuilderResult(rootCollection, results);
}
return new RootObjectBuilderResult(rootObjectCollection, results);
private Dictionary<ADM.MapMember, long> CountAllFeaturesInLayers(List<ADM.MapMember> unpackedLayers)
{
Dictionary<ADM.MapMember, long> layersFeatureCount = new();
foreach (ADM.MapMember layer in unpackedLayers)
{
switch (layer)
{
case ADM.FeatureLayer featureLayer:
layersFeatureCount.Add(featureLayer, featureLayer.GetFeatureClass().GetCount());
break;
case ADM.RasterLayer rasterLayer:
// count Raster layer as 1 feature: not optimal but this is the approach for now
layersFeatureCount.Add(rasterLayer, 1);
break;
case ADM.LasDatasetLayer lasDatasetLayer:
var dataset = lasDatasetLayer.GetLasDataset();
// simple dataset.GetPointCount() keeps returning null, so switched to EstimatePointCount
layersFeatureCount.Add(
lasDatasetLayer,
(long)dataset.EstimatePointCount(dataset.GetDefinition().GetExtent())
);
break;
}
}
return layersFeatureCount;
}
private List<Base> ConvertFeatureLayerObjects(
ADM.FeatureLayer featureLayer,
long count,
long allFeaturesCount,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
string layerApplicationId = featureLayer.GetSpeckleApplicationId();
List<Base> convertedObjects = new();
// 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())
{
// allow cancellation before every feature
cancellationToken.ThrowIfCancellationRequested();
// 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;
convertedObjects.Add(converted);
// process the object color
_colorUnpacker.ProcessFeatureLayerColor(row, applicationId);
}
// update report
onOperationProgressed.Report(new("Converting", (double)++count / allFeaturesCount));
}
}
return convertedObjects;
}
// POC: raster colors are stored as mesh vertex colors in RasterToSpeckleConverter. Should probably move to color unpacker.
private List<Base> ConvertRasterLayerObjects(
ADM.RasterLayer rasterLayer,
long count,
long allFeaturesCount,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
string layerApplicationId = rasterLayer.GetSpeckleApplicationId();
List<Base> convertedObjects = new();
Raster raster = rasterLayer.GetRaster();
// check cancellation token before conversion
cancellationToken.ThrowIfCancellationRequested();
Base converted = _rootToSpeckleConverter.Convert(raster);
string applicationId = raster.GetSpeckleApplicationId(layerApplicationId);
converted.applicationId = applicationId;
convertedObjects.Add(converted);
// update report
onOperationProgressed.Report(new("Converting", (double)++count / allFeaturesCount));
return convertedObjects;
}
private List<Base> ConvertLasDatasetLayerObjects(
ADM.LasDatasetLayer lasDatasetLayer,
long count,
long allFeaturesCount,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
string layerApplicationId = lasDatasetLayer.GetSpeckleApplicationId();
List<Base> convertedObjects = new();
try
{
// store the layer renderer for color unpacking
_colorUnpacker.StoreRenderer(lasDatasetLayer);
using (ACD.Analyst3D.LasPointCursor ptCursor = lasDatasetLayer.SearchPoints(new ACD.Analyst3D.LasPointFilter()))
{
while (ptCursor.MoveNext())
{
// allow cancellation before every point
cancellationToken.ThrowIfCancellationRequested();
using (ACD.Analyst3D.LasPoint pt = ptCursor.Current)
{
Base converted = _rootToSpeckleConverter.Convert(pt);
string applicationId = pt.GetSpeckleApplicationId(layerApplicationId);
converted.applicationId = applicationId;
convertedObjects.Add(converted);
// process the object color
_colorUnpacker.ProcessLasLayerColor(pt, applicationId);
}
// update report
onOperationProgressed.Report(new("Converting", (double)++count / allFeaturesCount));
}
}
}
catch (ACD.Exceptions.TinException ex)
{
throw new SpeckleException("3D analyst extension is not enabled for .las layer operations", ex);
}
return convertedObjects;
}
}
@@ -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();
}
}
@@ -3,21 +3,25 @@ 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.Newtonsoft.Json;
using Speckle.Sdk.Common;
using Speckle.Connectors.DUI.Utils;
namespace Speckle.Connectors.ArcGIS.Utils;
public class ArcGISDocumentStore : DocumentModelStore
{
private readonly IThreadContext _threadContext;
public ArcGISDocumentStore(
JsonSerializerSettings serializerOption,
ITopLevelExceptionHandler topLevelExceptionHandler
IJsonSerializer jsonSerializer,
ITopLevelExceptionHandler topLevelExceptionHandler,
IThreadContext threadContext
)
: base(serializerOption, true)
: base(jsonSerializer)
{
_threadContext = threadContext;
ActiveMapViewChangedEvent.Subscribe(a => topLevelExceptionHandler.CatchUnhandled(() => OnMapViewChanged(a)), true);
ProjectSavingEvent.Subscribe(
_ =>
@@ -40,7 +44,7 @@ public class ArcGISDocumentStore : DocumentModelStore
if (!IsDocumentInit && MapView.Active != null)
{
IsDocumentInit = true;
ReadFromFile();
LoadState();
OnDocumentChanged();
}
}
@@ -52,14 +56,14 @@ public class ArcGISDocumentStore : DocumentModelStore
return;
}
WriteToFile();
SaveState();
}
private void OnProjectSaving()
{
if (MapView.Active is not null)
{
WriteToFile();
SaveState();
}
}
@@ -74,58 +78,56 @@ public class ArcGISDocumentStore : DocumentModelStore
}
IsDocumentInit = true;
ReadFromFile();
LoadState();
OnDocumentChanged();
}
public override void WriteToFile()
{
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"));
string serializedModels = Serialize();
XElement xmlModelCards = new("SpeckleModelCards", serializedModels);
// 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) =>
QueuedTask
.Run(() =>
{
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() =>
QueuedTask
.Run(() =>
{
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());
});
}
public override void ReadFromFile()
{
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)
{
Models = new();
return;
}
string modelsString = element.Value;
Models = Deserialize(modelsString).NotNull();
});
}
string modelsString = element.Value;
LoadFromString(modelsString);
})
.FireAndForget();
}
@@ -1,4 +1,3 @@
using ArcGIS.Desktop.Internal.Mapping;
using ArcGIS.Desktop.Mapping;
namespace Speckle.Connectors.ArcGIS.Utils;
@@ -28,45 +27,35 @@ public class MapMembersUtils
List<MapMember> mapMembers = new();
foreach (var layer in mapMembersToUnpack)
{
mapMembers.Add(layer);
switch (layer)
{
case GroupLayer subGroup:
mapMembers.Add(layer);
var subGroupMapMembers = UnpackMapLayers(subGroup.Layers);
mapMembers.AddRange(subGroupMapMembers);
break;
case ILayerContainerInternal subLayerContainerInternal:
mapMembers.Add(layer);
var subLayerMapMembers = UnpackMapLayers(subLayerContainerInternal.InternalLayers);
case ILayerContainer subGroup:
var subLayerMapMembers = UnpackMapLayers(subGroup.Layers);
mapMembers.AddRange(subLayerMapMembers);
break;
default:
mapMembers.Add(layer);
break;
}
}
return mapMembers;
}
// Gets the layer display priority for selected layers
public List<(MapMember, int)> GetLayerDisplayPriority(Map map, IReadOnlyList<MapMember> selectedMapMembers)
/// <summary>
/// Sorts the selected mapmembers into the same order as they appear in the Table of Contents (TOC) bar in the file.
/// This is a required step before unpacking layers, because depending on the user selection order, some children layers may appear before their container layer if both the container and children layers are selected.
/// </summary>
public IEnumerable<MapMember> GetMapMembersInOrder(Map map, IReadOnlyList<MapMember> selectedMapMembers)
{
// first get all map layers
List<MapMember> allMapMembers = GetAllMapMembers(map);
// recalculate selected layer priority from all map layers
List<(MapMember, int)> selectedLayers = new();
int newCount = 0;
foreach (MapMember mapMember in allMapMembers)
{
if (selectedMapMembers.Contains(mapMember))
{
selectedLayers.Add((mapMember, newCount));
newCount++;
yield return mapMember;
}
}
return selectedLayers;
}
}
@@ -76,6 +76,11 @@
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ=="
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
@@ -88,17 +93,17 @@
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "tiNmV1oPy+Z2R7Wd0bPB/FxCr8B+/5q11OpDMG751GA/YuOL7MZrBFfzv5oFRlFe08K6sjrnbrauzzGIeNrzLQ==",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.7",
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "21FRzcJhaTrlv7kTrqr/ltFcSQM2TyuTTPhUcjO8H73od7Bb3QraNW90c7lUucNI/245XPkKZG4fp7/7OsKCSg==",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
@@ -161,29 +166,6 @@
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Polly": {
"type": "Transitive",
"resolved": "7.2.3",
"contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ=="
},
"Polly.Contrib.WaitAndRetry": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA=="
},
"Polly.Extensions.Http": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==",
"dependencies": {
"Polly": "7.1.0"
}
},
"Speckle.DoubleNumerics": {
"type": "Transitive",
"resolved": "4.0.1",
"contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
@@ -239,13 +221,21 @@
"resolved": "4.5.1",
"contentHash": "Zh8t8oqolRaFa9vmOZfdQm/qKejdqz0J9kr7o2Fu0vPeoH3BL1EOXipKWwkWtLT1JPzjByrF19fGuFlNbmPpiw=="
},
"speckle.common.meshtriangulation": {
"type": "Project",
"dependencies": {
"LibTessDotNet": "[1.1.15, )",
"Speckle.DoubleNumerics": "[4.1.0, )"
}
},
"speckle.connectors.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )",
"Speckle.Sdk": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
@@ -253,8 +243,8 @@
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.0-dev.146, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
@@ -271,6 +261,7 @@
"type": "Project",
"dependencies": {
"Esri.ArcGISPro.Extensions30": "[3.2.0.49743, )",
"Speckle.Common.MeshTriangulation": "[1.0.0, )",
"Speckle.Converters.Common": "[1.0.0, )"
}
},
@@ -278,9 +269,15 @@
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )"
}
},
"LibTessDotNet": {
"type": "CentralTransitive",
"requested": "[1.1.15, )",
"resolved": "1.1.15",
"contentHash": "KuA7N3Nv/lIeawJdQBQJR6oqWD9KETHLbWzBqapwFs+Tby+R5I4crkKujKMm5bXcSuFZ8LNtflFQVadsWCbBjg=="
},
"Microsoft.Extensions.DependencyInjection": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
@@ -308,38 +305,43 @@
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "xuv5LaU6j8ODGHyClHbbK78bOJid8LGuwfVcEega1q3sYwmLWOWIDP9lO0QA1tyctE+2CZDH3sOUChleAFC4fg==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.0-dev.146"
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "vNaWJkt7/xcIH/CraOrEumGn8A6gAlyl1RHfRI8B8qAGylSlEhuvuBSatS1gUPI35p9omO63yYQFKaIKEIsa3Q==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.7",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Polly": "7.2.3",
"Polly.Contrib.WaitAndRetry": "1.1.1",
"Polly.Extensions.Http": "3.0.0",
"Speckle.DoubleNumerics": "4.0.1",
"Speckle.Newtonsoft.Json": "13.0.2"
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"System.Threading.Tasks.Dataflow": {
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
},
"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>
@@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2022.0.2" />
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2022.0.2" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
@@ -71,6 +71,14 @@
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
@@ -83,17 +91,17 @@
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "tiNmV1oPy+Z2R7Wd0bPB/FxCr8B+/5q11OpDMG751GA/YuOL7MZrBFfzv5oFRlFe08K6sjrnbrauzzGIeNrzLQ==",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.7",
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "21FRzcJhaTrlv7kTrqr/ltFcSQM2TyuTTPhUcjO8H73od7Bb3QraNW90c7lUucNI/245XPkKZG4fp7/7OsKCSg==",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
@@ -156,29 +164,6 @@
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Polly": {
"type": "Transitive",
"resolved": "7.2.3",
"contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ=="
},
"Polly.Contrib.WaitAndRetry": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA=="
},
"Polly.Extensions.Http": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==",
"dependencies": {
"Polly": "7.1.0"
}
},
"Speckle.DoubleNumerics": {
"type": "Transitive",
"resolved": "4.0.1",
"contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
@@ -274,8 +259,9 @@
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )",
"Speckle.Sdk": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
@@ -283,8 +269,8 @@
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.0-dev.146, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
@@ -308,7 +294,7 @@
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
@@ -344,38 +330,43 @@
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "xuv5LaU6j8ODGHyClHbbK78bOJid8LGuwfVcEega1q3sYwmLWOWIDP9lO0QA1tyctE+2CZDH3sOUChleAFC4fg==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.0-dev.146"
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "vNaWJkt7/xcIH/CraOrEumGn8A6gAlyl1RHfRI8B8qAGylSlEhuvuBSatS1gUPI35p9omO63yYQFKaIKEIsa3Q==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.7",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Polly": "7.2.3",
"Polly.Contrib.WaitAndRetry": "1.1.1",
"Polly.Extensions.Http": "3.0.0",
"Speckle.DoubleNumerics": "4.0.1",
"Speckle.Newtonsoft.Json": "13.0.2"
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"System.Threading.Tasks.Dataflow": {
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
}
}
@@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2023.0.0" />
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2023.0.0" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
@@ -71,6 +71,14 @@
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
@@ -83,17 +91,17 @@
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "tiNmV1oPy+Z2R7Wd0bPB/FxCr8B+/5q11OpDMG751GA/YuOL7MZrBFfzv5oFRlFe08K6sjrnbrauzzGIeNrzLQ==",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.7",
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "21FRzcJhaTrlv7kTrqr/ltFcSQM2TyuTTPhUcjO8H73od7Bb3QraNW90c7lUucNI/245XPkKZG4fp7/7OsKCSg==",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
@@ -156,29 +164,6 @@
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Polly": {
"type": "Transitive",
"resolved": "7.2.3",
"contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ=="
},
"Polly.Contrib.WaitAndRetry": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA=="
},
"Polly.Extensions.Http": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==",
"dependencies": {
"Polly": "7.1.0"
}
},
"Speckle.DoubleNumerics": {
"type": "Transitive",
"resolved": "4.0.1",
"contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
@@ -274,8 +259,9 @@
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )",
"Speckle.Sdk": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
@@ -283,8 +269,8 @@
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.0-dev.146, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
@@ -308,7 +294,7 @@
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
@@ -344,38 +330,43 @@
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "xuv5LaU6j8ODGHyClHbbK78bOJid8LGuwfVcEega1q3sYwmLWOWIDP9lO0QA1tyctE+2CZDH3sOUChleAFC4fg==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.0-dev.146"
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "vNaWJkt7/xcIH/CraOrEumGn8A6gAlyl1RHfRI8B8qAGylSlEhuvuBSatS1gUPI35p9omO63yYQFKaIKEIsa3Q==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.7",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Polly": "7.2.3",
"Polly.Contrib.WaitAndRetry": "1.1.1",
"Polly.Extensions.Http": "3.0.0",
"Speckle.DoubleNumerics": "4.0.1",
"Speckle.Newtonsoft.Json": "13.0.2"
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"System.Threading.Tasks.Dataflow": {
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
}
}
@@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2024.0.0" />
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2024.0.0" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
@@ -71,6 +71,14 @@
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
@@ -83,17 +91,17 @@
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "tiNmV1oPy+Z2R7Wd0bPB/FxCr8B+/5q11OpDMG751GA/YuOL7MZrBFfzv5oFRlFe08K6sjrnbrauzzGIeNrzLQ==",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.7",
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "21FRzcJhaTrlv7kTrqr/ltFcSQM2TyuTTPhUcjO8H73od7Bb3QraNW90c7lUucNI/245XPkKZG4fp7/7OsKCSg==",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
@@ -156,29 +164,6 @@
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Polly": {
"type": "Transitive",
"resolved": "7.2.3",
"contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ=="
},
"Polly.Contrib.WaitAndRetry": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA=="
},
"Polly.Extensions.Http": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==",
"dependencies": {
"Polly": "7.1.0"
}
},
"Speckle.DoubleNumerics": {
"type": "Transitive",
"resolved": "4.0.1",
"contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
@@ -274,8 +259,9 @@
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )",
"Speckle.Sdk": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
@@ -283,8 +269,8 @@
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.0-dev.146, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
@@ -309,7 +295,7 @@
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
@@ -345,38 +331,43 @@
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "xuv5LaU6j8ODGHyClHbbK78bOJid8LGuwfVcEega1q3sYwmLWOWIDP9lO0QA1tyctE+2CZDH3sOUChleAFC4fg==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.0-dev.146"
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "vNaWJkt7/xcIH/CraOrEumGn8A6gAlyl1RHfRI8B8qAGylSlEhuvuBSatS1gUPI35p9omO63yYQFKaIKEIsa3Q==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.7",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Polly": "7.2.3",
"Polly.Contrib.WaitAndRetry": "1.1.1",
"Polly.Extensions.Http": "3.0.0",
"Speckle.DoubleNumerics": "4.0.1",
"Speckle.Newtonsoft.Json": "13.0.2"
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"System.Threading.Tasks.Dataflow": {
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
}
}
@@ -13,8 +13,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2025.0.0" />
<FrameworkReference Include="Microsoft.WindowsDesktop.App"/>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2025.0.0" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
@@ -82,17 +82,17 @@
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "tiNmV1oPy+Z2R7Wd0bPB/FxCr8B+/5q11OpDMG751GA/YuOL7MZrBFfzv5oFRlFe08K6sjrnbrauzzGIeNrzLQ==",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.7",
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "21FRzcJhaTrlv7kTrqr/ltFcSQM2TyuTTPhUcjO8H73od7Bb3QraNW90c7lUucNI/245XPkKZG4fp7/7OsKCSg==",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
@@ -155,29 +155,6 @@
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Polly": {
"type": "Transitive",
"resolved": "7.2.3",
"contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ=="
},
"Polly.Contrib.WaitAndRetry": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA=="
},
"Polly.Extensions.Http": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==",
"dependencies": {
"Polly": "7.1.0"
}
},
"Speckle.DoubleNumerics": {
"type": "Transitive",
"resolved": "4.0.1",
"contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
@@ -238,8 +215,9 @@
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )",
"Speckle.Sdk": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
@@ -247,8 +225,8 @@
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.0-dev.146, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
@@ -273,7 +251,7 @@
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
@@ -309,38 +287,42 @@
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "xuv5LaU6j8ODGHyClHbbK78bOJid8LGuwfVcEega1q3sYwmLWOWIDP9lO0QA1tyctE+2CZDH3sOUChleAFC4fg==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.0-dev.146"
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "vNaWJkt7/xcIH/CraOrEumGn8A6gAlyl1RHfRI8B8qAGylSlEhuvuBSatS1gUPI35p9omO63yYQFKaIKEIsa3Q==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.7",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Polly": "7.2.3",
"Polly.Contrib.WaitAndRetry": "1.1.1",
"Polly.Extensions.Http": "3.0.0",
"Speckle.DoubleNumerics": "4.0.1",
"Speckle.Newtonsoft.Json": "13.0.2"
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"System.Threading.Tasks.Dataflow": {
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
},
"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,8 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
private readonly DocumentModelStore _store;
private readonly ISpeckleApplication _speckleApplication;
private readonly IThreadContext _threadContext;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly ILogger<AutocadBasicConnectorBinding> _logger;
public BasicConnectorBindingCommands Commands { get; }
@@ -28,7 +31,9 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
IBrowserBridge parent,
IAccountManager accountManager,
ISpeckleApplication speckleApplication,
ILogger<AutocadBasicConnectorBinding> logger
ILogger<AutocadBasicConnectorBinding> logger,
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler
)
{
_store = store;
@@ -36,12 +41,14 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
_accountManager = accountManager;
_speckleApplication = speckleApplication;
Commands = new BasicConnectorBindingCommands(parent);
_store.DocumentChanged += (_, _) =>
{
Commands.NotifyDocumentChanged();
};
_logger = logger;
_threadContext = threadContext;
_topLevelExceptionHandler = topLevelExceptionHandler;
_store.DocumentChanged += (_, _) =>
_topLevelExceptionHandler.FireAndForget(async () =>
{
await Commands.NotifyDocumentChanged();
});
}
public string GetConnectorVersion() => _speckleApplication.SpeckleVersion;
@@ -66,23 +73,25 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
public DocumentModelStore GetDocumentState() => _store;
public void AddModel(ModelCard model) => _store.Models.Add(model);
public void AddModel(ModelCard model) => _store.AddModel(model);
public void UpdateModel(ModelCard model) => _store.UpdateModel(model);
public void RemoveModel(ModelCard model) => _store.RemoveModel(model);
public void HighlightObjects(List<string> objectIds)
public void RemoveModels(List<ModelCard> models) => _store.RemoveModels(models);
public async Task HighlightObjects(IReadOnlyList<string> objectIds)
{
// POC: Will be addressed to move it into AutocadContext!
var doc = Application.DocumentManager.MdiActiveDocument;
var dbObjects = doc.GetObjects(objectIds);
var acadObjectIds = dbObjects.Select(tuple => tuple.Root.Id).ToArray();
HighlightObjectsOnView(acadObjectIds);
await HighlightObjectsOnView(acadObjectIds);
}
public void HighlightModel(string modelCardId)
public async Task HighlightModel(string modelCardId)
{
// POC: Will be addressed to move it into AutocadContext!
var doc = Application.DocumentManager.MdiActiveDocument;
@@ -104,7 +113,7 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
if (model is SenderModelCard senderModelCard)
{
var dbObjects = doc.GetObjects(senderModelCard.SendFilter.NotNull().GetObjectIds());
var dbObjects = doc.GetObjects(senderModelCard.SendFilter.NotNull().RefreshObjectIds());
objectIds = dbObjects.Select(tuple => tuple.Root.Id).ToArray();
}
@@ -116,22 +125,22 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
if (objectIds.Length == 0)
{
Commands.SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight."));
await Commands.SetModelError(modelCardId, new OperationCanceledException("No objects found to highlight."));
return;
}
HighlightObjectsOnView(objectIds, modelCardId);
await HighlightObjectsOnView(objectIds, modelCardId);
}
private void HighlightObjectsOnView(ObjectId[] objectIds, string? modelCardId = null)
private async Task HighlightObjectsOnView(ObjectId[] objectIds, string? modelCardId = null)
{
var doc = Application.DocumentManager.MdiActiveDocument;
Parent.RunOnMainThread(() =>
await _threadContext.RunOnMainAsync(async () =>
{
try
{
doc.Editor.SetImpliedSelection(Array.Empty<ObjectId>()); // Deselects
doc.Editor.SetImpliedSelection([]); // Deselects
try
{
doc.Editor.SetImpliedSelection(objectIds);
@@ -162,6 +171,7 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
{
// 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
}
}
@@ -173,7 +183,7 @@ public class AutocadBasicConnectorBinding : IBasicConnectorBinding
{
if (modelCardId != null)
{
Commands.SetModelError(modelCardId, new OperationCanceledException("Failed to highlight objects."));
await Commands.SetModelError(modelCardId, new OperationCanceledException("Failed to highlight objects."));
}
else
{
@@ -0,0 +1,119 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
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.Logging;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card;
using Speckle.Sdk;
namespace Speckle.Connectors.Autocad.Bindings;
public abstract class AutocadReceiveBaseBinding : IReceiveBinding
{
public string Name => "receiveBinding";
public IBrowserBridge Parent { get; }
private readonly DocumentModelStore _store;
private readonly ICancellationManager _cancellationManager;
private readonly IServiceProvider _serviceProvider;
private readonly IOperationProgressManager _operationProgressManager;
private readonly ILogger<AutocadReceiveBinding> _logger;
private readonly ISpeckleApplication _speckleApplication;
private readonly IThreadContext _threadContext;
private ReceiveBindingUICommands Commands { get; }
protected AutocadReceiveBaseBinding(
DocumentModelStore store,
IBrowserBridge parent,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
IOperationProgressManager operationProgressManager,
ILogger<AutocadReceiveBinding> logger,
ISpeckleApplication speckleApplication,
IThreadContext threadContext
)
{
_store = store;
_cancellationManager = cancellationManager;
_serviceProvider = serviceProvider;
_operationProgressManager = operationProgressManager;
_logger = logger;
_speckleApplication = speckleApplication;
_threadContext = threadContext;
Parent = parent;
Commands = new ReceiveBindingUICommands(parent);
}
protected abstract void InitializeSettings(IServiceProvider serviceProvider);
public void CancelReceive(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
public async Task Receive(string modelCardId) =>
await _threadContext.RunOnMainAsync(async () => await ReceiveInternal(modelCardId));
private async Task ReceiveInternal(string modelCardId)
{
using var scope = _serviceProvider.CreateScope();
InitializeSettings(scope.ServiceProvider);
try
{
// Get receiver card
if (_store.GetModelById(modelCardId) is not ReceiverModelCard modelCard)
{
// Handle as GLOBAL ERROR at BrowserBridge
throw new InvalidOperationException("No download model card was found.");
}
using var cancellationItem = _cancellationManager.GetCancellationItem(modelCardId);
// Disable document activation (document creation and document switch)
// Not disabling results in DUI model card being out of sync with the active document
// The DocumentActivated event isn't usable probably because it is pushed to back of main thread queue
Application.DocumentManager.DocumentActivationEnabled = false;
// Receive host objects
var operationResults = await scope
.ServiceProvider.GetRequiredService<ReceiveOperation>()
.Execute(
modelCard.GetReceiveInfo(_speckleApplication.Slug),
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationItem.Token),
cancellationItem.Token
);
await Commands.SetModelReceiveResult(
modelCardId,
operationResults.BakedObjectIds,
operationResults.ConversionResults
);
}
catch (OperationCanceledException)
{
// SWALLOW -> UI handles it immediately, so we do not need to handle anything for now!
// Idea for later -> when cancel called, create promise from UI to solve it later with this catch block.
// So have 3 state on UI -> Cancellation clicked -> Cancelling -> Cancelled
return;
}
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);
}
finally
{
// reenable document activation
Application.DocumentManager.DocumentActivationEnabled = true;
// regenerate doc to flush graphics, sometimes some objects (ellipses, nurbs curves) do not appear fully visible after receive.
// Adding a regen (must be run on main thread) here, but it doesn't seem to work:
// it's run on main thread, tried sending the "regen" string to execute, also tried regen after every object bake, but still can't fix.
// the objects should appear visible if you manually call the "regen" command after the operation finishes, or click on a view on the view cube which also calls regen.
Application.DocumentManager.CurrentDocument.Editor.Regen();
}
}
}
@@ -1,113 +1,49 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
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.Logging;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;
using Speckle.Sdk;
namespace Speckle.Connectors.Autocad.Bindings;
public sealed class AutocadReceiveBinding : IReceiveBinding
public sealed class AutocadReceiveBinding : AutocadReceiveBaseBinding
{
public string Name => "receiveBinding";
public IBrowserBridge Parent { get; }
private readonly DocumentModelStore _store;
private readonly CancellationManager _cancellationManager;
private readonly IServiceProvider _serviceProvider;
private readonly IOperationProgressManager _operationProgressManager;
private readonly ILogger<AutocadReceiveBinding> _logger;
private readonly IAutocadConversionSettingsFactory _autocadConversionSettingsFactory;
private readonly ISpeckleApplication _speckleApplication;
private ReceiveBindingUICommands Commands { get; }
public AutocadReceiveBinding(
DocumentModelStore store,
IBrowserBridge parent,
CancellationManager cancellationManager,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
IOperationProgressManager operationProgressManager,
ILogger<AutocadReceiveBinding> logger,
IAutocadConversionSettingsFactory autocadConversionSettingsFactory,
ISpeckleApplication speckleApplication
ISpeckleApplication speckleApplication,
IThreadContext threadContext
)
: base(
store,
parent,
cancellationManager,
serviceProvider,
operationProgressManager,
logger,
speckleApplication,
threadContext
)
{
_store = store;
_cancellationManager = cancellationManager;
_serviceProvider = serviceProvider;
_operationProgressManager = operationProgressManager;
_logger = logger;
_autocadConversionSettingsFactory = autocadConversionSettingsFactory;
_speckleApplication = speckleApplication;
Parent = parent;
Commands = new ReceiveBindingUICommands(parent);
}
public void CancelReceive(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
public async Task Receive(string modelCardId)
protected override void InitializeSettings(IServiceProvider serviceProvider)
{
using var scope = _serviceProvider.CreateScope();
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
serviceProvider
.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
.Initialize(_autocadConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
try
{
// Get receiver card
if (_store.GetModelById(modelCardId) is not ReceiverModelCard modelCard)
{
// Handle as GLOBAL ERROR at BrowserBridge
throw new InvalidOperationException("No download model card was found.");
}
CancellationToken cancellationToken = _cancellationManager.InitCancellationTokenSource(modelCardId);
// Disable document activation (document creation and document switch)
// Not disabling results in DUI model card being out of sync with the active document
// The DocumentActivated event isn't usable probably because it is pushed to back of main thread queue
Application.DocumentManager.DocumentActivationEnabled = false;
// Receive host objects
var operationResults = await scope
.ServiceProvider.GetRequiredService<ReceiveOperation>()
.Execute(
modelCard.GetReceiveInfo(_speckleApplication.Slug),
cancellationToken,
(status, progress) =>
_operationProgressManager.SetModelProgress(
Parent,
modelCardId,
new ModelCardProgress(modelCardId, status, progress),
cancellationToken
)
)
.ConfigureAwait(false);
Commands.SetModelReceiveResult(modelCardId, operationResults.BakedObjectIds, operationResults.ConversionResults);
}
catch (OperationCanceledException)
{
// SWALLOW -> UI handles it immediately, so we do not need to handle anything for now!
// Idea for later -> when cancel called, create promise from UI to solve it later with this catch block.
// So have 3 state on UI -> Cancellation clicked -> Cancelling -> Cancelled
return;
}
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);
Commands.SetModelError(modelCardId, ex);
}
finally
{
// reenable document activation
Application.DocumentManager.DocumentActivationEnabled = true;
}
}
}
@@ -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;
@@ -8,17 +9,23 @@ namespace Speckle.Connectors.Autocad.Bindings;
public class AutocadSelectionBinding : ISelectionBinding
{
private const string SELECTION_EVENT = "setSelection";
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IThreadContext _threadContext;
private const string SELECTION_EVENT = "setSelection";
private readonly HashSet<Document> _visitedDocuments = new();
public string Name => "selectionBinding";
public IBrowserBridge Parent { get; }
public AutocadSelectionBinding(IBrowserBridge parent)
public AutocadSelectionBinding(
IBrowserBridge parent,
ITopLevelExceptionHandler topLevelExceptionHandler,
IThreadContext threadContext
)
{
_topLevelExceptionHandler = parent.TopLevelExceptionHandler;
_topLevelExceptionHandler = topLevelExceptionHandler;
_threadContext = threadContext;
Parent = parent;
// POC: Use here Context for doc. In converters it's OK but we are still lacking to use context into bindings.
@@ -41,7 +48,7 @@ public class AutocadSelectionBinding : ISelectionBinding
if (!_visitedDocuments.Contains(document))
{
document.ImpliedSelectionChanged += (_, _) =>
_topLevelExceptionHandler.CatchUnhandled(() => Parent.RunOnMainThread(OnSelectionChanged));
_topLevelExceptionHandler.FireAndForget(async () => await _threadContext.RunOnMainAsync(OnSelectionChanged));
_visitedDocuments.Add(document);
}
@@ -52,10 +59,10 @@ public class AutocadSelectionBinding : ISelectionBinding
// Ui requests to GetSelection() should just return this local copy that is kept up to date by the event handler.
private SelectionInfo _selectionInfo;
private void OnSelectionChanged()
private async Task OnSelectionChanged()
{
_selectionInfo = GetSelectionInternal();
Parent.Send(SELECTION_EVENT, _selectionInfo);
await Parent.Send(SELECTION_EVENT, _selectionInfo);
}
public SelectionInfo GetSelection() => _selectionInfo;
@@ -0,0 +1,213 @@
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using Autodesk.AutoCAD.DatabaseServices;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.HostApp.Extensions;
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;
using Speckle.Connectors.DUI.Logging;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.Settings;
using Speckle.Sdk;
using Speckle.Sdk.Common;
namespace Speckle.Connectors.Autocad.Bindings;
[SuppressMessage("ReSharper", "AsyncVoidMethod")]
public abstract class AutocadSendBaseBinding : ISendBinding
{
public string Name => "sendBinding";
public SendBindingUICommands Commands { get; }
private OperationProgressManager OperationProgressManager { get; }
public IBrowserBridge Parent { get; }
private readonly DocumentModelStore _store;
private readonly List<ISendFilter> _sendFilters;
private readonly ICancellationManager _cancellationManager;
private readonly IServiceProvider _serviceProvider;
private readonly ISendConversionCache _sendConversionCache;
private readonly IOperationProgressManager _operationProgressManager;
private readonly ILogger<AutocadSendBinding> _logger;
private readonly ISpeckleApplication _speckleApplication;
private readonly IThreadContext _threadContext;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IAppIdleManager _idleManager;
/// <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:
/// [CNX-202: Unhandled Exception Occurred when receiving in Rhino](https://linear.app/speckle/issue/CNX-202/unhandled-exception-occurred-when-receiving-in-rhino)
/// As to why a concurrent dictionary, it's because it's the cheapest/easiest way to do so.
/// https://stackoverflow.com/questions/18922985/concurrent-hashsett-in-net-framework
/// </summary>
private ConcurrentBag<string> ChangedObjectIds { get; set; } = new();
protected AutocadSendBaseBinding(
DocumentModelStore store,
IBrowserBridge parent,
IEnumerable<ISendFilter> sendFilters,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
ISendConversionCache sendConversionCache,
IOperationProgressManager operationProgressManager,
ILogger<AutocadSendBinding> logger,
ISpeckleApplication speckleApplication,
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager idleManager
)
{
_store = store;
_serviceProvider = serviceProvider;
_cancellationManager = cancellationManager;
_sendFilters = sendFilters.ToList();
_sendConversionCache = sendConversionCache;
_operationProgressManager = operationProgressManager;
_logger = logger;
_speckleApplication = speckleApplication;
_threadContext = threadContext;
_topLevelExceptionHandler = topLevelExceptionHandler;
_idleManager = idleManager;
Parent = parent;
Commands = new SendBindingUICommands(parent);
Application.DocumentManager.DocumentActivated += (_, args) =>
_topLevelExceptionHandler.CatchUnhandled(() => SubscribeToObjectChanges(args.Document));
if (Application.DocumentManager.CurrentDocument != null)
{
// catches the case when autocad just opens up with a blank new doc
SubscribeToObjectChanges(Application.DocumentManager.CurrentDocument);
}
// Since ids of the objects generates from same seed, we should clear the cache always whenever doc swapped.
_store.DocumentChanged += (_, _) =>
{
_sendConversionCache.ClearCache();
};
}
private readonly List<string> _docSubsTracker = new();
private void SubscribeToObjectChanges(Document doc)
{
if (doc == null || doc.Database == null || _docSubsTracker.Contains(doc.Name))
{
return;
}
_docSubsTracker.Add(doc.Name);
doc.Database.ObjectAppended += (_, e) => OnObjectChanged(e.DBObject);
doc.Database.ObjectErased += (_, e) => OnObjectChanged(e.DBObject);
doc.Database.ObjectModified += (_, e) => OnObjectChanged(e.DBObject);
}
private void OnObjectChanged(DBObject dbObject) =>
_topLevelExceptionHandler.CatchUnhandled(() => OnChangeChangedObjectIds(dbObject));
private void OnChangeChangedObjectIds(DBObject dBObject)
{
ChangedObjectIds.Add(dBObject.GetSpeckleApplicationId());
_idleManager.SubscribeToIdle(nameof(RunExpirationChecks), async () => await RunExpirationChecks());
}
private async Task RunExpirationChecks()
{
var senders = _store.GetSenders();
List<string> expiredSenderIds = new();
_sendConversionCache.EvictObjects(ChangedObjectIds);
foreach (SenderModelCard modelCard in senders)
{
var intersection = modelCard.SendFilter.NotNull().RefreshObjectIds().Intersect(ChangedObjectIds).ToList();
bool isExpired = intersection.Count != 0;
if (isExpired)
{
expiredSenderIds.Add(modelCard.ModelCardId.NotNull());
}
}
await Commands.SetModelsExpired(expiredSenderIds);
ChangedObjectIds = new();
}
public List<ISendFilter> GetSendFilters() => _sendFilters;
public List<ICardSetting> GetSendSettings() => [];
public async Task Send(string modelCardId) =>
await _threadContext.RunOnMainAsync(async () => await SendInternal(modelCardId));
protected abstract void InitializeSettings(IServiceProvider serviceProvider);
private async Task SendInternal(string modelCardId)
{
try
{
if (_store.GetModelById(modelCardId) is not SenderModelCard modelCard)
{
// Handle as GLOBAL ERROR at BrowserBridge
throw new InvalidOperationException("No publish model card was found.");
}
using var scope = _serviceProvider.CreateScope();
InitializeSettings(scope.ServiceProvider);
using var cancellationItem = _cancellationManager.GetCancellationItem(modelCardId);
// Disable document activation (document creation and document switch)
// Not disabling results in DUI model card being out of sync with the active document
// The DocumentActivated event isn't usable probably because it is pushed to back of main thread queue
Application.DocumentManager.DocumentActivationEnabled = false;
// Get elements to convert
List<AutocadRootObject> autocadObjects = Application.DocumentManager.CurrentDocument.GetObjects(
modelCard.SendFilter.NotNull().RefreshObjectIds()
);
if (autocadObjects.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<AutocadRootObject>>()
.Execute(
autocadObjects,
modelCard.GetSendInfo(_speckleApplication.ApplicationAndVersion),
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationItem.Token),
cancellationItem.Token
);
await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
}
catch (OperationCanceledException)
{
// SWALLOW -> UI handles it immediately, so we do not need to handle anything for now!
// Idea for later -> when cancel called, create promise from UI to solve it later with this catch block.
// So have 3 state on UI -> Cancellation clicked -> Cancelling -> Cancelled
return;
}
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);
}
finally
{
// renable document activation
Application.DocumentManager.DocumentActivationEnabled = true;
}
}
public void CancelSend(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
}
@@ -1,225 +1,59 @@
using System.Collections.Concurrent;
using Autodesk.AutoCAD.DatabaseServices;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.HostApp;
using Speckle.Connectors.Autocad.HostApp.Extensions;
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;
using Speckle.Connectors.DUI.Logging;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.Settings;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;
using Speckle.Sdk;
using Speckle.Sdk.Common;
namespace Speckle.Connectors.Autocad.Bindings;
public sealed class AutocadSendBinding : ISendBinding
public sealed class AutocadSendBinding : AutocadSendBaseBinding
{
public string Name => "sendBinding";
public SendBindingUICommands Commands { get; }
private OperationProgressManager OperationProgressManager { get; }
public IBrowserBridge Parent { get; }
private readonly DocumentModelStore _store;
private readonly IAutocadIdleManager _idleManager;
private readonly List<ISendFilter> _sendFilters;
private readonly CancellationManager _cancellationManager;
private readonly IServiceProvider _serviceProvider;
private readonly ISendConversionCache _sendConversionCache;
private readonly IOperationProgressManager _operationProgressManager;
private readonly ILogger<AutocadSendBinding> _logger;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IAutocadConversionSettingsFactory _autocadConversionSettingsFactory;
private readonly ISpeckleApplication _speckleApplication;
/// <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:
/// [CNX-202: Unhandled Exception Occurred when receiving in Rhino](https://linear.app/speckle/issue/CNX-202/unhandled-exception-occurred-when-receiving-in-rhino)
/// As to why a concurrent dictionary, it's because it's the cheapest/easiest way to do so.
/// https://stackoverflow.com/questions/18922985/concurrent-hashsett-in-net-framework
/// </summary>
private ConcurrentDictionary<string, byte> ChangedObjectIds { get; set; } = new();
public AutocadSendBinding(
DocumentModelStore store,
IAutocadIdleManager idleManager,
IBrowserBridge parent,
IEnumerable<ISendFilter> sendFilters,
CancellationManager cancellationManager,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
ISendConversionCache sendConversionCache,
IOperationProgressManager operationProgressManager,
ILogger<AutocadSendBinding> logger,
IAutocadConversionSettingsFactory autocadConversionSettingsFactory,
ISpeckleApplication speckleApplication
ISpeckleApplication speckleApplication,
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager appIdleManager
)
: base(
store,
parent,
sendFilters,
cancellationManager,
serviceProvider,
sendConversionCache,
operationProgressManager,
logger,
speckleApplication,
threadContext,
topLevelExceptionHandler,
appIdleManager
)
{
_store = store;
_idleManager = idleManager;
_serviceProvider = serviceProvider;
_cancellationManager = cancellationManager;
_sendFilters = sendFilters.ToList();
_sendConversionCache = sendConversionCache;
_operationProgressManager = operationProgressManager;
_logger = logger;
_autocadConversionSettingsFactory = autocadConversionSettingsFactory;
_speckleApplication = speckleApplication;
_topLevelExceptionHandler = parent.TopLevelExceptionHandler;
Parent = parent;
Commands = new SendBindingUICommands(parent);
Application.DocumentManager.DocumentActivated += (_, args) =>
_topLevelExceptionHandler.CatchUnhandled(() => SubscribeToObjectChanges(args.Document));
if (Application.DocumentManager.CurrentDocument != null)
{
// catches the case when autocad just opens up with a blank new doc
SubscribeToObjectChanges(Application.DocumentManager.CurrentDocument);
}
// Since ids of the objects generates from same seed, we should clear the cache always whenever doc swapped.
_store.DocumentChanged += (_, _) =>
{
_sendConversionCache.ClearCache();
};
}
private readonly List<string> _docSubsTracker = new();
private void SubscribeToObjectChanges(Document doc)
protected override void InitializeSettings(IServiceProvider serviceProvider)
{
if (doc == null || doc.Database == null || _docSubsTracker.Contains(doc.Name))
{
return;
}
_docSubsTracker.Add(doc.Name);
doc.Database.ObjectAppended += (_, e) => OnObjectChanged(e.DBObject);
doc.Database.ObjectErased += (_, e) => OnObjectChanged(e.DBObject);
doc.Database.ObjectModified += (_, e) => OnObjectChanged(e.DBObject);
serviceProvider
.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
.Initialize(_autocadConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
}
private void OnObjectChanged(DBObject dbObject)
{
_topLevelExceptionHandler.CatchUnhandled(() => OnChangeChangedObjectIds(dbObject));
}
private void OnChangeChangedObjectIds(DBObject dBObject)
{
ChangedObjectIds[dBObject.GetSpeckleApplicationId()] = 1;
_idleManager.SubscribeToIdle(nameof(AutocadSendBinding), RunExpirationChecks);
}
private void RunExpirationChecks()
{
var senders = _store.GetSenders();
string[] objectIdsList = ChangedObjectIds.Keys.ToArray();
List<string> expiredSenderIds = new();
_sendConversionCache.EvictObjects(objectIdsList);
foreach (SenderModelCard modelCard in senders)
{
var intersection = modelCard.SendFilter.NotNull().GetObjectIds().Intersect(objectIdsList).ToList();
bool isExpired = intersection.Count != 0;
if (isExpired)
{
expiredSenderIds.Add(modelCard.ModelCardId.NotNull());
}
}
Commands.SetModelsExpired(expiredSenderIds);
ChangedObjectIds = new();
}
public List<ISendFilter> GetSendFilters() => _sendFilters;
public List<ICardSetting> GetSendSettings() => [];
public Task Send(string modelCardId)
{
Parent.RunOnMainThread(async () => await SendInternal(modelCardId).ConfigureAwait(false));
return Task.CompletedTask;
}
private async Task SendInternal(string modelCardId)
{
try
{
if (_store.GetModelById(modelCardId) is not SenderModelCard modelCard)
{
// Handle as GLOBAL ERROR at BrowserBridge
throw new InvalidOperationException("No publish model card was found.");
}
using var scope = _serviceProvider.CreateScope();
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
.Initialize(_autocadConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
CancellationToken cancellationToken = _cancellationManager.InitCancellationTokenSource(modelCardId);
// Disable document activation (document creation and document switch)
// Not disabling results in DUI model card being out of sync with the active document
// The DocumentActivated event isn't usable probably because it is pushed to back of main thread queue
Application.DocumentManager.DocumentActivationEnabled = false;
// Get elements to convert
List<AutocadRootObject> autocadObjects = Application.DocumentManager.CurrentDocument.GetObjects(
modelCard.SendFilter.NotNull().GetObjectIds()
);
if (autocadObjects.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<AutocadRootObject>>()
.Execute(
autocadObjects,
modelCard.GetSendInfo(_speckleApplication.Slug),
(status, progress) =>
_operationProgressManager.SetModelProgress(
Parent,
modelCardId,
new ModelCardProgress(modelCardId, status, progress),
cancellationToken
),
cancellationToken
)
.ConfigureAwait(false);
Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
}
catch (OperationCanceledException)
{
// SWALLOW -> UI handles it immediately, so we do not need to handle anything for now!
// Idea for later -> when cancel called, create promise from UI to solve it later with this catch block.
// So have 3 state on UI -> Cancellation clicked -> Cancelling -> Cancelled
return;
}
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);
Commands.SetModelError(modelCardId, ex);
}
finally
{
// renable document activation
Application.DocumentManager.DocumentActivationEnabled = true;
}
}
public void CancelSend(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
}
@@ -1,5 +1,11 @@
#if AUTOCAD
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Connectors.Autocad.Bindings;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.Common.Builders;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Sdk;
namespace Speckle.Connectors.Autocad.DependencyInjection;
@@ -9,9 +15,16 @@ public static class AutocadConnectorModule
{
serviceCollection.AddAutocadBase();
// Operations
// Send
serviceCollection.LoadSend();
serviceCollection.AddScoped<IRootObjectBuilder<AutocadRootObject>, AutocadRootObjectBuilder>();
// Receive
serviceCollection.LoadReceive();
// Register vertical specific bindings
serviceCollection.AddSingleton<IBinding, AutocadSendBinding>();
serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetExecutingAssembly());
}
}
#endif
@@ -1,5 +1,7 @@
#if CIVIL3D
using Microsoft.Extensions.DependencyInjection;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.Common.Builders;
namespace Speckle.Connectors.Autocad.DependencyInjection;
@@ -8,7 +10,10 @@ public static class Civil3dConnectorModule
public static void AddCivil3d(this IServiceCollection serviceCollection)
{
serviceCollection.AddAutocadBase();
// send
serviceCollection.LoadSend();
serviceCollection.AddScoped<IRootObjectBuilder<AutocadRootObject>, Civil3dRootObjectBuilder>();
}
}
#endif
@@ -10,9 +10,10 @@ 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.Models;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.WebView;
using Speckle.Sdk.Models.GraphTraversal;
@@ -24,13 +25,12 @@ public static class SharedRegistration
public static void AddAutocadBase(this IServiceCollection serviceCollection)
{
serviceCollection.AddConnectorUtils();
serviceCollection.AddDUI();
serviceCollection.AddDUI<DefaultThreadContext, AutocadDocumentStore>();
serviceCollection.AddDUIView();
// Register other connector specific types
serviceCollection.AddTransient<TransactionContext>();
serviceCollection.AddSingleton(new AutocadDocumentManager()); // TODO: Dependent to TransactionContext, can be moved to AutocadContext
serviceCollection.AddSingleton<DocumentModelStore, AutocadDocumentStore>();
serviceCollection.AddSingleton<AutocadContext>();
// Unpackers and builders
@@ -44,12 +44,12 @@ 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<IAutocadIdleManager, AutocadIdleManager>();
serviceCollection.AddSingleton<IAppIdleManager, AutocadIdleManager>();
// operation progress manager
serviceCollection.AddSingleton<IOperationProgressManager, OperationProgressManager>();
@@ -61,8 +61,6 @@ public static class SharedRegistration
serviceCollection.AddSingleton<IBinding>(sp => sp.GetRequiredService<IBasicConnectorBinding>());
serviceCollection.AddSingleton<IBasicConnectorBinding, AutocadBasicConnectorBinding>();
serviceCollection.AddSingleton<IBinding, ConfigBinding>();
serviceCollection.RegisterTopLevelExceptionHandler();
}
public static void LoadSend(this IServiceCollection serviceCollection)
@@ -70,12 +68,6 @@ public static class SharedRegistration
// Operations
serviceCollection.AddScoped<SendOperation<AutocadRootObject>>();
// Object Builders
serviceCollection.AddScoped<IRootObjectBuilder<AutocadRootObject>, AutocadRootObjectBuilder>();
// Register bindings
serviceCollection.AddSingleton<IBinding, AutocadSendBinding>();
// register send filters
serviceCollection.AddTransient<ISendFilter, AutocadSelectionFilter>();
@@ -4,7 +4,10 @@ namespace Speckle.Connectors.Autocad.Filters;
public class AutocadSelectionFilter : DirectSelectionSendFilter
{
public override List<string> GetObjectIds() => SelectedObjectIds;
public AutocadSelectionFilter()
{
IsDefault = true;
}
public override bool CheckExpiry(string[] changedObjectIds) => SelectedObjectIds.Intersect(changedObjectIds).Any();
public override List<string> RefreshObjectIds() => SelectedObjectIds;
}
@@ -1,5 +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;
@@ -9,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>
@@ -28,14 +24,14 @@ public class AutocadColorBaker
/// </summary>
/// <param name="colorProxies"></param>
/// <param name="onOperationProgressed"></param>
public void ParseColors(List<ColorProxy> colorProxies, Action<string, double?>? onOperationProgressed)
public void ParseColors(IReadOnlyCollection<ColorProxy> colorProxies, IProgress<CardProgress> onOperationProgressed)
{
var count = 0;
foreach (ColorProxy colorProxy in colorProxies)
{
try
{
onOperationProgressed?.Invoke("Converting colors", (double)++count / colorProxies.Count);
onOperationProgressed.Report(new("Converting colors", (double)++count / colorProxies.Count));
// skip any colors with source = layer, since object color default source is by layer
if (colorProxy["source"] is string source && source == "layer")
@@ -58,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");
}
}
}
@@ -1,25 +1,26 @@
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Newtonsoft.Json;
using Speckle.Sdk.Common;
using Speckle.Connectors.DUI.Utils;
namespace Speckle.Connectors.Autocad.HostApp;
public class AutocadDocumentStore : DocumentModelStore
{
private readonly string _nullDocumentName = "Null Doc";
private const string NULL_DOCUMENT_NAME = "Null Doc";
private string _previousDocName;
private readonly AutocadDocumentManager _autocadDocumentManager;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
public AutocadDocumentStore(
JsonSerializerSettings jsonSerializerSettings,
IJsonSerializer jsonSerializer,
AutocadDocumentManager autocadDocumentManager,
ITopLevelExceptionHandler topLevelExceptionHandler
)
: base(jsonSerializerSettings, true)
: base(jsonSerializer)
{
_autocadDocumentManager = autocadDocumentManager;
_previousDocName = _nullDocumentName;
_topLevelExceptionHandler = topLevelExceptionHandler;
_previousDocName = NULL_DOCUMENT_NAME;
// POC: Will be addressed to move it into AutocadContext!
if (Application.DocumentManager.MdiActiveDocument != null)
@@ -41,39 +42,38 @@ public class AutocadDocumentStore : DocumentModelStore
private void OnDocChangeInternal(Document? doc)
{
var currentDocName = doc != null ? doc.Name : _nullDocumentName;
var currentDocName = doc != null ? doc.Name : NULL_DOCUMENT_NAME;
if (_previousDocName == currentDocName)
{
return;
}
_previousDocName = currentDocName;
ReadFromFile();
LoadState();
OnDocumentChanged();
}
public override void ReadFromFile()
protected override void LoadState()
{
Models = new();
// POC: Will be addressed to move it into AutocadContext!
Document? doc = Application.DocumentManager.MdiActiveDocument;
if (doc == null)
{
ClearAndSave();
return;
}
string? serializedModelCards = _autocadDocumentManager.ReadModelCards(doc);
if (serializedModelCards == null)
{
ClearAndSave();
return;
}
Models = Deserialize(serializedModelCards).NotNull();
LoadFromString(serializedModelCards);
}
public override void WriteToFile()
protected override void HostAppSaveState(string modelCardState)
{
// POC: Will be addressed to move it into AutocadContext!
Document doc = Application.DocumentManager.MdiActiveDocument;
@@ -83,7 +83,6 @@ public class AutocadDocumentStore : DocumentModelStore
return;
}
string modelCardsString = Serialize();
_autocadDocumentManager.WriteModelCards(doc, modelCardsString);
_autocadDocumentManager.WriteModelCards(doc, modelCardState);
}
}
@@ -2,6 +2,7 @@ using Autodesk.AutoCAD.DatabaseServices;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Common.Conversion;
using Speckle.Sdk;
using Speckle.Sdk.Dependencies;
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Connectors.Autocad.HostApp;
@@ -29,12 +30,12 @@ public class AutocadGroupBaker
/// <param name="applicationIdMap"></param>
/// <returns></returns>
// TODO: Oguzhan! Do not report here too! But this is TBD that we don't know the shape of the report yet.
public List<ReceiveConversionResult> CreateGroups(
public IReadOnlyCollection<ReceiveConversionResult> CreateGroups(
IEnumerable<GroupProxy> groupProxies,
Dictionary<string, List<Entity>> applicationIdMap
Dictionary<string, IReadOnlyCollection<Entity>> applicationIdMap
)
{
List<ReceiveConversionResult> results = new();
HashSet<ReceiveConversionResult> results = new();
using var groupCreationTransaction =
Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction();
@@ -75,6 +76,6 @@ public class AutocadGroupBaker
groupCreationTransaction.Commit();
return results;
return results.Freeze();
}
}
@@ -3,23 +3,17 @@ using Speckle.InterfaceGenerator;
namespace Speckle.Connectors.Autocad.HostApp;
public partial interface IAutocadIdleManager : IAppIdleManager;
[GenerateAutoInterface]
public class AutocadIdleManager(IIdleCallManager idleCallManager) : IAutocadIdleManager
public sealed class AutocadIdleManager(IIdleCallManager idleCallManager)
: AppIdleManager(idleCallManager),
IAutocadIdleManager
{
/// <summary>
/// Subscribe deferred action to AutocadIdle event to run it whenever Autocad become idle.
/// </summary>
/// <param name="action"> Action to call whenever Autocad become Idle.</param>
public void SubscribeToIdle(string id, Action action) =>
idleCallManager.SubscribeToIdle(
id,
action,
() =>
{
Application.Idle += AutocadAppOnIdle;
}
);
private readonly IIdleCallManager _idleCallManager = idleCallManager;
protected override void AddEvent() => Application.Idle += AutocadAppOnIdle;
private void AutocadAppOnIdle(object? sender, EventArgs e) =>
idleCallManager.AppOnIdle(() => Application.Idle -= AutocadAppOnIdle);
_idleCallManager.AppOnIdle(() => Application.Idle -= AutocadAppOnIdle);
}
@@ -1,14 +1,18 @@
using System.Diagnostics.CodeAnalysis;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.HostApp.Extensions;
using Speckle.Connectors.Common.Conversion;
using Speckle.Connectors.Common.Instances;
using Speckle.Connectors.Common.Operations;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;
using Speckle.DoubleNumerics;
using Speckle.Sdk;
using Speckle.Sdk.Common;
using Speckle.Sdk.Common.Exceptions;
using Speckle.Sdk.Dependencies;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.Instances;
@@ -19,19 +23,19 @@ namespace Speckle.Connectors.Autocad.HostApp;
/// <summary>
/// Expects to be a scoped dependency receive operation.
/// </summary>
public class AutocadInstanceBaker : IInstanceBaker<List<Entity>>
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
@@ -45,11 +49,12 @@ public class AutocadInstanceBaker : IInstanceBaker<List<Entity>>
_converterSettings = converterSettings;
}
[SuppressMessage("Maintainability", "CA1506:Avoid excessive class coupling")]
public BakeResult BakeInstances(
List<(Collection[] collectionPath, IInstanceComponent obj)> instanceComponents,
Dictionary<string, List<Entity>> applicationIdMap,
ICollection<(Collection[] collectionPath, IInstanceComponent obj)> instanceComponents,
Dictionary<string, IReadOnlyCollection<Entity>> applicationIdMap,
string baseLayerName,
Action<string, double?>? onOperationProgressed
IProgress<CardProgress> onOperationProgressed
)
{
var sortedInstanceComponents = instanceComponents
@@ -60,21 +65,24 @@ public class AutocadInstanceBaker : IInstanceBaker<List<Entity>>
var definitionIdAndApplicationIdMap = new Dictionary<string, ObjectId>();
using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction();
var conversionResults = new List<ReceiveConversionResult>();
var createdObjectIds = new List<string>();
var consumedObjectIds = new List<string>();
var conversionResults = new HashSet<ReceiveConversionResult>();
var createdObjectIds = new HashSet<string>();
var consumedObjectIds = new HashSet<string>();
var count = 0;
foreach (var (collectionPath, instanceOrDefinition) in sortedInstanceComponents)
{
try
{
onOperationProgressed?.Invoke("Converting blocks", (double)++count / sortedInstanceComponents.Count);
onOperationProgressed.Report(new("Converting blocks", (double)++count / sortedInstanceComponents.Count));
if (instanceOrDefinition is InstanceDefinitionProxy { applicationId: not null } definitionProxy)
{
// TODO: create definition (block table record)
var constituentEntities = definitionProxy
.objects.Select(id => applicationIdMap.TryGetValue(id, out List<Entity>? value) ? value : null)
.objects.Select(id =>
applicationIdMap.TryGetValue(id, out IReadOnlyCollection<Entity>? value) ? value : null
)
.Where(x => x is not null)
.SelectMany(ent => ent!)
.ToList();
@@ -104,8 +112,8 @@ public class AutocadInstanceBaker : IInstanceBaker<List<Entity>>
definitionIdAndApplicationIdMap[definitionProxy.applicationId] = id;
transaction.AddNewlyCreatedDBObject(record, true);
var consumedEntitiesHandleValues = constituentEntities.Select(ent => ent.GetSpeckleApplicationId()).ToArray();
consumedObjectIds.AddRange(consumedEntitiesHandleValues);
createdObjectIds.RemoveAll(newId => consumedEntitiesHandleValues.Contains(newId));
consumedObjectIds.UnionWith(consumedEntitiesHandleValues);
createdObjectIds.RemoveWhere(newId => consumedEntitiesHandleValues.Contains(newId));
}
else if (
instanceOrDefinition is InstanceProxy instanceProxy
@@ -123,7 +131,7 @@ public class AutocadInstanceBaker : IInstanceBaker<List<Entity>>
string layerName = _layerBaker.CreateLayerForReceive(collectionPath, baseLayerName);
// get color and material if any
string instanceId = instanceProxy.applicationId ?? instanceProxy.id;
string instanceId = instanceProxy.applicationId ?? instanceProxy.id.NotNull();
AutocadColor? objColor = _colorBaker.ObjectColorsIdMap.TryGetValue(instanceId, out AutocadColor? color)
? color
: null;
@@ -162,7 +170,7 @@ public class AutocadInstanceBaker : IInstanceBaker<List<Entity>>
}
transaction.Commit();
return new(createdObjectIds, consumedObjectIds, conversionResults);
return new(createdObjectIds.Freeze(), consumedObjectIds.Freeze(), conversionResults.Freeze());
}
/// <summary>
@@ -2,6 +2,7 @@
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.LayerManager;
using Speckle.Connectors.Common.Operations.Receive;
using Speckle.Sdk.Common;
using Speckle.Sdk.Models.Collections;
using AutocadColor = Autodesk.AutoCAD.Colors.Color;
@@ -11,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;
@@ -52,7 +53,7 @@ public class AutocadLayerBaker : TraversalContextUnpacker
// Goes up the tree to find any potential parent layer that has a material/color
for (int j = layerPath.Length - 1; j >= 0; j--)
{
string layerId = layerPath[j].applicationId ?? layerPath[j].id;
string layerId = layerPath[j].applicationId ?? layerPath[j].id.NotNull();
if (!foundColor)
{
@@ -1,6 +1,6 @@
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.DatabaseServices;
using Speckle.Connectors.Autocad.HostApp.Extensions;
using Speckle.Converters.Common;
using Speckle.Sdk;
using Speckle.Sdk.Models.Collections;
namespace Speckle.Connectors.Autocad.HostApp;
@@ -19,14 +19,12 @@ public class AutocadLayerUnpacker
}
if (tr.GetObject(entity.LayerId, OpenMode.ForRead) is LayerTableRecord autocadLayer)
{
// Layers and geometries can have same application ids.....
// We should prevent it for sketchup converter. Because when it happens "objects_to_bake" definition
// is changing on the way if it happens.
speckleLayer = new Layer(layerName) { applicationId = autocadLayer.GetSpeckleApplicationId() }; // Do not use handle directly, see note in the 'GetSpeckleApplicationId' method
_layerCollectionCache[layerName] = speckleLayer;
layer = autocadLayer;
return speckleLayer;
}
throw new SpeckleConversionException("Unexpected condition in GetOrCreateSpeckleLayer");
throw new SpeckleException("Unexpected condition in GetOrCreateSpeckleLayer");
}
}
@@ -3,8 +3,11 @@ using Autodesk.AutoCAD.DatabaseServices;
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;
using Speckle.Sdk.Models;
using Material = Autodesk.AutoCAD.DatabaseServices.Material;
using RenderMaterial = Speckle.Objects.Other.RenderMaterial;
@@ -14,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;
@@ -41,7 +45,7 @@ public class AutocadMaterialBaker
public bool TryGetMaterialId(Base originalObject, Base? parentObject, out ObjectId materialId)
{
materialId = ObjectId.Null;
var originalObjectId = originalObject.applicationId ?? originalObject.id;
var originalObjectId = originalObject.applicationId ?? originalObject.id.NotNull();
if (ObjectMaterialsIdMap.TryGetValue(originalObjectId, out ObjectId originalObjectMaterialId))
{
materialId = originalObjectMaterialId;
@@ -53,7 +57,7 @@ public class AutocadMaterialBaker
return false;
}
var subObjectId = parentObject.applicationId ?? parentObject.id;
var subObjectId = parentObject.applicationId ?? parentObject.id.NotNull();
if (ObjectMaterialsIdMap.TryGetValue(subObjectId, out ObjectId subObjectMaterialId))
{
materialId = subObjectMaterialId;
@@ -91,9 +95,9 @@ public class AutocadMaterialBaker
}
public void ParseAndBakeRenderMaterials(
List<RenderMaterialProxy> materialProxies,
IReadOnlyCollection<RenderMaterialProxy> materialProxies,
string baseLayerPrefix,
Action<string, double?>? onOperationProgressed
IProgress<CardProgress> onOperationProgressed
)
{
using var transaction = Application.DocumentManager.CurrentDocument.Database.TransactionManager.StartTransaction();
@@ -109,11 +113,11 @@ public class AutocadMaterialBaker
var count = 0;
foreach (RenderMaterialProxy materialProxy in materialProxies)
{
onOperationProgressed?.Invoke("Converting render materials", (double)++count / materialProxies.Count);
onOperationProgressed.Report(new("Converting render materials", (double)++count / materialProxies.Count));
// bake render material
RenderMaterial renderMaterial = materialProxy.value;
string renderMaterialId = renderMaterial.applicationId ?? renderMaterial.id;
string renderMaterialId = renderMaterial.applicationId ?? renderMaterial.id.NotNull();
ObjectId materialId = ObjectId.Null;
if (!ObjectMaterialsIdMap.TryGetValue(renderMaterialId, out materialId))
@@ -154,7 +158,7 @@ public class AutocadMaterialBaker
{
// POC: Currently we're relying on the render material name for identification if it's coming from speckle and from which model; could we do something else?
// POC: we should assume render materials all have application ids?
string renderMaterialId = renderMaterial.applicationId ?? renderMaterial.id;
string renderMaterialId = renderMaterial.applicationId ?? renderMaterial.id.NotNull();
string matName = _autocadContext.RemoveInvalidChars(
$"{renderMaterial.name}-({renderMaterialId})-{baseLayerPrefix}"
);
@@ -70,7 +70,7 @@ public class AutocadMaterialUnpacker
}
}
// Stage 2: make sure we collect layer colors as well
// Stage 2: make sure we collect layer materials as well
foreach (LayerTableRecord layer in layers)
{
try
@@ -110,10 +110,14 @@ public class AutocadMaterialUnpacker
diffuseColor.Blue
);
string name = material.Name;
double opacity = material.Opacity.Percentage;
RenderMaterial renderMaterial = new(opacity: opacity, diffuse: diffuse) { name = name, applicationId = id };
RenderMaterial renderMaterial =
new()
{
name = material.Name,
opacity = material.Opacity.Percentage,
diffuse = diffuse.ToArgb(),
applicationId = id
};
// Add additional properties
renderMaterial["ior"] = material.Refraction.Index;
@@ -3,10 +3,13 @@ using Speckle.Connectors.Autocad.HostApp;
using Speckle.Connectors.Autocad.HostApp.Extensions;
using Speckle.Connectors.Common.Builders;
using Speckle.Connectors.Common.Conversion;
using Speckle.Connectors.Common.Extensions;
using Speckle.Connectors.Common.Operations;
using Speckle.Connectors.Common.Operations.Receive;
using Speckle.Converters.Common;
using Speckle.Sdk;
using Speckle.Sdk.Common;
using Speckle.Sdk.Dependencies;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.Instances;
@@ -17,196 +20,176 @@ 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 Task<HostObjectBuilderResult> Build(
Base rootObject,
string projectName,
string modelName,
Action<string, double?>? 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.
_syncToThread.RunOnThread(() =>
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);
// 0 - Clean then Rock n Roll!
string baseLayerPrefix = autocadContext.RemoveInvalidChars($"SPK-{projectName}-{modelName}-");
PreReceiveDeepClean(baseLayerPrefix);
// 1 - Unpack objects and proxies from root commit object
var unpackedRoot = rootObjectUnpacker.Unpack(rootObject);
// 2 - Split atomic objects and instance components with their path
var (atomicObjects, instanceComponents) = rootObjectUnpacker.SplitAtomicObjectsAndInstances(
unpackedRoot.ObjectsToConvert
);
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)
{
// Prompt the UI conversion started. Progress bar will swoosh.
onOperationProgressed?.Invoke("Converting", null);
// Layer filter for received commit with project and model name
_layerBaker.CreateLayerFilter(projectName, modelName);
// 0 - Clean then Rock n Roll!
string baseLayerPrefix = _autocadContext.RemoveInvalidChars($"SPK-{projectName}-{modelName}-");
PreReceiveDeepClean(baseLayerPrefix);
// 1 - Unpack objects and proxies from root commit object
var unpackedRoot = _rootObjectUnpacker.Unpack(rootObject);
// 2 - Split atomic objects and instance components with their path
var (atomicObjects, instanceComponents) = _rootObjectUnpacker.SplitAtomicObjectsAndInstances(
unpackedRoot.ObjectsToConvert
var transformed = unpackedRoot.DefinitionProxies.Select(proxy =>
(Array.Empty<Collection>(), proxy as IInstanceComponent)
);
var atomicObjectsWithPath = _layerBaker.GetAtomicObjectsWithPath(atomicObjects);
var instanceComponentsWithPath = _layerBaker.GetInstanceComponentsWithPath(instanceComponents);
instanceComponentsWithPath.AddRange(transformed);
}
// POC: these are not captured by traversal, so we need to re-add them here
if (unpackedRoot.DefinitionProxies != null && unpackedRoot.DefinitionProxies.Count > 0)
{
var transformed = unpackedRoot.DefinitionProxies.Select(proxy =>
(Array.Empty<Collection>(), proxy as IInstanceComponent)
);
instanceComponentsWithPath.AddRange(transformed);
}
// 3 - Bake materials and colors, as they are used later down the line by layers and objects
if (unpackedRoot.RenderMaterialProxies != null)
{
_materialBaker.ParseAndBakeRenderMaterials(
unpackedRoot.RenderMaterialProxies,
baseLayerPrefix,
onOperationProgressed
);
}
if (unpackedRoot.ColorProxies != null)
{
_colorBaker.ParseColors(unpackedRoot.ColorProxies, onOperationProgressed);
}
// 5 - Convert atomic objects
List<ReceiveConversionResult> results = new();
List<string> bakedObjectIds = new();
Dictionary<string, List<Entity>> applicationIdMap = new();
var count = 0;
foreach (var (layerPath, atomicObject) in atomicObjectsWithPath)
{
string objectId = atomicObject.applicationId ?? atomicObject.id;
onOperationProgressed?.Invoke("Converting objects", (double)++count / atomicObjects.Count);
try
{
List<Entity> convertedObjects = ConvertObject(atomicObject, layerPath, baseLayerPrefix).ToList();
applicationIdMap[objectId] = convertedObjects;
results.AddRange(
convertedObjects.Select(e => new ReceiveConversionResult(
Status.SUCCESS,
atomicObject,
e.GetSpeckleApplicationId(),
e.GetType().ToString()
))
);
bakedObjectIds.AddRange(convertedObjects.Select(e => e.GetSpeckleApplicationId()));
}
catch (Exception ex) when (!ex.IsFatal())
{
results.Add(new(Status.ERROR, atomicObject, null, null, ex));
}
}
// 6 - Convert instances
var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = _instanceBaker.BakeInstances(
instanceComponentsWithPath,
applicationIdMap,
// 3 - Bake materials and colors, as they are used later down the line by layers and objects
if (unpackedRoot.RenderMaterialProxies != null)
{
materialBaker.ParseAndBakeRenderMaterials(
unpackedRoot.RenderMaterialProxies,
baseLayerPrefix,
onOperationProgressed
);
}
bakedObjectIds.RemoveAll(id => consumedObjectIds.Contains(id));
bakedObjectIds.AddRange(createdInstanceIds);
results.RemoveAll(result => result.ResultId != null && consumedObjectIds.Contains(result.ResultId));
results.AddRange(instanceConversionResults);
if (unpackedRoot.ColorProxies != null)
{
colorBaker.ParseColors(unpackedRoot.ColorProxies, onOperationProgressed);
}
// 7 - Create groups
if (unpackedRoot.GroupProxies != null)
// 4 - Convert atomic objects
HashSet<ReceiveConversionResult> results = new();
HashSet<string> bakedObjectIds = new();
Dictionary<string, IReadOnlyCollection<Entity>> applicationIdMap = new();
var count = 0;
foreach (var (layerPath, atomicObject) in atomicObjectsWithPath)
{
string objectId = atomicObject.applicationId ?? atomicObject.id.NotNull();
onOperationProgressed.Report(new("Converting objects", (double)++count / atomicObjects.Count));
cancellationToken.ThrowIfCancellationRequested();
try
{
List<ReceiveConversionResult> groupResults = _groupBaker.CreateGroups(
unpackedRoot.GroupProxies,
applicationIdMap
);
results.AddRange(groupResults);
}
IReadOnlyCollection<Entity> convertedObjects = ConvertObject(atomicObject, layerPath, baseLayerPrefix);
return new HostObjectBuilderResult(bakedObjectIds, results);
});
applicationIdMap[objectId] = convertedObjects;
results.UnionWith(
convertedObjects.Select(e => new ReceiveConversionResult(
Status.SUCCESS,
atomicObject,
e.GetSpeckleApplicationId(),
e.GetType().ToString()
))
);
bakedObjectIds.UnionWith(convertedObjects.Select(e => e.GetSpeckleApplicationId()));
}
catch (Exception ex) when (!ex.IsFatal())
{
results.Add(new(Status.ERROR, atomicObject, null, null, ex));
}
}
// 5 - Convert instances
var (createdInstanceIds, consumedObjectIds, instanceConversionResults) = instanceBaker.BakeInstances(
instanceComponentsWithPath,
applicationIdMap,
baseLayerPrefix,
onOperationProgressed
);
bakedObjectIds.RemoveWhere(id => consumedObjectIds.Contains(id));
bakedObjectIds.UnionWith(createdInstanceIds);
results.RemoveWhere(result => result.ResultId != null && consumedObjectIds.Contains(result.ResultId));
results.UnionWith(instanceConversionResults);
// 6 - Create groups
if (unpackedRoot.GroupProxies != null)
{
IReadOnlyCollection<ReceiveConversionResult> groupResults = groupBaker.CreateGroups(
unpackedRoot.GroupProxies,
applicationIdMap
);
results.UnionWith(groupResults);
}
return Task.FromResult(new HostObjectBuilderResult(bakedObjectIds, results));
}
private void PreReceiveDeepClean(string baseLayerPrefix)
{
_layerBaker.DeleteAllLayersByPrefix(baseLayerPrefix);
_instanceBaker.PurgeInstances(baseLayerPrefix);
_materialBaker.PurgeMaterials(baseLayerPrefix);
layerBaker.DeleteAllLayersByPrefix(baseLayerPrefix);
instanceBaker.PurgeInstances(baseLayerPrefix);
materialBaker.PurgeMaterials(baseLayerPrefix);
}
private IEnumerable<Entity> ConvertObject(Base obj, Collection[] layerPath, string baseLayerNamePrefix)
private IReadOnlyCollection<Entity> ConvertObject(Base obj, Collection[] layerPath, string baseLayerNamePrefix)
{
string layerName = _layerBaker.CreateLayerForReceive(layerPath, baseLayerNamePrefix);
var convertedEntities = new List<Entity>();
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)
switch (converted)
{
var bakedEntity = BakeObject(entity, obj, layerName);
convertedEntities.Add(bakedEntity);
}
else if (converted is IEnumerable<(object, Base)> fallbackConversionResult)
{
var bakedFallbackEntities = BakeObjectsAsGroup(fallbackConversionResult, obj, layerName, baseLayerNamePrefix);
convertedEntities.AddRange(bakedFallbackEntities);
case Entity entity:
var bakedEntity = BakeObject(entity, obj, layerName);
convertedEntities.Add(bakedEntity);
break;
case List<(Entity, Base)> listConversionResult: // this is from fallback conversion for brep/brepx/subdx/extrusionx/polycurve
var bakedFallbackEntities = BakeObjectsAsGroup(listConversionResult, obj, layerName, baseLayerNamePrefix);
convertedEntities.UnionWith(bakedFallbackEntities);
break;
default:
// TODO: capture defualt case with report object here? Same as in Rhino
break;
}
tr.Commit();
return convertedEntities;
return convertedEntities.Freeze();
}
private Entity BakeObject(Entity entity, Base originalObject, string layerName, Base? parentObject = null)
{
var objId = originalObject.applicationId ?? originalObject.id;
if (_colorBaker.ObjectColorsIdMap.TryGetValue(objId, out AutocadColor? color))
var objId = originalObject.applicationId ?? originalObject.id.NotNull();
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;
}
@@ -216,7 +199,7 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
}
private List<Entity> BakeObjectsAsGroup(
IEnumerable<(object, Base)> fallbackConversionResult,
List<(Entity, Base)> fallbackConversionResult,
Base parentObject,
string layerName,
string baseLayerName
@@ -226,22 +209,21 @@ public class AutocadHostObjectBuilder : IHostObjectBuilder
var entities = new List<Entity>();
foreach (var (conversionResult, originalObject) in fallbackConversionResult)
{
if (conversionResult is not Entity entity)
{
// TODO: throw?
continue;
}
BakeObject(conversionResult, originalObject, layerName, parentObject);
ids.Add(conversionResult.ObjectId);
entities.Add(conversionResult);
}
BakeObject(entity, originalObject, layerName, parentObject);
ids.Add(entity.ObjectId);
entities.Add(entity);
if (entities.Count <= 1) // return if empty list or only one, because we don't want to create empty or single item groups.
{
return entities;
}
var tr = Application.DocumentManager.CurrentDocument.Database.TransactionManager.TopTransaction;
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})"
);
@@ -0,0 +1,185 @@
using System.Diagnostics.CodeAnalysis;
using Autodesk.AutoCAD.DatabaseServices;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.HostApp;
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;
using Speckle.Converters.Common;
using Speckle.Sdk;
using Speckle.Sdk.Logging;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.Instances;
namespace Speckle.Connectors.Autocad.Operations.Send;
public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadRootObject>
{
private readonly IRootToSpeckleConverter _converter;
private readonly string[] _documentPathSeparator = ["\\"];
private readonly ISendConversionCache _sendConversionCache;
private readonly AutocadInstanceUnpacker _instanceUnpacker;
private readonly AutocadMaterialUnpacker _materialUnpacker;
private readonly AutocadColorUnpacker _colorUnpacker;
private readonly AutocadGroupUnpacker _groupUnpacker;
private readonly ILogger<AutocadRootObjectBuilder> _logger;
private readonly ISdkActivityFactory _activityFactory;
protected AutocadRootObjectBaseBuilder(
IRootToSpeckleConverter converter,
ISendConversionCache sendConversionCache,
AutocadInstanceUnpacker instanceObjectManager,
AutocadMaterialUnpacker materialUnpacker,
AutocadColorUnpacker colorUnpacker,
AutocadGroupUnpacker groupUnpacker,
ILogger<AutocadRootObjectBuilder> logger,
ISdkActivityFactory activityFactory
)
{
_converter = converter;
_sendConversionCache = sendConversionCache;
_instanceUnpacker = instanceObjectManager;
_materialUnpacker = materialUnpacker;
_colorUnpacker = colorUnpacker;
_groupUnpacker = groupUnpacker;
_logger = logger;
_activityFactory = activityFactory;
}
[SuppressMessage(
"Maintainability",
"CA1506:Avoid excessive class coupling",
Justification = """
It is already simplified but has many different references since it is a builder. Do not know can we simplify it now.
Later we might consider to refactor proxies from one proxy manager? but we do not know the shape of it all potential
proxy classes yet. So I'm supressing this one now!!!
"""
)]
public Task<RootObjectBuilderResult> Build(
IReadOnlyList<AutocadRootObject> objects,
SendInfo sendInfo,
IProgress<CardProgress> onOperationProgressed,
CancellationToken cancellationToken
)
{
// 0 - Init the root
Collection root =
new()
{
name = Application
.DocumentManager.CurrentDocument.Name // POC: https://spockle.atlassian.net/browse/CNX-9319
.Split(_documentPathSeparator, StringSplitOptions.None)
.Reverse()
.First()
};
// TODO: better handling for document and transactions!!
Document doc = Application.DocumentManager.CurrentDocument;
using Transaction tr = doc.Database.TransactionManager.StartTransaction();
// 1 - Unpack the instances
var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceUnpacker.UnpackSelection(objects);
root[ProxyKeys.INSTANCE_DEFINITION] = instanceDefinitionProxies;
// 2 - Unpack the groups
root[ProxyKeys.GROUP] = _groupUnpacker.UnpackGroups(atomicObjects);
using (var _ = _activityFactory.Start("Converting objects"))
{
// 3 - Convert atomic objects
List<LayerTableRecord> usedAcadLayers = new(); // Keeps track of autocad layers used, so we can pass them on later to the material and color unpacker.
List<SendConversionResult> results = new();
int count = 0;
foreach (var (entity, applicationId) in atomicObjects)
{
cancellationToken.ThrowIfCancellationRequested();
using (var convertActivity = _activityFactory.Start("Converting object"))
{
// Create and add a collection for this entity if not done so already.
(Collection objectCollection, LayerTableRecord? autocadLayer) = CreateObjectCollection(entity, tr);
if (autocadLayer is not null)
{
usedAcadLayers.Add(autocadLayer);
root.elements.Add(objectCollection);
}
var result = ConvertAutocadEntity(
entity,
applicationId,
objectCollection,
instanceProxies,
sendInfo.ProjectId
);
results.Add(result);
onOperationProgressed.Report(new("Converting", (double)++count / atomicObjects.Count));
}
}
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.
}
// 4 - Unpack the render material proxies
root[ProxyKeys.RENDER_MATERIAL] = _materialUnpacker.UnpackMaterials(atomicObjects, usedAcadLayers);
// 5 - Unpack the color proxies
root[ProxyKeys.COLOR] = _colorUnpacker.UnpackColors(atomicObjects, usedAcadLayers);
// add any additional properties (most likely from verticals)
AddAdditionalProxiesToRoot(root);
return Task.FromResult(new RootObjectBuilderResult(root, results));
}
}
public virtual (Collection, LayerTableRecord?) CreateObjectCollection(Entity entity, Transaction tr)
{
return (new(), null);
}
public virtual void AddAdditionalProxiesToRoot(Collection rootCollection)
{
return;
}
private SendConversionResult ConvertAutocadEntity(
Entity entity,
string applicationId,
Collection collectionHost,
IReadOnlyDictionary<string, InstanceProxy> instanceProxies,
string projectId
)
{
string sourceType = entity.GetType().ToString();
try
{
Base converted;
if (entity is BlockReference && instanceProxies.TryGetValue(applicationId, out InstanceProxy? instanceProxy))
{
converted = instanceProxy;
}
else if (_sendConversionCache.TryGetValue(projectId, applicationId, out ObjectReference? value))
{
converted = value;
}
else
{
converted = _converter.Convert(entity);
converted.applicationId = applicationId;
}
collectionHost.elements.Add(converted);
return new(Status.SUCCESS, applicationId, sourceType, converted);
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogSendConversionError(ex, sourceType);
return new(Status.ERROR, applicationId, sourceType, null, ex);
}
}
}
@@ -1,180 +1,46 @@
using System.Diagnostics.CodeAnalysis;
using Autodesk.AutoCAD.DatabaseServices;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.HostApp;
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;
using Speckle.Converters.Autocad;
using Speckle.Converters.Common;
using Speckle.Sdk;
using Speckle.Sdk.Logging;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Collections;
using Speckle.Sdk.Models.Instances;
namespace Speckle.Connectors.Autocad.Operations.Send;
public class AutocadRootObjectBuilder : IRootObjectBuilder<AutocadRootObject>
public sealed class AutocadRootObjectBuilder : AutocadRootObjectBaseBuilder
{
private readonly IRootToSpeckleConverter _converter;
private readonly string[] _documentPathSeparator = ["\\"];
private readonly IConverterSettingsStore<AutocadConversionSettings> _converterSettings;
private readonly ISendConversionCache _sendConversionCache;
private readonly AutocadInstanceUnpacker _instanceUnpacker;
private readonly AutocadMaterialUnpacker _materialUnpacker;
private readonly AutocadColorUnpacker _colorUnpacker;
private readonly AutocadLayerUnpacker _layerUnpacker;
private readonly AutocadGroupUnpacker _groupUnpacker;
private readonly ILogger<AutocadRootObjectBuilder> _logger;
private readonly ISdkActivityFactory _activityFactory;
public AutocadRootObjectBuilder(
AutocadLayerUnpacker layerUnpacker,
IRootToSpeckleConverter converter,
ISendConversionCache sendConversionCache,
AutocadInstanceUnpacker instanceObjectManager,
AutocadMaterialUnpacker materialUnpacker,
AutocadColorUnpacker colorUnpacker,
AutocadLayerUnpacker layerUnpacker,
AutocadGroupUnpacker groupUnpacker,
ILogger<AutocadRootObjectBuilder> logger,
ISdkActivityFactory activityFactory,
IConverterSettingsStore<AutocadConversionSettings> converterSettings
ISdkActivityFactory activityFactory
)
: base(
converter,
sendConversionCache,
instanceObjectManager,
materialUnpacker,
colorUnpacker,
groupUnpacker,
logger,
activityFactory
)
{
_converter = converter;
_sendConversionCache = sendConversionCache;
_instanceUnpacker = instanceObjectManager;
_materialUnpacker = materialUnpacker;
_colorUnpacker = colorUnpacker;
_layerUnpacker = layerUnpacker;
_groupUnpacker = groupUnpacker;
_logger = logger;
_activityFactory = activityFactory;
_converterSettings = converterSettings;
}
public Task<RootObjectBuilderResult> Build(
IReadOnlyList<AutocadRootObject> objects,
SendInfo sendInfo,
Action<string, double?>? onOperationProgressed = null,
CancellationToken ct = default
) => Task.FromResult(BuildSync(objects, sendInfo, onOperationProgressed, ct));
[SuppressMessage(
"Maintainability",
"CA1506:Avoid excessive class coupling",
Justification = """
It is already simplified but has many different references since it is a builder. Do not know can we simplify it now.
Later we might consider to refactor proxies from one proxy manager? but we do not know the shape of it all potential
proxy classes yet. So I'm supressing this one now!!!
"""
)]
private RootObjectBuilderResult BuildSync(
IReadOnlyList<AutocadRootObject> objects,
SendInfo sendInfo,
Action<string, double?>? onOperationProgressed,
CancellationToken ct
)
public override (Collection, LayerTableRecord?) CreateObjectCollection(Entity entity, Transaction tr)
{
// 0 - Init the root
Collection root =
new()
{
name = Application
.DocumentManager.CurrentDocument.Name // POC: https://spockle.atlassian.net/browse/CNX-9319
.Split(_documentPathSeparator, StringSplitOptions.None)
.Reverse()
.First()
};
root["units"] = _converterSettings.Current.SpeckleUnits;
Layer layer = _layerUnpacker.GetOrCreateSpeckleLayer(entity, tr, out LayerTableRecord? autocadLayer);
// TODO: better handling for document and transactions!!
Document doc = Application.DocumentManager.CurrentDocument;
using Transaction tr = doc.Database.TransactionManager.StartTransaction();
// 1 - Unpack the instances
var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceUnpacker.UnpackSelection(objects);
root[ProxyKeys.INSTANCE_DEFINITION] = instanceDefinitionProxies;
// 2 - Unpack the groups
root[ProxyKeys.GROUP] = _groupUnpacker.UnpackGroups(atomicObjects);
using (var _ = _activityFactory.Start("Converting objects"))
{
// 3 - Convert atomic objects
List<LayerTableRecord> usedAcadLayers = new(); // Keeps track of autocad layers used, so we can pass them on later to the material and color unpacker.
List<SendConversionResult> results = new();
int count = 0;
foreach (var (entity, applicationId) in atomicObjects)
{
ct.ThrowIfCancellationRequested();
using (var convertActivity = _activityFactory.Start("Converting object"))
{
// Create and add a collection for each layer if not done so already.
Layer layer = _layerUnpacker.GetOrCreateSpeckleLayer(entity, tr, out LayerTableRecord? autocadLayer);
if (autocadLayer is not null)
{
usedAcadLayers.Add(autocadLayer);
root.elements.Add(layer);
}
var result = ConvertAutocadEntity(entity, applicationId, layer, instanceProxies, sendInfo.ProjectId);
results.Add(result);
onOperationProgressed?.Invoke("Converting", (double)++count / atomicObjects.Count);
}
}
if (results.All(x => x.Status == Status.ERROR))
{
throw new SpeckleConversionException("Failed to convert all objects."); // fail fast instead creating empty commit! It will appear as model card error with red color.
}
// 4 - Unpack the render material proxies
root[ProxyKeys.RENDER_MATERIAL] = _materialUnpacker.UnpackMaterials(atomicObjects, usedAcadLayers);
// 5 - Unpack the color proxies
root[ProxyKeys.COLOR] = _colorUnpacker.UnpackColors(atomicObjects, usedAcadLayers);
return new RootObjectBuilderResult(root, results);
}
}
private SendConversionResult ConvertAutocadEntity(
Entity entity,
string applicationId,
Collection collectionHost,
IReadOnlyDictionary<string, InstanceProxy> instanceProxies,
string projectId
)
{
string sourceType = entity.GetType().ToString();
try
{
Base converted;
if (entity is BlockReference && instanceProxies.TryGetValue(applicationId, out InstanceProxy? instanceProxy))
{
converted = instanceProxy;
}
else if (_sendConversionCache.TryGetValue(projectId, applicationId, out ObjectReference? value))
{
converted = value;
}
else
{
converted = _converter.Convert(entity);
converted.applicationId = applicationId;
}
collectionHost.elements.Add(converted);
return new(Status.SUCCESS, applicationId, sourceType, converted);
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogSendConversionError(ex, sourceType);
return new(Status.ERROR, applicationId, sourceType, null, ex);
}
return (layer, autocadLayer);
}
}
@@ -10,21 +10,19 @@ public static class AppUtils
#elif AUTOCAD
HostApplications.AutoCAD;
#else
throw new NotImplementedException();
throw new NotSupportedException();
#endif
public static HostAppVersion Version =>
#if CIVIL3D2024
HostAppVersion.v2024;
#elif AUTOCAD2025
#if AUTOCAD2025 || CIVIL3D2025
HostAppVersion.v2025;
#elif AUTOCAD2024
#elif AUTOCAD2024 || CIVIL3D2024
HostAppVersion.v2024;
#elif AUTOCAD2023
#elif AUTOCAD2023|| CIVIL3D2023
HostAppVersion.v2023;
#elif AUTOCAD2022
#elif AUTOCAD2022 || CIVIL3D2022
HostAppVersion.v2022;
#else
throw new NotImplementedException();
throw new NotSupportedException();
#endif
}
@@ -2,14 +2,15 @@ using System.Drawing;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Connectors.Autocad.DependencyInjection;
using Speckle.Connectors.Common;
using Speckle.Connectors.DUI;
using Speckle.Connectors.DUI.WebView;
#if AUTOCAD
using Speckle.Connectors.Autocad.DependencyInjection;
using Speckle.Converters.Autocad;
#elif CIVIL3D
using Speckle.Converters.Civil3d;
using Speckle.Converters.Civil3dShared;
using Speckle.Connectors.Civil3dShared.DependencyInjection;
#endif
namespace Speckle.Connectors.Autocad.Plugin;
@@ -30,7 +31,7 @@ public class AutocadCommand
return;
}
PaletteSet = new PaletteSet("Speckle (Beta) for Autocad", s_id)
PaletteSet = new PaletteSet($"Speckle (Beta)", s_id)
{
Size = new Size(400, 500),
DockEnabled = (DockSides)((int)DockSides.Left + (int)DockSides.Right)
@@ -51,7 +52,7 @@ public class AutocadCommand
var panelWebView = Container.GetRequiredService<DUI3ControlWebView>();
PaletteSet.AddVisual("Speckle (Beta) for Autocad WebView", panelWebView);
PaletteSet.AddVisual("Speckle (Beta)", panelWebView);
FocusPalette();
}
@@ -46,20 +46,20 @@ public class AutocadRibbon
private void Create()
{
RibbonTab tab = FindOrMakeTab("Add-ins");
RibbonPanelSource source = new() { Title = "Speckle 2 (New Beta)" };
RibbonTab tab = FindOrMakeTab("Speckle");
RibbonPanelSource source = new() { Title = "Speckle (Beta)" };
RibbonPanel panel = new() { Source = source };
tab.Panels.Add(panel);
RibbonToolTip speckleToolTip =
new()
{
Title = "Speckle 2 (New Beta)",
Content = "Speckle Connector for " + AppUtils.App.Name,
Title = "Speckle (Beta)",
Content = $"Next Gen Speckle Connector (Beta) for {AppUtils.App.Name}",
IsHelpEnabled = true // Without this "Press F1 for help" does not appear in the tooltip
};
_ = CreateSpeckleButton("Connector " + AppUtils.App.Name + " (New)", source, null, speckleToolTip, "logo");
_ = CreateSpeckleButton("Speckle (Beta)", source, null, speckleToolTip, "logo");
}
private void ComponentManager_ItemInitialized(object? sender, RibbonItemEventArgs e)
@@ -9,18 +9,20 @@
<Import_RootNamespace>Speckle.Connectors.AutocadShared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadReceiveBaseBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadSelectionBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadReceiveBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadSendBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadBasicConnectorBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\AutocadSendBaseBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\SharedRegistration.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\AutocadConnectorModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\Civil3dConnectorModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Filters\AutocadSelectionFilter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadColorBaker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadColorUnpacker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadGroupBaker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadGroupUnpacker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadIdleManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadInstanceBaker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadInstanceUnpacker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadLayerBaker.cs" />
@@ -29,7 +31,6 @@
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadDocumentManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadDocumentModelStore.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadIdleManager.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\AutocadMaterialUnpacker.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Extensions\DatabaseExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Extensions\DocumentExtensions.cs" />
@@ -39,6 +40,7 @@
<Compile Include="$(MSBuildThisFileDirectory)HostApp\TransactionContext.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\AutocadHostObjectBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\AutocadRootObject.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\AutocadRootObjectBaseBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\AutocadRootObjectBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\AutocadRibbon.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Plugin\AutocadExtensionApplication.cs" />
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<UseWpf>true</UseWpf>
<Civil3DVersion>2022</Civil3DVersion>
<DefineConstants>$(DefineConstants);CIVIL3D;CIVIL3D2022;CIVIL3D2022_OR_GREATER</DefineConstants>
<Configurations>Debug;Release;Local</Configurations>
<StartAction>Program</StartAction>
<StartProgram>$(ProgramW6432)\Autodesk\AutoCAD $(Civil3DVersion)\acad.exe</StartProgram>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2022.0.2" ExcludeAssets="runtime"/>
<PackageReference Include="Speckle.Civil3D.API" VersionOverride="2022.0.2" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Converters\Civil3d\Speckle.Converters.Civil3d2022\Speckle.Converters.Civil3d2022.csproj" />
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj" />
</ItemGroup>
<Import Project="..\..\Autocad\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
<Import Project="..\..\Autocad\Speckle.Connectors.Civil3dShared\Speckle.Connectors.Civil3dShared.projitems" Label="Shared" />
</Project>
@@ -0,0 +1,383 @@
{
"version": 2,
"dependencies": {
".NETFramework,Version=v4.8": {
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3"
}
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "8.0.0",
"Microsoft.SourceLink.Common": "8.0.0"
}
},
"PolySharp": {
"type": "Direct",
"requested": "[1.14.1, )",
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"Speckle.AutoCAD.API": {
"type": "Direct",
"requested": "[2022.0.2, )",
"resolved": "2022.0.2",
"contentHash": "NFHXnlkBjzM8Bau52d6eF6m0+etHddGx7qlWN8YyrfTtGyz+AmPvF8fgxcLgyjAcB3W4Wim11JeYuEoTNH1X0w=="
},
"Speckle.Civil3D.API": {
"type": "Direct",
"requested": "[2022.0.2, )",
"resolved": "2022.0.2",
"contentHash": "H36v9rA2Ynh4gDCzpBeUcWs4BQwWi3MwgTAnClM22vNbQXZlxjK85iO8i/mJsX57hh8VfqLB8EA7CUw94gBddw==",
"dependencies": {
"Speckle.AutoCAD.API": "2022.0.2"
}
},
"Speckle.InterfaceGenerator": {
"type": "Direct",
"requested": "[0.9.6, )",
"resolved": "0.9.6",
"contentHash": "HKH7tYrYYlCK1ct483hgxERAdVdMtl7gUKW9ijWXxA1UsYR4Z+TrRHYmzZ9qmpu1NnTycSrp005NYM78GDKV1w=="
},
"GraphQL.Client": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==",
"dependencies": {
"GraphQL.Client.Abstractions": "6.0.0",
"GraphQL.Client.Abstractions.Websocket": "6.0.0",
"System.Net.WebSockets.Client.Managed": "1.0.22",
"System.Reactive": "5.0.0"
}
},
"GraphQL.Client.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==",
"dependencies": {
"GraphQL.Primitives": "6.0.0"
}
},
"GraphQL.Client.Abstractions.Websocket": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==",
"dependencies": {
"GraphQL.Client.Abstractions": "6.0.0"
}
},
"GraphQL.Primitives": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.7.0",
"contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA=="
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "nOP8R1mVb/6mZtm2qgAJXn/LFm/2kMjHDAg/QJLFG6CuWYJtaD3p1BwQhufBVvRzL9ceJ/xF0SQ0qsI2GkDQAA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "2.2.0"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "65MrmXCziWaQFrI0UHkQbesrX5wTwf9XPjY5yFm/VkgJKFJ5gqvXRoXjIZcf2wLi5ZlwGz/oMYfyURVCWbM5iw==",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
}
},
"Microsoft.Extensions.Configuration.Binder": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "vJ9xvOZCnUAIHcGC3SU35r3HKmHTVIeHzo6u/qzlHAqD8m6xv92MLin4oJntTvkpKxVX3vI1GFFkIQtU3AdlsQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "2.2.0"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "f9hstgjVmr6rmrfGSpfsVOl2irKAgr1QjrSi3FgnS7kulxband50f2brRLwySAQTADPZeTdow0mpSMcoAdadCw=="
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "UpZLNLBpIZ0GTebShui7xXYh6DmBHjWM8NxGxZbdQh/bPZ5e6YswqI+bru6BnEL5eWiOdodsXtEz3FROcgi/qg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Primitives": "2.2.0",
"System.ComponentModel.Annotations": "4.5.0"
}
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==",
"dependencies": {
"System.Memory": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "zMk4D+9zyiEWByyQ7oPImPN/Jhpj166Ky0Nlla4eXlNL8hI/BtSJsgR8Inldd4NNpIAH3oh8yym0W2DrhXdSLQ=="
},
"Microsoft.SourceLink.Common": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
"contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA=="
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==",
"dependencies": {
"SQLitePCLRaw.lib.e_sqlite3": "2.1.4",
"SQLitePCLRaw.provider.dynamic_cdecl": "2.1.4"
}
},
"SQLitePCLRaw.core": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==",
"dependencies": {
"System.Memory": "4.5.3"
}
},
"SQLitePCLRaw.lib.e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg=="
},
"SQLitePCLRaw.provider.dynamic_cdecl": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "ZsaKKhgYF9B1fvcnOGKl3EycNAwd9CRWX7v0rEfuPWhQQ5Jjpvf2VEHahiLIGHio3hxi3EIKFJw9KvyowWOUAw==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw=="
},
"System.ComponentModel.Annotations": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "UxYQ3FGUOtzJ7LfSdnYSFd7+oEv6M8NgUatatIN2HxNtDdlcvFAf+VIq4Of9cDMJEJC0aSRv/x898RYhB4Yppg=="
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.3",
"contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==",
"dependencies": {
"System.Buffers": "4.4.0",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
}
},
"System.Net.WebSockets.Client.Managed": {
"type": "Transitive",
"resolved": "1.0.22",
"contentHash": "WqEOxPlXjuZrIjUtXNE9NxEfU/n5E35iV2PtoZdJSUC4tlrqwHnTee+wvMIM4OUaJWmwrymeqcgYrE0IkGAgLA==",
"dependencies": {
"System.Buffers": "4.4.0",
"System.Numerics.Vectors": "4.4.0"
}
},
"System.Numerics.Vectors": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ=="
},
"System.Reactive": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.5.3",
"contentHash": "3TIsJhD1EiiT0w2CcDMN/iSSwnNnsrnbzeVHSKkaEgV85txMprmuO+Yq2AdSbeVGcg28pdNDTPK87tJhX7VFHw=="
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.5.4",
"contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
},
"speckle.connectors.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
"type": "Project",
"dependencies": {
"Microsoft.Web.WebView2": "[1.0.1938.49, )",
"Speckle.Connectors.DUI": "[1.0.0, )"
}
},
"speckle.connectors.logging": {
"type": "Project"
},
"speckle.converters.civil3d2022": {
"type": "Project",
"dependencies": {
"Speckle.AutoCAD.API": "[2022.0.2, )",
"Speckle.Civil3D.API": "[2022.0.2, )",
"Speckle.Converters.Common": "[1.0.0, )"
}
},
"speckle.converters.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "MZtBIwfDFork5vfjpJdG5g8wuJFt7d/y3LOSVVtDK/76wlbtz6cjltfKHqLx2TKVqTj5/c41t77m1+h20zqtPA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0"
}
},
"Microsoft.Extensions.Logging": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "Nxqhadc9FCmFHzU+fz3oc8sFlE6IadViYg8dfUdGzJZ2JUxnCsRghBhhOWdM4B2zSZqEc+0BjliBh/oNdRZuig==",
"dependencies": {
"Microsoft.Extensions.Configuration.Binder": "2.2.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging.Abstractions": "2.2.0",
"Microsoft.Extensions.Options": "2.2.0"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A=="
},
"Microsoft.Web.WebView2": {
"type": "CentralTransitive",
"requested": "[1.0.1938.49, )",
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
}
}
}
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<UseWpf>true</UseWpf>
<Civil3DVersion>2023</Civil3DVersion>
<DefineConstants>$(DefineConstants);CIVIL3D;CIVIL3D2023;CIVIL3D2022_OR_GREATER;CIVIL3D2023_OR_GREATER</DefineConstants>
<Configurations>Debug;Release;Local</Configurations>
<StartAction>Program</StartAction>
<StartProgram>$(ProgramW6432)\Autodesk\AutoCAD $(Civil3DVersion)\acad.exe</StartProgram>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2023.0.0" ExcludeAssets="runtime"/>
<PackageReference Include="Speckle.Civil3D.API" VersionOverride="2023.0.0" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Converters\Civil3d\Speckle.Converters.Civil3d2023\Speckle.Converters.Civil3d2023.csproj" />
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj" />
</ItemGroup>
<Import Project="..\..\Autocad\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
<Import Project="..\..\Autocad\Speckle.Connectors.Civil3dShared\Speckle.Connectors.Civil3dShared.projitems" Label="Shared" />
</Project>
@@ -0,0 +1,383 @@
{
"version": 2,
"dependencies": {
".NETFramework,Version=v4.8": {
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net48": "1.0.3"
}
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "8.0.0",
"Microsoft.SourceLink.Common": "8.0.0"
}
},
"PolySharp": {
"type": "Direct",
"requested": "[1.14.1, )",
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"Speckle.AutoCAD.API": {
"type": "Direct",
"requested": "[2023.0.0, )",
"resolved": "2023.0.0",
"contentHash": "aNfiNw9zRW8pCl8AAQK7afEJuea4bJ4sFNsGVSDrdq1egaonZrwALU01dSyFNCE8tne86eVjlprpOGG6r0+G/A=="
},
"Speckle.Civil3D.API": {
"type": "Direct",
"requested": "[2023.0.0, )",
"resolved": "2023.0.0",
"contentHash": "URb0wfrxm4jcAApRxZ15a1dmxWDRry8WAuGmUwC7saP5+ltkJOVSOYb6WeJKYhDiJbO3UlVCesTFNnsNjMFd5A==",
"dependencies": {
"Speckle.AutoCAD.API": "2022.0.2"
}
},
"Speckle.InterfaceGenerator": {
"type": "Direct",
"requested": "[0.9.6, )",
"resolved": "0.9.6",
"contentHash": "HKH7tYrYYlCK1ct483hgxERAdVdMtl7gUKW9ijWXxA1UsYR4Z+TrRHYmzZ9qmpu1NnTycSrp005NYM78GDKV1w=="
},
"GraphQL.Client": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==",
"dependencies": {
"GraphQL.Client.Abstractions": "6.0.0",
"GraphQL.Client.Abstractions.Websocket": "6.0.0",
"System.Net.WebSockets.Client.Managed": "1.0.22",
"System.Reactive": "5.0.0"
}
},
"GraphQL.Client.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==",
"dependencies": {
"GraphQL.Primitives": "6.0.0"
}
},
"GraphQL.Client.Abstractions.Websocket": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==",
"dependencies": {
"GraphQL.Client.Abstractions": "6.0.0"
}
},
"GraphQL.Primitives": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.7.0",
"contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA=="
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "nOP8R1mVb/6mZtm2qgAJXn/LFm/2kMjHDAg/QJLFG6CuWYJtaD3p1BwQhufBVvRzL9ceJ/xF0SQ0qsI2GkDQAA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "2.2.0"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "65MrmXCziWaQFrI0UHkQbesrX5wTwf9XPjY5yFm/VkgJKFJ5gqvXRoXjIZcf2wLi5ZlwGz/oMYfyURVCWbM5iw==",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
}
},
"Microsoft.Extensions.Configuration.Binder": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "vJ9xvOZCnUAIHcGC3SU35r3HKmHTVIeHzo6u/qzlHAqD8m6xv92MLin4oJntTvkpKxVX3vI1GFFkIQtU3AdlsQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "2.2.0"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "f9hstgjVmr6rmrfGSpfsVOl2irKAgr1QjrSi3FgnS7kulxband50f2brRLwySAQTADPZeTdow0mpSMcoAdadCw=="
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "UpZLNLBpIZ0GTebShui7xXYh6DmBHjWM8NxGxZbdQh/bPZ5e6YswqI+bru6BnEL5eWiOdodsXtEz3FROcgi/qg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Primitives": "2.2.0",
"System.ComponentModel.Annotations": "4.5.0"
}
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==",
"dependencies": {
"System.Memory": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"Microsoft.NETFramework.ReferenceAssemblies.net48": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "zMk4D+9zyiEWByyQ7oPImPN/Jhpj166Ky0Nlla4eXlNL8hI/BtSJsgR8Inldd4NNpIAH3oh8yym0W2DrhXdSLQ=="
},
"Microsoft.SourceLink.Common": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
"contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA=="
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==",
"dependencies": {
"SQLitePCLRaw.lib.e_sqlite3": "2.1.4",
"SQLitePCLRaw.provider.dynamic_cdecl": "2.1.4"
}
},
"SQLitePCLRaw.core": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==",
"dependencies": {
"System.Memory": "4.5.3"
}
},
"SQLitePCLRaw.lib.e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg=="
},
"SQLitePCLRaw.provider.dynamic_cdecl": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "ZsaKKhgYF9B1fvcnOGKl3EycNAwd9CRWX7v0rEfuPWhQQ5Jjpvf2VEHahiLIGHio3hxi3EIKFJw9KvyowWOUAw==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
},
"System.Buffers": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "AwarXzzoDwX6BgrhjoJsk6tUezZEozOT5Y9QKF94Gl4JK91I4PIIBkBco9068Y9/Dra8Dkbie99kXB8+1BaYKw=="
},
"System.ComponentModel.Annotations": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "UxYQ3FGUOtzJ7LfSdnYSFd7+oEv6M8NgUatatIN2HxNtDdlcvFAf+VIq4Of9cDMJEJC0aSRv/x898RYhB4Yppg=="
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.3",
"contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA==",
"dependencies": {
"System.Buffers": "4.4.0",
"System.Numerics.Vectors": "4.4.0",
"System.Runtime.CompilerServices.Unsafe": "4.5.2"
}
},
"System.Net.WebSockets.Client.Managed": {
"type": "Transitive",
"resolved": "1.0.22",
"contentHash": "WqEOxPlXjuZrIjUtXNE9NxEfU/n5E35iV2PtoZdJSUC4tlrqwHnTee+wvMIM4OUaJWmwrymeqcgYrE0IkGAgLA==",
"dependencies": {
"System.Buffers": "4.4.0",
"System.Numerics.Vectors": "4.4.0"
}
},
"System.Numerics.Vectors": {
"type": "Transitive",
"resolved": "4.4.0",
"contentHash": "UiLzLW+Lw6HLed1Hcg+8jSRttrbuXv7DANVj0DkL9g6EnnzbL75EB7EWsw5uRbhxd/4YdG8li5XizGWepmG3PQ=="
},
"System.Reactive": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.5.3",
"contentHash": "3TIsJhD1EiiT0w2CcDMN/iSSwnNnsrnbzeVHSKkaEgV85txMprmuO+Yq2AdSbeVGcg28pdNDTPK87tJhX7VFHw=="
},
"System.Threading.Tasks.Extensions": {
"type": "Transitive",
"resolved": "4.5.4",
"contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==",
"dependencies": {
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
}
},
"speckle.connectors.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
"type": "Project",
"dependencies": {
"Microsoft.Web.WebView2": "[1.0.1938.49, )",
"Speckle.Connectors.DUI": "[1.0.0, )"
}
},
"speckle.connectors.logging": {
"type": "Project"
},
"speckle.converters.civil3d2023": {
"type": "Project",
"dependencies": {
"Speckle.AutoCAD.API": "[2023.0.0, )",
"Speckle.Civil3D.API": "[2023.0.0, )",
"Speckle.Converters.Common": "[1.0.0, )"
}
},
"speckle.converters.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "MZtBIwfDFork5vfjpJdG5g8wuJFt7d/y3LOSVVtDK/76wlbtz6cjltfKHqLx2TKVqTj5/c41t77m1+h20zqtPA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0"
}
},
"Microsoft.Extensions.Logging": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "Nxqhadc9FCmFHzU+fz3oc8sFlE6IadViYg8dfUdGzJZ2JUxnCsRghBhhOWdM4B2zSZqEc+0BjliBh/oNdRZuig==",
"dependencies": {
"Microsoft.Extensions.Configuration.Binder": "2.2.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging.Abstractions": "2.2.0",
"Microsoft.Extensions.Options": "2.2.0"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A=="
},
"Microsoft.Web.WebView2": {
"type": "CentralTransitive",
"requested": "[1.0.1938.49, )",
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
}
}
}
@@ -4,15 +4,15 @@
<PlatformTarget>x64</PlatformTarget>
<UseWpf>true</UseWpf>
<Civil3DVersion>2024</Civil3DVersion>
<DefineConstants>$(DefineConstants);CIVIL3D;CIVIL3D2024;CIVIL3D2024_OR_GREATER</DefineConstants>
<DefineConstants>$(DefineConstants);CIVIL3D;CIVIL3D2024;CIVIL3D2022_OR_GREATER;CIVIL3D2023_OR_GREATER;CIVIL3D2024_OR_GREATER</DefineConstants>
<Configurations>Debug;Release;Local</Configurations>
<StartAction>Program</StartAction>
<StartProgram>$(ProgramW6432)\Autodesk\AutoCAD $(Civil3DVersion)\acad.exe</StartProgram>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2024.0.0" />
<PackageReference Include="Speckle.Civil3D.API" VersionOverride="2024.0.0" />
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2024.0.0" ExcludeAssets="runtime"/>
<PackageReference Include="Speckle.Civil3D.API" VersionOverride="2024.0.0" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
@@ -22,4 +22,5 @@
</ItemGroup>
<Import Project="..\..\Autocad\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
<Import Project="..\..\Autocad\Speckle.Connectors.Civil3dShared\Speckle.Connectors.Civil3dShared.projitems" Label="Shared" />
</Project>
@@ -80,6 +80,14 @@
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Bcl.AsyncInterfaces": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "W8DPQjkMScOMTtJbPwmPyj9c3zYSFGawDW3jwlBOOsnY+EzZFLgNQ/UMkK35JmkNOVPdCyPr2Tw7Vv9N+KA3ZQ==",
"dependencies": {
"System.Threading.Tasks.Extensions": "4.5.4"
}
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
@@ -92,17 +100,17 @@
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "tiNmV1oPy+Z2R7Wd0bPB/FxCr8B+/5q11OpDMG751GA/YuOL7MZrBFfzv5oFRlFe08K6sjrnbrauzzGIeNrzLQ==",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.7",
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.7",
"contentHash": "21FRzcJhaTrlv7kTrqr/ltFcSQM2TyuTTPhUcjO8H73od7Bb3QraNW90c7lUucNI/245XPkKZG4fp7/7OsKCSg==",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
@@ -165,29 +173,6 @@
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Polly": {
"type": "Transitive",
"resolved": "7.2.3",
"contentHash": "DeCY0OFbNdNxsjntr1gTXHJ5pKUwYzp04Er2LLeN3g6pWhffsGuKVfMBLe1lw7x76HrPkLxKEFxBlpRxS2nDEQ=="
},
"Polly.Contrib.WaitAndRetry": {
"type": "Transitive",
"resolved": "1.1.1",
"contentHash": "1MUQLiSo4KDkQe6nzQRhIU05lm9jlexX5BVsbuw0SL82ynZ+GzAHQxJVDPVBboxV37Po3SG077aX8DuSy8TkaA=="
},
"Polly.Extensions.Http": {
"type": "Transitive",
"resolved": "3.0.0",
"contentHash": "drrG+hB3pYFY7w1c3BD+lSGYvH2oIclH8GRSehgfyP5kjnFnHKQuuBhuHLv+PWyFuaTDyk/vfRpnxOzd11+J8g==",
"dependencies": {
"Polly": "7.1.0"
}
},
"Speckle.DoubleNumerics": {
"type": "Transitive",
"resolved": "4.0.1",
"contentHash": "MzEQ1Im0zTja+tEsdRIk/WlPiKqb22NmTOJcR1ZKm/mz46pezyyID3/wRz6vJUELMpSLnG7LhsxBL+nxbr7V0w=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
@@ -283,8 +268,9 @@
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )",
"Speckle.Sdk": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
@@ -292,8 +278,8 @@
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.0-dev.146, )",
"System.Threading.Tasks.Dataflow": "[6.0.0, )"
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
@@ -318,7 +304,7 @@
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.0-dev.146, )"
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
@@ -354,38 +340,43 @@
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "xuv5LaU6j8ODGHyClHbbK78bOJid8LGuwfVcEega1q3sYwmLWOWIDP9lO0QA1tyctE+2CZDH3sOUChleAFC4fg==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.0-dev.146"
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.0-dev.146, )",
"resolved": "3.1.0-dev.146",
"contentHash": "vNaWJkt7/xcIH/CraOrEumGn8A6gAlyl1RHfRI8B8qAGylSlEhuvuBSatS1gUPI35p9omO63yYQFKaIKEIsa3Q==",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.7",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Polly": "7.2.3",
"Polly.Contrib.WaitAndRetry": "1.1.1",
"Polly.Extensions.Http": "3.0.0",
"Speckle.DoubleNumerics": "4.0.1",
"Speckle.Newtonsoft.Json": "13.0.2"
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"System.Threading.Tasks.Dataflow": {
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[6.0.0, )",
"resolved": "6.0.0",
"contentHash": "+tyDCU3/B1lDdOOAJywHQoFwyXIUghIaP2BxG79uvhfTnO+D9qIgjVlL/JV2NTliYbMHpd6eKDmHp2VHpij7MA=="
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
}
}
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<UseWpf>true</UseWpf>
<Civil3DVersion>2025</Civil3DVersion>
<DefineConstants>$(DefineConstants);CIVIL3D2025;CIVIL3D;CIVIL3D2022_OR_GREATER;CIVIL3D2023_OR_GREATER;CIVIL3D2024_OR_GREATER;CIVIL3D2025_OR_GREATER</DefineConstants>
<Configurations>Debug;Release;Local</Configurations>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <!-- .NET Core uses this to move native dependencies into a root for runtime selection and usage for non-windows development https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#enablewindowstargeting -->
<StartAction>Program</StartAction>
<StartProgram>$(ProgramW6432)\Autodesk\AutoCAD $(Civil3DVersion)\acad.exe</StartProgram>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Speckle.AutoCAD.API" VersionOverride="2025.0.0" ExcludeAssets="runtime"/>
<PackageReference Include="Speckle.Civil3d.API" VersionOverride="2025.0.0" ExcludeAssets="runtime"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Converters\Civil3d\Speckle.Converters.Civil3d2025\Speckle.Converters.Civil3d2025.csproj" />
<ProjectReference Include="..\..\..\DUI3\Speckle.Connectors.DUI.WebView\Speckle.Connectors.DUI.WebView.csproj" />
<ProjectReference Include="..\..\..\Sdk\Speckle.Converters.Common\Speckle.Converters.Common.csproj" />
</ItemGroup>
<Import Project="..\Speckle.Connectors.Civil3dShared\Speckle.Connectors.Civil3dShared.projitems" Label="Shared" />
<Import Project="..\Speckle.Connectors.AutocadShared\Speckle.Connectors.AutocadShared.projitems" Label="Shared" />
</Project>
@@ -0,0 +1,352 @@
{
"version": 2,
"dependencies": {
"net8.0-windows7.0": {
"Microsoft.NETFramework.ReferenceAssemblies": {
"type": "Direct",
"requested": "[1.0.3, )",
"resolved": "1.0.3",
"contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==",
"dependencies": {
"Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3"
}
},
"Microsoft.SourceLink.GitHub": {
"type": "Direct",
"requested": "[8.0.0, )",
"resolved": "8.0.0",
"contentHash": "G5q7OqtwIyGTkeIOAc3u2ZuV/kicQaec5EaRnc0pIeSnh9LUjj+PYQrJYBURvDt7twGl2PKA7nSN0kz1Zw5bnQ==",
"dependencies": {
"Microsoft.Build.Tasks.Git": "8.0.0",
"Microsoft.SourceLink.Common": "8.0.0"
}
},
"PolySharp": {
"type": "Direct",
"requested": "[1.14.1, )",
"resolved": "1.14.1",
"contentHash": "mOOmFYwad3MIOL14VCjj02LljyF1GNw1wP0YVlxtcPvqdxjGGMNdNJJxHptlry3MOd8b40Flm8RPOM8JOlN2sQ=="
},
"Speckle.AutoCAD.API": {
"type": "Direct",
"requested": "[2025.0.0, )",
"resolved": "2025.0.0",
"contentHash": "dqEgZ+bTqAG0tx0WwdnTZcbNKH2igzhOr3SMXtRYai7yIqXiz5btZ4Mf2bmfxbmxLucww3GKVpdZoI+PSZlMuQ=="
},
"Speckle.Civil3D.API": {
"type": "Direct",
"requested": "[2025.0.0, )",
"resolved": "2025.0.0",
"contentHash": "zWxdzk7M2JE1+PgIpGrCycDUwbmTqJ+YCNMaJPbjUgVKoAiI5w7Ou9ynbFgmQkRuYrkTflbL+s799Fw62PJixQ==",
"dependencies": {
"Speckle.AutoCAD.API": "2025.0.0"
}
},
"Speckle.InterfaceGenerator": {
"type": "Direct",
"requested": "[0.9.6, )",
"resolved": "0.9.6",
"contentHash": "HKH7tYrYYlCK1ct483hgxERAdVdMtl7gUKW9ijWXxA1UsYR4Z+TrRHYmzZ9qmpu1NnTycSrp005NYM78GDKV1w=="
},
"GraphQL.Client": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "8yPNBbuVBpTptivyAlak4GZvbwbUcjeQTL4vN1HKHRuOykZ4r7l5fcLS6vpyPyLn0x8FsL31xbOIKyxbmR9rbA==",
"dependencies": {
"GraphQL.Client.Abstractions": "6.0.0",
"GraphQL.Client.Abstractions.Websocket": "6.0.0",
"System.Reactive": "5.0.0"
}
},
"GraphQL.Client.Abstractions": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "h7uzWFORHZ+CCjwr/ThAyXMr0DPpzEANDa4Uo54wqCQ+j7qUKwqYTgOrb1W40sqbvNaZm9v/X7It31SUw0maHA==",
"dependencies": {
"GraphQL.Primitives": "6.0.0"
}
},
"GraphQL.Client.Abstractions.Websocket": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "Nr9bPf8gIOvLuXpqEpqr9z9jslYFJOvd0feHth3/kPqeR3uMbjF5pjiwh4jxyMcxHdr8Pb6QiXkV3hsSyt0v7A==",
"dependencies": {
"GraphQL.Client.Abstractions": "6.0.0"
}
},
"GraphQL.Primitives": {
"type": "Transitive",
"resolved": "6.0.0",
"contentHash": "yg72rrYDapfsIUrul7aF6wwNnTJBOFvuA9VdDTQpPa8AlAriHbufeXYLBcodKjfUdkCnaiggX1U/nEP08Zb5GA=="
},
"Microsoft.Build.Tasks.Git": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "bZKfSIKJRXLTuSzLudMFte/8CempWjVamNUR5eHJizsy+iuOuO/k2gnh7W0dHJmYY0tBf+gUErfluCv5mySAOQ=="
},
"Microsoft.CSharp": {
"type": "Transitive",
"resolved": "4.7.0",
"contentHash": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA=="
},
"Microsoft.Data.Sqlite": {
"type": "Transitive",
"resolved": "7.0.5",
"contentHash": "KGxbPeWsQMnmQy43DSBxAFtHz3l2JX8EWBSGUCvT3CuZ8KsuzbkqMIJMDOxWtG8eZSoCDI04aiVQjWuuV8HmSw==",
"dependencies": {
"Microsoft.Data.Sqlite.Core": "7.0.5",
"SQLitePCLRaw.bundle_e_sqlite3": "2.1.4"
}
},
"Microsoft.Data.Sqlite.Core": {
"type": "Transitive",
"resolved": "7.0.5",
"contentHash": "FTerRmQPqHrCrnoUzhBu+E+1DNGwyrAMLqHkAqOOOu5pGfyMOj8qQUBxI/gDtWtG11p49UxSfWmBzRNlwZqfUg==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
},
"Microsoft.Extensions.Configuration": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "nOP8R1mVb/6mZtm2qgAJXn/LFm/2kMjHDAg/QJLFG6CuWYJtaD3p1BwQhufBVvRzL9ceJ/xF0SQ0qsI2GkDQAA==",
"dependencies": {
"Microsoft.Extensions.Configuration.Abstractions": "2.2.0"
}
},
"Microsoft.Extensions.Configuration.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "65MrmXCziWaQFrI0UHkQbesrX5wTwf9XPjY5yFm/VkgJKFJ5gqvXRoXjIZcf2wLi5ZlwGz/oMYfyURVCWbM5iw==",
"dependencies": {
"Microsoft.Extensions.Primitives": "2.2.0"
}
},
"Microsoft.Extensions.Configuration.Binder": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "vJ9xvOZCnUAIHcGC3SU35r3HKmHTVIeHzo6u/qzlHAqD8m6xv92MLin4oJntTvkpKxVX3vI1GFFkIQtU3AdlsQ==",
"dependencies": {
"Microsoft.Extensions.Configuration": "2.2.0"
}
},
"Microsoft.Extensions.DependencyInjection.Abstractions": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "f9hstgjVmr6rmrfGSpfsVOl2irKAgr1QjrSi3FgnS7kulxband50f2brRLwySAQTADPZeTdow0mpSMcoAdadCw=="
},
"Microsoft.Extensions.Options": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "UpZLNLBpIZ0GTebShui7xXYh6DmBHjWM8NxGxZbdQh/bPZ5e6YswqI+bru6BnEL5eWiOdodsXtEz3FROcgi/qg==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Primitives": "2.2.0",
"System.ComponentModel.Annotations": "4.5.0"
}
},
"Microsoft.Extensions.Primitives": {
"type": "Transitive",
"resolved": "2.2.0",
"contentHash": "azyQtqbm4fSaDzZHD/J+V6oWMFaf2tWP4WEGIYePLCMw3+b2RQdj9ybgbQyjCshcitQKQ4lEDOZjmSlTTrHxUg==",
"dependencies": {
"System.Memory": "4.5.1",
"System.Runtime.CompilerServices.Unsafe": "4.5.1"
}
},
"Microsoft.NETFramework.ReferenceAssemblies.net461": {
"type": "Transitive",
"resolved": "1.0.3",
"contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA=="
},
"Microsoft.SourceLink.Common": {
"type": "Transitive",
"resolved": "8.0.0",
"contentHash": "dk9JPxTCIevS75HyEQ0E4OVAFhB2N+V9ShCXf8Q6FkUQZDkgLI12y679Nym1YqsiSysuQskT7Z+6nUf3yab6Vw=="
},
"Speckle.Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.2",
"contentHash": "g1BejUZwax5PRfL6xHgLEK23sqHWOgOj9hE7RvfRRlN00AGt8GnPYt8HedSK7UB3HiRW8zCA9Pn0iiYxCK24BA=="
},
"SQLitePCLRaw.bundle_e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "EWI1olKDjFEBMJu0+3wuxwziIAdWDVMYLhuZ3Qs84rrz+DHwD00RzWPZCa+bLnHCf3oJwuFZIRsHT5p236QXww==",
"dependencies": {
"SQLitePCLRaw.lib.e_sqlite3": "2.1.4",
"SQLitePCLRaw.provider.e_sqlite3": "2.1.4"
}
},
"SQLitePCLRaw.core": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "inBjvSHo9UDKneGNzfUfDjK08JzlcIhn1+SP5Y3m6cgXpCxXKCJDy6Mka7LpgSV+UZmKSnC8rTwB0SQ0xKu5pA==",
"dependencies": {
"System.Memory": "4.5.3"
}
},
"SQLitePCLRaw.lib.e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg=="
},
"SQLitePCLRaw.provider.e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "CSlb5dUp1FMIkez9Iv5EXzpeq7rHryVNqwJMWnpq87j9zWZexaEMdisDktMsnnrzKM6ahNrsTkjqNodTBPBxtQ==",
"dependencies": {
"SQLitePCLRaw.core": "2.1.4"
}
},
"System.ComponentModel.Annotations": {
"type": "Transitive",
"resolved": "4.5.0",
"contentHash": "UxYQ3FGUOtzJ7LfSdnYSFd7+oEv6M8NgUatatIN2HxNtDdlcvFAf+VIq4Of9cDMJEJC0aSRv/x898RYhB4Yppg=="
},
"System.Memory": {
"type": "Transitive",
"resolved": "4.5.3",
"contentHash": "3oDzvc/zzetpTKWMShs1AADwZjQ/36HnsufHRPcOjyRAAMLDlu2iD33MBI2opxnezcVUtXyqDXXjoFMOU9c7SA=="
},
"System.Reactive": {
"type": "Transitive",
"resolved": "5.0.0",
"contentHash": "erBZjkQHWL9jpasCE/0qKAryzVBJFxGHVBAvgRN1bzM0q2s1S4oYREEEL0Vb+1kA/6BKb5FjUZMp5VXmy+gzkQ=="
},
"System.Runtime.CompilerServices.Unsafe": {
"type": "Transitive",
"resolved": "4.5.1",
"contentHash": "Zh8t8oqolRaFa9vmOZfdQm/qKejdqz0J9kr7o2Fu0vPeoH3BL1EOXipKWwkWtLT1JPzjByrF19fGuFlNbmPpiw=="
},
"speckle.connectors.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
"Speckle.Connectors.Logging": "[1.0.0, )",
"Speckle.Objects": "[3.1.7, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Connectors.Common": "[1.0.0, )",
"Speckle.Sdk": "[3.1.7, )",
"Speckle.Sdk.Dependencies": "[3.1.7, )"
}
},
"speckle.connectors.dui.webview": {
"type": "Project",
"dependencies": {
"Microsoft.Web.WebView2": "[1.0.1938.49, )",
"Speckle.Connectors.DUI": "[1.0.0, )"
}
},
"speckle.connectors.logging": {
"type": "Project"
},
"speckle.converters.civil3d2025": {
"type": "Project",
"dependencies": {
"Speckle.AutoCAD.API": "[2025.0.0, )",
"Speckle.Civil3d.API": "[2025.0.0, )",
"Speckle.Connectors.DUI.WebView": "[1.0.0, )",
"Speckle.Converters.Common": "[1.0.0, )"
}
},
"speckle.converters.common": {
"type": "Project",
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
"Speckle.Objects": "[3.1.7, )"
}
},
"Microsoft.Extensions.DependencyInjection": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "MZtBIwfDFork5vfjpJdG5g8wuJFt7d/y3LOSVVtDK/76wlbtz6cjltfKHqLx2TKVqTj5/c41t77m1+h20zqtPA==",
"dependencies": {
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0"
}
},
"Microsoft.Extensions.Logging": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "Nxqhadc9FCmFHzU+fz3oc8sFlE6IadViYg8dfUdGzJZ2JUxnCsRghBhhOWdM4B2zSZqEc+0BjliBh/oNdRZuig==",
"dependencies": {
"Microsoft.Extensions.Configuration.Binder": "2.2.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging.Abstractions": "2.2.0",
"Microsoft.Extensions.Options": "2.2.0"
}
},
"Microsoft.Extensions.Logging.Abstractions": {
"type": "CentralTransitive",
"requested": "[2.2.0, )",
"resolved": "2.2.0",
"contentHash": "B2WqEox8o+4KUOpL7rZPyh6qYjik8tHi2tN8Z9jZkHzED8ElYgZa/h6K+xliB435SqUcWT290Fr2aa8BtZjn8A=="
},
"Microsoft.Web.WebView2": {
"type": "CentralTransitive",
"requested": "[1.0.1938.49, )",
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
},
"Speckle.DoubleNumerics": {
"type": "CentralTransitive",
"requested": "[4.1.0, )",
"resolved": "4.1.0",
"contentHash": "20DtS+FsDRsOD9+AU3TwNFZ0qrKo5f6f7B5ZR9wStsIHHHC9k7DpjbCvuNtmnSjx54MD+TJC7wV2f5iyGVPj1A=="
},
"Speckle.Objects": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "Htg6IeMLTTf8fTaOKEKMPZzrseu4NAtVpiZwVtLhg7ZzdndW8WlsvEyFRShK1o3hxlPsQJOA5qfsTvf5fcz/pQ==",
"dependencies": {
"Speckle.Sdk": "3.1.7"
}
},
"Speckle.Sdk": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "oi6fz5fSsWZ+VQiZukpom/fKHRH++Vlyf8a6rlkYQPj6NAqTIV3Rgthalt7Y7wWxGNRIP4KMdGTXvrN7wqCcjA==",
"dependencies": {
"GraphQL.Client": "6.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.Data.Sqlite": "7.0.5",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0",
"Microsoft.Extensions.Logging": "2.2.0",
"Speckle.DoubleNumerics": "4.1.0",
"Speckle.Newtonsoft.Json": "13.0.2",
"Speckle.Sdk.Dependencies": "3.1.7"
}
},
"Speckle.Sdk.Dependencies": {
"type": "CentralTransitive",
"requested": "[3.1.7, )",
"resolved": "3.1.7",
"contentHash": "T7FgbPXh9zI+VkC7f9I5qchtktEhslIOo2xeCm4VKRhImrR7naTmZInQ5MXIZvRfawZlPEg6u0tWzCV1q7ov9g=="
}
},
"net8.0-windows7.0/win-x64": {
"SQLitePCLRaw.lib.e_sqlite3": {
"type": "Transitive",
"resolved": "2.1.4",
"contentHash": "2C9Q9eX7CPLveJA0rIhf9RXAvu+7nWZu1A2MdG6SD/NOu26TakGgL1nsbc0JAspGijFOo3HoN79xrx8a368fBg=="
},
"Microsoft.Web.WebView2": {
"type": "CentralTransitive",
"requested": "[1.0.1938.49, )",
"resolved": "1.0.1938.49",
"contentHash": "z8KnFnaTYzhA/ZnyRX0qGfS1NU5ZBJeClAH64F0fVDvdDJTvME7xl6zTJ0Jlfe1BtL3C0NH9xTy64shg2baKdw=="
}
}
}
}
@@ -0,0 +1,60 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.Bindings;
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;
using Speckle.Converters.Autocad;
using Speckle.Converters.Civil3dShared;
using Speckle.Converters.Common;
using Speckle.Sdk;
namespace Speckle.Connectors.Civil3dShared.Bindings;
public sealed class Civil3dReceiveBinding : AutocadReceiveBaseBinding
{
private readonly ICivil3dConversionSettingsFactory _civil3dConversionSettingsFactory;
private readonly IAutocadConversionSettingsFactory _autocadConversionSettingsFactory;
public Civil3dReceiveBinding(
DocumentModelStore store,
IBrowserBridge parent,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
IOperationProgressManager operationProgressManager,
ILogger<AutocadReceiveBinding> logger,
ICivil3dConversionSettingsFactory civil3dConversionSettingsFactory,
IAutocadConversionSettingsFactory autocadConversionSettingsFactory,
ISpeckleApplication speckleApplication,
IThreadContext threadContext
)
: base(
store,
parent,
cancellationManager,
serviceProvider,
operationProgressManager,
logger,
speckleApplication,
threadContext
)
{
_civil3dConversionSettingsFactory = civil3dConversionSettingsFactory;
_autocadConversionSettingsFactory = autocadConversionSettingsFactory;
}
// POC: we're registering the conversion settings for autocad here because we need the autocad conversion settings to be able to use the autocad typed converters.
// POC: We need a separate receive binding for civil3d due to using a different unit converter (needed for conversion settings construction)
protected override void InitializeSettings(IServiceProvider serviceProvider)
{
serviceProvider
.GetRequiredService<IConverterSettingsStore<Civil3dConversionSettings>>()
.Initialize(_civil3dConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
serviceProvider
.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
.Initialize(_autocadConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
}
}
@@ -0,0 +1,70 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.Bindings;
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;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Converters.Autocad;
using Speckle.Converters.Civil3dShared;
using Speckle.Converters.Common;
using Speckle.Sdk;
namespace Speckle.Connectors.Civil3dShared.Bindings;
public sealed class Civil3dSendBinding : AutocadSendBaseBinding
{
private readonly ICivil3dConversionSettingsFactory _civil3dConversionSettingsFactory;
private readonly IAutocadConversionSettingsFactory _autocadConversionSettingsFactory;
public Civil3dSendBinding(
DocumentModelStore store,
IBrowserBridge parent,
IEnumerable<ISendFilter> sendFilters,
ICancellationManager cancellationManager,
IServiceProvider serviceProvider,
ISendConversionCache sendConversionCache,
IOperationProgressManager operationProgressManager,
ILogger<AutocadSendBinding> logger,
ICivil3dConversionSettingsFactory civil3dConversionSettingsFactory,
IAutocadConversionSettingsFactory autocadConversionSettingsFactory,
ISpeckleApplication speckleApplication,
IThreadContext threadContext,
ITopLevelExceptionHandler topLevelExceptionHandler,
IAppIdleManager appIdleManager
)
: base(
store,
parent,
sendFilters,
cancellationManager,
serviceProvider,
sendConversionCache,
operationProgressManager,
logger,
speckleApplication,
threadContext,
topLevelExceptionHandler,
appIdleManager
)
{
_civil3dConversionSettingsFactory = civil3dConversionSettingsFactory;
_autocadConversionSettingsFactory = autocadConversionSettingsFactory;
}
// POC: we're registering the conversion settings for autocad here because we need the autocad conversion settings to be able to use the autocad typed converters.
// POC: We need a separate send binding for civil3d due to using a different unit converter (needed for conversion settings construction)
protected override void InitializeSettings(IServiceProvider serviceProvider)
{
serviceProvider
.GetRequiredService<IConverterSettingsStore<Civil3dConversionSettings>>()
.Initialize(_civil3dConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
serviceProvider
.GetRequiredService<IConverterSettingsStore<AutocadConversionSettings>>()
.Initialize(_autocadConversionSettingsFactory.Create(Application.DocumentManager.CurrentDocument));
}
}
@@ -0,0 +1,35 @@
using System.Reflection;
using Microsoft.Extensions.DependencyInjection;
using Speckle.Connectors.Autocad.DependencyInjection;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.Civil3dShared.Bindings;
using Speckle.Connectors.Civil3dShared.Operations.Send;
using Speckle.Connectors.Common.Builders;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Converters.Civil3dShared.ToSpeckle;
using Speckle.Sdk;
namespace Speckle.Connectors.Civil3dShared.DependencyInjection;
public static class Civil3dConnectorModule
{
public static void AddCivil3d(this IServiceCollection serviceCollection)
{
serviceCollection.AddAutocadBase();
// add send
serviceCollection.LoadSend();
serviceCollection.AddScoped<IRootObjectBuilder<AutocadRootObject>, Civil3dRootObjectBuilder>();
serviceCollection.AddSingleton<IBinding, Civil3dSendBinding>();
// add receive
serviceCollection.LoadReceive();
serviceCollection.AddSingleton<IBinding, Civil3dReceiveBinding>();
// additional classes
serviceCollection.AddScoped<PropertySetDefinitionHandler>();
// automatically detects the Class:IClass interface pattern to register all generated interfaces
serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetExecutingAssembly());
}
}
@@ -0,0 +1,57 @@
using Autodesk.AutoCAD.DatabaseServices;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Autocad.HostApp;
using Speckle.Connectors.Autocad.Operations.Send;
using Speckle.Connectors.Common.Caching;
using Speckle.Connectors.Common.Operations;
using Speckle.Converters.Civil3dShared.ToSpeckle;
using Speckle.Converters.Common;
using Speckle.Sdk.Logging;
using Speckle.Sdk.Models.Collections;
namespace Speckle.Connectors.Civil3dShared.Operations.Send;
public sealed class Civil3dRootObjectBuilder : AutocadRootObjectBaseBuilder
{
private readonly AutocadLayerUnpacker _layerUnpacker;
private readonly PropertySetDefinitionHandler _propertySetDefinitionHandler;
public Civil3dRootObjectBuilder(
AutocadLayerUnpacker layerUnpacker,
PropertySetDefinitionHandler propertySetDefinitionHandler,
IRootToSpeckleConverter converter,
ISendConversionCache sendConversionCache,
AutocadInstanceUnpacker instanceObjectManager,
AutocadMaterialUnpacker materialUnpacker,
AutocadColorUnpacker colorUnpacker,
AutocadGroupUnpacker groupUnpacker,
ILogger<AutocadRootObjectBuilder> logger,
ISdkActivityFactory activityFactory
)
: base(
converter,
sendConversionCache,
instanceObjectManager,
materialUnpacker,
colorUnpacker,
groupUnpacker,
logger,
activityFactory
)
{
_layerUnpacker = layerUnpacker;
_propertySetDefinitionHandler = propertySetDefinitionHandler;
}
public override (Collection, LayerTableRecord?) CreateObjectCollection(Entity entity, Transaction tr)
{
Layer layer = _layerUnpacker.GetOrCreateSpeckleLayer(entity, tr, out LayerTableRecord? autocadLayer);
return (layer, autocadLayer);
}
public override void AddAdditionalProxiesToRoot(Collection rootObject)
{
rootObject[ProxyKeys.PROPERTYSET_DEFINITIONS] = _propertySetDefinitionHandler.Definitions;
}
}
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>55E65D72-2FE8-4E61-891C-16A4D551CCF7</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>Speckle.Connectors.Civil3dShared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Bindings\Civil3dReceiveBinding.cs" />
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\Civil3dConnectorModule.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Civil3dRootObjectBuilder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bindings\Civil3dSendBinding.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)DependencyInjection\" />
<Folder Include="$(MSBuildThisFileDirectory)Operations\Send\" />
</ItemGroup>
</Project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>{EFD01520-93E8-4CCA-8E03-9CDC635F55F4}</ProjectGuid>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<Import Project="Speckle.Connectors.Civil3dShared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
@@ -0,0 +1,74 @@
using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card;
using Speckle.Sdk;
namespace Speckle.Connectors.CSiShared.Bindings;
public class CsiSharedBasicConnectorBinding : IBasicConnectorBinding
{
private readonly ISpeckleApplication _speckleApplication;
private readonly DocumentModelStore _store;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IThreadContext _threadContext;
public string Name => "baseBinding";
public IBrowserBridge Parent { get; }
public BasicConnectorBindingCommands Commands { get; }
public CsiSharedBasicConnectorBinding(
IBrowserBridge parent,
ISpeckleApplication speckleApplication,
DocumentModelStore store,
ITopLevelExceptionHandler topLevelExceptionHandler,
IThreadContext threadContext
)
{
_threadContext = threadContext;
Parent = parent;
_speckleApplication = speckleApplication;
_store = store;
_topLevelExceptionHandler = topLevelExceptionHandler;
Commands = new BasicConnectorBindingCommands(Parent);
_store.DocumentChanged += (_, _) =>
_topLevelExceptionHandler.FireAndForget(async () =>
{
// enforce main thread
await _threadContext.RunOnMainAsync(async () =>
{
await Commands.NotifyDocumentChanged();
});
});
}
public string GetConnectorVersion() => _speckleApplication.SpeckleVersion;
public string GetSourceApplicationName() => _speckleApplication.Slug;
public string GetSourceApplicationVersion() => _speckleApplication.HostApplicationVersion;
public DocumentInfo? GetDocumentInfo() => new("ETABS Model", "ETABS Model", "1");
public DocumentModelStore GetDocumentState() => _store;
/// <remarks>Operations must run on the main thread for ETABS and SAP 2000</remarks>
public void AddModel(ModelCard model) =>
_topLevelExceptionHandler.CatchUnhandled(() => _threadContext.RunOnThread(() => _store.AddModel(model), true));
/// <remarks>Operations must run on the main thread for ETABS and SAP 2000</remarks>
public void UpdateModel(ModelCard model) =>
_topLevelExceptionHandler.CatchUnhandled(() => _threadContext.RunOnThread(() => _store.UpdateModel(model), true));
/// <remarks>Operations must run on the main thread for ETABS and SAP 2000</remarks>
public void RemoveModel(ModelCard model) =>
_topLevelExceptionHandler.CatchUnhandled(() => _threadContext.RunOnThread(() => _store.RemoveModel(model), true));
public void RemoveModels(List<ModelCard> models) =>
_topLevelExceptionHandler.CatchUnhandled(() => _threadContext.RunOnThread(() => _store.RemoveModels(models), true));
public Task HighlightModel(string modelCardId) => Task.CompletedTask;
public Task HighlightObjects(IReadOnlyList<string> objectIds) => Task.CompletedTask;
}
@@ -0,0 +1,108 @@
using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.CSiShared.HostApp;
using Speckle.Connectors.CSiShared.Utils;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Converters.CSiShared.Utils;
using Timer = System.Timers.Timer;
namespace Speckle.Connectors.CSiShared.Bindings;
public class CsiSharedSelectionBinding : ISelectionBinding, IDisposable
{
private bool _disposed;
private readonly Timer _selectionTimer;
private readonly ICsiApplicationService _csiApplicationService;
private readonly IThreadContext _threadContext;
private HashSet<string> _lastSelection = new();
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
public IBrowserBridge Parent { get; }
public string Name => "selectionBinding";
public CsiSharedSelectionBinding(
IBrowserBridge parent,
ICsiApplicationService csiApplicationService,
ITopLevelExceptionHandler topLevelExceptionHandler,
IThreadContext threadContext
)
{
_threadContext = threadContext;
Parent = parent;
_csiApplicationService = csiApplicationService;
_topLevelExceptionHandler = topLevelExceptionHandler;
_selectionTimer = new Timer(1000);
_selectionTimer.Elapsed += (_, _) =>
_topLevelExceptionHandler.CatchUnhandled(() => _threadContext.RunOnMain(CheckSelectionChanged));
_selectionTimer.Start();
}
private void CheckSelectionChanged()
{
// timer callbacks are on a background thread, but CSI API calls must be on main thread
var currentSelection = GetSelection();
var currentIds = new HashSet<string>(currentSelection.SelectedObjectIds);
if (!_lastSelection.SetEquals(currentIds))
{
_lastSelection = currentIds;
// ensure UI updates also run on main thread
_threadContext.RunOnMain(
() =>
_topLevelExceptionHandler.CatchUnhandled(
() => Parent.Send(SelectionBindingEvents.SET_SELECTION, currentSelection)
)
);
}
}
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
_selectionTimer?.Dispose();
}
_disposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Gets the selection and creates an encoded ID (objectType and objectName).
/// </summary>
/// <remarks>
/// Refer to ObjectIdentifier.cs for more info.
/// </remarks>
public SelectionInfo GetSelection()
{
int numberItems = 0;
int[] objectType = [];
string[] objectName = [];
_csiApplicationService.SapModel.SelectObj.GetSelected(ref numberItems, ref objectType, ref objectName);
var encodedIds = new List<string>(numberItems);
var typeCounts = new Dictionary<string, int>();
for (int i = 0; i < numberItems; i++)
{
var typeKey = (ModelObjectType)objectType[i];
var typeName = typeKey.ToString();
encodedIds.Add(ObjectIdentifier.Encode(objectType[i], objectName[i]));
typeCounts[typeName] = (typeCounts.TryGetValue(typeName, out var count) ? count : 0) + 1; // NOTE: Cross-framework compatibility (net 48 and net8)
}
var summary =
encodedIds.Count == 0
? "No objects selected."
: $"{encodedIds.Count} objects ({string.Join(", ",
typeCounts.Select(kv => $"{kv.Value} {kv.Key}"))})";
return new SelectionInfo(encodedIds, summary);
}
}
@@ -0,0 +1,132 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Common.Cancellation;
using Speckle.Connectors.Common.Operations;
using Speckle.Connectors.CSiShared.HostApp;
using Speckle.Connectors.CSiShared.Utils;
using Speckle.Connectors.DUI.Bindings;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Exceptions;
using Speckle.Connectors.DUI.Logging;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Models.Card;
using Speckle.Connectors.DUI.Models.Card.SendFilter;
using Speckle.Connectors.DUI.Settings;
using Speckle.Converters.Common;
using Speckle.Converters.CSiShared;
using Speckle.Sdk;
using Speckle.Sdk.Common;
using Speckle.Sdk.Logging;
namespace Speckle.Connectors.CSiShared.Bindings;
public sealed class CsiSharedSendBinding : ISendBinding
{
public string Name => "sendBinding";
public SendBindingUICommands Commands { get; }
public IBrowserBridge Parent { get; }
private readonly DocumentModelStore _store;
private readonly IServiceProvider _serviceProvider;
private readonly List<ISendFilter> _sendFilters;
private readonly ICancellationManager _cancellationManager;
private readonly IOperationProgressManager _operationProgressManager;
private readonly ILogger<CsiSharedSendBinding> _logger;
private readonly ICsiApplicationService _csiApplicationService;
private readonly ICsiConversionSettingsFactory _csiConversionSettingsFactory;
private readonly ISpeckleApplication _speckleApplication;
private readonly ISdkActivityFactory _activityFactory;
public CsiSharedSendBinding(
DocumentModelStore store,
IBrowserBridge parent,
IEnumerable<ISendFilter> sendFilters,
IServiceProvider serviceProvider,
ICancellationManager cancellationManager,
IOperationProgressManager operationProgressManager,
ILogger<CsiSharedSendBinding> logger,
ICsiConversionSettingsFactory csiConversionSettingsFactory,
ISpeckleApplication speckleApplication,
ISdkActivityFactory activityFactory,
ICsiApplicationService csiApplicationService
)
{
_store = store;
_serviceProvider = serviceProvider;
_sendFilters = sendFilters.ToList();
_cancellationManager = cancellationManager;
_operationProgressManager = operationProgressManager;
_logger = logger;
Parent = parent;
Commands = new SendBindingUICommands(parent);
_csiConversionSettingsFactory = csiConversionSettingsFactory;
_speckleApplication = speckleApplication;
_activityFactory = activityFactory;
_csiApplicationService = csiApplicationService;
}
public List<ISendFilter> GetSendFilters() => _sendFilters;
public List<ICardSetting> GetSendSettings() => [];
public async Task Send(string modelCardId)
{
using var activity = _activityFactory.Start();
try
{
if (_store.GetModelById(modelCardId) is not SenderModelCard modelCard)
{
throw new InvalidOperationException("No publish model card was found.");
}
using var scope = _serviceProvider.CreateScope();
scope
.ServiceProvider.GetRequiredService<IConverterSettingsStore<CsiConversionSettings>>()
.Initialize(_csiConversionSettingsFactory.Create(_csiApplicationService.SapModel));
using var cancellationItem = _cancellationManager.GetCancellationItem(modelCardId);
List<ICsiWrapper> wrappers = modelCard
.SendFilter.NotNull()
.RefreshObjectIds()
.Select(DecodeObjectIdentifier)
.ToList();
if (wrappers.Count == 0)
{
throw new SpeckleSendFilterException("No objects were found to convert. Please update your publish filter!");
}
var sendResult = await scope
.ServiceProvider.GetRequiredService<SendOperation<ICsiWrapper>>()
.Execute(
wrappers,
modelCard.GetSendInfo(_speckleApplication.ApplicationAndVersion),
_operationProgressManager.CreateOperationProgressEventHandler(Parent, modelCardId, cancellationItem.Token),
cancellationItem.Token
);
await Commands.SetModelSendResult(modelCardId, sendResult.RootObjId, sendResult.ConversionResults);
}
catch (OperationCanceledException)
{
return;
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogModelCardHandledError(ex);
await Commands.SetModelError(modelCardId, ex);
}
}
private ICsiWrapper DecodeObjectIdentifier(string encodedId)
{
var (type, name) = ObjectIdentifier.Decode(encodedId);
return CsiWrapperFactory.Create(type, name);
}
public void CancelSend(string modelCardId)
{
_cancellationManager.CancelOperation(modelCardId);
}
}
@@ -0,0 +1,13 @@
using Speckle.Connectors.DUI.Models.Card.SendFilter;
namespace Speckle.Connectors.CSiShared.Filters;
public class CsiSharedSelectionFilter : DirectSelectionSendFilter
{
public CsiSharedSelectionFilter()
{
IsDefault = true;
}
public override List<string> RefreshObjectIds() => SelectedObjectIds;
}
@@ -0,0 +1 @@
global using CSiAPIv1;
@@ -0,0 +1,16 @@
namespace Speckle.Connectors.CSiShared.HostApp;
/// <summary>
/// Create a centralized access point for ETABS and SAP APIs across the entire program.
/// </summary>
/// <remarks>
/// All API methods are based on the objectType and objectName, not the GUID.
/// CSi is already giving us the "sapModel" reference through the plugin interface. No need to attach to running instance.
/// Since objectType is a single int (1, 2 ... 7) we know first index will always be the objectType.
/// Prevent having to pass the "sapModel" around between classes and this ensures consistent access.
/// Name "sapModel" is misleading since it doesn't only apply to SAP2000, but this is the convention in the API, so we keep it.
/// </remarks>
public interface ICsiApplicationService
{
cSapModel SapModel { get; }
}
@@ -0,0 +1,156 @@
using System.IO;
using Microsoft.Extensions.Logging;
using Speckle.Connectors.Common.Threading;
using Speckle.Connectors.DUI.Bridge;
using Speckle.Connectors.DUI.Models;
using Speckle.Connectors.DUI.Utils;
using Speckle.Sdk;
using Speckle.Sdk.Helpers;
using Speckle.Sdk.Logging;
using Timer = System.Timers.Timer;
namespace Speckle.Connectors.CSiShared.HostApp;
public class CsiDocumentModelStore : DocumentModelStore, IDisposable
{
private readonly ISpeckleApplication _speckleApplication;
private readonly ILogger<CsiDocumentModelStore> _logger;
private readonly ICsiApplicationService _csiApplicationService;
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
private readonly IThreadContext _threadContext;
private readonly Timer _modelCheckTimer;
private string _lastModelFilename = string.Empty;
private bool _disposed;
private string HostAppUserDataPath { get; set; }
private string DocumentStateFile { get; set; }
private string ModelPathHash { get; set; }
public CsiDocumentModelStore(
IJsonSerializer jsonSerializer,
ISpeckleApplication speckleApplication,
ILogger<CsiDocumentModelStore> logger,
ICsiApplicationService csiApplicationService,
ITopLevelExceptionHandler topLevelExceptionHandler,
IThreadContext threadContext
)
: base(jsonSerializer)
{
_threadContext = threadContext;
_speckleApplication = speckleApplication;
_logger = logger;
_csiApplicationService = csiApplicationService;
_topLevelExceptionHandler = topLevelExceptionHandler;
// initialize timer to check for model changes
_modelCheckTimer = new Timer(1000);
// timer runs on background thread but model checks must be on main thread
_modelCheckTimer.Elapsed += (_, _) =>
_topLevelExceptionHandler.CatchUnhandled(() => _threadContext.RunOnMain(CheckModelChanges));
_modelCheckTimer.Start();
}
private void CheckModelChanges()
{
string currentFilename = _csiApplicationService.SapModel.GetModelFilename();
if (string.IsNullOrEmpty(currentFilename) || currentFilename == _lastModelFilename)
{
return;
}
_lastModelFilename = currentFilename;
SetPaths();
LoadState();
OnDocumentChanged();
}
public override Task OnDocumentStoreInitialized()
{
var currentFilename = _csiApplicationService.SapModel.GetModelFilename();
if (!string.IsNullOrEmpty(currentFilename))
{
_lastModelFilename = currentFilename;
SetPaths();
LoadState();
}
return Task.CompletedTask;
}
private void SetPaths()
{
try
{
ModelPathHash = Crypt.Md5(_csiApplicationService.SapModel.GetModelFilename(), length: 32);
HostAppUserDataPath = Path.Combine(
SpecklePathProvider.UserSpeckleFolderPath,
"ConnectorsFileData",
_speckleApplication.Slug
);
DocumentStateFile = Path.Combine(HostAppUserDataPath, $"{ModelPathHash}.json");
_logger.LogDebug($"Paths set - Hash: {ModelPathHash}, File: {DocumentStateFile}");
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogError(ex, "Error in setting paths for CsiDocumentModelStore");
}
}
protected override void HostAppSaveState(string modelCardState)
{
try
{
if (!Directory.Exists(HostAppUserDataPath))
{
Directory.CreateDirectory(HostAppUserDataPath);
}
File.WriteAllText(DocumentStateFile, modelCardState);
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogError(ex, "Failed to save state");
}
}
protected override void LoadState()
{
try
{
if (!File.Exists(DocumentStateFile))
{
ClearAndSave();
return;
}
string serializedState = File.ReadAllText(DocumentStateFile);
LoadFromString(serializedState);
}
catch (Exception ex) when (!ex.IsFatal())
{
_logger.LogError(ex, "Failed to load state, initializing empty state");
ClearAndSave();
}
}
protected virtual void Dispose(bool disposing)
{
if (_disposed)
{
return;
}
if (disposing)
{
_modelCheckTimer.Dispose();
}
_disposed = true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
}
@@ -0,0 +1,43 @@
using Speckle.Converters.Common;
using Speckle.Converters.CSiShared;
using Speckle.Sdk.Models;
using Speckle.Sdk.Models.Collections;
namespace Speckle.Connectors.CSiShared.HostApp;
/// <summary>
/// We can use the CSiWrappers to create our collection structure.
/// </summary>
/// <remarks>
/// This class manages the collections. If the key (from the path) already exists, this collection is returned.
/// If it doesn't exist, a new collection is created and added to the rootObject.
/// </remarks>
public class CsiSendCollectionManager
{
protected IConverterSettingsStore<CsiConversionSettings> ConverterSettings { get; }
protected Dictionary<string, Collection> CollectionCache { get; } = new();
public CsiSendCollectionManager(IConverterSettingsStore<CsiConversionSettings> converterSettings)
{
ConverterSettings = converterSettings;
}
public virtual Collection AddObjectCollectionToRoot(Base convertedObject, Collection rootObject)
{
var path = GetCollectionPath(convertedObject);
if (CollectionCache.TryGetValue(path, out Collection? collection))
{
return collection;
}
Collection childCollection = CreateCollection(convertedObject);
rootObject.elements.Add(childCollection);
CollectionCache[path] = childCollection;
return childCollection;
}
protected virtual string GetCollectionPath(Base convertedObject) => convertedObject["type"]?.ToString() ?? "Unknown";
protected virtual Collection CreateCollection(Base convertedObject) => new(GetCollectionPath(convertedObject));
}
@@ -0,0 +1,115 @@
using Speckle.Converters.Common;
using Speckle.Converters.CSiShared;
using Speckle.Converters.CSiShared.Utils;
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
/// <summary>
/// Base frame section property extractor for CSi products.
/// </summary>
/// <remarks>
/// Handles common Csi API calls for frame section properties
/// Provides foundation for application-specific extractors.
/// </remarks>
public class CsiFrameSectionPropertyExtractor : IFrameSectionPropertyExtractor
{
private readonly IConverterSettingsStore<CsiConversionSettings> _settingsStore;
public CsiFrameSectionPropertyExtractor(IConverterSettingsStore<CsiConversionSettings> settingsStore)
{
_settingsStore = settingsStore;
}
public void ExtractProperties(string sectionName, Dictionary<string, object?> properties)
{
GetMaterialName(sectionName, properties);
GetSectionProperties(sectionName, properties);
GetPropertyModifiers(sectionName, properties);
}
private void GetMaterialName(string sectionName, Dictionary<string, object?> properties)
{
// get material name
string materialName = string.Empty;
_settingsStore.Current.SapModel.PropFrame.GetMaterial(sectionName, ref materialName);
// append to General Data of properties dictionary
Dictionary<string, object?> generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
generalData["Material"] = materialName;
}
private void GetSectionProperties(string sectionName, Dictionary<string, object?> properties)
{
double crossSectionalArea = 0,
shearAreaInMajorAxisDirection = 0,
shearAreaInMinorAxisDirection = 0,
torsionalConstant = 0,
momentOfInertiaAboutMajorAxis = 0,
momentOfInertiaAboutMinorAxis = 0,
sectionModulusAboutMajorAxis = 0,
sectionModulusAboutMinorAxis = 0,
plasticModulusAboutMajorAxis = 0,
plasticModulusAboutMinorAxis = 0,
radiusOfGyrationAboutMajorAxis = 0,
radiusOfGyrationAboutMinorAxis = 0;
_settingsStore.Current.SapModel.PropFrame.GetSectProps(
sectionName,
ref crossSectionalArea,
ref shearAreaInMajorAxisDirection,
ref shearAreaInMinorAxisDirection,
ref torsionalConstant,
ref momentOfInertiaAboutMajorAxis,
ref momentOfInertiaAboutMinorAxis,
ref sectionModulusAboutMajorAxis,
ref sectionModulusAboutMinorAxis,
ref plasticModulusAboutMajorAxis,
ref plasticModulusAboutMinorAxis,
ref radiusOfGyrationAboutMajorAxis,
ref radiusOfGyrationAboutMinorAxis
);
string distanceUnit = _settingsStore.Current.SpeckleUnits;
string areaUnit = $"{distanceUnit}²"; // // TODO: Formalize this better
string modulusUnit = $"{distanceUnit}³"; // // TODO: Formalize this better
string inertiaUnit = $"{distanceUnit}\u2074"; // TODO: Formalize this better
Dictionary<string, object?> mechanicalProperties = properties.EnsureNested(
SectionPropertyCategory.SECTION_PROPERTIES
);
mechanicalProperties.AddWithUnits("Area", crossSectionalArea, areaUnit);
mechanicalProperties.AddWithUnits("As2", shearAreaInMajorAxisDirection, areaUnit);
mechanicalProperties.AddWithUnits("As3", shearAreaInMinorAxisDirection, areaUnit);
mechanicalProperties.AddWithUnits("J", torsionalConstant, inertiaUnit);
mechanicalProperties.AddWithUnits("I22", momentOfInertiaAboutMajorAxis, inertiaUnit);
mechanicalProperties.AddWithUnits("I33", momentOfInertiaAboutMinorAxis, inertiaUnit);
mechanicalProperties.AddWithUnits("S22", sectionModulusAboutMajorAxis, modulusUnit);
mechanicalProperties.AddWithUnits("S33", sectionModulusAboutMinorAxis, modulusUnit);
mechanicalProperties.AddWithUnits("Z22", plasticModulusAboutMajorAxis, modulusUnit);
mechanicalProperties.AddWithUnits("Z33", plasticModulusAboutMinorAxis, modulusUnit);
mechanicalProperties.AddWithUnits("R22", radiusOfGyrationAboutMajorAxis, distanceUnit);
mechanicalProperties.AddWithUnits("R33", radiusOfGyrationAboutMinorAxis, distanceUnit);
}
private void GetPropertyModifiers(string sectionName, Dictionary<string, object?> properties)
{
double[] stiffnessModifiersArray = [];
_settingsStore.Current.SapModel.PropFrame.GetModifiers(sectionName, ref stiffnessModifiersArray);
Dictionary<string, object?> modifiers =
new()
{
["Cross-section (Axial) Area"] = stiffnessModifiersArray[0],
["Shear Area in 2 Direction"] = stiffnessModifiersArray[1],
["Shear Area in 3 Direction"] = stiffnessModifiersArray[2],
["Torsional Constant"] = stiffnessModifiersArray[3],
["Moment of Inertia about 2 Axis"] = stiffnessModifiersArray[4],
["Moment of Inertia about 3 Axis"] = stiffnessModifiersArray[5],
["Mass"] = stiffnessModifiersArray[6],
["Weight"] = stiffnessModifiersArray[7],
};
Dictionary<string, object?> generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
generalData["Modifiers"] = modifiers;
}
}
@@ -0,0 +1,212 @@
using Speckle.Converters.Common;
using Speckle.Converters.CSiShared;
using Speckle.Converters.CSiShared.Utils;
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
/// <summary>
/// Base material property extractor for CSi products.
/// </summary>
/// <remarks>
/// Currently, all material property extraction can happen on a CsiShared level which simplifies things a lot.
/// Properties depend on the directional symmetry of the material, hence the switch statements.
/// </remarks>
public class CsiMaterialPropertyExtractor
{
/// <summary>
/// Property strings for all mechanical properties, used by numerous methods.
/// </summary>
private static class MechanicalPropertyNames
{
public const string MODULUS_OF_ELASTICITY = "Modulus of Elasticity, E";
public const string MODULUS_OF_ELASTICITY_ARRAY = "Modulus of Elasticity Array, E";
public const string POISSON_RATIO = "Poisson's Ratio, U";
public const string POISSON_RATIO_ARRAY = "Poisson's Ratio Array, U";
public const string THERMAL_COEFFICIENT = "Coefficient of Thermal Expansion, A";
public const string THERMAL_COEFFICIENT_ARRAY = "Coefficient of Thermal Expansion Array, A";
public const string SHEAR_MODULUS = "Shear Modulus, G";
public const string SHEAR_MODULUS_ARRAY = "Shear Modulus Array, G";
}
private readonly IConverterSettingsStore<CsiConversionSettings> _settingsStore;
public CsiMaterialPropertyExtractor(IConverterSettingsStore<CsiConversionSettings> settingsStore)
{
_settingsStore = settingsStore;
}
public void ExtractProperties(string materialName, Dictionary<string, object?> properties)
{
GetGeneralProperties(materialName, properties);
GetWeightAndMassProperties(materialName, properties); // TODO: Add units
GetMechanicalProperties(materialName, properties); // TODO: Add units
}
private void GetGeneralProperties(string materialName, Dictionary<string, object?> properties)
{
{
eMatType materialType = default;
int materialColor = 0;
string materialNotes = string.Empty;
string materialGuid = string.Empty;
_settingsStore.Current.SapModel.PropMaterial.GetMaterial(
materialName,
ref materialType,
ref materialColor,
ref materialNotes,
ref materialGuid
);
var generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
generalData["Name"] = materialName;
generalData["Type"] = materialType.ToString();
generalData["Notes"] = materialNotes;
}
}
private void GetWeightAndMassProperties(string materialName, Dictionary<string, object?> properties)
{
double weightPerUnitVolume = double.NaN;
double massPerUnitVolume = double.NaN;
_settingsStore.Current.SapModel.PropMaterial.GetWeightAndMass(
materialName,
ref weightPerUnitVolume,
ref massPerUnitVolume
);
var weightAndMass = properties.EnsureNested("Weight and Mass");
weightAndMass["Weight per Unit Volume"] = weightPerUnitVolume;
weightAndMass["Mass per Unit Volume"] = massPerUnitVolume;
}
private void GetMechanicalProperties(string materialName, Dictionary<string, object?> properties)
{
int materialDirectionalSymmetryKey = 0;
eMatType materialType = default;
_settingsStore.Current.SapModel.PropMaterial.GetTypeOAPI(
materialName,
ref materialType,
ref materialDirectionalSymmetryKey
);
var materialDirectionalSymmetryValue = materialDirectionalSymmetryKey switch
{
0 => DirectionalSymmetryType.ISOTROPIC,
1 => DirectionalSymmetryType.ORTHOTROPIC,
2 => DirectionalSymmetryType.ANISOTROPIC,
3 => DirectionalSymmetryType.UNIAXIAL,
_ => throw new ArgumentException($"Unknown symmetry type: {materialDirectionalSymmetryKey}")
};
var mechanicalProperties = properties.EnsureNested("Mechanical Properties");
mechanicalProperties["Directional Symmetry Type"] = materialDirectionalSymmetryValue.ToString();
GetMechanicalPropertiesByType(materialName, materialDirectionalSymmetryValue, mechanicalProperties);
}
private void GetMechanicalPropertiesByType(
string materialName,
DirectionalSymmetryType directionalSymmetryType,
Dictionary<string, object?> mechanicalProperties
)
{
switch (directionalSymmetryType)
{
case DirectionalSymmetryType.ISOTROPIC:
ExtractIsotropicProperties(materialName, mechanicalProperties);
break;
case DirectionalSymmetryType.ORTHOTROPIC:
ExtractOrthotropicProperties(materialName, mechanicalProperties);
break;
case DirectionalSymmetryType.ANISOTROPIC:
ExtractAnisotropicProperties(materialName, mechanicalProperties);
break;
case DirectionalSymmetryType.UNIAXIAL:
ExtractUniaxialProperties(materialName, mechanicalProperties);
break;
default:
throw new ArgumentException($"Unknown directional symmetry type: {directionalSymmetryType}");
}
}
private void ExtractIsotropicProperties(string materialName, Dictionary<string, object?> mechanicalProperties)
{
double modulusOfElasticity = double.NaN;
double poissonRatio = double.NaN;
double thermalCoefficient = double.NaN;
double shearModulus = double.NaN;
_settingsStore.Current.SapModel.PropMaterial.GetMPIsotropic(
materialName,
ref modulusOfElasticity,
ref poissonRatio,
ref thermalCoefficient,
ref shearModulus
);
mechanicalProperties[MechanicalPropertyNames.MODULUS_OF_ELASTICITY] = modulusOfElasticity;
mechanicalProperties[MechanicalPropertyNames.POISSON_RATIO] = poissonRatio;
mechanicalProperties[MechanicalPropertyNames.THERMAL_COEFFICIENT] = thermalCoefficient;
mechanicalProperties[MechanicalPropertyNames.SHEAR_MODULUS] = shearModulus;
}
private void ExtractOrthotropicProperties(string materialName, Dictionary<string, object?> mechanicalProperties)
{
double[] modulusOfElasticityArray = [];
double[] poissonRatioArray = [];
double[] thermalCoefficientArray = [];
double[] shearModulusArray = [];
_settingsStore.Current.SapModel.PropMaterial.GetMPOrthotropic(
materialName,
ref modulusOfElasticityArray,
ref poissonRatioArray,
ref thermalCoefficientArray,
ref shearModulusArray
);
mechanicalProperties[MechanicalPropertyNames.MODULUS_OF_ELASTICITY_ARRAY] = modulusOfElasticityArray;
mechanicalProperties[MechanicalPropertyNames.POISSON_RATIO_ARRAY] = poissonRatioArray;
mechanicalProperties[MechanicalPropertyNames.THERMAL_COEFFICIENT_ARRAY] = thermalCoefficientArray;
mechanicalProperties[MechanicalPropertyNames.SHEAR_MODULUS_ARRAY] = shearModulusArray;
}
private void ExtractAnisotropicProperties(string materialName, Dictionary<string, object?> mechanicalProperties)
{
double[] modulusOfElasticityArray = [];
double[] poissonRatioArray = [];
double[] thermalCoefficientArray = [];
double[] shearModulusArray = [];
_settingsStore.Current.SapModel.PropMaterial.GetMPAnisotropic(
materialName,
ref modulusOfElasticityArray,
ref poissonRatioArray,
ref thermalCoefficientArray,
ref shearModulusArray
);
mechanicalProperties[MechanicalPropertyNames.MODULUS_OF_ELASTICITY_ARRAY] = modulusOfElasticityArray;
mechanicalProperties[MechanicalPropertyNames.POISSON_RATIO_ARRAY] = poissonRatioArray;
mechanicalProperties[MechanicalPropertyNames.THERMAL_COEFFICIENT_ARRAY] = thermalCoefficientArray;
mechanicalProperties[MechanicalPropertyNames.SHEAR_MODULUS_ARRAY] = shearModulusArray;
}
private void ExtractUniaxialProperties(string materialName, Dictionary<string, object?> mechanicalProperties)
{
double modulusOfElasticity = double.NaN;
double thermalCoefficient = double.NaN;
_settingsStore.Current.SapModel.PropMaterial.GetMPUniaxial(
materialName,
ref modulusOfElasticity,
ref thermalCoefficient
);
mechanicalProperties[MechanicalPropertyNames.MODULUS_OF_ELASTICITY] = modulusOfElasticity;
mechanicalProperties[MechanicalPropertyNames.THERMAL_COEFFICIENT] = thermalCoefficient;
}
}
@@ -0,0 +1,68 @@
using Speckle.Converters.Common;
using Speckle.Converters.CSiShared;
using Speckle.Converters.CSiShared.Utils;
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
/// <summary>
/// Base shell section property extractor for CSi products.
/// </summary>
/// <remarks>
/// Handles common Csi API calls for shell section properties.
/// Provides foundation for application-specific extractors.
/// </remarks>
public class CsiShellSectionPropertyExtractor : IShellSectionPropertyExtractor
{
private readonly IConverterSettingsStore<CsiConversionSettings> _settingsStore;
public CsiShellSectionPropertyExtractor(IConverterSettingsStore<CsiConversionSettings> settingsStore)
{
_settingsStore = settingsStore;
}
public void ExtractProperties(string sectionName, Dictionary<string, object?> properties)
{
GetPropertyType(sectionName, properties);
GetPropertyModifiers(sectionName, properties);
}
private void GetPropertyType(string sectionName, Dictionary<string, object?> properties)
{
int propertyTypeKey = 1;
_settingsStore.Current.SapModel.PropArea.GetTypeOAPI(sectionName, ref propertyTypeKey);
var propertyTypeValue = propertyTypeKey switch
{
1 => AreaPropertyType.SHELL,
2 => AreaPropertyType.PLANE,
3 => AreaPropertyType.ASOLID,
_ => throw new ArgumentException($"Unknown property type: {propertyTypeKey}"),
};
var generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
generalData["Property Type"] = propertyTypeValue.ToString();
}
private void GetPropertyModifiers(string sectionName, Dictionary<string, object?> properties)
{
double[] stiffnessModifiersArray = [];
_settingsStore.Current.SapModel.PropArea.GetModifiers(sectionName, ref stiffnessModifiersArray);
Dictionary<string, object?> modifiers =
new()
{
["Membrane f11 Direction"] = stiffnessModifiersArray[0],
["Membrane f22 Direction"] = stiffnessModifiersArray[1],
["Membrane f12 Direction"] = stiffnessModifiersArray[2],
["Bending m11 Direction"] = stiffnessModifiersArray[3],
["Bending m22 Direction"] = stiffnessModifiersArray[3],
["Bending m12 Direction"] = stiffnessModifiersArray[4],
["Shear v13 Direction"] = stiffnessModifiersArray[5],
["Shear v23 Direction"] = stiffnessModifiersArray[6],
["Mass"] = stiffnessModifiersArray[7],
["Weight"] = stiffnessModifiersArray[8]
};
var generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
generalData["Modifiers"] = modifiers;
}
}
@@ -0,0 +1,18 @@
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
/// <summary>
/// Contract for host application specific section property extraction.
/// </summary>
/// <remarks>
/// Mirrors property extraction system pattern by composing with base extractor.
/// Enables both shared and application-specific property extraction in one call.
/// </remarks>
public interface IApplicationSectionPropertyExtractor
{
void ExtractProperties(string sectionName, Dictionary<string, object?> properties);
}
// NOTE: Seemingly silly, but allows us to register the correct extractor for the correct type.
public interface IApplicationFrameSectionPropertyExtractor : IApplicationSectionPropertyExtractor { }
public interface IApplicationShellSectionPropertyExtractor : IApplicationSectionPropertyExtractor { }
@@ -0,0 +1,14 @@
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
/// <summary>
/// Core contract for section property extraction common across CSi products.
/// </summary>
public interface ISectionPropertyExtractor
{
void ExtractProperties(string sectionName, Dictionary<string, object?> properties);
}
// NOTE: Seemingly silly, but allows us to register the correct extractor for the correct type.
public interface IFrameSectionPropertyExtractor : ISectionPropertyExtractor { }
public interface IShellSectionPropertyExtractor : ISectionPropertyExtractor { }
@@ -0,0 +1,10 @@
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
// NOTE: Interface because Etabs and Sap2000 section unpacking and extraction is different.
// At ServiceRegistration, we inject the correct implementation of the ISectionUnpacker
public interface ISectionUnpacker
{
IEnumerable<GroupProxy> UnpackSections();
}
@@ -0,0 +1,51 @@
using Speckle.Connectors.CSiShared.HostApp.Helpers;
using Speckle.Converters.CSiShared.ToSpeckle.Helpers;
using Speckle.Sdk.Models.Proxies;
namespace Speckle.Connectors.CSiShared.HostApp;
/// <summary>
/// Creates material proxies based on stored entries from the materials cache
/// </summary>
public class MaterialUnpacker
{
private readonly CsiMaterialPropertyExtractor _propertyExtractor;
private readonly CsiToSpeckleCacheSingleton _csiToSpeckleCacheSingleton;
public MaterialUnpacker(
CsiMaterialPropertyExtractor propertyExtractor,
CsiToSpeckleCacheSingleton csiToSpeckleCacheSingleton
)
{
_propertyExtractor = propertyExtractor;
_csiToSpeckleCacheSingleton = csiToSpeckleCacheSingleton;
}
// Creates a list of material proxies from the csi materials cache
public IEnumerable<IProxyCollection> UnpackMaterials()
{
foreach (var kvp in _csiToSpeckleCacheSingleton.MaterialCache)
{
// get the cached entry
string materialName = kvp.Key;
List<string> sectionIds = kvp.Value;
// get the properties of the material
Dictionary<string, object?> properties = new(); // create empty dictionary
_propertyExtractor.ExtractProperties(materialName, properties); // dictionary mutated with respective properties
// create the material proxy
GroupProxy materialProxy =
new()
{
id = materialName,
name = materialName,
applicationId = materialName,
objects = sectionIds,
["properties"] = properties
};
yield return materialProxy;
}
}
}

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