Compare commits
53 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c594112ff | |||
| 389204a0d1 | |||
| cd30370654 | |||
| 9b9c383128 | |||
| e87eebefd1 | |||
| c5deaf4844 | |||
| 882358e22a | |||
| 532adb855f | |||
| 1d8e19293d | |||
| be6cd69d16 | |||
| 5a554e7cf7 | |||
| d773c1fff4 | |||
| a26d06434f | |||
| a07b6f6d94 | |||
| b06fcc484e | |||
| db205024cc | |||
| fa8e4d2528 | |||
| 31c2d8d5b3 | |||
| e22527f85e | |||
| f082cf6723 | |||
| c4184f2662 | |||
| c0b38f0e12 | |||
| 4a88380fd2 | |||
| 04132e88ac | |||
| 3e3003827b | |||
| e3bd4f6365 | |||
| 6e6d52509c | |||
| 637ffbfc54 | |||
| 32b26f8c86 | |||
| c41c57544a | |||
| 6687383ce4 | |||
| f08d52e080 | |||
| 4dcf9910a5 | |||
| 9a61ded43e | |||
| 5acb0b80ab | |||
| ba41ceca2f | |||
| 8474088e5b | |||
| fe042d7a1c | |||
| d681c63a05 | |||
| bdc0e2b5bd | |||
| 6dc1726536 | |||
| 46198934ec | |||
| b4191d1d65 | |||
| f007e28565 | |||
| d05667dac8 | |||
| c922976bcd | |||
| c3aa44dfc2 | |||
| e1a64189c8 | |||
| b0e0669cab | |||
| b2a14e055c | |||
| 74f4525ff2 | |||
| bb57b31ae4 | |||
| d33a6ca358 |
+14
-14
@@ -6,34 +6,34 @@
|
||||
|
||||
# Connectors
|
||||
|
||||
/Connectors/ArcGIS/* @KatKatKateryna
|
||||
/Connectors/Autocad/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Connectors/Civil3d/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Connectors/Autocad/* @oguzhankoral @JR-Morgan @dogukankaratas
|
||||
/Connectors/Civil3d/* @oguzhankoral @JR-Morgan @dogukankaratas
|
||||
/Connectors/CSi/* @bjoernsteinhagen @dogukankaratas
|
||||
/Connectors/Navisworks/* @jsdbroughton
|
||||
/Connectors/Revit/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Connectors/Rhino/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Connectors/Revit/* @oguzhankoral
|
||||
/Connectors/Rhino/* @oguzhankoral @JR-Morgan
|
||||
/Connectors/Tekla/* @bjoernsteinhagen @dogukankaratas
|
||||
|
||||
# Converters
|
||||
/Convertors/ArcGIS/* @KatKatKateryna
|
||||
/Convertors/Autocad/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Convertors/Civil3d/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Convertors/Autocad/* @oguzhankoral @JR-Morgan @dogukankaratas
|
||||
/Convertors/Civil3d/* @oguzhankoral @JR-Morgan @dogukankaratas
|
||||
/Convertors/CSi/* @bjoernsteinhagen @dogukankaratas
|
||||
/Convertors/Navisworks/* @jsdbroughton
|
||||
/Convertors/Revit/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Convertors/Rhino/* @clairekuang @oguzhankoral @didimitrie
|
||||
/Convertors/Revit/* @oguzhankoral
|
||||
/Convertors/Rhino/* @oguzhankoral @JR-Morgan
|
||||
/Convertors/Tekla/* @bjoernsteinhagen @dogukankaratas
|
||||
|
||||
# DUI
|
||||
|
||||
/DUI3/* @clairekuang @oguzhankoral @didimitrie
|
||||
/DUI3/* @oguzhankoral
|
||||
|
||||
# Importers
|
||||
/Importers/* @JR-Morgan @didimitrie @oguzhankoral @adamhathcock
|
||||
/Importers/* @JR-Morgan @oguzhankoral
|
||||
|
||||
# SDK
|
||||
/SDK/* @JR-Morgan @clairekuang @didimitrie @oguzhankoral @adamhathcock
|
||||
/SDK/* @JR-Morgan @oguzhankoral
|
||||
|
||||
# Build
|
||||
/Build/* @JR-Morgan @oguzhankoral @adamhathcock
|
||||
/Build/* @JR-Morgan @oguzhankoral
|
||||
/.github/* @JR-Morgan @oguzhankoral
|
||||
/.config/* @JR-Morgan @oguzhankoral
|
||||
|
||||
@@ -68,7 +68,7 @@ jobs:
|
||||
"repo": "${{ github.repository }}",
|
||||
"is_public_release": ${{ env.IS_PUBLIC_RELEASE }}
|
||||
}'
|
||||
ref: main
|
||||
ref: jedd/cnx-1358-autocad-and-civil3d-installations-are-blocked-by-pre #todo: revert back to main before PR is merged
|
||||
wait-for-completion: true
|
||||
wait-for-completion-interval: 10s
|
||||
wait-for-completion-timeout: 10m
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<Target AfterTargets="Clean" Name="CleanAddinAutocad" Condition="'$(AutoCADVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
<RemoveDir Directories="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad$(AutoCADVersion);" />
|
||||
<RemoveDir Directories="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad.bundle\Contents\Windows\Speckle.Connectors.Autocad$(AutoCADVersion);" />
|
||||
</Target>
|
||||
|
||||
<Target AfterTargets="Build" Name="AfterBuildAutoCAD" Condition="'$(AutoCADVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
@@ -9,11 +9,12 @@
|
||||
<AutoCADDLLs Include="$(TargetDir)\**\*.*" />
|
||||
</ItemGroup>
|
||||
<Message Text="AutoCAD Version $(AutoCADVersion)" Importance="high"/>
|
||||
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad$(AutoCADVersion)\%(RecursiveDir)" SourceFiles="@(AutoCADDLLs)" />
|
||||
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad.bundle\Contents\Windows\Speckle.Connectors.Autocad$(AutoCADVersion)\%(RecursiveDir)" SourceFiles="@(AutoCADDLLs)" />
|
||||
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Autocad.bundle\" SourceFiles="$(TargetDir)\Plugin\BundleAutoCAD\PackageContents.xml" />
|
||||
</Target>
|
||||
|
||||
<Target AfterTargets="Clean" Name="CleanAddinCivil3D" Condition="'$(Civil3DVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
<RemoveDir Directories="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d$(Civil3DVersion);" />
|
||||
<RemoveDir Directories="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d.bundle\Contents\Windows\Speckle.Connectors.Civil3d$(Civil3DVersion);" />
|
||||
</Target>
|
||||
|
||||
<Target AfterTargets="Build" Name="AfterBuildCivil3D" Condition="'$(Civil3DVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
@@ -21,7 +22,8 @@
|
||||
<Civil3DDLLs Include="$(TargetDir)\**\*.*" />
|
||||
</ItemGroup>
|
||||
<Message Text="Civil3D Version $(Civil3DVersion)" Importance="high"/>
|
||||
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d$(Civil3DVersion)\%(RecursiveDir)" SourceFiles="@(Civil3DDLLs)" />
|
||||
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d.bundle\Contents\Windows\Speckle.Connectors.Civil3d$(Civil3DVersion)\%(RecursiveDir)" SourceFiles="@(Civil3DDLLs)" />
|
||||
<Copy DestinationFolder="$(AppData)\Autodesk\ApplicationPlugins\Speckle.Connectors.Civil3d.bundle\" SourceFiles="$(TargetDir)\Plugin\BundleCivil3D\PackageContents.xml" />
|
||||
</Target>
|
||||
|
||||
<PropertyGroup Condition="'$(AutoCADVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -312,7 +312,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -356,11 +356,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -312,7 +312,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -356,11 +356,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -313,7 +313,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -166,13 +166,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -230,7 +230,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -262,7 +262,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -306,11 +306,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -157,8 +157,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -166,13 +166,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -230,7 +230,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -262,7 +262,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -306,11 +306,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+71
-3
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Autodesk.AutoCAD.DatabaseServices;
|
||||
using Autodesk.AutoCAD.Geometry;
|
||||
using Speckle.Connectors.Autocad.HostApp.Extensions;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.Common.Cancellation;
|
||||
@@ -40,6 +41,9 @@ public abstract class AutocadSendBaseBinding : ISendBinding
|
||||
/// </summary>
|
||||
private ConcurrentBag<string> ChangedObjectIds { get; set; } = new();
|
||||
|
||||
private readonly List<string> _docSubsTracker = new();
|
||||
private readonly Dictionary<string, Matrix3d> _docUcsTracker = new();
|
||||
|
||||
protected AutocadSendBaseBinding(
|
||||
DocumentModelStore store,
|
||||
IBrowserBridge parent,
|
||||
@@ -71,6 +75,10 @@ public abstract class AutocadSendBaseBinding : ISendBinding
|
||||
// catches the case when autocad just opens up with a blank new doc
|
||||
SubscribeToObjectChanges(Application.DocumentManager.CurrentDocument);
|
||||
}
|
||||
|
||||
Application.SystemVariableChanged += (_, e) =>
|
||||
_topLevelExceptionHandler.CatchUnhandled(() => OnSystemVariableChanged(e));
|
||||
|
||||
// Since ids of the objects generates from same seed, we should clear the cache always whenever doc swapped.
|
||||
_store.DocumentChanged += (_, _) =>
|
||||
{
|
||||
@@ -78,8 +86,6 @@ public abstract class AutocadSendBaseBinding : ISendBinding
|
||||
};
|
||||
}
|
||||
|
||||
private readonly List<string> _docSubsTracker = new();
|
||||
|
||||
private void SubscribeToObjectChanges(Document doc)
|
||||
{
|
||||
if (doc == null || doc.Database == null || _docSubsTracker.Contains(doc.Name))
|
||||
@@ -88,11 +94,58 @@ public abstract class AutocadSendBaseBinding : ISendBinding
|
||||
}
|
||||
|
||||
_docSubsTracker.Add(doc.Name);
|
||||
_docUcsTracker[doc.Name] = doc.Editor.CurrentUserCoordinateSystem;
|
||||
|
||||
doc.Database.ObjectAppended += (_, e) => OnObjectChanged(e.DBObject);
|
||||
doc.Database.ObjectErased += (_, e) => OnObjectChanged(e.DBObject);
|
||||
doc.Database.ObjectModified += (_, e) => OnObjectChanged(e.DBObject);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles system variable changes to detect UCS modifications.
|
||||
/// When UCS changes, clears the conversion cache and expires all sender model cards.
|
||||
/// </summary>
|
||||
private void OnSystemVariableChanged(Autodesk.AutoCAD.ApplicationServices.SystemVariableChangedEventArgs e)
|
||||
{
|
||||
// check if this is a UCS-defining system variable
|
||||
string varName = e.Name.ToUpperInvariant();
|
||||
bool isUcsChange = varName == "UCSNAME" || varName == "UCSORG" || varName == "UCSXDIR" || varName == "UCSYDIR";
|
||||
|
||||
if (!isUcsChange)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// get the currently active document
|
||||
Document doc = Application.DocumentManager.MdiActiveDocument;
|
||||
if (doc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var currentUcs = doc.Editor.CurrentUserCoordinateSystem;
|
||||
|
||||
// first time tracking this document's UCS
|
||||
if (!_docUcsTracker.TryGetValue(doc.Name, out Matrix3d storedUcs))
|
||||
{
|
||||
_docUcsTracker[doc.Name] = currentUcs;
|
||||
return;
|
||||
}
|
||||
|
||||
// ucs hasn't actually changed (multiple variables fire for single UCS change)
|
||||
if (currentUcs.IsEqualTo(storedUcs))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ucs has changed - all cached conversions invalid
|
||||
_sendConversionCache.ClearCache();
|
||||
_docUcsTracker[doc.Name] = currentUcs;
|
||||
|
||||
// expire all sender model cards
|
||||
_idleManager.SubscribeToIdle(nameof(ExpireAllSenders), async () => await ExpireAllSenders());
|
||||
}
|
||||
|
||||
private void OnObjectChanged(DBObject dbObject) =>
|
||||
_topLevelExceptionHandler.CatchUnhandled(() => OnChangeChangedObjectIds(dbObject));
|
||||
|
||||
@@ -123,6 +176,19 @@ public abstract class AutocadSendBaseBinding : ISendBinding
|
||||
ChangedObjectIds = new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Expires all sender model cards when a global change occurs (like UCS change).
|
||||
/// </summary>
|
||||
private async Task ExpireAllSenders()
|
||||
{
|
||||
var senders = _store.GetSenders();
|
||||
var expiredSenderIds = senders.Select(s => s.ModelCardId.NotNull()).ToList();
|
||||
if (expiredSenderIds.Count > 0)
|
||||
{
|
||||
await Commands.SetModelsExpired(expiredSenderIds);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ISendFilter> GetSendFilters() => _sendFilters;
|
||||
|
||||
public List<ICardSetting> GetSendSettings() => [];
|
||||
@@ -145,7 +211,9 @@ public abstract class AutocadSendBaseBinding : ISendBinding
|
||||
Commands,
|
||||
modelCardId,
|
||||
(sp, card) => InitializeSettings(sp),
|
||||
card => Application.DocumentManager.CurrentDocument.GetObjects(card.SendFilter.NotNull().RefreshObjectIds())
|
||||
card => Application.DocumentManager.CurrentDocument.GetObjects(card.SendFilter.NotNull().RefreshObjectIds()),
|
||||
Application.DocumentManager.CurrentDocument.Name,
|
||||
null
|
||||
);
|
||||
}
|
||||
finally
|
||||
|
||||
+5
-5
@@ -3,9 +3,9 @@ using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Autocad.HostApp.Extensions;
|
||||
using Speckle.Connectors.Autocad.Operations.Send;
|
||||
using Speckle.Connectors.Common.Instances;
|
||||
using Speckle.Converters.Autocad.Helpers;
|
||||
using Speckle.Converters.AutocadShared.ToSpeckle;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.DoubleNumerics;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Models.Instances;
|
||||
|
||||
@@ -46,6 +46,7 @@ public class AutocadInstanceUnpacker : IInstanceUnpacker<AutocadRootObject>
|
||||
{
|
||||
UnpackInstance(blockReference, 0, transaction);
|
||||
}
|
||||
|
||||
_instanceObjectsManager.AddAtomicObject(obj.ApplicationId, obj);
|
||||
}
|
||||
return _instanceObjectsManager.GetUnpackResult();
|
||||
@@ -66,13 +67,14 @@ public class AutocadInstanceUnpacker : IInstanceUnpacker<AutocadRootObject>
|
||||
? instance.AnonymousBlockTableRecord
|
||||
: instance.BlockTableRecord;
|
||||
|
||||
// transforms on instances are always stored in WCS
|
||||
InstanceProxy instanceProxy =
|
||||
new()
|
||||
{
|
||||
applicationId = instanceId,
|
||||
definitionId = definitionId.ToString(),
|
||||
maxDepth = depth,
|
||||
transform = GetMatrix(instance.BlockTransform.ToArray()),
|
||||
transform = TransformHelper.ConvertToInstanceMatrix4x4(instance.BlockTransform),
|
||||
units = _unitsConverter.ConvertOrThrow(Application.DocumentManager.CurrentDocument.Database.Insunits)
|
||||
};
|
||||
|
||||
@@ -173,6 +175,7 @@ public class AutocadInstanceUnpacker : IInstanceUnpacker<AutocadRootObject>
|
||||
UnpackInstance(blockReference, depth + 1, transaction);
|
||||
}
|
||||
|
||||
_instanceObjectsManager.AddAtomicDefinitionObjectId(appId);
|
||||
_instanceObjectsManager.AddAtomicObject(appId, new(obj, appId));
|
||||
}
|
||||
|
||||
@@ -183,7 +186,4 @@ public class AutocadInstanceUnpacker : IInstanceUnpacker<AutocadRootObject>
|
||||
_logger.LogError(ex, "Failed unpacking Autocad instance");
|
||||
}
|
||||
}
|
||||
|
||||
private Matrix4x4 GetMatrix(double[] t) =>
|
||||
new(t[0], t[1], t[2], t[3], t[4], t[5], t[6], t[7], t[8], t[9], t[10], t[11], t[12], t[13], t[14], t[15]);
|
||||
}
|
||||
|
||||
+12
@@ -51,6 +51,12 @@ public class AutocadMaterialUnpacker
|
||||
|
||||
if (transaction.GetObject(entity.MaterialId, OpenMode.ForRead) is Material material)
|
||||
{
|
||||
// skip default material
|
||||
if (material.Name == "Global")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string materialId = material.GetSpeckleApplicationId();
|
||||
if (materialProxies.TryGetValue(materialId, out RenderMaterialProxy? value))
|
||||
{
|
||||
@@ -77,6 +83,12 @@ public class AutocadMaterialUnpacker
|
||||
{
|
||||
if (transaction.GetObject(layer.MaterialId, OpenMode.ForRead) is Material material)
|
||||
{
|
||||
// skip default material
|
||||
if (material.Name == "Global")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string materialId = material.GetSpeckleApplicationId();
|
||||
string layerId = layer.GetSpeckleApplicationId(); // Do not use handle directly, see note in the 'GetSpeckleApplicationId' method
|
||||
if (materialProxies.TryGetValue(materialId, out RenderMaterialProxy? value))
|
||||
|
||||
+60
-8
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Autodesk.AutoCAD.DatabaseServices;
|
||||
using Autodesk.AutoCAD.Geometry;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Autocad.HostApp;
|
||||
using Speckle.Connectors.Common.Builders;
|
||||
@@ -7,6 +8,8 @@ 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.Autocad.Helpers;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Logging;
|
||||
@@ -19,6 +22,7 @@ namespace Speckle.Connectors.Autocad.Operations.Send;
|
||||
public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadRootObject>
|
||||
{
|
||||
private readonly IRootToSpeckleConverter _converter;
|
||||
private readonly IConverterSettingsStore<AutocadConversionSettings> _converterSettings;
|
||||
private readonly string[] _documentPathSeparator = ["\\"];
|
||||
private readonly ISendConversionCache _sendConversionCache;
|
||||
private readonly AutocadInstanceUnpacker _instanceUnpacker;
|
||||
@@ -30,6 +34,7 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
|
||||
protected AutocadRootObjectBaseBuilder(
|
||||
IRootToSpeckleConverter converter,
|
||||
IConverterSettingsStore<AutocadConversionSettings> converterSettings,
|
||||
ISendConversionCache sendConversionCache,
|
||||
AutocadInstanceUnpacker instanceObjectManager,
|
||||
AutocadMaterialUnpacker materialUnpacker,
|
||||
@@ -40,6 +45,7 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
)
|
||||
{
|
||||
_converter = converter;
|
||||
_converterSettings = converterSettings;
|
||||
_sendConversionCache = sendConversionCache;
|
||||
_instanceUnpacker = instanceObjectManager;
|
||||
_materialUnpacker = materialUnpacker;
|
||||
@@ -81,17 +87,35 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
using Transaction tr = doc.Database.TransactionManager.StartTransaction();
|
||||
|
||||
// 1 - Unpack the instances
|
||||
var (atomicObjects, instanceProxies, instanceDefinitionProxies) = _instanceUnpacker.UnpackSelection(objects);
|
||||
var (atomicObjects, atomicDefinitionObjectIds, instanceProxies, instanceDefinitionProxies) =
|
||||
_instanceUnpacker.UnpackSelection(objects);
|
||||
root[ProxyKeys.INSTANCE_DEFINITION] = instanceDefinitionProxies;
|
||||
|
||||
// 2 - Unpack the groups
|
||||
root[ProxyKeys.GROUP] = _groupUnpacker.UnpackGroups(atomicObjects);
|
||||
|
||||
// 3 - Add the Reference Point
|
||||
Matrix3d? referenceTransform = null;
|
||||
if (
|
||||
Application.DocumentManager.CurrentDocument.Editor.CurrentUserCoordinateSystem is Matrix3d matrix
|
||||
&& matrix != Matrix3d.Identity
|
||||
)
|
||||
{
|
||||
referenceTransform = matrix.Inverse();
|
||||
|
||||
/* POC: Do not attach transform to root for now! we are not consuming this in autocad/civil on receive and in revit it will undo all baked transforms :(
|
||||
var transformMatrix = ReferencePointHelper.CreateTransformDataForRootObject(matrix);
|
||||
root[ReferencePointHelper.REFERENCE_POINT_TRANSFORM_KEY] = transformMatrix;
|
||||
*/
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
// 4 - Convert atomic objects
|
||||
foreach (var (entity, applicationId) in atomicObjects)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
@@ -104,9 +128,28 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
root.elements.Add(objectCollection);
|
||||
}
|
||||
|
||||
var result = ConvertAutocadEntity(entity, applicationId, objectCollection, instanceProxies, projectId);
|
||||
results.Add(result);
|
||||
SendConversionResult? result = null;
|
||||
// If this is a atomic definition object, we *do not* want to bake in the reference point transform to the object
|
||||
if (atomicDefinitionObjectIds.Contains(applicationId))
|
||||
{
|
||||
using (_converterSettings.Push(currentSettings => currentSettings with { ReferencePointTransform = null }))
|
||||
{
|
||||
result = ConvertAutocadEntity(entity, applicationId, objectCollection, instanceProxies, projectId);
|
||||
}
|
||||
}
|
||||
else // this is a selected atomic object (not part of definition)
|
||||
{
|
||||
result = ConvertAutocadEntity(
|
||||
entity,
|
||||
applicationId,
|
||||
objectCollection,
|
||||
instanceProxies,
|
||||
projectId,
|
||||
referenceTransform // set this for top level instance proxies to use if needed
|
||||
);
|
||||
}
|
||||
|
||||
results.Add(result);
|
||||
onOperationProgressed.Report(new("Converting", (double)++count / atomicObjects.Count));
|
||||
}
|
||||
|
||||
@@ -115,10 +158,10 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
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
|
||||
// 5 - Unpack the render material proxies
|
||||
root[ProxyKeys.RENDER_MATERIAL] = _materialUnpacker.UnpackMaterials(atomicObjects, usedAcadLayers);
|
||||
|
||||
// 5 - Unpack the color proxies
|
||||
// 6 - Unpack the color proxies
|
||||
root[ProxyKeys.COLOR] = _colorUnpacker.UnpackColors(atomicObjects, usedAcadLayers);
|
||||
|
||||
// add any additional properties (most likely from verticals)
|
||||
@@ -143,15 +186,24 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
string applicationId,
|
||||
Collection collectionHost,
|
||||
IReadOnlyDictionary<string, InstanceProxy> instanceProxies,
|
||||
string projectId
|
||||
string projectId,
|
||||
Matrix3d? transform = null
|
||||
)
|
||||
{
|
||||
string sourceType = entity.GetType().ToString();
|
||||
try
|
||||
{
|
||||
Base converted;
|
||||
if (entity is BlockReference && instanceProxies.TryGetValue(applicationId, out InstanceProxy? instanceProxy))
|
||||
if (entity is BlockReference br && instanceProxies.TryGetValue(applicationId, out InstanceProxy? instanceProxy))
|
||||
{
|
||||
// modify transform by reference point this if it is top level
|
||||
if (instanceProxy.maxDepth == 0 && transform is Matrix3d validTransform)
|
||||
{
|
||||
instanceProxy.transform = TransformHelper.ConvertToInstanceMatrix4x4(
|
||||
br.BlockTransform.PreMultiplyBy(validTransform)
|
||||
);
|
||||
}
|
||||
|
||||
converted = instanceProxy;
|
||||
}
|
||||
else if (_sendConversionCache.TryGetValue(projectId, applicationId, out ObjectReference? value))
|
||||
|
||||
+3
@@ -2,6 +2,7 @@ using Autodesk.AutoCAD.DatabaseServices;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Autocad.HostApp;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Converters.Autocad;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk.Logging;
|
||||
using Speckle.Sdk.Models.Collections;
|
||||
@@ -15,6 +16,7 @@ public sealed class AutocadRootObjectBuilder : AutocadRootObjectBaseBuilder
|
||||
public AutocadRootObjectBuilder(
|
||||
AutocadLayerUnpacker layerUnpacker,
|
||||
IRootToSpeckleConverter converter,
|
||||
IConverterSettingsStore<AutocadConversionSettings> converterSettings,
|
||||
ISendConversionCache sendConversionCache,
|
||||
AutocadInstanceUnpacker instanceObjectManager,
|
||||
AutocadMaterialUnpacker materialUnpacker,
|
||||
@@ -25,6 +27,7 @@ public sealed class AutocadRootObjectBuilder : AutocadRootObjectBaseBuilder
|
||||
)
|
||||
: base(
|
||||
converter,
|
||||
converterSettings,
|
||||
sendConversionCache,
|
||||
instanceObjectManager,
|
||||
materialUnpacker,
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ApplicationPackage
|
||||
SchemaVersion="1.0"
|
||||
AppVersion="1.0"
|
||||
Author="AEC SYSTEMS LTD"
|
||||
Name="Speckle for AutoCAD"
|
||||
Description="Speckle for AutoCAD"
|
||||
Icon="./Contents/Resources/Logo.ico"
|
||||
ProductCode="{958850b9-3782-4e6f-b9b3-1b570e0fcae1}"
|
||||
UpgradeCode="{274de351-80aa-4972-9b45-6a93f8ce968f}"> <!-- For now, we're not updating the AppVersion & ProductCodes with each version -->
|
||||
|
||||
<CompanyDetails
|
||||
Name="Speckle"
|
||||
Url="https://speckle.systems"
|
||||
Email="support@speckle.systems" />
|
||||
<Components>
|
||||
|
||||
<!-- AutoCAD 2022 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Autocad2022"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Autocad2022/Speckle.Connectors.Autocad2022.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="AutoCAD"
|
||||
SeriesMin="R24.1"
|
||||
SeriesMax="R24.1" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2023 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Autocad2023"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Autocad2023/Speckle.Connectors.Autocad2023.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="AutoCAD"
|
||||
SeriesMin="R24.2"
|
||||
SeriesMax="R24.2" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2024 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Autocad2024"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Autocad2024/Speckle.Connectors.Autocad2024.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="AutoCAD"
|
||||
SeriesMin="R24.3"
|
||||
SeriesMax="R24.3" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2025 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Autocad2025"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Autocad2025/Speckle.Connectors.Autocad2025.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="AutoCAD"
|
||||
SeriesMin="R25.0"
|
||||
SeriesMax="R25.0" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2026 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Autocad2026"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Autocad2026/Speckle.Connectors.Autocad2026.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="AutoCAD"
|
||||
SeriesMin="R25.1"
|
||||
SeriesMax="R25.1" />
|
||||
</ComponentEntry>
|
||||
</Components>
|
||||
|
||||
</ApplicationPackage>
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ApplicationPackage
|
||||
SchemaVersion="1.0"
|
||||
AppVersion="1.0"
|
||||
Author="AEC SYSTEMS LTD"
|
||||
Name="Speckle for Civil 3D"
|
||||
Description="Speckle for Civil 3D"
|
||||
Icon="./Contents/Resources/Logo.ico"
|
||||
ProductCode="{cecad7b2-daa9-4a9d-941d-737619ffd999}"
|
||||
UpgradeCode="{ccf4134d-0e24-4e91-8bf4-781ec7313bef}"> <!-- For now, we're not updating the AppVersion & ProductCodes with each version -->
|
||||
|
||||
<CompanyDetails
|
||||
Name="Speckle"
|
||||
Url="https://speckle.systems"
|
||||
Email="support@speckle.systems" />
|
||||
<Components>
|
||||
|
||||
<!-- AutoCAD 2022 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Civil3d2022"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Civil3d2022/Speckle.Connectors.Civil3d2022.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="Civil3D"
|
||||
SeriesMin="R24.1"
|
||||
SeriesMax="R24.1" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2023 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Civil3d2023"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Civil3d2023/Speckle.Connectors.Civil3d2023.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="Civil3D"
|
||||
SeriesMin="R24.2"
|
||||
SeriesMax="R24.2" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2024 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Civil3d2024"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Civil3d2024/Speckle.Connectors.Civil3d2024.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="Civil3D"
|
||||
SeriesMin="R24.3"
|
||||
SeriesMax="R24.3" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2025 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Civil3d2025"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Civil3d2025/Speckle.Connectors.Civil3d2025.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="Civil3D"
|
||||
SeriesMin="R25.0"
|
||||
SeriesMax="R25.0" />
|
||||
</ComponentEntry>
|
||||
|
||||
<!-- AutoCAD 2026 -->
|
||||
<ComponentEntry
|
||||
AppName="Speckle.Connectors.Civil3d2026"
|
||||
ModuleName="./Contents/Windows/Speckle.Connectors.Civil3d2026/Speckle.Connectors.Civil3d2026.dll"
|
||||
LoadOnAutoCADStartup="True">
|
||||
<RuntimeRequirements
|
||||
OS="Win64"
|
||||
Platform="Civil3D"
|
||||
SeriesMin="R25.1"
|
||||
SeriesMax="R25.1" />
|
||||
</ComponentEntry>
|
||||
</Components>
|
||||
|
||||
</ApplicationPackage>
|
||||
+8
@@ -53,4 +53,12 @@
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\s2logo16.png" />
|
||||
<EmbeddedResource Include="$(MSBuildThisFileDirectory)Resources\s2logo32.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Plugin\BundleCivil3D\PackageContents.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="$(MSBuildThisFileDirectory)Plugin\BundleAutoCAD\PackageContents.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -180,8 +180,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -191,13 +191,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -290,7 +290,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -322,7 +322,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -366,11 +366,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -191,13 +191,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -290,7 +290,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -322,7 +322,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -366,11 +366,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,8 +180,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -191,13 +191,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -290,7 +290,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -322,7 +322,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -366,11 +366,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +166,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -175,13 +175,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -239,7 +239,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -272,7 +272,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -316,11 +316,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -166,8 +166,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -175,13 +175,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -239,7 +239,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -272,7 +272,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -316,11 +316,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+1
@@ -32,6 +32,7 @@ public static class Civil3dConnectorModule
|
||||
// additional classes
|
||||
serviceCollection.AddScoped<PropertySetDefinitionHandler>();
|
||||
serviceCollection.AddScoped<PropertySetBaker>();
|
||||
serviceCollection.AddScoped<CutFillHelper>();
|
||||
|
||||
// automatically detects the Class:IClass interface pattern to register all generated interfaces
|
||||
serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetExecutingAssembly());
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
using Autodesk.AutoCAD.DatabaseServices;
|
||||
using Autodesk.Civil.ApplicationServices;
|
||||
using Autodesk.Civil.DatabaseServices;
|
||||
using Speckle.Converters.Civil3dShared;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk.Common;
|
||||
using Surface = Autodesk.Civil.DatabaseServices.Surface;
|
||||
|
||||
namespace Speckle.Connectors.Civil3dShared.HostApp;
|
||||
|
||||
public class CutFillHelper
|
||||
{
|
||||
private readonly IConverterSettingsStore<Civil3dConversionSettings> _settingsStore;
|
||||
|
||||
public CutFillHelper(IConverterSettingsStore<Civil3dConversionSettings> settingsStore)
|
||||
{
|
||||
_settingsStore = settingsStore;
|
||||
}
|
||||
|
||||
public Dictionary<string, double> GetVolumesFromVolumeSurface(string surfaceName)
|
||||
{
|
||||
Database db = _settingsStore.Current.Document.Database;
|
||||
var results = new Dictionary<string, double>();
|
||||
|
||||
using Transaction tr = db.TransactionManager.StartTransaction();
|
||||
|
||||
var volumeSurfaceId = GetVolumeSurfaceByName(db, surfaceName);
|
||||
|
||||
if (volumeSurfaceId == ObjectId.Null)
|
||||
{
|
||||
tr.Commit();
|
||||
return results;
|
||||
}
|
||||
|
||||
var volSurface = tr.GetObject(volumeSurfaceId, OpenMode.ForRead) as TinVolumeSurface;
|
||||
VolumeSurfaceProperties props = volSurface.NotNull().GetVolumeProperties();
|
||||
// var props = volSurface?.Analysis.;
|
||||
|
||||
Units.GetConversionFactor(Units.Millimeters, _settingsStore.Current.SpeckleUnits);
|
||||
results["CutVolume"] = props.AdjustedCutVolume / 27.0;
|
||||
results["FillVolume"] = props.AdjustedFillVolume / 27.0;
|
||||
results["NetVolume"] = props.AdjustedNetVolume / 27.0;
|
||||
|
||||
tr.Commit();
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
public List<string> GetAllVolumeSurfaceNames(Database db)
|
||||
{
|
||||
var volumeSurfaceNames = new List<string>();
|
||||
|
||||
using Transaction tr = db.TransactionManager.StartTransaction();
|
||||
|
||||
var civilDoc = CivilApplication.ActiveDocument;
|
||||
|
||||
foreach (ObjectId surfaceId in civilDoc.GetSurfaceIds())
|
||||
{
|
||||
var volSurface = tr.GetObject(surfaceId, OpenMode.ForRead) as TinVolumeSurface;
|
||||
|
||||
if (volSurface != null)
|
||||
{
|
||||
volumeSurfaceNames.Add(volSurface.Name);
|
||||
}
|
||||
}
|
||||
|
||||
tr.Commit();
|
||||
|
||||
return volumeSurfaceNames;
|
||||
}
|
||||
|
||||
private ObjectId GetVolumeSurfaceByName(Database db, string surfaceName)
|
||||
{
|
||||
using Transaction tr = db.TransactionManager.StartTransaction();
|
||||
|
||||
var civilDoc = CivilApplication.ActiveDocument;
|
||||
|
||||
foreach (ObjectId surfaceId in civilDoc.GetSurfaceIds())
|
||||
{
|
||||
var surface = tr.GetObject(surfaceId, OpenMode.ForRead) as Surface;
|
||||
|
||||
if (surface is TinVolumeSurface && surface.Name == surfaceName)
|
||||
{
|
||||
tr.Commit();
|
||||
return surfaceId;
|
||||
}
|
||||
}
|
||||
|
||||
tr.Commit();
|
||||
|
||||
return ObjectId.Null;
|
||||
}
|
||||
}
|
||||
+8
@@ -2,8 +2,10 @@ using Autodesk.AutoCAD.DatabaseServices;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Autocad.HostApp;
|
||||
using Speckle.Connectors.Autocad.Operations.Send;
|
||||
using Speckle.Connectors.Civil3dShared.HostApp;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Converters.Autocad;
|
||||
using Speckle.Converters.Civil3dShared.ToSpeckle;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk.Logging;
|
||||
@@ -15,11 +17,14 @@ public sealed class Civil3dRootObjectBuilder : AutocadRootObjectBaseBuilder
|
||||
{
|
||||
private readonly AutocadLayerUnpacker _layerUnpacker;
|
||||
private readonly PropertySetDefinitionHandler _propertySetDefinitionHandler;
|
||||
private readonly CutFillHelper _cutFillHelper;
|
||||
|
||||
public Civil3dRootObjectBuilder(
|
||||
AutocadLayerUnpacker layerUnpacker,
|
||||
PropertySetDefinitionHandler propertySetDefinitionHandler,
|
||||
CutFillHelper cutFillHelper,
|
||||
IRootToSpeckleConverter converter,
|
||||
IConverterSettingsStore<AutocadConversionSettings> converterSettings,
|
||||
ISendConversionCache sendConversionCache,
|
||||
AutocadInstanceUnpacker instanceObjectManager,
|
||||
AutocadMaterialUnpacker materialUnpacker,
|
||||
@@ -30,6 +35,7 @@ public sealed class Civil3dRootObjectBuilder : AutocadRootObjectBaseBuilder
|
||||
)
|
||||
: base(
|
||||
converter,
|
||||
converterSettings,
|
||||
sendConversionCache,
|
||||
instanceObjectManager,
|
||||
materialUnpacker,
|
||||
@@ -41,6 +47,7 @@ public sealed class Civil3dRootObjectBuilder : AutocadRootObjectBaseBuilder
|
||||
{
|
||||
_layerUnpacker = layerUnpacker;
|
||||
_propertySetDefinitionHandler = propertySetDefinitionHandler;
|
||||
_cutFillHelper = cutFillHelper;
|
||||
}
|
||||
|
||||
public override (Collection, LayerTableRecord?) CreateObjectCollection(Entity entity, Transaction tr)
|
||||
@@ -52,6 +59,7 @@ public sealed class Civil3dRootObjectBuilder : AutocadRootObjectBaseBuilder
|
||||
|
||||
public override void AddAdditionalProxiesToRoot(Collection rootObject)
|
||||
{
|
||||
rootObject["cutFill"] = _cutFillHelper.GetVolumesFromVolumeSurface("Surface02");
|
||||
rootObject[ProxyKeys.PROPERTYSET_DEFINITIONS] = _propertySetDefinitionHandler.Definitions;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -11,6 +11,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bindings\Civil3dReceiveBinding.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DependencyInjection\Civil3dConnectorModule.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CutFillHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\PropertySetBaker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\Civil3dHostObjectBuilder.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Civil3dRootObjectBuilder.cs" />
|
||||
@@ -18,7 +19,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="$(MSBuildThisFileDirectory)DependencyInjection\" />
|
||||
<Folder Include="$(MSBuildThisFileDirectory)HostApp\" />
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Operations\Receive\" />
|
||||
<Folder Include="$(MSBuildThisFileDirectory)Operations\Send\" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.IO;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connectors.Common.Cancellation;
|
||||
using Speckle.Connectors.CSiShared.HostApp;
|
||||
using Speckle.Connectors.CSiShared.Operations.Send.Settings;
|
||||
@@ -55,6 +56,7 @@ public sealed class CsiSharedSendBinding : ISendBinding
|
||||
public async Task Send(string modelCardId)
|
||||
{
|
||||
using var manager = _sendOperationManagerFactory.Create();
|
||||
var (fileName, fileSizeBytes) = GetFileInfo();
|
||||
await manager.Process(
|
||||
Commands,
|
||||
modelCardId,
|
||||
@@ -69,10 +71,24 @@ public sealed class CsiSharedSendBinding : ISendBinding
|
||||
)
|
||||
);
|
||||
},
|
||||
card => card.SendFilter.NotNull().RefreshObjectIds().Select(DecodeObjectIdentifier).ToList()
|
||||
card => card.SendFilter.NotNull().RefreshObjectIds().Select(DecodeObjectIdentifier).ToList(),
|
||||
fileName,
|
||||
fileSizeBytes
|
||||
);
|
||||
}
|
||||
|
||||
private (string? fileName, long? fileBytes) GetFileInfo()
|
||||
{
|
||||
string fullPath = _csiApplicationService.SapModel.GetModelFilename(true);
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
var fileInfo = new FileInfo(fullPath);
|
||||
return (fileInfo.Name, fileInfo.Length);
|
||||
}
|
||||
|
||||
private ICsiWrapper DecodeObjectIdentifier(string encodedId)
|
||||
{
|
||||
var (type, name) = ObjectIdentifier.Decode(encodedId);
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -305,7 +305,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.etabs21": {
|
||||
@@ -355,11 +355,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,8 +157,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -166,13 +166,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -230,7 +230,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -254,7 +254,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.etabs22": {
|
||||
@@ -304,11 +304,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -305,7 +305,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2020": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -305,7 +305,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2021": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -305,7 +305,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2022": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -305,7 +305,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2023": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -281,7 +281,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -305,7 +305,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2024": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -177,8 +177,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -188,13 +188,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -287,7 +287,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -311,7 +311,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2025": {
|
||||
@@ -357,11 +357,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -186,8 +186,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -197,13 +197,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -288,7 +288,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -312,7 +312,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2026": {
|
||||
@@ -359,11 +359,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
+15
-25
@@ -6,32 +6,22 @@ using Speckle.Sdk;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Bindings;
|
||||
|
||||
public class NavisworksBasicConnectorBinding : IBasicConnectorBinding
|
||||
public class NavisworksBasicConnectorBinding(
|
||||
IBrowserBridge parent,
|
||||
DocumentModelStore store,
|
||||
ISpeckleApplication speckleApplication
|
||||
) : IBasicConnectorBinding
|
||||
{
|
||||
public string Name => "baseBinding";
|
||||
public IBrowserBridge Parent { get; }
|
||||
public BasicConnectorBindingCommands Commands { get; }
|
||||
public IBrowserBridge Parent { get; } = parent;
|
||||
|
||||
private readonly DocumentModelStore _store;
|
||||
private readonly ISpeckleApplication _speckleApplication;
|
||||
public BasicConnectorBindingCommands Commands { get; } = new(parent);
|
||||
|
||||
public NavisworksBasicConnectorBinding(
|
||||
IBrowserBridge parent,
|
||||
DocumentModelStore store,
|
||||
ISpeckleApplication speckleApplication
|
||||
)
|
||||
{
|
||||
Parent = parent;
|
||||
_store = store;
|
||||
_speckleApplication = speckleApplication;
|
||||
Commands = new BasicConnectorBindingCommands(parent);
|
||||
}
|
||||
public string GetSourceApplicationName() => speckleApplication.Slug;
|
||||
|
||||
public string GetSourceApplicationName() => _speckleApplication.Slug;
|
||||
public string GetSourceApplicationVersion() => speckleApplication.HostApplicationVersion;
|
||||
|
||||
public string GetSourceApplicationVersion() => _speckleApplication.HostApplicationVersion;
|
||||
|
||||
public string GetConnectorVersion() => _speckleApplication.SpeckleVersion;
|
||||
public string GetConnectorVersion() => speckleApplication.SpeckleVersion;
|
||||
|
||||
public DocumentInfo? GetDocumentInfo() =>
|
||||
NavisworksApp.ActiveDocument is null || NavisworksApp.ActiveDocument.Models.Count == 0
|
||||
@@ -42,15 +32,15 @@ public class NavisworksBasicConnectorBinding : IBasicConnectorBinding
|
||||
NavisworksApp.ActiveDocument.GetHashCode().ToString()
|
||||
);
|
||||
|
||||
public DocumentModelStore GetDocumentState() => _store;
|
||||
public DocumentModelStore GetDocumentState() => store;
|
||||
|
||||
public void AddModel(ModelCard model) => _store.AddModel(model);
|
||||
public void AddModel(ModelCard model) => store.AddModel(model);
|
||||
|
||||
public void UpdateModel(ModelCard model) => _store.UpdateModel(model);
|
||||
public void UpdateModel(ModelCard model) => store.UpdateModel(model);
|
||||
|
||||
public void RemoveModel(ModelCard model) => _store.RemoveModel(model);
|
||||
public void RemoveModel(ModelCard model) => store.RemoveModel(model);
|
||||
|
||||
public void RemoveModels(List<ModelCard> models) => _store.RemoveModels(models);
|
||||
public void RemoveModels(List<ModelCard> models) => store.RemoveModels(models);
|
||||
|
||||
public Task HighlightModel(string modelCardId) => Task.CompletedTask;
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Connectors.DUI.Bindings;
|
||||
using Speckle.Connectors.DUI.Bridge;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Bindings;
|
||||
|
||||
|
||||
+84
-12
@@ -1,3 +1,5 @@
|
||||
using System.IO;
|
||||
using Autodesk.Navisworks.Api;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connector.Navisworks.Operations.Send.Filters;
|
||||
using Speckle.Connector.Navisworks.Operations.Send.Settings;
|
||||
@@ -12,6 +14,7 @@ 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.Converter.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Settings;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk.Common;
|
||||
@@ -58,12 +61,12 @@ public class NavisworksSendBinding : ISendBinding
|
||||
|
||||
private static void SubscribeToNavisworksEvents() { }
|
||||
|
||||
// Do not change the behavior/scope of this class on send binding unless make sure the behavior is same. Otherwise, we might not be able to update list of saved sets.
|
||||
// WARNING: Changes to filter behavior here must match everywhere filters are used, or saved sets won't update correctly
|
||||
public List<ISendFilter> GetSendFilters() =>
|
||||
[
|
||||
new NavisworksSelectionFilter() { IsDefault = true },
|
||||
new NavisworksSavedSetsFilter(new ElementSelectionService()),
|
||||
new NavisworksSavedViewsFilter(new ElementSelectionService())
|
||||
new NavisworksSavedSetsFilter(new ConnectorElementSelectionService()),
|
||||
new NavisworksSavedViewsFilter(new ConnectorElementSelectionService())
|
||||
];
|
||||
|
||||
public List<ICardSetting> GetSendSettings() =>
|
||||
@@ -82,7 +85,27 @@ public class NavisworksSendBinding : ISendBinding
|
||||
private async Task SendInternal(string modelCardId)
|
||||
{
|
||||
using var manager = _sendOperationManagerFactory.Create();
|
||||
await manager.Process(Commands, modelCardId, InitializeConverterSettings, GetNavisworksModelItems);
|
||||
var (fileName, fileSizeBytes) = GetFileInfo();
|
||||
await manager.Process(
|
||||
Commands,
|
||||
modelCardId,
|
||||
InitializeConverterSettings,
|
||||
GetNavisworksModelItems,
|
||||
fileName,
|
||||
fileSizeBytes
|
||||
);
|
||||
}
|
||||
|
||||
private (string? fileName, long? fileSizeBytes) GetFileInfo()
|
||||
{
|
||||
Document? activeDoc = NavisworksApp.ActiveDocument;
|
||||
if (activeDoc is null || !File.Exists(activeDoc.FileName))
|
||||
{
|
||||
return (null, null);
|
||||
}
|
||||
|
||||
FileInfo fileInfo = new(activeDoc.FileName);
|
||||
return (fileInfo.Name, fileInfo.Length);
|
||||
}
|
||||
|
||||
private void InitializeConverterSettings(IServiceProvider serviceProvider, SenderModelCard modelCard) =>
|
||||
@@ -105,6 +128,7 @@ public class NavisworksSendBinding : ISendBinding
|
||||
)
|
||||
{
|
||||
var selectedPaths = modelCard.SendFilter.NotNull().RefreshObjectIds();
|
||||
|
||||
var convertHiddenElementsSetting =
|
||||
modelCard.Settings!.FirstOrDefault(s => s.Id == "convertHiddenElements")?.Value as bool? ?? false;
|
||||
var message = convertHiddenElementsSetting
|
||||
@@ -115,30 +139,78 @@ public class NavisworksSendBinding : ISendBinding
|
||||
{
|
||||
throw new SpeckleSendFilterException(message);
|
||||
}
|
||||
|
||||
onOperationProgressed.Report(new CardProgress("Getting selection...", null));
|
||||
await Task.CompletedTask;
|
||||
|
||||
var modelItems = new List<NAV.ModelItem>();
|
||||
int estimatedCapacity = selectedPaths.Count * 10;
|
||||
var modelItems = new List<NAV.ModelItem>(estimatedCapacity);
|
||||
double count = 0;
|
||||
|
||||
foreach (var path in selectedPaths)
|
||||
{
|
||||
onOperationProgressed.Report(new CardProgress("Getting selection...", count / selectedPaths.Count));
|
||||
await Task.CompletedTask;
|
||||
|
||||
var modelItem = _selectionService.GetModelItemFromPath(path);
|
||||
modelItems.AddRange(_selectionService.GetGeometryNodes(modelItem).Where(_selectionService.IsVisible));
|
||||
var hasChildren = modelItem.Children.Any();
|
||||
|
||||
if (hasChildren)
|
||||
{
|
||||
int nodesVisited = 0;
|
||||
int hiddenBranchesPruned = 0;
|
||||
const int REPORT_INTERVAL = 1000;
|
||||
|
||||
void TraverseWithProgress(NAV.ModelItem node)
|
||||
{
|
||||
nodesVisited++;
|
||||
|
||||
if (nodesVisited % REPORT_INTERVAL == 0)
|
||||
{
|
||||
onOperationProgressed.Report(
|
||||
new CardProgress(
|
||||
$"Expanding tree: {nodesVisited} visited, {modelItems.Count} with geometry, {hiddenBranchesPruned} hidden",
|
||||
null
|
||||
)
|
||||
);
|
||||
Task.Delay(1).Wait();
|
||||
}
|
||||
|
||||
if (!_selectionService.IsVisible(node))
|
||||
{
|
||||
hiddenBranchesPruned++;
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.HasGeometry)
|
||||
{
|
||||
modelItems.Add(node);
|
||||
}
|
||||
|
||||
foreach (var child in node.Children)
|
||||
{
|
||||
TraverseWithProgress(child);
|
||||
}
|
||||
}
|
||||
|
||||
TraverseWithProgress(modelItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (modelItem.HasGeometry && _selectionService.IsVisible(modelItem))
|
||||
{
|
||||
modelItems.Add(modelItem);
|
||||
}
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return modelItems.Count == 0 ? throw new SpeckleSendFilterException(message) : modelItems;
|
||||
}
|
||||
|
||||
public void CancelSend(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
|
||||
|
||||
/// <summary>
|
||||
/// Cancels all outstanding send operations for the current document.
|
||||
/// This method is called when the active document changes, to ensure
|
||||
/// that any in-progress send operations are properly canceled before
|
||||
/// the new document is loaded.
|
||||
/// </summary>
|
||||
public void CancelAllSendOperations()
|
||||
{
|
||||
foreach (var modelCardId in _store.GetSenders().Select(m => m.ModelCardId))
|
||||
|
||||
+8
-5
@@ -15,7 +15,7 @@ using Speckle.Connectors.DUI.Bridge;
|
||||
using Speckle.Connectors.DUI.Models;
|
||||
using Speckle.Connectors.DUI.Models.Card.SendFilter;
|
||||
using Speckle.Connectors.DUI.WebView;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Constants.Registers;
|
||||
using Speckle.Converter.Navisworks.Settings;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk.Models.GraphTraversal;
|
||||
@@ -53,9 +53,6 @@ public static class NavisworksConnectorServiceRegistration
|
||||
serviceCollection.AddScoped<NavisworksMaterialUnpacker>();
|
||||
serviceCollection.AddScoped<NavisworksColorUnpacker>();
|
||||
|
||||
// Register dual shared geometry stores for instancing pattern
|
||||
serviceCollection.AddScoped<InstanceStoreManager>();
|
||||
|
||||
serviceCollection.AddSingleton<IAppIdleManager, NavisworksIdleManager>();
|
||||
|
||||
// Sending operations
|
||||
@@ -64,6 +61,9 @@ public static class NavisworksConnectorServiceRegistration
|
||||
serviceCollection.AddSingleton(DefaultTraversal.CreateTraversalFunc());
|
||||
serviceCollection.AddSingleton<IOperationProgressManager, OperationProgressManager>();
|
||||
|
||||
// Registers and caches
|
||||
serviceCollection.AddScoped<IInstanceFragmentRegistry, InstanceFragmentRegistry>();
|
||||
|
||||
// Register Intercom/interop
|
||||
serviceCollection.AddSingleton<NavisworksDocumentModelStore>();
|
||||
serviceCollection.AddSingleton<DocumentModelStore>(sp => sp.GetRequiredService<NavisworksDocumentModelStore>());
|
||||
@@ -73,6 +73,9 @@ public static class NavisworksConnectorServiceRegistration
|
||||
serviceCollection.AddScoped<ISendFilter, NavisworksSelectionFilter>();
|
||||
serviceCollection.AddScoped<ISendFilter, NavisworksSavedSetsFilter>();
|
||||
serviceCollection.AddScoped<ISendFilter, NavisworksSavedViewsFilter>();
|
||||
serviceCollection.AddScoped<IElementSelectionService, ElementSelectionService>();
|
||||
serviceCollection.AddScoped<
|
||||
Converter.Navisworks.Services.IElementSelectionService,
|
||||
ConnectorElementSelectionService
|
||||
>();
|
||||
}
|
||||
}
|
||||
|
||||
+9
-28
@@ -1,31 +1,12 @@
|
||||
using Speckle.InterfaceGenerator;
|
||||
using static Speckle.Converter.Navisworks.Helpers.ElementSelectionHelper;
|
||||
namespace Speckle.Connector.Navisworks.Services;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Services;
|
||||
|
||||
[GenerateAutoInterface]
|
||||
public class ElementSelectionService : IElementSelectionService
|
||||
/// <summary>
|
||||
/// Connector-specific element selection service that extends the converter's base implementation.
|
||||
/// Inherits the cached visibility checking and path resolution from the converter layer.
|
||||
/// </summary>
|
||||
public class ConnectorElementSelectionService : Converter.Navisworks.Services.ElementSelectionService
|
||||
{
|
||||
private readonly Dictionary<Guid, bool> _visibleCache = new();
|
||||
|
||||
public string GetModelItemPath(NAV.ModelItem modelItem) => ResolveModelItemToIndexPath(modelItem);
|
||||
|
||||
public NAV.ModelItem GetModelItemFromPath(string path) => ResolveIndexPathToModelItem(path);
|
||||
|
||||
public bool IsVisible(NAV.ModelItem modelItem)
|
||||
{
|
||||
var key = modelItem.InstanceGuid;
|
||||
if (_visibleCache.TryGetValue(key, out var isVisible))
|
||||
{
|
||||
return isVisible;
|
||||
}
|
||||
//same as ElementSelectionHelper.IsElementVisible
|
||||
foreach (var item in modelItem.AncestorsAndSelf)
|
||||
{
|
||||
_visibleCache[item.InstanceGuid] = !item.IsHidden;
|
||||
}
|
||||
return _visibleCache[key];
|
||||
}
|
||||
|
||||
public IEnumerable<NAV.ModelItem> GetGeometryNodes(NAV.ModelItem modelItem) => ResolveGeometryLeafNodes(modelItem);
|
||||
// This inherits all functionality from the converter's ElementSelectionService
|
||||
// including cached IsVisible, GetModelItemPath, GetModelItemFromPath, and GetGeometryNodes
|
||||
// Connector-specific extensions can be added here if needed in the future
|
||||
}
|
||||
|
||||
+13
-9
@@ -1,6 +1,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Helpers;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Settings;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk;
|
||||
@@ -130,16 +130,20 @@ public class NavisworksColorUnpacker(
|
||||
var comSelection = ComBridge.ToInwOpSelection([modelItem]);
|
||||
try
|
||||
{
|
||||
var pathsCollection = comSelection.Paths();
|
||||
var paths = comSelection.Paths();
|
||||
try
|
||||
{
|
||||
foreach (ComApi.InwOaPath path in pathsCollection)
|
||||
foreach (ComApi.InwOaPath path in paths)
|
||||
{
|
||||
var fragmentsCollection = path.Fragments();
|
||||
GC.KeepAlive(path);
|
||||
|
||||
var fragments = path.Fragments();
|
||||
try
|
||||
{
|
||||
foreach (ComApi.InwOaFragment3 fragment in fragmentsCollection.OfType<ComApi.InwOaFragment3>())
|
||||
foreach (ComApi.InwOaFragment3 fragment in fragments)
|
||||
{
|
||||
GC.KeepAlive(fragment);
|
||||
|
||||
fragment.GenerateSimplePrimitives(ComApi.nwEVertexProperty.eNORMAL, primitiveChecker);
|
||||
|
||||
if (primitiveChecker.HasTriangles)
|
||||
@@ -150,9 +154,9 @@ public class NavisworksColorUnpacker(
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fragmentsCollection != null)
|
||||
if (fragments != null)
|
||||
{
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(fragmentsCollection);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(fragments);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,9 +165,9 @@ public class NavisworksColorUnpacker(
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (pathsCollection != null)
|
||||
if (paths != null)
|
||||
{
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(pathsCollection);
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(paths);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-11
@@ -120,17 +120,6 @@ public sealed class NavisworksDocumentEvents
|
||||
}
|
||||
}
|
||||
|
||||
private void UnsubscribeFromDocumentModelEvents(object _)
|
||||
{
|
||||
var activeDocument = NavisworksApp.ActiveDocument;
|
||||
if (activeDocument != null)
|
||||
{
|
||||
UnsubscribeFromModelEvents(activeDocument);
|
||||
}
|
||||
|
||||
_isSubscribed = false;
|
||||
}
|
||||
|
||||
private void UnsubscribeFromModelEvents(NAV.Document document)
|
||||
{
|
||||
document.Models.CollectionChanged -= HandleDocumentModelCountChanged;
|
||||
|
||||
+7
-73
@@ -1,22 +1,18 @@
|
||||
using Autodesk.Navisworks.Api.ComApi;
|
||||
using Autodesk.Navisworks.Api.Interop.ComApi;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Constants;
|
||||
using Speckle.Converter.Navisworks.Helpers;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Settings;
|
||||
using Speckle.Converter.Navisworks.ToSpeckle;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Objects.Other;
|
||||
using Speckle.Sdk;
|
||||
using static Speckle.Converter.Navisworks.Constants.MaterialConstants;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.HostApp;
|
||||
|
||||
public class NavisworksMaterialUnpacker(
|
||||
ILogger<NavisworksMaterialUnpacker> logger,
|
||||
IConverterSettingsStore<NavisworksConversionSettings> converterSettings,
|
||||
IElementSelectionService selectionService,
|
||||
GeometryToSpeckleConverter converter
|
||||
IElementSelectionService selectionService
|
||||
)
|
||||
{
|
||||
private static T SelectByRepresentationMode<T>(
|
||||
@@ -74,66 +70,6 @@ public class NavisworksMaterialUnpacker(
|
||||
var navisworksObjectId = selectionService.GetModelItemPath(navisworksObject);
|
||||
var finalId = mergedIds.TryGetValue(navisworksObjectId, out var mergedId) ? mergedId : navisworksObjectId;
|
||||
|
||||
string hashId = "";
|
||||
try
|
||||
{
|
||||
var item = selectionService.GetModelItemFromPath(finalId);
|
||||
var comSelection = ComApiBridge.ToInwOpSelection([item]);
|
||||
try
|
||||
{
|
||||
var paths = comSelection.Paths();
|
||||
try
|
||||
{
|
||||
if (paths.Count > 0)
|
||||
{
|
||||
var firstPath = paths.OfType<InwOaPath>().FirstOrDefault();
|
||||
if (firstPath != null)
|
||||
{
|
||||
var fragments = firstPath.Fragments();
|
||||
try
|
||||
{
|
||||
if (fragments.Count > 1)
|
||||
{
|
||||
var fragmentId = converter.GenerateFragmentId(paths);
|
||||
hashId = $"{InstanceConstants.GEOMETRY_ID_PREFIX}{fragmentId}";
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (fragments != null)
|
||||
{
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(fragments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (paths != null)
|
||||
{
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(paths);
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (comSelection != null)
|
||||
{
|
||||
System.Runtime.InteropServices.Marshal.ReleaseComObject(comSelection);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!ex.IsFatal())
|
||||
{ // If COM interop fails during hash generation, fall back to using finalId
|
||||
logger.LogWarning(
|
||||
ex,
|
||||
"Failed to generate fragment hash ID for item {ItemId}, using finalId as fallback",
|
||||
finalId
|
||||
);
|
||||
hashId = "";
|
||||
}
|
||||
|
||||
var geometry = navisworksObject.Geometry;
|
||||
var mode = converterSettings.Current.User.VisualRepresentationMode;
|
||||
|
||||
@@ -162,7 +98,7 @@ public class NavisworksMaterialUnpacker(
|
||||
);
|
||||
|
||||
var materialName =
|
||||
$"{MaterialConstants.DEFAULT_MATERIAL_NAME_PREFIX}{Math.Abs(ColorConverter.NavisworksColorToColor(renderColor).ToArgb())}";
|
||||
$"{DEFAULT_MATERIAL_NAME_PREFIX}{Math.Abs(ColorConverter.NavisworksColorToColor(renderColor).ToArgb())}";
|
||||
|
||||
var itemCategory = navisworksObject.PropertyCategories.FindCategoryByDisplayName("Item");
|
||||
if (itemCategory != null)
|
||||
@@ -188,14 +124,14 @@ public class NavisworksMaterialUnpacker(
|
||||
|
||||
if (renderMaterialProxies.TryGetValue(renderMaterialId.ToString(), out RenderMaterialProxy? value))
|
||||
{
|
||||
value.objects.Add(!string.IsNullOrEmpty(hashId) ? hashId : finalId);
|
||||
value.objects.Add(finalId);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderMaterialProxies[renderMaterialId.ToString()] = new RenderMaterialProxy()
|
||||
{
|
||||
value = CreateRenderMaterial(materialName, renderTransparency, renderColor, renderMaterialId),
|
||||
objects = [!string.IsNullOrEmpty(hashId) ? hashId : finalId]
|
||||
objects = [finalId]
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -219,9 +155,7 @@ public class NavisworksMaterialUnpacker(
|
||||
|
||||
var speckleRenderMaterial = new RenderMaterial()
|
||||
{
|
||||
name = !string.IsNullOrEmpty(name)
|
||||
? name
|
||||
: $"{MaterialConstants.DEFAULT_MATERIAL_NAME_PREFIX}{Math.Abs(color.ToArgb())}",
|
||||
name = !string.IsNullOrEmpty(name) ? name : $"{DEFAULT_MATERIAL_NAME_PREFIX}{Math.Abs(color.ToArgb())}",
|
||||
opacity = 1 - transparency,
|
||||
metalness = 0,
|
||||
roughness = 1,
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Connectors.DUI.Exceptions;
|
||||
using Speckle.Connectors.DUI.Exceptions;
|
||||
using Speckle.Connectors.DUI.Models.Card.SendFilter;
|
||||
using Speckle.Connectors.DUI.Utils;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send.Filters;
|
||||
|
||||
|
||||
+5
-7
@@ -1,7 +1,7 @@
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Connectors.DUI.Exceptions;
|
||||
using Speckle.Connectors.DUI.Exceptions;
|
||||
using Speckle.Connectors.DUI.Models.Card.SendFilter;
|
||||
using Speckle.Connectors.DUI.Utils;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send.Filters;
|
||||
|
||||
@@ -48,8 +48,6 @@ public class NavisworksSavedViewsFilter : DiscriminatedObject, ISendFilterSelect
|
||||
return objectIds;
|
||||
}
|
||||
|
||||
var savedViews = NavisworksApp.ActiveDocument.SavedViewpoints;
|
||||
|
||||
foreach (var savedViewItem in SelectedItems.Select(item => ResolveSavedView(item.Id)))
|
||||
{
|
||||
// Get the visible elements in the saved view.
|
||||
@@ -82,12 +80,12 @@ public class NavisworksSavedViewsFilter : DiscriminatedObject, ISendFilterSelect
|
||||
{
|
||||
var objectIds = new List<string>();
|
||||
|
||||
// THIS IS COMMENTED OUT AS IT IS LEGACY DEFENSIVE BEHAVIOUR - DISCUSSION REQUIRED
|
||||
// THIS IS COMMENTED OUT AS IT IS LEGACY DEFENSIVE BEHAVIOR - DISCUSSION REQUIRED
|
||||
// if (!savedView.ContainsVisibilityOverrides)
|
||||
// {
|
||||
// // We check this again as the view settings may have changed in the saved card.
|
||||
// // If the saved view does not contain visibility overrides, this is effectively everything in the model.
|
||||
// // This will need to be the documented behaviour.
|
||||
// // This will need to be the documented behavior.
|
||||
// throw new SpeckleSendFilterException(
|
||||
// "Saved view does not contain visibility overrides. This would effectively publish everything in the model."
|
||||
// );
|
||||
@@ -154,7 +152,7 @@ public class NavisworksSavedViewsFilter : DiscriminatedObject, ISendFilterSelect
|
||||
switch (item)
|
||||
{
|
||||
// case NAV.SavedViewpoint { ContainsVisibilityOverrides: false }:
|
||||
// Legacy defensive behaviour: skip viewpoints without visibility overrides.
|
||||
// Legacy defensive behavior: skip viewpoints without visibility overrides.
|
||||
// Essentially, send everything, or whatever the current view state for hidden elements is.
|
||||
// break;
|
||||
case NAV.SavedViewpointAnimationCut:
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
using Speckle.Converter.Navisworks.Constants;
|
||||
using static Speckle.Converter.Navisworks.Constants.PathConstants;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send.Filters;
|
||||
|
||||
@@ -15,6 +15,6 @@ public static class SavedItemHelpers
|
||||
current = current.Parent;
|
||||
}
|
||||
|
||||
return string.Join(PathConstants.SET_SEPARATOR, pathParts);
|
||||
return string.Join(SET_SEPARATOR, pathParts);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -1,5 +1,5 @@
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Constants;
|
||||
using static Speckle.Converter.Navisworks.Constants.PathConstants;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send;
|
||||
|
||||
@@ -10,29 +10,29 @@ public static class GeometryNodeMerger
|
||||
{
|
||||
/// <summary>
|
||||
/// Groups sibling geometry nodes based on material properties for merging.
|
||||
/// Only merges nodes that share the same parent and have identical material properties.
|
||||
/// This only merges nodes that share the same parent and have identical material properties.
|
||||
/// </summary>
|
||||
/// <param name="nodes">The collection of ModelItems to process</param>
|
||||
/// <returns>Dictionary mapping parent paths (with material signature suffix) to their mergeable child nodes</returns>
|
||||
public static Dictionary<string, List<NAV.ModelItem>> GroupSiblingGeometryNodes(IReadOnlyList<NAV.ModelItem> nodes)
|
||||
{
|
||||
var selectionService = new ElementSelectionService();
|
||||
var selectionService = new ConnectorElementSelectionService();
|
||||
|
||||
// Group nameless geometry nodes by parent path and material signature
|
||||
var mergeableGroups = nodes
|
||||
.Where(node => node.HasGeometry && string.IsNullOrEmpty(node.DisplayName)) // Only anonymous geometry nodes
|
||||
.GroupBy(node =>
|
||||
{
|
||||
// Get parent path
|
||||
// Get the parent path
|
||||
var path = selectionService.GetModelItemPath(node);
|
||||
var lastSeparatorIndex = path.LastIndexOf(PathConstants.SEPARATOR);
|
||||
var lastSeparatorIndex = path.LastIndexOf(SEPARATOR);
|
||||
var parentPath = lastSeparatorIndex == -1 ? path : path[..lastSeparatorIndex];
|
||||
|
||||
// Generate material signature
|
||||
string signature = GenerateSignature(node);
|
||||
|
||||
// Combine parent path with signature
|
||||
return $"{parentPath}{PathConstants.MATERIAL_SEPARATOR}{signature}";
|
||||
return $"{parentPath}{MATERIAL_SEPARATOR}{signature}";
|
||||
})
|
||||
.Where(group => group.Count() > 1) // Only include groups with multiple children
|
||||
.ToDictionary(group => group.Key, group => group.ToList());
|
||||
@@ -95,7 +95,7 @@ public static class GeometryNodeMerger
|
||||
// Build a consistent string representation of all properties
|
||||
var hashInput = new System.Text.StringBuilder();
|
||||
|
||||
// Sort keys to ensure consistent order
|
||||
// Sort keys to ensure a consistent order
|
||||
var sortedKeys = properties.Keys.OrderBy(k => k).ToList();
|
||||
|
||||
foreach (var key in sortedKeys)
|
||||
@@ -139,7 +139,7 @@ public static class GeometryNodeMerger
|
||||
/// </summary>
|
||||
private static string GetMaterialName(NAV.ModelItem node)
|
||||
{
|
||||
// Check Item category for material name
|
||||
// Check the Item category for material name
|
||||
var itemCategory = node.PropertyCategories.FindCategoryByDisplayName("Item");
|
||||
if (itemCategory != null)
|
||||
{
|
||||
|
||||
+5
-5
@@ -1,8 +1,8 @@
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Converter.Navisworks.Constants;
|
||||
using Speckle.Converter.Navisworks.Services;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Sdk.Models;
|
||||
using Speckle.Sdk.Models.Collections;
|
||||
using static Speckle.Converter.Navisworks.Constants.PathConstants;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send;
|
||||
|
||||
@@ -59,8 +59,8 @@ public class NavisworksHierarchyBuilder
|
||||
allPaths.Sort(
|
||||
(a, b) =>
|
||||
{
|
||||
var depthA = a.Count(c => c == PathConstants.SEPARATOR);
|
||||
var depthB = b.Count(c => c == PathConstants.SEPARATOR);
|
||||
var depthA = a.Count(c => c == SEPARATOR);
|
||||
var depthB = b.Count(c => c == SEPARATOR);
|
||||
return depthB.CompareTo(depthA); // <- Sort in ascending order of path length
|
||||
}
|
||||
);
|
||||
@@ -126,7 +126,7 @@ public class NavisworksHierarchyBuilder
|
||||
|
||||
private static string GetParentPath(string path)
|
||||
{
|
||||
var idx = path.LastIndexOf(PathConstants.SEPARATOR);
|
||||
var idx = path.LastIndexOf(SEPARATOR);
|
||||
return idx == -1 ? string.Empty : path[..idx];
|
||||
}
|
||||
|
||||
|
||||
+156
-39
@@ -1,6 +1,5 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connector.Navisworks.HostApp;
|
||||
using Speckle.Connector.Navisworks.Services;
|
||||
using Speckle.Connectors.Common.Builders;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.Common.Conversion;
|
||||
@@ -14,7 +13,10 @@ using Speckle.Sdk;
|
||||
using Speckle.Sdk.Logging;
|
||||
using Speckle.Sdk.Models;
|
||||
using Speckle.Sdk.Models.Collections;
|
||||
using Speckle.Sdk.Models.Instances;
|
||||
using static Speckle.Connector.Navisworks.Operations.Send.GeometryNodeMerger;
|
||||
using static Speckle.Connectors.Common.Operations.ProxyKeys;
|
||||
using static Speckle.Converter.Navisworks.Constants.InstanceConstants;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send;
|
||||
|
||||
@@ -26,14 +28,15 @@ public class NavisworksRootObjectBuilder(
|
||||
ISdkActivityFactory activityFactory,
|
||||
NavisworksMaterialUnpacker materialUnpacker,
|
||||
NavisworksColorUnpacker colorUnpacker,
|
||||
Speckle.Converter.Navisworks.Constants.Registers.IInstanceFragmentRegistry instanceRegistry,
|
||||
IElementSelectionService elementSelectionService,
|
||||
IUiUnitsCache uiUnitsCache,
|
||||
InstanceStoreManager instanceStoreManager
|
||||
IUiUnitsCache uiUnitsCache
|
||||
) : IRootObjectBuilder<NAV.ModelItem>
|
||||
{
|
||||
#pragma warning disable CA1823
|
||||
#pragma warning restore CA1823
|
||||
private bool SkipNodeMerging { get; set; }
|
||||
|
||||
internal NavisworksConversionSettings GetCurrentSettings() => converterSettings.Current;
|
||||
private bool DisableGroupingForInstanceTesting { get; set; }
|
||||
|
||||
public async Task<RootObjectBuilderResult> Build(
|
||||
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
|
||||
@@ -43,14 +46,14 @@ public class NavisworksRootObjectBuilder(
|
||||
)
|
||||
{
|
||||
#if DEBUG
|
||||
SkipNodeMerging = true;
|
||||
SkipNodeMerging = false;
|
||||
DisableGroupingForInstanceTesting = false;
|
||||
#endif
|
||||
using var activity = activityFactory.Start("Build");
|
||||
|
||||
ValidateInputs(navisworksModelItems, projectId, onOperationProgressed);
|
||||
|
||||
var rootCollection = InitializeRootCollection();
|
||||
|
||||
(Dictionary<string, Base?> convertedElements, List<SendConversionResult> conversionResults) =
|
||||
await ConvertModelItemsAsync(navisworksModelItems, projectId, onOperationProgressed, cancellationToken);
|
||||
|
||||
@@ -58,30 +61,17 @@ public class NavisworksRootObjectBuilder(
|
||||
|
||||
var groupedNodes = SkipNodeMerging ? [] : GroupSiblingGeometryNodes(navisworksModelItems);
|
||||
var finalElements = BuildFinalElements(convertedElements, groupedNodes);
|
||||
List<Base> geometryDefinitions = instanceStoreManager.GetGeometryDefinitions();
|
||||
|
||||
await AddProxiesToCollection(rootCollection, navisworksModelItems, groupedNodes);
|
||||
|
||||
var geometryDefinitionsCollection = new Collection
|
||||
{
|
||||
name = "Geometry Definitions",
|
||||
["units"] = converterSettings.Current.Derived.SpeckleUnits,
|
||||
elements = geometryDefinitions
|
||||
};
|
||||
|
||||
var mainElementsCollection = new Collection
|
||||
{
|
||||
name = rootCollection.name,
|
||||
["units"] = converterSettings.Current.Derived.SpeckleUnits,
|
||||
elements = finalElements
|
||||
};
|
||||
|
||||
rootCollection.elements = [mainElementsCollection];
|
||||
if (geometryDefinitions.Count > 0)
|
||||
{
|
||||
rootCollection.elements.Add(geometryDefinitionsCollection);
|
||||
}
|
||||
AddInstanceDefinitionsToCollection(rootCollection, ref finalElements);
|
||||
int finalInstanceProxyCount = CountInstanceProxiesRecursive(finalElements);
|
||||
logger.LogInformation(
|
||||
"Final output contains {count} InstanceProxy objects in displayValues",
|
||||
finalInstanceProxyCount
|
||||
);
|
||||
|
||||
rootCollection.elements = finalElements;
|
||||
return new RootObjectBuilderResult(rootCollection, conversionResults);
|
||||
}
|
||||
|
||||
@@ -127,16 +117,32 @@ public class NavisworksRootObjectBuilder(
|
||||
var convertedBases = new Dictionary<string, Base?>();
|
||||
int processedCount = 0;
|
||||
int totalCount = navisworksModelItems.Count;
|
||||
int instanceProxyCount = 0;
|
||||
|
||||
foreach (var item in navisworksModelItems)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
var converted = ConvertNavisworksItem(item, convertedBases, projectId);
|
||||
results.Add(converted);
|
||||
|
||||
if (
|
||||
converted.Status == Status.SUCCESS
|
||||
&& convertedBases.TryGetValue(elementSelectionService.GetModelItemPath(item), out var convertedBase)
|
||||
&& convertedBase?["displayValue"] is List<Base> displayValues
|
||||
)
|
||||
{
|
||||
instanceProxyCount += displayValues.Count(dv => dv.GetType().Name == "InstanceProxy");
|
||||
}
|
||||
|
||||
processedCount++;
|
||||
onOperationProgressed.Report(new CardProgress("Converting", (double)processedCount / totalCount));
|
||||
}
|
||||
|
||||
logger.LogInformation(
|
||||
"Converted {total} items, found {instanceProxies} InstanceProxy objects",
|
||||
totalCount,
|
||||
instanceProxyCount
|
||||
);
|
||||
return Task.FromResult((convertedBases, results));
|
||||
}
|
||||
|
||||
@@ -155,10 +161,24 @@ public class NavisworksRootObjectBuilder(
|
||||
{
|
||||
var finalElements = new List<Base>();
|
||||
var processedPaths = new HashSet<string>();
|
||||
AddGroupedElements(finalElements, convertedBases, groupedNodes, processedPaths);
|
||||
|
||||
if (!DisableGroupingForInstanceTesting)
|
||||
{
|
||||
AddGroupedElements(finalElements, convertedBases, groupedNodes, processedPaths);
|
||||
logger.LogInformation(
|
||||
"After grouping: {grouped} paths processed, {elements} elements in collection",
|
||||
processedPaths.Count,
|
||||
finalElements.Count
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation("Grouping disabled for instance testing");
|
||||
}
|
||||
|
||||
if (converterSettings.Current.User.PreserveModelHierarchy)
|
||||
{
|
||||
logger.LogInformation("Building hierarchy (PreserveModelHierarchy=true)");
|
||||
var hierarchyBuilder = new NavisworksHierarchyBuilder(
|
||||
convertedBases,
|
||||
rootToSpeckleConverter,
|
||||
@@ -168,7 +188,10 @@ public class NavisworksRootObjectBuilder(
|
||||
return hierarchyBuilder.BuildHierarchy();
|
||||
}
|
||||
|
||||
logger.LogInformation("Adding remaining elements (flat mode)");
|
||||
AddRemainingElements(finalElements, convertedBases, processedPaths);
|
||||
|
||||
logger.LogInformation("Final elements count: {count}", finalElements.Count);
|
||||
return finalElements;
|
||||
}
|
||||
|
||||
@@ -181,7 +204,7 @@ public class NavisworksRootObjectBuilder(
|
||||
{
|
||||
foreach (var group in groupedNodes)
|
||||
{
|
||||
var siblingBases = new List<Base>();
|
||||
var siblingBases = new List<Base>(group.Value.Count);
|
||||
foreach (var itemPath in group.Value.Select(elementSelectionService.GetModelItemPath))
|
||||
{
|
||||
processedPaths.Add(itemPath);
|
||||
@@ -236,10 +259,29 @@ public class NavisworksRootObjectBuilder(
|
||||
string cleanParentPath = ElementSelectionHelper.GetCleanPath(groupKey);
|
||||
(string name, string path) = GetElementNameAndPath(cleanParentPath);
|
||||
|
||||
int estimatedCapacity = siblingBases.Sum(b => (b["displayValue"] as List<Base>)?.Count ?? 0);
|
||||
var displayValues = new List<Base>(estimatedCapacity);
|
||||
displayValues.AddRange(
|
||||
siblingBases
|
||||
.Where(sibling => sibling["displayValue"] is List<Base>)
|
||||
.SelectMany(sibling => (List<Base>)sibling["displayValue"]!)
|
||||
);
|
||||
|
||||
var instanceProxyCount = displayValues.Count(dv => dv.GetType().Name == "InstanceProxy");
|
||||
if (instanceProxyCount > 0)
|
||||
{
|
||||
logger.LogDebug(
|
||||
"Group {groupKey} merging {siblings} siblings with {proxies} InstanceProxy objects",
|
||||
groupKey,
|
||||
siblingBases.Count,
|
||||
instanceProxyCount
|
||||
);
|
||||
}
|
||||
|
||||
return new NavisworksObject
|
||||
{
|
||||
name = name,
|
||||
displayValue = siblingBases.SelectMany(b => b["displayValue"] as List<Base> ?? []).ToList(),
|
||||
displayValue = displayValues,
|
||||
properties = siblingBases.First()["properties"] as Dictionary<string, object?> ?? [],
|
||||
units = converterSettings.Current.Derived.SpeckleUnits,
|
||||
applicationId = groupKey,
|
||||
@@ -280,25 +322,100 @@ public class NavisworksRootObjectBuilder(
|
||||
var renderMaterials = materialUnpacker.UnpackRenderMaterial(navisworksModelItems, groupedNodes);
|
||||
if (renderMaterials.Count > 0)
|
||||
{
|
||||
rootCollection[ProxyKeys.RENDER_MATERIAL] = renderMaterials;
|
||||
rootCollection[RENDER_MATERIAL] = renderMaterials;
|
||||
}
|
||||
|
||||
var colors = colorUnpacker.UnpackColor(navisworksModelItems, groupedNodes);
|
||||
if (colors.Count > 0)
|
||||
{
|
||||
rootCollection[ProxyKeys.COLOR] = colors;
|
||||
}
|
||||
|
||||
var instanceDefinitionProxies = instanceStoreManager.GetInstanceDefinitionProxies();
|
||||
|
||||
if (instanceDefinitionProxies.Count > 0)
|
||||
{
|
||||
rootCollection[ProxyKeys.INSTANCE_DEFINITION] = instanceDefinitionProxies.ToList();
|
||||
rootCollection[COLOR] = colors;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void AddInstanceDefinitionsToCollection(Collection rootCollection, ref List<Base> finalElements)
|
||||
{
|
||||
using var _ = activityFactory.Start("BuildInstanceDefinitions");
|
||||
|
||||
// Get all definition geometries from the registry
|
||||
var allDefinitions = instanceRegistry.GetAllDefinitionGeometries();
|
||||
|
||||
if (allDefinitions.Count == 0)
|
||||
{
|
||||
logger.LogInformation("No instance definitions found - instancing may be disabled");
|
||||
return;
|
||||
}
|
||||
|
||||
logger.LogInformation("Building instance structure for {count} definition groups", allDefinitions.Count);
|
||||
|
||||
if (allDefinitions.Count > 100)
|
||||
{
|
||||
logger.LogWarning(
|
||||
"Large number of definition groups ({count}) detected - this may indicate instance grouping is not working effectively",
|
||||
allDefinitions.Count
|
||||
);
|
||||
}
|
||||
|
||||
var instanceDefinitionProxies = new List<InstanceDefinitionProxy>(allDefinitions.Count);
|
||||
|
||||
int estimatedGeometryCount = allDefinitions.Sum(kvp => kvp.Value.Count);
|
||||
var allDefinitionGeometries = new List<Base>(estimatedGeometryCount);
|
||||
|
||||
foreach (var kvp in allDefinitions)
|
||||
{
|
||||
var groupKey = kvp.Key;
|
||||
var geometries = kvp.Value;
|
||||
var groupKeyHash = groupKey.ToHashString();
|
||||
|
||||
var defProxy = new InstanceDefinitionProxy
|
||||
{
|
||||
name = $"Shared Geometry {groupKeyHash}",
|
||||
objects = geometries.Select(g => g.applicationId ?? "").Where(id => !string.IsNullOrEmpty(id)).ToList(),
|
||||
applicationId = $"{DEFINITION_ID_PREFIX}{groupKeyHash}",
|
||||
maxDepth = 0
|
||||
};
|
||||
|
||||
instanceDefinitionProxies.Add(defProxy);
|
||||
allDefinitionGeometries.AddRange(geometries);
|
||||
}
|
||||
|
||||
rootCollection[INSTANCE_DEFINITION] = instanceDefinitionProxies;
|
||||
var geometryDefinitionsCollection = new Collection
|
||||
{
|
||||
name = "Geometry Definitions",
|
||||
elements = allDefinitionGeometries
|
||||
};
|
||||
|
||||
var objectCollection = new Collection { name = "", elements = finalElements };
|
||||
|
||||
finalElements = [geometryDefinitionsCollection, objectCollection];
|
||||
|
||||
logger.LogInformation(
|
||||
"Added {proxyCount} instance definition proxies and {geomCount} definition geometries",
|
||||
instanceDefinitionProxies.Count,
|
||||
allDefinitionGeometries.Count
|
||||
);
|
||||
}
|
||||
|
||||
private int CountInstanceProxiesRecursive(List<Base> elements)
|
||||
{
|
||||
int count = 0;
|
||||
foreach (var element in elements)
|
||||
{
|
||||
if (element["displayValue"] is List<Base> displayValues)
|
||||
{
|
||||
count += displayValues.Count(dv => dv.GetType().Name == "InstanceProxy");
|
||||
}
|
||||
|
||||
if (element is Collection { elements: not null } collection)
|
||||
{
|
||||
count += CountInstanceProxiesRecursive(collection.elements);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private SendConversionResult ConvertNavisworksItem(
|
||||
NAV.ModelItem navisworksItem,
|
||||
Dictionary<string, Base?> convertedBases,
|
||||
|
||||
+71
-124
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.DUI.Models.Card;
|
||||
using Speckle.Converter.Navisworks.Settings;
|
||||
using Speckle.InterfaceGenerator;
|
||||
@@ -8,158 +7,106 @@ using Speckle.Sdk.Common;
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send.Settings;
|
||||
|
||||
[GenerateAutoInterface]
|
||||
public class ToSpeckleSettingsManagerNavisworks : IToSpeckleSettingsManagerNavisworks
|
||||
public class ToSpeckleSettingsManagerNavisworks(ISendConversionCache sendConversionCache)
|
||||
: IToSpeckleSettingsManagerNavisworks
|
||||
{
|
||||
private readonly ISendConversionCache _sendConversionCache;
|
||||
|
||||
// cache invalidation process run with ModelCardId since the settings are model specific
|
||||
// cache invalidation process run with ModelCardId since the settings are model-specific
|
||||
private readonly Dictionary<string, RepresentationMode> _visualRepresentationCache = [];
|
||||
private readonly Dictionary<string, OriginMode> _originModeCache = [];
|
||||
private readonly Dictionary<string, bool?> _convertHiddenElementsCache = [];
|
||||
private readonly Dictionary<string, bool?> _includeInternalPropertiesCache = [];
|
||||
private readonly Dictionary<string, bool?> _preserveModelHierarchyCache = [];
|
||||
private readonly Dictionary<string, bool?> _revitCategoryMappingCache = [];
|
||||
private readonly Dictionary<string, bool> _convertHiddenElementsCache = [];
|
||||
private readonly Dictionary<string, bool> _includeInternalPropertiesCache = [];
|
||||
private readonly Dictionary<string, bool> _preserveModelHierarchyCache = [];
|
||||
private readonly Dictionary<string, bool> _revitCategoryMappingCache = [];
|
||||
|
||||
public ToSpeckleSettingsManagerNavisworks(ISendConversionCache sendConversionCache)
|
||||
{
|
||||
_sendConversionCache = sendConversionCache;
|
||||
}
|
||||
|
||||
public RepresentationMode GetVisualRepresentationMode(SenderModelCard modelCard)
|
||||
/// <summary>
|
||||
/// Generic helper to get a setting value with caching and cache invalidation.
|
||||
/// </summary>
|
||||
private T GetCachedSetting<T>(
|
||||
SenderModelCard modelCard,
|
||||
string settingId,
|
||||
Dictionary<string, T> cache,
|
||||
Func<object?, T> valueExtractor,
|
||||
T defaultValue
|
||||
)
|
||||
{
|
||||
if (modelCard == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(modelCard));
|
||||
}
|
||||
|
||||
var representationString = modelCard.Settings?.First(s => s.Id == "visualRepresentation").Value as string;
|
||||
var settingValue = modelCard.Settings?.FirstOrDefault(s => s.Id == settingId)?.Value;
|
||||
var returnValue = settingValue != null ? valueExtractor(settingValue) : defaultValue;
|
||||
|
||||
if (
|
||||
representationString is not null
|
||||
&& VisualRepresentationSetting.VisualRepresentationMap.TryGetValue(
|
||||
representationString,
|
||||
out RepresentationMode representation
|
||||
)
|
||||
cache.TryGetValue(modelCard.ModelCardId.NotNull(), out var previousValue)
|
||||
&& !EqualityComparer<T>.Default.Equals(previousValue, returnValue)
|
||||
)
|
||||
{
|
||||
if (_visualRepresentationCache.TryGetValue(modelCard.ModelCardId.NotNull(), out RepresentationMode previousType))
|
||||
{
|
||||
if (previousType != representation)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
|
||||
_visualRepresentationCache[modelCard.ModelCardId.NotNull()] = representation;
|
||||
return representation;
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid visual representation value: {representationString}");
|
||||
}
|
||||
|
||||
public OriginMode GetOriginMode(SenderModelCard modelCard)
|
||||
{
|
||||
if (modelCard == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(modelCard));
|
||||
}
|
||||
|
||||
var originString = modelCard.Settings?.FirstOrDefault(s => s.Id == "originMode")?.Value as string;
|
||||
if (!OriginModeSetting.OriginModeMap.TryGetValue(originString ?? string.Empty, out var origin))
|
||||
{
|
||||
return OriginMode.ModelOrigin; // Default to ModelOrigin if not specified or invalid
|
||||
}
|
||||
|
||||
if (_originModeCache.TryGetValue(modelCard.ModelCardId.NotNull(), out var previousType) && previousType != origin)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
|
||||
_originModeCache[modelCard.ModelCardId.NotNull()] = origin;
|
||||
return origin;
|
||||
}
|
||||
|
||||
public bool GetMappingToRevitCategories(SenderModelCard modelCard)
|
||||
{
|
||||
if (modelCard == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(modelCard));
|
||||
}
|
||||
|
||||
var value = modelCard.Settings?.FirstOrDefault(s => s.Id == "mappingToRevitCategories")?.Value as bool?;
|
||||
|
||||
var returnValue = value != null && value.NotNull();
|
||||
if (_revitCategoryMappingCache.TryGetValue(modelCard.ModelCardId.NotNull(), out var previousValue))
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
|
||||
_revitCategoryMappingCache[modelCard.ModelCardId] = returnValue;
|
||||
cache[modelCard.ModelCardId.NotNull()] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public bool GetConvertHiddenElements(SenderModelCard modelCard)
|
||||
{
|
||||
if (modelCard == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(modelCard));
|
||||
}
|
||||
|
||||
var value = modelCard.Settings?.FirstOrDefault(s => s.Id == "convertHiddenElements")?.Value as bool?;
|
||||
|
||||
var returnValue = value != null && value.NotNull();
|
||||
if (_convertHiddenElementsCache.TryGetValue(modelCard.ModelCardId.NotNull(), out var previousValue))
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
public RepresentationMode GetVisualRepresentationMode(SenderModelCard modelCard) =>
|
||||
GetCachedSetting(
|
||||
modelCard,
|
||||
"visualRepresentation",
|
||||
_visualRepresentationCache,
|
||||
value =>
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
var representationString = value as string;
|
||||
return
|
||||
representationString is not null
|
||||
&& VisualRepresentationSetting.VisualRepresentationMap.TryGetValue(
|
||||
representationString,
|
||||
out RepresentationMode representation
|
||||
)
|
||||
? representation
|
||||
: throw new ArgumentException($"Invalid visual representation value: {representationString}");
|
||||
},
|
||||
RepresentationMode.Active // default value if setting not found
|
||||
);
|
||||
|
||||
_convertHiddenElementsCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public bool GetIncludeInternalProperties([NotNull] SenderModelCard modelCard)
|
||||
{
|
||||
var value = modelCard.Settings?.FirstOrDefault(s => s.Id == "includeInternalProperties")?.Value as bool?;
|
||||
|
||||
var returnValue = value != null && value.NotNull();
|
||||
if (_includeInternalPropertiesCache.TryGetValue(modelCard.ModelCardId.NotNull(), out var previousValue))
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
public OriginMode GetOriginMode(SenderModelCard modelCard) =>
|
||||
GetCachedSetting(
|
||||
modelCard,
|
||||
"originMode",
|
||||
_originModeCache,
|
||||
value =>
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
var originString = value as string;
|
||||
if (OriginModeSetting.OriginModeMap.TryGetValue(originString ?? string.Empty, out var origin))
|
||||
{
|
||||
return origin;
|
||||
}
|
||||
return OriginMode.ModelOrigin;
|
||||
},
|
||||
OriginMode.ModelOrigin
|
||||
);
|
||||
|
||||
_includeInternalPropertiesCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
public bool GetMappingToRevitCategories(SenderModelCard modelCard) =>
|
||||
GetCachedSetting(modelCard, "mappingToRevitCategories", _revitCategoryMappingCache, value => value is true, false);
|
||||
|
||||
public bool GetPreserveModelHierarchy([NotNull] SenderModelCard modelCard)
|
||||
{
|
||||
var value = modelCard.Settings?.FirstOrDefault(s => s.Id == "preserveModelHierarchy")?.Value as bool?;
|
||||
public bool GetConvertHiddenElements(SenderModelCard modelCard) =>
|
||||
GetCachedSetting(modelCard, "convertHiddenElements", _convertHiddenElementsCache, value => value is true, false);
|
||||
|
||||
var returnValue = value != null && value.NotNull();
|
||||
if (_preserveModelHierarchyCache.TryGetValue(modelCard.ModelCardId.NotNull(), out var previousValue))
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
public bool GetIncludeInternalProperties(SenderModelCard modelCard) =>
|
||||
GetCachedSetting(
|
||||
modelCard,
|
||||
"includeInternalProperties",
|
||||
_includeInternalPropertiesCache,
|
||||
value => value is true,
|
||||
false
|
||||
);
|
||||
|
||||
_preserveModelHierarchyCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
public bool GetPreserveModelHierarchy(SenderModelCard modelCard) =>
|
||||
GetCachedSetting(modelCard, "preserveModelHierarchy", _preserveModelHierarchyCache, value => value is true, false);
|
||||
|
||||
private void EvictCacheForModelCard(SenderModelCard modelCard)
|
||||
{
|
||||
var objectIds = modelCard.SendFilter != null ? modelCard.SendFilter.NotNull().SelectedObjectIds : [];
|
||||
_sendConversionCache.EvictObjects(objectIds);
|
||||
sendConversionCache.EvictObjects(objectIds);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ public static class SpeckleV3Tool
|
||||
public const string RIBBON_STRINGS = "NavisworksRibbon.name";
|
||||
public const string PLUGIN_SUFFIX = ".Speckle";
|
||||
|
||||
public static Speckle.Sdk.Application App =>
|
||||
public static Sdk.Application App =>
|
||||
#if NAVIS
|
||||
HostApplications.Navisworks;
|
||||
#else
|
||||
|
||||
@@ -193,8 +193,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -204,13 +204,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -297,13 +297,20 @@
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
"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.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -326,16 +333,23 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2022": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Speckle.Common.MeshTriangulation": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Revit.API": "[2022.0.2.1, )"
|
||||
}
|
||||
},
|
||||
"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, )",
|
||||
@@ -371,11 +385,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
|
||||
@@ -193,8 +193,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -204,13 +204,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -297,13 +297,20 @@
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
"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.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -326,16 +333,23 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2023": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Speckle.Common.MeshTriangulation": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Revit.API": "[2023.0.0, )"
|
||||
}
|
||||
},
|
||||
"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, )",
|
||||
@@ -371,11 +385,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
|
||||
@@ -193,8 +193,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -204,13 +204,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -297,13 +297,20 @@
|
||||
"System.Runtime.CompilerServices.Unsafe": "4.5.3"
|
||||
}
|
||||
},
|
||||
"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.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -326,16 +333,23 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2024": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Speckle.Common.MeshTriangulation": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Revit.API": "[2024.0.0, )"
|
||||
}
|
||||
},
|
||||
"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, )",
|
||||
@@ -371,11 +385,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
|
||||
@@ -173,8 +173,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -182,13 +182,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -240,13 +240,20 @@
|
||||
"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.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -269,16 +276,23 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2025": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Speckle.Common.MeshTriangulation": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Revit.API": "[2025.0.0, )"
|
||||
}
|
||||
},
|
||||
"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, )",
|
||||
@@ -314,11 +328,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
|
||||
@@ -3,17 +3,15 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
xmlns:dui="clr-namespace:Speckle.Connectors.DUI;assembly=Speckle.Connectors.DUI"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<wv2:CoreWebView2CreationProperties x:Key="EvergreenWebView2CreationProperties" UserDataFolder="C:\temp" />
|
||||
</UserControl.Resources>
|
||||
<DockPanel>
|
||||
<wv2:WebView2
|
||||
CreationProperties="{StaticResource EvergreenWebView2CreationProperties}"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
Name="Browser" Grid.Row="0" Source="{x:Static dui:Url.Netlify}" />
|
||||
</DockPanel>
|
||||
<!-- WebView2 is created lazily -->
|
||||
<Border Name="BrowserContainer" Background="White">
|
||||
<TextBlock Name="LoadingText"
|
||||
Text="Loading Speckle..."
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="Gray" />
|
||||
</Border>
|
||||
</UserControl>
|
||||
|
||||
@@ -2,6 +2,8 @@ using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Web.WebView2.Core;
|
||||
using Microsoft.Web.WebView2.Wpf;
|
||||
using Speckle.Connectors.DUI;
|
||||
using Speckle.Connectors.DUI.Bindings;
|
||||
using Speckle.Connectors.DUI.Bridge;
|
||||
using Speckle.Connectors.Revit.Plugin;
|
||||
@@ -12,6 +14,10 @@ public sealed partial class RevitControlWebView : UserControl, IBrowserScriptExe
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IRevitTask _revitTask;
|
||||
#pragma warning disable CA2213
|
||||
private WebView2? _browser;
|
||||
#pragma warning restore CA2213
|
||||
private bool _isInitializing;
|
||||
|
||||
public RevitControlWebView(IServiceProvider serviceProvider, IRevitTask revitTask)
|
||||
{
|
||||
@@ -19,36 +25,73 @@ public sealed partial class RevitControlWebView : UserControl, IBrowserScriptExe
|
||||
_revitTask = revitTask;
|
||||
InitializeComponent();
|
||||
|
||||
Browser.CoreWebView2InitializationCompleted += (sender, args) =>
|
||||
// Delay WebView2 creation until the panel is actually visible
|
||||
// This avoids conflicts with other plugins (like pyRevit) during startup
|
||||
IsVisibleChanged += OnIsVisibleChanged;
|
||||
}
|
||||
|
||||
private void OnIsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.NewValue is true && _browser == null && !_isInitializing)
|
||||
{
|
||||
_isInitializing = true;
|
||||
Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, CreateWebView2);
|
||||
}
|
||||
}
|
||||
|
||||
private void CreateWebView2()
|
||||
{
|
||||
_browser = new WebView2
|
||||
{
|
||||
CreationProperties = new CoreWebView2CreationProperties { UserDataFolder = "C:\\temp" },
|
||||
HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch,
|
||||
VerticalAlignment = System.Windows.VerticalAlignment.Stretch,
|
||||
Source = Url.Netlify
|
||||
};
|
||||
|
||||
_browser.CoreWebView2InitializationCompleted += (sender, args) =>
|
||||
_serviceProvider
|
||||
.GetRequiredService<ITopLevelExceptionHandler>()
|
||||
.CatchUnhandled(() => OnInitialized(sender, args));
|
||||
|
||||
BrowserContainer.Child = _browser;
|
||||
}
|
||||
|
||||
public bool IsBrowserInitialized => Browser.IsInitialized;
|
||||
public bool IsBrowserInitialized => _browser?.IsInitialized ?? false;
|
||||
|
||||
public object BrowserElement => Browser;
|
||||
public object BrowserElement => _browser!;
|
||||
|
||||
public void ExecuteScript(string script)
|
||||
/// <inheritdoc/>
|
||||
public void ExecuteScript(string script, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!Browser.IsInitialized)
|
||||
if (_browser == null || !_browser.IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException("Failed to execute script, Webview2 is not initialized yet.");
|
||||
throw new InvalidOperationException("Failed to execute script, Webview2 is not initialized yet");
|
||||
}
|
||||
_revitTask.Run(() => Browser.ExecuteScriptAsync(script));
|
||||
|
||||
if (!_browser.CheckAccess())
|
||||
{
|
||||
ExecuteScriptDispatched(script, cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
_browser.ExecuteScriptAsync(script);
|
||||
}
|
||||
|
||||
public void SendProgress(string script)
|
||||
/// <inheritdoc/>
|
||||
public void ExecuteScriptDispatched(string script, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!Browser.IsInitialized)
|
||||
if (_browser == null || !_browser.IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException("Failed to execute script, Webview2 is not initialized yet.");
|
||||
throw new InvalidOperationException("Failed to execute script, Webview2 is not initialized yet");
|
||||
}
|
||||
//always invoke even on the main thread because it's better somehow
|
||||
Browser.Dispatcher.Invoke(
|
||||
//fire and forget
|
||||
() => Browser.ExecuteScriptAsync(script),
|
||||
DispatcherPriority.Background
|
||||
|
||||
//Intentionally using the dispatcher even from the main thread
|
||||
//As it allows the UI to pump messages, and stay responsive
|
||||
_browser.Dispatcher.Invoke(
|
||||
() => _browser.ExecuteScriptAsync(script),
|
||||
DispatcherPriority.Background,
|
||||
cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,11 +117,18 @@ public sealed partial class RevitControlWebView : UserControl, IBrowserScriptExe
|
||||
private void SetupBinding(IBinding binding)
|
||||
{
|
||||
binding.Parent.AssociateWithBinding(binding);
|
||||
Browser.CoreWebView2.AddHostObjectToScript(binding.Name, binding.Parent);
|
||||
_browser!.CoreWebView2.AddHostObjectToScript(binding.Name, binding.Parent);
|
||||
}
|
||||
|
||||
public void ShowDevTools() => Browser.CoreWebView2.OpenDevToolsWindow();
|
||||
public void ShowDevTools() => _browser?.CoreWebView2?.OpenDevToolsWindow();
|
||||
|
||||
//https://github.com/MicrosoftEdge/WebView2Feedback/issues/2161
|
||||
public void Dispose() => Browser.Dispatcher.Invoke(() => Browser.Dispose(), DispatcherPriority.Send);
|
||||
public void Dispose()
|
||||
{
|
||||
if (_browser != null)
|
||||
{
|
||||
_browser.Dispatcher.Invoke(() => _browser.Dispose(), DispatcherPriority.Send);
|
||||
_browser = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,8 +166,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -175,13 +175,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -233,13 +233,20 @@
|
||||
"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.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -262,16 +269,23 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2026": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Speckle.Common.MeshTriangulation": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Revit.API": "[2026.0.0, )"
|
||||
}
|
||||
},
|
||||
"LibTessDotNet": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[1.1.15, )",
|
||||
"resolved": "1.1.15",
|
||||
"contentHash": "KuA7N3Nv/lIeawJdQBQJR6oqWD9KETHLbWzBqapwFs+Tby+R5I4crkKujKMm5bXcSuFZ8LNtflFQVadsWCbBjg=="
|
||||
},
|
||||
"Microsoft.Extensions.Logging": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[2.2.0, )",
|
||||
@@ -298,11 +312,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Autodesk.Revit.UI;
|
||||
@@ -14,35 +13,49 @@ public partial class CefSharpPanel : Page, Autodesk.Revit.UI.IDockablePaneProvid
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void ExecuteScript(string script)
|
||||
/// <inheritdoc/>
|
||||
public void ExecuteScript(string script, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
if (!Browser.CheckAccess())
|
||||
{
|
||||
Browser.Dispatcher.Invoke(
|
||||
() =>
|
||||
{
|
||||
//avoid exceptions by checking if IBrowser is there
|
||||
if (!Browser.IsBrowserInitialized || Browser.GetBrowser() is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
ExecuteScriptDispatched(script, cancellationToken);
|
||||
return;
|
||||
}
|
||||
|
||||
Browser.ExecuteScriptAsync(script);
|
||||
},
|
||||
DispatcherPriority.Background
|
||||
);
|
||||
}
|
||||
catch (SEHException)
|
||||
//avoid exceptions by checking if IBrowser is there
|
||||
if (!Browser.IsBrowserInitialized || Browser.GetBrowser() is null)
|
||||
{
|
||||
//do nothing as we can't control external components
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//do nothing, happens when closing Revit while a script is being executed
|
||||
return;
|
||||
}
|
||||
|
||||
Browser.ExecuteScriptAsync(script);
|
||||
}
|
||||
|
||||
public void SendProgress(string script) => ExecuteScript(script);
|
||||
/// <inheritdoc/>
|
||||
public void ExecuteScriptDispatched(string script, CancellationToken cancellationToken)
|
||||
{
|
||||
if (Browser == null || !Browser.IsInitialized)
|
||||
{
|
||||
throw new InvalidOperationException("Failed to execute script, ChromiumWebBrowser is not initialized yet");
|
||||
}
|
||||
|
||||
//Intentionally using the dispatcher even from the main thread
|
||||
//As it allows the UI to pump messages, and stay responsive
|
||||
Browser.Dispatcher.Invoke(
|
||||
() =>
|
||||
{
|
||||
//avoid exceptions by checking if IBrowser is there
|
||||
if (!Browser.IsBrowserInitialized || Browser.GetBrowser() is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Browser.ExecuteScriptAsync(script);
|
||||
},
|
||||
DispatcherPriority.Background,
|
||||
cancellationToken
|
||||
);
|
||||
}
|
||||
|
||||
public bool IsBrowserInitialized => Browser.IsBrowserInitialized;
|
||||
public object BrowserElement => Browser;
|
||||
|
||||
+6
-1
@@ -73,7 +73,12 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
|
||||
}
|
||||
|
||||
//should this use the Hashcode of the document instead of something like CreationGUID?
|
||||
var info = new DocumentInfo(doc.PathName, doc.Title, doc.GetHashCode().ToString());
|
||||
var info = new DocumentInfo(
|
||||
doc.PathName,
|
||||
doc.Title,
|
||||
doc.GetHashCode().ToString(),
|
||||
doc.IsModelInCloud ? doc.GetCloudModelUrn() : null
|
||||
);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ public sealed class RevitReceiveBinding(
|
||||
toHostSettingsManager.GetReferencePointSetting(card),
|
||||
false,
|
||||
true,
|
||||
false,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.IO;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.ExtensibleStorage;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -24,7 +25,7 @@ namespace Speckle.Connectors.Revit.Bindings;
|
||||
|
||||
internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
{
|
||||
private readonly IAppIdleManager _idleManager;
|
||||
private readonly RevitIdleManager _revitIdleManager;
|
||||
private readonly RevitContext _revitContext;
|
||||
private readonly DocumentModelStore _store;
|
||||
private readonly ICancellationManager _cancellationManager;
|
||||
@@ -38,6 +39,9 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
private readonly LinkedModelHandler _linkedModelHandler;
|
||||
private readonly IThreadContext _threadContext;
|
||||
private readonly ISendOperationManagerFactory _sendOperationManagerFactory;
|
||||
private bool _isDocChangedSubscribed;
|
||||
private EventHandler<Autodesk.Revit.DB.Events.DocumentChangedEventArgs>? _documentChangedHandler;
|
||||
private readonly ConnectorConfig _config;
|
||||
|
||||
/// <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:
|
||||
@@ -48,7 +52,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
private ConcurrentHashSet<ElementId> ChangedObjectIds { get; set; } = new();
|
||||
|
||||
public RevitSendBinding(
|
||||
IAppIdleManager idleManager,
|
||||
RevitIdleManager revitIdleManager,
|
||||
RevitContext revitContext,
|
||||
DocumentModelStore store,
|
||||
ICancellationManager cancellationManager,
|
||||
@@ -62,11 +66,12 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
LinkedModelHandler linkedModelHandler,
|
||||
IThreadContext threadContext,
|
||||
IRevitTask revitTask,
|
||||
ISendOperationManagerFactory sendOperationManagerFactory
|
||||
ISendOperationManagerFactory sendOperationManagerFactory,
|
||||
IConfigStore configStore
|
||||
)
|
||||
: base("sendBinding", bridge)
|
||||
{
|
||||
_idleManager = idleManager;
|
||||
_revitIdleManager = revitIdleManager;
|
||||
_revitContext = revitContext;
|
||||
_store = store;
|
||||
_cancellationManager = cancellationManager;
|
||||
@@ -79,6 +84,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
_linkedModelHandler = linkedModelHandler;
|
||||
_threadContext = threadContext;
|
||||
_sendOperationManagerFactory = sendOperationManagerFactory;
|
||||
_config = configStore.GetConnectorConfig();
|
||||
|
||||
Commands = new SendBindingUICommands(bridge);
|
||||
// TODO expiry events
|
||||
@@ -86,12 +92,58 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
|
||||
revitTask.Run(() =>
|
||||
{
|
||||
revitContext.UIApplication.NotNull().Application.DocumentChanged += (_, e) =>
|
||||
_topLevelExceptionHandler.CatchUnhandled(() => DocChangeHandler(e));
|
||||
// revitContext.UIApplication.NotNull().Application.DocumentChanged += (_, e) =>
|
||||
// _topLevelExceptionHandler.CatchUnhandled(() => DocChangeHandler(e));
|
||||
_documentChangedHandler = (_, e) => _topLevelExceptionHandler.CatchUnhandled(() => DocChangeHandler(e));
|
||||
_store.ModelCardsChanged += (_, e) => OnModelCardsChanged(e);
|
||||
_store.DocumentChanged += (_, _) => topLevelExceptionHandler.FireAndForget(async () => await OnDocumentChanged());
|
||||
});
|
||||
}
|
||||
|
||||
private void OnModelCardsChanged(ModelCardsChangedEventArgs e)
|
||||
{
|
||||
if (
|
||||
!_config.DocumentChangeListeningDisabled
|
||||
&& e.ModelCards.Count > 0
|
||||
&& e.ModelCards.Any(m => m.TypeDiscriminator == nameof(SenderModelCard))
|
||||
)
|
||||
{
|
||||
SubscribeDocChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
UnsubscribeDocChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void SubscribeDocChanged()
|
||||
{
|
||||
if (_documentChangedHandler == null || _isDocChangedSubscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_threadContext.RunOnMain(() =>
|
||||
{
|
||||
_revitContext.UIApplication.NotNull().Application.DocumentChanged += _documentChangedHandler;
|
||||
});
|
||||
_isDocChangedSubscribed = true;
|
||||
}
|
||||
|
||||
private void UnsubscribeDocChanged()
|
||||
{
|
||||
if (_documentChangedHandler == null || !_isDocChangedSubscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_threadContext.RunOnMain(() =>
|
||||
{
|
||||
_revitContext.UIApplication.NotNull().Application.DocumentChanged -= _documentChangedHandler;
|
||||
});
|
||||
_isDocChangedSubscribed = false;
|
||||
}
|
||||
|
||||
public List<ISendFilter> GetSendFilters() =>
|
||||
[
|
||||
new RevitSelectionFilter { IsDefault = true },
|
||||
@@ -105,7 +157,8 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
new SendReferencePointSetting(),
|
||||
new SendParameterNullOrEmptyStringsSetting(),
|
||||
new LinkedModelsSetting(),
|
||||
new SendRebarsAsVolumetricSetting()
|
||||
new SendRebarsAsVolumetricSetting(),
|
||||
new SendAreasAsMeshSetting()
|
||||
];
|
||||
|
||||
public void CancelSend(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
|
||||
@@ -120,7 +173,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
throw new SpeckleException("No document is active for sending.");
|
||||
}
|
||||
using var manager = _sendOperationManagerFactory.Create();
|
||||
|
||||
var (fileName, fileBytes) = GetFileInfo(document);
|
||||
await manager.Process<DocumentToConvert>(
|
||||
Commands,
|
||||
modelCardId,
|
||||
@@ -133,14 +186,31 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
_toSpeckleSettingsManager.GetReferencePointSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetSendParameterNullOrEmptyStringsSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetLinkedModelsSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetSendRebarsAsVolumetric(document, card)
|
||||
_toSpeckleSettingsManager.GetSendRebarsAsVolumetric(document, card),
|
||||
_toSpeckleSettingsManager.GetSendAreasAsMesh(document, card)
|
||||
)
|
||||
);
|
||||
},
|
||||
async x => await RefreshElementsIdsOnSender(document, x.NotNull())
|
||||
async x => await RefreshElementsIdsOnSender(document, x.NotNull()),
|
||||
fileName: fileName,
|
||||
fileSizeBytes: fileBytes
|
||||
);
|
||||
}
|
||||
|
||||
private static (string? fileName, long? fileBytes) GetFileInfo(Document document)
|
||||
{
|
||||
string fullPath = document.PathName;
|
||||
if (File.Exists(document.PathName))
|
||||
{
|
||||
var fileInfo = new FileInfo(document.PathName);
|
||||
return (fileInfo.Name, fileInfo.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (fullPath.Split('/').LastOrDefault(), null);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<List<DocumentToConvert>> RefreshElementsIdsOnSender(Document document, SenderModelCard modelCard)
|
||||
{
|
||||
if (modelCard.SendFilter.NotNull() is IRevitSendFilter viewFilter)
|
||||
@@ -276,7 +346,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
|
||||
if (addedElementIds.Count > 0)
|
||||
{
|
||||
_idleManager.SubscribeToIdle(nameof(PostSetObjectIds), PostSetObjectIds);
|
||||
_revitIdleManager.SubscribeToIdle(nameof(PostSetObjectIds), PostSetObjectIds);
|
||||
}
|
||||
|
||||
if (HaveUnitsChanged(doc))
|
||||
@@ -296,8 +366,8 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
_sendConversionCache.EvictObjects(unpackedObjectIds);
|
||||
}
|
||||
|
||||
_idleManager.SubscribeToIdle(nameof(CheckFilterExpiration), CheckFilterExpiration);
|
||||
_idleManager.SubscribeToIdle(nameof(RunExpirationChecks), RunExpirationChecks);
|
||||
_revitIdleManager.SubscribeToIdle(nameof(CheckFilterExpiration), CheckFilterExpiration);
|
||||
_revitIdleManager.SubscribeToIdle(nameof(RunExpirationChecks), RunExpirationChecks);
|
||||
}
|
||||
|
||||
// Keeps track of doc and current units
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Speckle.Connectors.DUI.Bindings;
|
||||
using Speckle.Connectors.DUI.Bridge;
|
||||
using Speckle.Connectors.DUI.Settings;
|
||||
using Speckle.Connectors.Revit.Plugin;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Sdk.Common;
|
||||
@@ -17,27 +18,32 @@ internal sealed class SelectionBinding : RevitBaseBinding, ISelectionBinding, ID
|
||||
public SelectionBinding(
|
||||
RevitContext revitContext,
|
||||
IBrowserBridge parent,
|
||||
IAppIdleManager idleManager,
|
||||
RevitIdleManager idleManager,
|
||||
#if REVIT2022
|
||||
ITopLevelExceptionHandler topLevelExceptionHandler,
|
||||
IRevitTask revitTask
|
||||
#endif
|
||||
IRevitTask revitTask,
|
||||
IConfigStore configStore
|
||||
)
|
||||
: base("selectionBinding", parent)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
|
||||
if (!configStore.GetConnectorConfig().SelectionChangeListeningDisabled)
|
||||
{
|
||||
#if REVIT2022
|
||||
// NOTE: getting the selection data should be a fast function all, even for '000s of elements - and having a timer hitting it every 1s is ok.
|
||||
_selectionTimer = new System.Timers.Timer(1000);
|
||||
_selectionTimer.Elapsed += (_, _) => topLevelExceptionHandler.CatchUnhandled(OnSelectionChanged);
|
||||
_selectionTimer.Start();
|
||||
// NOTE: getting the selection data should be a fast function all, even for '000s of elements - and having a timer hitting it every 1s is ok.
|
||||
_selectionTimer = new System.Timers.Timer(1000);
|
||||
_selectionTimer.Elapsed += (_, _) => topLevelExceptionHandler.CatchUnhandled(OnSelectionChanged);
|
||||
_selectionTimer.Start();
|
||||
#else
|
||||
|
||||
revitTask.Run(
|
||||
() =>
|
||||
_revitContext.UIApplication.NotNull().SelectionChanged += (_, _) =>
|
||||
idleManager.SubscribeToIdle(nameof(OnSelectionChanged), OnSelectionChanged)
|
||||
);
|
||||
revitTask.Run(
|
||||
() =>
|
||||
_revitContext.UIApplication.NotNull().SelectionChanged += (_, _) =>
|
||||
idleManager.SubscribeToIdle(nameof(OnSelectionChanged), OnSelectionChanged)
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
private void OnSelectionChanged()
|
||||
|
||||
+3
-1
@@ -48,11 +48,12 @@ public static class ServiceRegistration
|
||||
serviceCollection.AddSingleton<IBinding, SelectionBinding>();
|
||||
serviceCollection.AddSingleton<IBinding, RevitSendBinding>();
|
||||
serviceCollection.AddSingleton<IBinding, RevitReceiveBinding>();
|
||||
serviceCollection.AddSingleton<RevitIdleManager>();
|
||||
|
||||
serviceCollection.AddSingleton<IBinding>(sp => sp.GetRequiredService<IBasicConnectorBinding>());
|
||||
serviceCollection.AddSingleton<IBasicConnectorBinding, BasicConnectorBindingRevit>();
|
||||
|
||||
serviceCollection.AddSingleton<IAppIdleManager, RevitIdleManager>();
|
||||
// serviceCollection.AddSingleton<IAppIdleManager, RevitIdleManager>();
|
||||
|
||||
// send operation and dependencies
|
||||
serviceCollection.AddScoped<SendOperation<DocumentToConvert>>();
|
||||
@@ -71,6 +72,7 @@ public static class ServiceRegistration
|
||||
serviceCollection.AddScoped<ITransactionManager, TransactionManager>();
|
||||
serviceCollection.AddScoped<RevitGroupBaker>();
|
||||
serviceCollection.AddScoped<RevitMaterialBaker>();
|
||||
serviceCollection.AddScoped<RevitViewBaker>();
|
||||
serviceCollection.AddScoped<RevitViewManager>();
|
||||
serviceCollection.AddSingleton<RevitUtils>();
|
||||
serviceCollection.AddSingleton<IFailuresPreprocessor, HideWarningsFailuresPreprocessor>();
|
||||
|
||||
@@ -9,8 +9,19 @@ namespace Speckle.Connectors.Revit.HostApp;
|
||||
/// </summary>
|
||||
public class ElementUnpacker
|
||||
{
|
||||
private static readonly List<BuiltInCategory> s_skippedCategories =
|
||||
[
|
||||
BuiltInCategory.OST_SketchLines,
|
||||
BuiltInCategory.OST_MassForm,
|
||||
BuiltInCategory.OST_StairsSketchBoundaryLines,
|
||||
BuiltInCategory.OST_StairsSketchLandingCenterLines,
|
||||
BuiltInCategory.OST_StairsSketchRiserLines,
|
||||
BuiltInCategory.OST_RebarSketchLines,
|
||||
BuiltInCategory.OST_StairsSketchRunLines
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks a random set of revit objects into atomic objects. It currently unpacks groups recurisvely, nested families into atomic family instances.
|
||||
/// Unpacks a random set of revit objects into atomic objects. It currently unpacks groups recursively, nested families into atomic family instances.
|
||||
/// This method will also "pack" curtain walls if necessary (ie, if mullions or panels are selected without their parent curtain wall, they are sent independently; if the parent curtain wall is selected, they will be removed out as the curtain wall will include all its children).
|
||||
/// </summary>
|
||||
/// <param name="selectionElements"></param>
|
||||
@@ -32,7 +43,7 @@ public class ElementUnpacker
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks input element ids into their subelements, eg groups and nested family instances
|
||||
/// Unpacks input element ids into their sub-elements, eg groups and nested family instances
|
||||
/// </summary>
|
||||
/// <param name="objectIds"></param>
|
||||
/// <returns></returns>
|
||||
@@ -57,11 +68,21 @@ public class ElementUnpacker
|
||||
// UNPACK: Groups
|
||||
if (element is Group g)
|
||||
{
|
||||
// When a group is from a linked model, GetMemberIds may behave differently
|
||||
// We add null checks to handle cases where elements can't be properly resolved
|
||||
// POC: this might screw up generating hosting rel generation here, because nested families in groups get flattened out by GetMemberIds().
|
||||
var groupElements = g.GetMemberIds().Select(doc.GetElement).Where(el => el != null);
|
||||
unpackedElements.AddRange(UnpackElements(groupElements, doc));
|
||||
var memberIds = g.GetMemberIds();
|
||||
|
||||
if (memberIds.Count <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// using a collector more efficient
|
||||
using var collector = new FilteredElementCollector(doc, memberIds);
|
||||
collector.WhereElementIsNotElementType(); // exclude "Type" elements (FamilySymbols)
|
||||
var filter = new ElementMulticategoryFilter(s_skippedCategories, inverted: true); // exclude "Sketch/Form" categories
|
||||
collector.WherePasses(filter);
|
||||
|
||||
// recursively unpack the valid results
|
||||
unpackedElements.AddRange(UnpackElements(collector, doc));
|
||||
}
|
||||
else if (element is BaseArray baseArray)
|
||||
{
|
||||
|
||||
@@ -17,13 +17,16 @@ namespace Speckle.Connectors.Revit.HostApp;
|
||||
internal sealed class RevitDocumentStore : DocumentModelStore
|
||||
{
|
||||
private readonly ILogger<RevitDocumentStore> _logger;
|
||||
private readonly IAppIdleManager _idleManager;
|
||||
|
||||
//private readonly IAppIdleManager _idleManager;
|
||||
private readonly RevitIdleManager _idleManager;
|
||||
private readonly RevitContext _revitContext;
|
||||
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
|
||||
private readonly ISqLiteJsonCacheManager _jsonCacheManager;
|
||||
|
||||
public RevitDocumentStore(
|
||||
IAppIdleManager idleManager,
|
||||
//IAppIdleManager idleManager,
|
||||
RevitIdleManager idleManager,
|
||||
RevitContext revitContext,
|
||||
IJsonSerializer jsonSerializer,
|
||||
ITopLevelExceptionHandler topLevelExceptionHandler,
|
||||
@@ -34,6 +37,7 @@ internal sealed class RevitDocumentStore : DocumentModelStore
|
||||
: base(logger, jsonSerializer)
|
||||
{
|
||||
_jsonCacheManager = jsonCacheManagerFactory.CreateForUser("ConnectorsFileData");
|
||||
//_idleManager = idleManager;
|
||||
_idleManager = idleManager;
|
||||
_revitContext = revitContext;
|
||||
_topLevelExceptionHandler = topLevelExceptionHandler;
|
||||
|
||||
@@ -5,7 +5,6 @@ using Speckle.Converters.Common;
|
||||
using Speckle.Converters.RevitShared.Settings;
|
||||
using Speckle.Objects.Other;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Common;
|
||||
using Speckle.Sdk.Models.Collections;
|
||||
using Speckle.Sdk.Models.Extensions;
|
||||
using Speckle.Sdk.Models.GraphTraversal;
|
||||
@@ -32,6 +31,24 @@ public class RevitMaterialBaker
|
||||
_converterSettings = converterSettings;
|
||||
}
|
||||
|
||||
private ElementId? FindExistingMaterialByName(string? materialName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(materialName))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
string sanitizedName = _revitUtils.RemoveInvalidChars(materialName!);
|
||||
|
||||
using var collector = new FilteredElementCollector(_converterSettings.Current.Document);
|
||||
var existingMaterial = collector
|
||||
.OfClass(typeof(Material))
|
||||
.Cast<Material>()
|
||||
.FirstOrDefault(m => string.Equals(m.Name, sanitizedName, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return existingMaterial?.Id;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks the every atomic object has render material or not, if not it tries to find it from its layer tree and mutates
|
||||
/// its render material proxy objects list with the traversal current. It will also map displayable objects' display values to their
|
||||
@@ -106,11 +123,9 @@ public class RevitMaterialBaker
|
||||
/// Will bake render materials in the revit document.
|
||||
/// </summary>
|
||||
/// <param name="speckleRenderMaterialProxies"></param>
|
||||
/// <param name="baseLayerName"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<string, ElementId> BakeMaterials(
|
||||
IReadOnlyCollection<RenderMaterialProxy> speckleRenderMaterialProxies,
|
||||
string baseLayerName
|
||||
IReadOnlyCollection<RenderMaterialProxy> speckleRenderMaterialProxies
|
||||
)
|
||||
{
|
||||
Dictionary<string, ElementId> objectIdAndMaterialIndexMap = new();
|
||||
@@ -120,27 +135,42 @@ public class RevitMaterialBaker
|
||||
|
||||
try
|
||||
{
|
||||
// all values assumed to be on the 0 - 1 scale need to pass through this validation and logging (if assumption wrong)
|
||||
double roughness = ClampToUnitRange(speckleRenderMaterial.roughness, "roughness", speckleRenderMaterial.name);
|
||||
double opacity = ClampToUnitRange(speckleRenderMaterial.opacity, "opacity", speckleRenderMaterial.name);
|
||||
double metalness = ClampToUnitRange(speckleRenderMaterial.metalness, "metalness", speckleRenderMaterial.name);
|
||||
// first try to match existing material by name
|
||||
ElementId? existingMaterialId = FindExistingMaterialByName(speckleRenderMaterial.name);
|
||||
|
||||
var diffuse = System.Drawing.Color.FromArgb(speckleRenderMaterial.diffuse);
|
||||
double transparency = 1 - opacity;
|
||||
double smoothness = 1 - roughness;
|
||||
string materialId = speckleRenderMaterial.applicationId ?? speckleRenderMaterial.id.NotNull();
|
||||
string matName = _revitUtils.RemoveInvalidChars($"{speckleRenderMaterial.name}-({materialId})-{baseLayerName}");
|
||||
ElementId materialIdToUse;
|
||||
|
||||
var newMaterialId = Material.Create(_converterSettings.Current.Document, matName);
|
||||
var revitMaterial = (Material)_converterSettings.Current.Document.GetElement(newMaterialId);
|
||||
revitMaterial.Color = new Color(diffuse.R, diffuse.G, diffuse.B);
|
||||
revitMaterial.Transparency = (int)(transparency * 100);
|
||||
revitMaterial.Shininess = (int)(metalness * 128);
|
||||
revitMaterial.Smoothness = (int)(smoothness * 128);
|
||||
if (existingMaterialId != null)
|
||||
{
|
||||
// Use existing material
|
||||
materialIdToUse = existingMaterialId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create new material
|
||||
// all values assumed to be on the 0 - 1 scale need to pass through this validation and logging (if assumption wrong)
|
||||
double roughness = ClampToUnitRange(speckleRenderMaterial.roughness, "roughness", speckleRenderMaterial.name);
|
||||
double opacity = ClampToUnitRange(speckleRenderMaterial.opacity, "opacity", speckleRenderMaterial.name);
|
||||
double metalness = ClampToUnitRange(speckleRenderMaterial.metalness, "metalness", speckleRenderMaterial.name);
|
||||
|
||||
var diffuse = System.Drawing.Color.FromArgb(speckleRenderMaterial.diffuse);
|
||||
double transparency = 1 - opacity;
|
||||
double smoothness = 1 - roughness;
|
||||
string matName = _revitUtils.RemoveInvalidChars($"{speckleRenderMaterial.name}");
|
||||
|
||||
var newMaterialId = Material.Create(_converterSettings.Current.Document, matName);
|
||||
var revitMaterial = (Material)_converterSettings.Current.Document.GetElement(newMaterialId);
|
||||
revitMaterial.Color = new Color(diffuse.R, diffuse.G, diffuse.B);
|
||||
revitMaterial.Transparency = (int)(transparency * 100);
|
||||
revitMaterial.Shininess = (int)(metalness * 128);
|
||||
revitMaterial.Smoothness = (int)(smoothness * 100);
|
||||
|
||||
materialIdToUse = revitMaterial.Id;
|
||||
}
|
||||
|
||||
foreach (var objectId in proxy.objects)
|
||||
{
|
||||
objectIdAndMaterialIndexMap[objectId] = revitMaterial.Id;
|
||||
objectIdAndMaterialIndexMap[objectId] = materialIdToUse;
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!ex.IsFatal())
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.Common.Objects;
|
||||
using Speckle.Converters.RevitShared.Settings;
|
||||
using Speckle.Objects.Other;
|
||||
using Speckle.Sdk;
|
||||
|
||||
namespace Speckle.Connectors.Revit.HostApp;
|
||||
|
||||
/// <summary>
|
||||
/// Utility class that creates View3D elements from Camera objects during receive.
|
||||
/// </summary>
|
||||
public class RevitViewBaker
|
||||
{
|
||||
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings;
|
||||
private readonly ILogger<RevitViewBaker> _logger;
|
||||
private readonly ITypedConverter<Speckle.Objects.Geometry.Point, XYZ> _pointConverter;
|
||||
private readonly ITypedConverter<Speckle.Objects.Geometry.Vector, XYZ> _vectorConverter;
|
||||
|
||||
public RevitViewBaker(
|
||||
IConverterSettingsStore<RevitConversionSettings> converterSettings,
|
||||
ILogger<RevitViewBaker> logger,
|
||||
ITypedConverter<Speckle.Objects.Geometry.Point, XYZ> pointConverter,
|
||||
ITypedConverter<Speckle.Objects.Geometry.Vector, XYZ> vectorConverter
|
||||
)
|
||||
{
|
||||
_converterSettings = converterSettings;
|
||||
_logger = logger;
|
||||
_pointConverter = pointConverter;
|
||||
_vectorConverter = vectorConverter;
|
||||
}
|
||||
|
||||
// Characters that are not allowed in Revit view names
|
||||
private readonly char[] _invalidViewNameChars = ['{', '}', '[', ']', '|', ';', '<', '>', '?', '`', '~', '\\', ':'];
|
||||
|
||||
/// <summary>
|
||||
/// Bakes Camera objects as View3D elements in Revit.
|
||||
/// </summary>
|
||||
public void BakeViews(IReadOnlyCollection<Camera> cameras)
|
||||
{
|
||||
if (cameras.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var camera in cameras)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(camera.name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var restoredName = RestoreViewName(camera.name);
|
||||
if (string.IsNullOrWhiteSpace(restoredName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var existingView = FindViewByName(restoredName);
|
||||
|
||||
try
|
||||
{
|
||||
if (existingView != null)
|
||||
{
|
||||
UpdatePerspectiveView(existingView, camera);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatePerspectiveView(camera, restoredName);
|
||||
}
|
||||
}
|
||||
catch (Exception ex) when (!ex.IsFatal())
|
||||
{
|
||||
_logger.LogError(ex, "Failed to create view '{ViewName}'", restoredName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sanitizes the view name by removing invalid characters.
|
||||
/// </summary>
|
||||
private string RestoreViewName(string name)
|
||||
{
|
||||
var restored = name;
|
||||
|
||||
foreach (var c in _invalidViewNameChars)
|
||||
{
|
||||
restored = restored.Replace(c.ToString(), string.Empty);
|
||||
}
|
||||
|
||||
return restored.Trim();
|
||||
}
|
||||
|
||||
private View3D? FindViewByName(string name)
|
||||
{
|
||||
using var collector = new FilteredElementCollector(_converterSettings.Current.Document);
|
||||
return collector
|
||||
.OfClass(typeof(View3D))
|
||||
.Cast<View3D>()
|
||||
.FirstOrDefault(v => !v.IsTemplate && string.Equals(v.Name, name, StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
private void UpdatePerspectiveView(View3D view3D, Camera camera)
|
||||
{
|
||||
var eyePosition = _pointConverter.Convert(camera.position);
|
||||
var forwardDirection = _vectorConverter.Convert(camera.forward).Normalize();
|
||||
var upDirection = _vectorConverter.Convert(camera.up).Normalize();
|
||||
|
||||
var orientation = new ViewOrientation3D(eyePosition, upDirection, forwardDirection);
|
||||
view3D.SetOrientation(orientation);
|
||||
}
|
||||
|
||||
private void CreatePerspectiveView(Camera camera, string viewName)
|
||||
{
|
||||
var document = _converterSettings.Current.Document;
|
||||
|
||||
// Get ViewFamilyType for 3D views
|
||||
using var collector = new FilteredElementCollector(document);
|
||||
var viewFamilyType = collector
|
||||
.OfClass(typeof(ViewFamilyType))
|
||||
.Cast<ViewFamilyType>()
|
||||
.FirstOrDefault(vft => vft.ViewFamily == ViewFamily.ThreeDimensional);
|
||||
|
||||
if (viewFamilyType == null)
|
||||
{
|
||||
_logger.LogError("Could not find a 3D ViewFamilyType to create view '{ViewName}'", viewName);
|
||||
return;
|
||||
}
|
||||
|
||||
// Create perspective view (View3D is a document element, not disposable) - low happiness level
|
||||
#pragma warning disable CA2000
|
||||
var view3D = View3D.CreatePerspective(document, viewFamilyType.Id);
|
||||
#pragma warning restore CA2000
|
||||
|
||||
// Convert camera position, forward, and up vectors
|
||||
var eyePosition = _pointConverter.Convert(camera.position);
|
||||
var forwardDirection = _vectorConverter.Convert(camera.forward).Normalize();
|
||||
var upDirection = _vectorConverter.Convert(camera.up).Normalize();
|
||||
|
||||
var orientation = new ViewOrientation3D(eyePosition, upDirection, forwardDirection);
|
||||
view3D.SetOrientation(orientation);
|
||||
|
||||
view3D.Name = viewName;
|
||||
|
||||
// Set display style to Shaded (looks better than default wireframe)
|
||||
view3D.DisplayStyle = DisplayStyle.Shading;
|
||||
|
||||
// Disable far clipping so depth is infinite
|
||||
var farClipParam = view3D.get_Parameter(BuiltInParameter.VIEWER_BOUND_ACTIVE_FAR);
|
||||
if (farClipParam != null && !farClipParam.IsReadOnly)
|
||||
{
|
||||
farClipParam.Set(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+112
-3
@@ -21,6 +21,7 @@ using Speckle.Sdk.Common;
|
||||
using Speckle.Sdk.Common.Exceptions;
|
||||
using Speckle.Sdk.Logging;
|
||||
using Speckle.Sdk.Models;
|
||||
using Speckle.Sdk.Models.Instances;
|
||||
using Transform = Speckle.Objects.Other.Transform;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Receive;
|
||||
@@ -33,17 +34,21 @@ public sealed class RevitHostObjectBuilder(
|
||||
ILocalToGlobalUnpacker localToGlobalUnpacker,
|
||||
RevitGroupBaker groupManager,
|
||||
RevitMaterialBaker materialBaker,
|
||||
RevitViewBaker viewBaker,
|
||||
RootObjectUnpacker rootObjectUnpacker,
|
||||
ILogger<RevitHostObjectBuilder> logger,
|
||||
IThreadContext threadContext,
|
||||
RevitToHostCacheSingleton revitToHostCacheSingleton,
|
||||
ITypedConverter<
|
||||
(Base atomicObject, IReadOnlyCollection<Matrix4x4> matrix),
|
||||
(Base atomicObject, IReadOnlyCollection<Matrix4x4> matrix, DataObject? parentDataObject),
|
||||
DirectShape
|
||||
> localToGlobalDirectShapeConverter,
|
||||
IReceiveConversionHandler conversionHandler
|
||||
) : IHostObjectBuilder, IDisposable
|
||||
{
|
||||
// Maps atomic object applicationId -> parent DataObject
|
||||
private readonly Dictionary<string, DataObject> _atomicObjectToParentDataObject = new();
|
||||
|
||||
public Task<HostObjectBuilderResult> Build(
|
||||
Base rootObject,
|
||||
string projectName,
|
||||
@@ -102,6 +107,9 @@ public sealed class RevitHostObjectBuilder(
|
||||
unpackedRoot.ObjectsToConvert.ToList()
|
||||
);
|
||||
|
||||
// Register DataObjects with InstanceProxy displayValues
|
||||
RegisterDataObjectsWithInstanceProxies(unpackedRoot);
|
||||
|
||||
// NOTE: below is 💩... https://github.com/specklesystems/speckle-sharp-connectors/pull/813 broke sketchup to revit workflow
|
||||
// ids were modified to fix receiving instances [CNX-1707](https://linear.app/speckle/issue/CNX-1707/revit-curves-and-meshes-in-blocks-come-as-duplicated)
|
||||
// but we then broke sketchup to revit because applicationIds in proxies didn't match modified application ids which cam from #813 hack
|
||||
@@ -176,12 +184,15 @@ public sealed class RevitHostObjectBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
// Update DataObject lookup IDs
|
||||
UpdateAtomicObjectLookupWithModifiedIds(originalToModifiedIds);
|
||||
|
||||
// 2 - Bake materials (now with the updated IDs)
|
||||
if (unpackedRoot.RenderMaterialProxies != null)
|
||||
{
|
||||
transactionManager.StartTransaction(true, "Baking materials");
|
||||
materialBaker.MapLayersRenderMaterials(unpackedRoot);
|
||||
var map = materialBaker.BakeMaterials(unpackedRoot.RenderMaterialProxies, baseGroupName);
|
||||
var map = materialBaker.BakeMaterials(unpackedRoot.RenderMaterialProxies);
|
||||
foreach (var kvp in map)
|
||||
{
|
||||
revitToHostCacheSingleton.MaterialsByObjectId.Add(kvp.Key, kvp.Value);
|
||||
@@ -189,6 +200,14 @@ public sealed class RevitHostObjectBuilder(
|
||||
transactionManager.CommitTransaction();
|
||||
}
|
||||
|
||||
// 2.1 - Bake views
|
||||
if (unpackedRoot.Cameras is not null)
|
||||
{
|
||||
transactionManager.StartTransaction(true, "Baking views");
|
||||
viewBaker.BakeViews(unpackedRoot.Cameras);
|
||||
transactionManager.CommitTransaction();
|
||||
}
|
||||
|
||||
// 3 - Bake objects
|
||||
(
|
||||
HostObjectBuilderResult builderResult,
|
||||
@@ -234,6 +253,87 @@ public sealed class RevitHostObjectBuilder(
|
||||
return conversionResults.builderResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers DataObjects that have InstanceProxy displayValues and builds the lookup.
|
||||
/// </summary>
|
||||
private void RegisterDataObjectsWithInstanceProxies(RootObjectUnpackerResult unpackedRoot)
|
||||
{
|
||||
var definitionToDataObject = new Dictionary<string, DataObject>();
|
||||
|
||||
foreach (var tc in unpackedRoot.ObjectsToConvert)
|
||||
{
|
||||
if (tc.Current is DataObject dataObject)
|
||||
{
|
||||
var instanceProxies = dataObject.displayValue.OfType<InstanceProxy>().ToList();
|
||||
if (instanceProxies.Count > 0)
|
||||
{
|
||||
foreach (var ip in instanceProxies)
|
||||
{
|
||||
definitionToDataObject[ip.definitionId] = dataObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Build lookup: definition object applicationId -> parent DataObject
|
||||
_atomicObjectToParentDataObject.Clear();
|
||||
if (unpackedRoot.DefinitionProxies is not null)
|
||||
{
|
||||
foreach (var defProxy in unpackedRoot.DefinitionProxies)
|
||||
{
|
||||
if (
|
||||
defProxy.applicationId is not null
|
||||
&& definitionToDataObject.TryGetValue(defProxy.applicationId, out var parentDataObject)
|
||||
)
|
||||
{
|
||||
foreach (var objectId in defProxy.objects)
|
||||
{
|
||||
_atomicObjectToParentDataObject[objectId] = parentDataObject;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogError(
|
||||
"Could not find parent DataObject for DefinitionProxy {ApplicationId}",
|
||||
defProxy.applicationId
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the atomic object lookup with modified IDs
|
||||
/// </summary>
|
||||
private void UpdateAtomicObjectLookupWithModifiedIds(Dictionary<string, List<string>> originalToModifiedIds)
|
||||
{
|
||||
// Build updated entries first to avoid modifying collection during iteration
|
||||
var entriesToAdd = new List<KeyValuePair<string, DataObject>>();
|
||||
var keysToRemove = new List<string>();
|
||||
|
||||
foreach (var kvp in _atomicObjectToParentDataObject)
|
||||
{
|
||||
if (originalToModifiedIds.TryGetValue(kvp.Key, out var modifiedIds))
|
||||
{
|
||||
keysToRemove.Add(kvp.Key);
|
||||
foreach (var modifiedId in modifiedIds)
|
||||
{
|
||||
entriesToAdd.Add(new(modifiedId, kvp.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var key in keysToRemove)
|
||||
{
|
||||
_atomicObjectToParentDataObject.Remove(key);
|
||||
}
|
||||
|
||||
foreach (var entry in entriesToAdd)
|
||||
{
|
||||
_atomicObjectToParentDataObject[entry.Key] = entry.Value;
|
||||
}
|
||||
}
|
||||
|
||||
private Autodesk.Revit.DB.Transform? CalculateNewTransform(
|
||||
Autodesk.Revit.DB.Transform? receiveTransform,
|
||||
Autodesk.Revit.DB.Transform? rootTransform
|
||||
@@ -278,9 +378,17 @@ public sealed class RevitHostObjectBuilder(
|
||||
onOperationProgressed.Report(new("Converting", (double)++count / localToGlobalMaps.Count));
|
||||
if (result is DirectShapeDefinitionWrapper)
|
||||
{
|
||||
// Look up parent DataObject for this atomic object (handles InstanceProxy displayValue)
|
||||
var atomicId = localToGlobalMap.AtomicObject.applicationId;
|
||||
DataObject? parentDataObject = null;
|
||||
if (atomicId is not null)
|
||||
{
|
||||
_atomicObjectToParentDataObject.TryGetValue(atomicId, out parentDataObject);
|
||||
}
|
||||
|
||||
// direct shape creation happens here
|
||||
DirectShape directShapes = localToGlobalDirectShapeConverter.Convert(
|
||||
(localToGlobalMap.AtomicObject, localToGlobalMap.Matrix)
|
||||
(localToGlobalMap.AtomicObject, localToGlobalMap.Matrix, parentDataObject)
|
||||
);
|
||||
|
||||
bakedObjectIds.Add(directShapes.UniqueId);
|
||||
@@ -351,6 +459,7 @@ public sealed class RevitHostObjectBuilder(
|
||||
DirectShapeLibrary.GetDirectShapeLibrary(converterSettings.Current.Document).Reset(); // Note: this needs to be cleared, as it is being used in the converter
|
||||
|
||||
revitToHostCacheSingleton.MaterialsByObjectId.Clear(); // Massive hack!
|
||||
_atomicObjectToParentDataObject.Clear();
|
||||
groupManager.PurgeGroups(baseGroupName);
|
||||
materialBaker.PurgeMaterials(baseGroupName);
|
||||
}
|
||||
|
||||
+5
-1
@@ -81,7 +81,11 @@ public class RevitCategoriesFilter : DiscriminatedObject, ISendFilter, IRevitSen
|
||||
|
||||
foreach (Category category in _doc.Settings.Categories)
|
||||
{
|
||||
if (SupportedCategoriesUtils.IsSupportedCategory(category))
|
||||
if (SupportedCategoriesUtils.IsSupportedCategory(category)
|
||||
#if REVIT2023_OR_GREATER
|
||||
&& category.BuiltInCategory != BuiltInCategory.INVALID
|
||||
#endif
|
||||
)
|
||||
{
|
||||
categories.Add(new CategoryData(category.Name, category.Id.ToString()));
|
||||
}
|
||||
|
||||
+13
-3
@@ -1,3 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Autodesk.Revit.DB;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Common.Builders;
|
||||
@@ -7,6 +8,7 @@ using Speckle.Connectors.Common.Extensions;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Connectors.Common.Threading;
|
||||
using Speckle.Connectors.DUI.Exceptions;
|
||||
using Speckle.Connectors.DUI.Settings;
|
||||
using Speckle.Connectors.Revit.HostApp;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
@@ -29,7 +31,8 @@ public class RevitRootObjectBuilder(
|
||||
SendCollectionManager sendCollectionManager,
|
||||
ILogger<RevitRootObjectBuilder> logger,
|
||||
RevitToSpeckleCacheSingleton revitToSpeckleCacheSingleton,
|
||||
LinkedModelHandler linkedModelHandler
|
||||
LinkedModelHandler linkedModelHandler,
|
||||
IConfigStore configStore
|
||||
) : IRootObjectBuilder<DocumentToConvert>
|
||||
{
|
||||
public Task<RootObjectBuilderResult> Build(
|
||||
@@ -42,6 +45,7 @@ public class RevitRootObjectBuilder(
|
||||
() => Task.FromResult(BuildSync(documentElementContexts, projectId, onOperationProgressed, ct))
|
||||
);
|
||||
|
||||
[SuppressMessage("Maintainability", "CA1506:Avoid excessive class coupling")]
|
||||
private RootObjectBuilderResult BuildSync(
|
||||
IReadOnlyList<DocumentToConvert> documentElementContexts,
|
||||
string projectId,
|
||||
@@ -134,6 +138,8 @@ public class RevitRootObjectBuilder(
|
||||
var cacheHitCount = 0;
|
||||
var skippedObjectCount = 0;
|
||||
|
||||
var config = configStore.GetConnectorConfig();
|
||||
|
||||
foreach (var atomicObjectByDocumentAndTransform in atomicObjectsByDocumentAndTransform)
|
||||
{
|
||||
string? modelDisplayName = null;
|
||||
@@ -185,7 +191,11 @@ public class RevitRootObjectBuilder(
|
||||
// TODO: Potential here to transform cached objects and NOT reconvert,
|
||||
// TODO: we wont do !hasTransform here, and re-set application id before this
|
||||
|
||||
if (!hasTransform && sendConversionCache.TryGetValue(projectId, applicationId, out ObjectReference? value))
|
||||
if (
|
||||
!hasTransform
|
||||
&& !config.DocumentChangeListeningDisabled //This is experimental
|
||||
&& sendConversionCache.TryGetValue(projectId, applicationId, out ObjectReference? value)
|
||||
)
|
||||
{
|
||||
converted = value;
|
||||
cacheHitCount++;
|
||||
@@ -258,7 +268,7 @@ public class RevitRootObjectBuilder(
|
||||
new Collection()
|
||||
{
|
||||
elements = revitToSpeckleCacheSingleton.GetBaseObjectsForObjects(idsAndSubElementIds),
|
||||
name = "revitInstancedObjects"
|
||||
name = "definitionGeometry"
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
using Speckle.Connectors.DUI.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
public class SendAreasAsMeshSetting(bool value = SendAreasAsMeshSetting.DEFAULT_VALUE) : ICardSetting
|
||||
{
|
||||
public const string SETTING_ID = "sendAreasAsMesh";
|
||||
public const bool DEFAULT_VALUE = false;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Send Areas As Mesh";
|
||||
public string? Type { get; set; } = "boolean";
|
||||
public object? Value { get; set; } = value;
|
||||
public List<string>? Enum { get; set; }
|
||||
}
|
||||
+11
@@ -22,6 +22,7 @@ public class ToSpeckleSettingsManager(
|
||||
private readonly Dictionary<string, bool?> _sendNullParamsCache = [];
|
||||
private readonly Dictionary<string, bool?> _sendLinkedModelsCache = [];
|
||||
private readonly Dictionary<string, bool?> _sendRebarsAsVolumetricCache = [];
|
||||
private readonly Dictionary<string, bool?> _sendAreasAsMeshCache = [];
|
||||
|
||||
public DetailLevelType GetDetailLevelSetting(Document document, SenderModelCard modelCard)
|
||||
{
|
||||
@@ -131,6 +132,16 @@ public class ToSpeckleSettingsManager(
|
||||
"Send rebars as volumetric"
|
||||
);
|
||||
|
||||
public bool GetSendAreasAsMesh(Document document, SenderModelCard modelCard) =>
|
||||
GetBooleanSettingWithCache(
|
||||
document,
|
||||
SendAreasAsMeshSetting.SETTING_ID,
|
||||
SendAreasAsMeshSetting.DEFAULT_VALUE,
|
||||
modelCard,
|
||||
_sendAreasAsMeshCache,
|
||||
"Send areas as mesh"
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to handle boolean settings with caching and logging
|
||||
/// </summary>
|
||||
|
||||
@@ -6,38 +6,106 @@ using Speckle.Sdk.Common;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Plugin;
|
||||
|
||||
public sealed class RevitIdleManager : AppIdleManager
|
||||
/// <remarks>
|
||||
/// Please do NOT try and refactor this class.
|
||||
/// Whether it's to try and generalize with the <see cref="IdleCallManager"/> class
|
||||
/// or to unnecessary try and make this class thread safe.
|
||||
/// This class is a simple singleton, targeted to a Revit's host app requirements
|
||||
/// where everything happens on the main thread, and we can avoid overly complex threading/thread-safety.
|
||||
///
|
||||
/// Previous refactors with good intention have lead to poor debugging experiences, over-engineered threading,
|
||||
/// and low confidence in the reliability.
|
||||
/// </remarks>
|
||||
/// should be registered as singleton
|
||||
public class RevitIdleManager(RevitContext revitContext, ITopLevelExceptionHandler topLevelExceptionHandler)
|
||||
{
|
||||
private readonly UIApplication _uiApplication;
|
||||
private readonly IIdleCallManager _idleCallManager;
|
||||
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
|
||||
private readonly UIApplication _uiApplication = revitContext.UIApplication.NotNull();
|
||||
|
||||
private event EventHandler<IdlingEventArgs>? OnIdle;
|
||||
private readonly Dictionary<string, Func<Task>> _calls = new();
|
||||
private bool _hasSubscribed;
|
||||
|
||||
public RevitIdleManager(
|
||||
RevitContext revitContext,
|
||||
IIdleCallManager idleCallManager,
|
||||
ITopLevelExceptionHandler topLevelExceptionHandler,
|
||||
IRevitTask revitTask
|
||||
)
|
||||
: base(idleCallManager)
|
||||
private bool _isExecutingIdle;
|
||||
|
||||
/// <summary>
|
||||
/// Defers the invocation of an <paramref name="action"/> until next Revit idle tick (deduped by name).
|
||||
/// The <paramref name="action"/> will be called only once.
|
||||
/// </summary>
|
||||
/// <param name="name">A key that prevents enqueuing duplicate events</param>
|
||||
/// <param name="action">The action to be invoked</param>
|
||||
/// <example>
|
||||
/// Some events in host app are triggered many times, we might get 10x per object
|
||||
/// Making this more like a deferred action, so we don't update the UI many times
|
||||
/// </example>
|
||||
/// <remarks>
|
||||
/// This function must be called on the main thread
|
||||
/// </remarks>
|
||||
public void SubscribeToIdle(string name, Action action)
|
||||
{
|
||||
_topLevelExceptionHandler = topLevelExceptionHandler;
|
||||
_uiApplication = revitContext.UIApplication.NotNull();
|
||||
_idleCallManager = idleCallManager;
|
||||
revitTask.Run(
|
||||
() => _uiApplication.Idling += (s, e) => OnIdle?.Invoke(s, e) // will be called on the main thread always and fixing the Revit exceptions on subscribing/unsubscribing Idle events
|
||||
SubscribeToIdle(
|
||||
name,
|
||||
() =>
|
||||
{
|
||||
action.Invoke();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
protected override void AddEvent()
|
||||
/// <inheritdoc cref="SubscribeToIdle(string, Action)"/>
|
||||
public void SubscribeToIdle(string name, Func<Task> action)
|
||||
{
|
||||
_topLevelExceptionHandler.CatchUnhandled(() =>
|
||||
if (_isExecutingIdle)
|
||||
{
|
||||
OnIdle += RevitAppOnIdle;
|
||||
});
|
||||
//Either, you're trying to SubscribeToIdle from not the main thread (don't do this)
|
||||
//OR, an OnIdle event handler is calling SubscribeToIdle (re-entry), check the call stack
|
||||
throw new InvalidOperationException("SubscribeToIdle called while already executing idle events");
|
||||
}
|
||||
|
||||
_calls[name] = action;
|
||||
|
||||
if (_hasSubscribed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_hasSubscribed = true;
|
||||
|
||||
_uiApplication.Idling += RevitAppOnIdle;
|
||||
}
|
||||
|
||||
private void RevitAppOnIdle(object? sender, IdlingEventArgs e) =>
|
||||
_idleCallManager.AppOnIdle(() => OnIdle -= RevitAppOnIdle);
|
||||
private void RevitAppOnIdle(object? sender, IdlingEventArgs e)
|
||||
{
|
||||
topLevelExceptionHandler.CatchUnhandled(() =>
|
||||
{
|
||||
if (_isExecutingIdle)
|
||||
{
|
||||
//Either, you're trying to SubscribeToIdle from not the main thread (don't do this)
|
||||
//OR, an OnIdle event handler is calling SubscribeToIdle (re-entry), check the call stack... avoid this
|
||||
throw new InvalidOperationException("SubscribeToIdle called while already executing idle events");
|
||||
}
|
||||
|
||||
_isExecutingIdle = true;
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (KeyValuePair<string, Func<Task>> kvp in _calls)
|
||||
{
|
||||
topLevelExceptionHandler.FireAndForget(kvp.Value.Invoke);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_calls.Clear();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_uiApplication.Idling -= RevitAppOnIdle;
|
||||
|
||||
_isExecutingIdle = false;
|
||||
// setting last will delay entering re-subscription
|
||||
_hasSubscribed = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -24,6 +24,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\LevelUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\LinkedModelHandler.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\RevitMaterialBaker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\RevitViewBaker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\ViewUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\SupportedCategoriesUtils.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\RevitViewManager.cs" />
|
||||
@@ -48,15 +49,16 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\RevitRootObjectBuilder.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\LinkedModelsSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\SendParameterNullOrEmptyStringsSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\SendAreasAsMeshSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\SendRebarsAsVolumetricSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ToSpeckleSettingsManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\SendReferencePointSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\DetailLevelSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\IRevitPlugin.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitCommand.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitIdleManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitTask.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitExternalApplication.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitIdleManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitThreadContext.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitCefPlugin.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\SpeckleRevitTaskException.cs" />
|
||||
|
||||
@@ -204,8 +204,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -215,13 +215,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -347,7 +347,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.logging": {
|
||||
@@ -357,7 +357,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.rhino7": {
|
||||
@@ -402,11 +402,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,8 +204,8 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "D04pCdleqLeDxthANCb8+X1xfEYr4+Q3GTuHtqOrMQeGHDAVPc5G3M0D6VYEUYbLYav0NBZ6tNuWO2Y/fqfWSw==",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "qCKCPT4HeSCJ7S+wnnjF+N+9Sd6lj5+Ra9DfxDHHrFli9rtXdnQRU5UOObyfcbiWQidVXhc2n0kbo3LPCEcvNw==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -215,13 +215,13 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.11.1"
|
||||
"Speckle.Sdk.Dependencies": "3.13.1"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "u8lJ+ECslmVPsn4yOCg3hAzj3zh6r+gp2oQh8RDGn22NihIPOsMhBFvoBruL1QVhXdJcS4rI2J6VEAbdvL9FRg=="
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "McLXS+Hd/bW+AdJifxGUIQi+ftofGY5r6i/X00HmlnbOvHJKZAR6fzJ12E8otMhMd78He8tcyjBD3R2jOR9ctA=="
|
||||
},
|
||||
"SQLitePCLRaw.bundle_e_sqlite3": {
|
||||
"type": "Transitive",
|
||||
@@ -347,7 +347,7 @@
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.logging": {
|
||||
@@ -357,7 +357,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.11.1, )"
|
||||
"Speckle.Objects": "[3.13.1, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.rhino8": {
|
||||
@@ -401,11 +401,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.11.1, )",
|
||||
"resolved": "3.11.1",
|
||||
"contentHash": "JUCY3bA6Pa+fa6wZV9uQ9mhLRihvICkF58nIr28Yi94j0th7wSg4l8WeThl3ubKVnHDQE5mdVffVlY1e5ZUkuQ==",
|
||||
"requested": "[3.13.1, )",
|
||||
"resolved": "3.13.1",
|
||||
"contentHash": "VRG8SApTbAYA0YmgWTw0Eb+/AHeE0yOxDuKBTvFj3VipuSnwF29fV479BehnZdg3d8OBh4aP/YEx3vPAafybVw==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.11.1"
|
||||
"Speckle.Sdk": "3.13.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Grasshopper.Kernel;
|
||||
using Grasshopper.Kernel.Types;
|
||||
using Speckle.Connectors.GrasshopperShared.HostApp;
|
||||
using Speckle.Connectors.GrasshopperShared.Parameters;
|
||||
using Speckle.Connectors.GrasshopperShared.Properties;
|
||||
using Speckle.Sdk.Models.Collections;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components.Collections;
|
||||
|
||||
/// <summary>
|
||||
/// Creates collections by matching name tree structure to elements tree structure.
|
||||
/// Each branch in the names tree corresponds to the same-path branch in the elements tree.
|
||||
/// </summary>
|
||||
[Guid("7E8F9A1B-2C3D-4E5F-6A7B-8C9D0E1F2A3B")]
|
||||
public class CollectionsByName : GH_Component
|
||||
{
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
protected override Bitmap Icon => Resources.speckle_collections_create; // TODO: Update to specific icon if available
|
||||
public override GH_Exposure Exposure => GH_Exposure.primary;
|
||||
|
||||
public CollectionsByName()
|
||||
: base(
|
||||
"Collections by Name",
|
||||
"CbN",
|
||||
"Creates collections by matching name tree structure to objects tree structure. Each branch in the names tree corresponds to the same-path branch in the objects tree.",
|
||||
ComponentCategories.PRIMARY_RIBBON,
|
||||
ComponentCategories.COLLECTIONS
|
||||
) { }
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
pManager.AddTextParameter(
|
||||
"Names",
|
||||
"N",
|
||||
"Collection names (tree structure must match Objects tree structure)",
|
||||
GH_ParamAccess.tree
|
||||
);
|
||||
|
||||
pManager.AddGenericParameter(
|
||||
"Objects",
|
||||
"O",
|
||||
"Objects to group into collections (tree structure must match Names tree structure)",
|
||||
GH_ParamAccess.tree
|
||||
);
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) =>
|
||||
pManager.AddParameter(
|
||||
new SpeckleCollectionParam(),
|
||||
"Collection",
|
||||
"C",
|
||||
"Root collection containing named sub-collections",
|
||||
GH_ParamAccess.item
|
||||
);
|
||||
|
||||
protected override void SolveInstance(IGH_DataAccess da)
|
||||
{
|
||||
// access the tree data directly from parameters
|
||||
var namesParam = Params.Input[0];
|
||||
var elementsParam = Params.Input[1];
|
||||
|
||||
var namesTree = namesParam.VolatileData;
|
||||
var elementsTree = elementsParam.VolatileData;
|
||||
|
||||
// validate that both inputs have data
|
||||
if (namesTree.IsEmpty)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Names tree is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
if (elementsTree.IsEmpty)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "Objects tree is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
// validate tree structures match exactly
|
||||
if (!TreeStructuresMatch(namesTree, elementsTree))
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Tree structures and topologies must match exactly");
|
||||
return;
|
||||
}
|
||||
|
||||
// create root collection
|
||||
var rootCollection = CollectionHelpers.CreateRootCollection(InstanceGuid.ToString());
|
||||
|
||||
// process each path
|
||||
foreach (var path in namesTree.Paths)
|
||||
{
|
||||
var nameBranch = namesTree.get_Branch(path);
|
||||
var elementsBranch = elementsTree.get_Branch(path);
|
||||
|
||||
// validate name branch - throw if empty
|
||||
if (nameBranch.Count == 0)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Name branch at path {path} is empty");
|
||||
return;
|
||||
}
|
||||
|
||||
// validate name branch - just warn if multiple, use first
|
||||
if (nameBranch.Count > 1)
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Warning,
|
||||
$"Name branch at path {path} has {nameBranch.Count} names - using first name only"
|
||||
);
|
||||
}
|
||||
|
||||
// get the collection name
|
||||
string collectionName = GetCollectionName(nameBranch[0]);
|
||||
if (string.IsNullOrWhiteSpace(collectionName))
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Invalid collection name at path {path}");
|
||||
return;
|
||||
}
|
||||
|
||||
// skip empty element branches with warning
|
||||
if (elementsBranch.Count == 0)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, $"Skipping empty elements branch at path {path}");
|
||||
continue;
|
||||
}
|
||||
|
||||
// parse nested collection path (e.g. parent::child)
|
||||
var collectionNames = collectionName.Split(
|
||||
new[] { Constants.LAYER_PATH_DELIMITER },
|
||||
StringSplitOptions.RemoveEmptyEntries
|
||||
);
|
||||
|
||||
// create or get nested collection structure
|
||||
var targetCollection = GetOrCreateNestedCollection(rootCollection, collectionNames, elementsBranch, path);
|
||||
|
||||
// add elements to deepest collection
|
||||
AddElementsToCollection(targetCollection, elementsBranch, path);
|
||||
}
|
||||
|
||||
// validate collection has content
|
||||
if (rootCollection.Elements.Count == 0)
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Error,
|
||||
"Collection contains no valid geometry. All branches were empty or contained unsupported types."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// validate for duplicate application IDs (following CreateCollection pattern)
|
||||
if (CollectionHelpers.HasDuplicateApplicationIds(rootCollection))
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The same object(s) cannot appear in multiple collections");
|
||||
return;
|
||||
}
|
||||
|
||||
da.SetData(0, new SpeckleCollectionWrapperGoo(rootCollection));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates that two tree structures have exactly matching paths
|
||||
/// </summary>
|
||||
private bool TreeStructuresMatch(
|
||||
Grasshopper.Kernel.Data.IGH_Structure namesTree,
|
||||
Grasshopper.Kernel.Data.IGH_Structure elementsTree
|
||||
)
|
||||
{
|
||||
if (namesTree.PathCount != elementsTree.PathCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check that all paths match exactly
|
||||
var namePaths = namesTree.Paths.ToList();
|
||||
var elementPaths = elementsTree.Paths.ToList();
|
||||
|
||||
for (int i = 0; i < namePaths.Count; i++)
|
||||
{
|
||||
if (namePaths[i].CompareTo(elementPaths[i]) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts collection name, handling GH_String and other text types
|
||||
/// </summary>
|
||||
private string GetCollectionName(object nameObj) =>
|
||||
nameObj switch
|
||||
{
|
||||
GH_String ghString => ghString.Value,
|
||||
IGH_Goo goo => goo.ToString(),
|
||||
_ => nameObj.ToString()
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets or creates a nested collection structure based on the collection names.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Handles paths like "parent::child::grandchild" by creating intermediate collections.
|
||||
/// </remarks>
|
||||
private SpeckleCollectionWrapper GetOrCreateNestedCollection(
|
||||
SpeckleCollectionWrapper rootCollection,
|
||||
string[] collectionNames,
|
||||
System.Collections.IList elementsBranch,
|
||||
Grasshopper.Kernel.Data.GH_Path path
|
||||
)
|
||||
{
|
||||
SpeckleCollectionWrapper currentCollection = rootCollection;
|
||||
var currentPath = new List<string>(rootCollection.Path);
|
||||
|
||||
foreach (var collectionName in collectionNames)
|
||||
{
|
||||
// build path for this level
|
||||
currentPath.Add(collectionName);
|
||||
|
||||
// check if child collection already exists
|
||||
var existingChild = currentCollection
|
||||
.Elements.OfType<SpeckleCollectionWrapper>()
|
||||
.FirstOrDefault(c => c.Name == collectionName);
|
||||
|
||||
if (existingChild != null)
|
||||
{
|
||||
// use existing collection
|
||||
currentCollection = existingChild;
|
||||
}
|
||||
else
|
||||
{
|
||||
// create new child collection
|
||||
var newChild = new SpeckleCollectionWrapper
|
||||
{
|
||||
Base = new Collection(),
|
||||
Name = collectionName,
|
||||
Path = currentPath.ToList(),
|
||||
Color = null,
|
||||
Material = null,
|
||||
Topology = null, // only set topology on leaf collections
|
||||
ApplicationId = Guid.NewGuid().ToString()
|
||||
};
|
||||
|
||||
currentCollection.Elements.Add(newChild);
|
||||
currentCollection = newChild;
|
||||
}
|
||||
}
|
||||
|
||||
// set topology on the final (leaf) collection
|
||||
currentCollection.Topology = GetBranchTopology(path, elementsBranch.Count);
|
||||
|
||||
return currentCollection;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds elements from a branch to the target collection
|
||||
/// </summary>
|
||||
private void AddElementsToCollection(
|
||||
SpeckleCollectionWrapper targetCollection,
|
||||
System.Collections.IList elementsBranch,
|
||||
Grasshopper.Kernel.Data.GH_Path path
|
||||
)
|
||||
{
|
||||
foreach (var item in elementsBranch)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
// preserve nulls for topology (CNX-2855 pattern)
|
||||
targetCollection.Elements.Add(null);
|
||||
continue;
|
||||
}
|
||||
|
||||
// convert to SpeckleWrapper if possible - cast to IGH_Goo first
|
||||
if (item is not IGH_Goo goo)
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Warning,
|
||||
$"Unsupported object type in branch {path}: {item.GetType().Name}"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
var wrapper = goo.ToSpeckleObjectWrapper();
|
||||
if (wrapper == null)
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Warning,
|
||||
$"Unsupported object type in branch {path}: {item.GetType().Name}"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (wrapper is ISpeckleCollectionObject collectionObject)
|
||||
{
|
||||
targetCollection.Elements.Add(collectionObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Warning,
|
||||
$"Object type {wrapper.GetType().Name} is not a valid collection element"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates topology string for a single branch (following GrasshopperHelpers.GetParamTopology pattern)
|
||||
/// </summary>
|
||||
private string GetBranchTopology(Grasshopper.Kernel.Data.GH_Path path, int count) =>
|
||||
$"{path.ToString(false)}-{count}";
|
||||
}
|
||||
+3
-53
@@ -47,7 +47,7 @@ public class CreateCollection : VariableParameterComponentBase
|
||||
|
||||
protected override void SolveInstance(IGH_DataAccess dataAccess)
|
||||
{
|
||||
var rootCollection = CreateRootCollection();
|
||||
var rootCollection = CollectionHelpers.CreateRootCollection(InstanceGuid.ToString());
|
||||
bool hasAnyInput = false;
|
||||
|
||||
foreach (var inputParam in Params.Input)
|
||||
@@ -73,14 +73,14 @@ public class CreateCollection : VariableParameterComponentBase
|
||||
}
|
||||
|
||||
// validate for duplicate application IDs across the entire collection hierarchy
|
||||
if (HasDuplicateApplicationIds(rootCollection))
|
||||
if (CollectionHelpers.HasDuplicateApplicationIds(rootCollection))
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "The same object(s) cannot appear in multiple collections");
|
||||
return;
|
||||
}
|
||||
|
||||
// validate collection isn't empty (CNX-2855)
|
||||
if (rootCollection.Elements.Count == 0 || !rootCollection.Elements.Any(HasAnyValidContent))
|
||||
if (rootCollection.Elements.Count == 0 || !rootCollection.Elements.Any(CollectionHelpers.HasAnyValidContent))
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Error,
|
||||
@@ -233,56 +233,6 @@ public class CreateCollection : VariableParameterComponentBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates that all application IDs are unique across the entire collection hierarchy.
|
||||
/// Shows an error if duplicates are found, indicating objects appear in multiple collections.
|
||||
/// </summary>
|
||||
/// <returns>True if duplicates exist, false if all IDs are unique</returns>
|
||||
private bool HasDuplicateApplicationIds(SpeckleCollectionWrapper rootCollection)
|
||||
{
|
||||
// args to CheckForDuplicateApplicationIds passed in since the method can recursively check
|
||||
var seenIds = new HashSet<string>();
|
||||
var duplicateIds = new HashSet<string>();
|
||||
|
||||
// iterate, create hash set and check all application IDs
|
||||
ProcessAndCheckForDuplicateApplicationIds(rootCollection, seenIds, duplicateIds);
|
||||
|
||||
return duplicateIds.Count > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recursively collects application IDs from all in the collection hierarchy.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only checks the wrapper's ApplicationId, not for example geometries within DataObjects.
|
||||
/// </remarks>
|
||||
private void ProcessAndCheckForDuplicateApplicationIds(
|
||||
SpeckleCollectionWrapper collection,
|
||||
HashSet<string> seenIds,
|
||||
HashSet<string> duplicateIds
|
||||
)
|
||||
{
|
||||
foreach (var element in collection.Elements)
|
||||
{
|
||||
switch (element)
|
||||
{
|
||||
case null:
|
||||
break; // skip nulls (CNX-2855)
|
||||
case SpeckleCollectionWrapper childCollection:
|
||||
// recurse into child collections
|
||||
ProcessAndCheckForDuplicateApplicationIds(childCollection, seenIds, duplicateIds);
|
||||
break;
|
||||
|
||||
case SpeckleWrapper wrapper:
|
||||
if (wrapper.ApplicationId != null && !seenIds.Add(wrapper.ApplicationId))
|
||||
{
|
||||
duplicateIds.Add(wrapper.ApplicationId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// IGH_VariableParameterComponent implementation
|
||||
public override bool CanInsertParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Input;
|
||||
|
||||
|
||||
+24
-23
@@ -1,5 +1,6 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Grasshopper.Kernel;
|
||||
using Speckle.Connectors.Common.Extensions;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Connectors.GrasshopperShared.HostApp;
|
||||
using Speckle.Connectors.GrasshopperShared.Parameters;
|
||||
@@ -7,6 +8,7 @@ using Speckle.Connectors.GrasshopperShared.Properties;
|
||||
using Speckle.Connectors.GrasshopperShared.Registration;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Api;
|
||||
using Speckle.Sdk.Models.Extensions;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components.Dev;
|
||||
|
||||
@@ -61,25 +63,23 @@ public class TokenUrlComponent : GH_Component
|
||||
try
|
||||
{
|
||||
// NOTE: once we split the logic in Sender and Receiver components, we need to set flag correctly
|
||||
var (resource, hasPermission) = SolveInstanceWithUrAndToken(urlInput, tokenInput, true);
|
||||
if (!hasPermission)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "You do not have enough permission for this project.");
|
||||
}
|
||||
var resource = Task.Run(() => SolveInstanceWithUrAndToken(urlInput, tokenInput)).GetAwaiter().GetResult();
|
||||
|
||||
da.SetData(0, resource);
|
||||
}
|
||||
catch (SpeckleException e)
|
||||
catch (SpeckleException ex)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, e.Message);
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, ex.Message);
|
||||
da.AbortComponentSolution();
|
||||
}
|
||||
catch (AggregateException ex)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, ex.ToFormattedString());
|
||||
da.AbortComponentSolution();
|
||||
}
|
||||
}
|
||||
|
||||
public (SpeckleUrlModelResource resource, bool hasPermission) SolveInstanceWithUrAndToken(
|
||||
string input,
|
||||
string token,
|
||||
bool isSender
|
||||
)
|
||||
private async Task<SpeckleUrlModelResource> SolveInstanceWithUrAndToken(string input, string? token)
|
||||
{
|
||||
// When input is provided, lock interaction of buttons so only text is shown (no context menu)
|
||||
// Should perform validation, fill in all internal data of the component (project, model, version, account)
|
||||
@@ -89,7 +89,7 @@ public class TokenUrlComponent : GH_Component
|
||||
if (resources.Length != 1)
|
||||
{
|
||||
// POC: this shouldn't ever hit since exceptions are thrown in the FromUrlString method
|
||||
throw new SpeckleException($"FromUrlString parser returned an invalid resource");
|
||||
throw new SpeckleException("FromUrlString parser returned an invalid resource");
|
||||
}
|
||||
|
||||
var resource = resources.First();
|
||||
@@ -109,24 +109,25 @@ public class TokenUrlComponent : GH_Component
|
||||
throw new SpeckleException("Token requires profile:read and profile:email scopes");
|
||||
}
|
||||
|
||||
using var userScope = UserActivityScope.AddUserScope(account);
|
||||
IClient client = scope.Get<IClientFactory>().Create(account);
|
||||
|
||||
var project = client.Project.Get(resource.ProjectId).Result;
|
||||
var projectPermissions = client.Project.GetPermissions(resource.ProjectId).Result;
|
||||
if (project != null && project.workspaceId != null)
|
||||
var project = await client.Project.Get(resource.ProjectId);
|
||||
if (project.workspaceId != null)
|
||||
{
|
||||
var workspace = client.Workspace.Get(project.workspaceId).Result;
|
||||
_ = await client.Workspace.Get(project.workspaceId);
|
||||
}
|
||||
|
||||
switch (resource)
|
||||
{
|
||||
case SpeckleUrlLatestModelVersionResource latestVersionResource:
|
||||
var model = client.Model.Get(latestVersionResource.ModelId, latestVersionResource.ProjectId).Result;
|
||||
case SpeckleUrlLatestModelVersionResource r:
|
||||
_ = await client.Model.Get(r.ModelId, r.ProjectId);
|
||||
break;
|
||||
case SpeckleUrlModelVersionResource versionResource:
|
||||
var m = client.Model.Get(versionResource.ModelId, versionResource.ProjectId).Result;
|
||||
case SpeckleUrlModelVersionResource r:
|
||||
_ = await client.Model.Get(r.ModelId, r.ProjectId);
|
||||
|
||||
// TODO: this wont be the case when we have separation between send and receive components
|
||||
var v = client.Version.Get(versionResource.VersionId, versionResource.ProjectId).Result;
|
||||
_ = await client.Version.Get(r.VersionId, r.ProjectId);
|
||||
break;
|
||||
case SpeckleUrlModelObjectResource:
|
||||
throw new SpeckleException("Object URLs are not supported");
|
||||
@@ -134,6 +135,6 @@ public class TokenUrlComponent : GH_Component
|
||||
throw new SpeckleException("Unknown Speckle resource type");
|
||||
}
|
||||
|
||||
return (resource, isSender ? projectPermissions.canPublish.authorized : projectPermissions.canLoad.authorized);
|
||||
return resource;
|
||||
}
|
||||
}
|
||||
|
||||
+209
-95
@@ -1,5 +1,6 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using Grasshopper.Kernel;
|
||||
using Grasshopper.Kernel.Parameters;
|
||||
using Grasshopper.Kernel.Types;
|
||||
using Speckle.Connectors.GrasshopperShared.Components.BaseComponents;
|
||||
using Speckle.Connectors.GrasshopperShared.HostApp;
|
||||
@@ -12,7 +13,7 @@ namespace Speckle.Connectors.GrasshopperShared.Components.Objects;
|
||||
/// Given a list of objects, this component will filter the list for objects that match the queries.
|
||||
/// </summary>
|
||||
[Guid("26AEA046-4DD4-4F61-8251-E92A6D2AC880")]
|
||||
public class FilterSpeckleObjects : GH_Component
|
||||
public class FilterSpeckleObjects : GH_Component, IGH_VariableParameterComponent
|
||||
{
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
protected override Bitmap Icon => Resources.speckle_objects_filter;
|
||||
@@ -49,17 +50,6 @@ public class FilterSpeckleObjects : GH_Component
|
||||
GH_ParamAccess.item
|
||||
);
|
||||
Params.Input[3].Optional = true;
|
||||
|
||||
pManager.AddTextParameter(
|
||||
"Application Id",
|
||||
"aID",
|
||||
"Find objects with a matching applicationId",
|
||||
GH_ParamAccess.item
|
||||
);
|
||||
Params.Input[4].Optional = true;
|
||||
|
||||
pManager.AddTextParameter("Speckle Id", "sID", "Find objects with a matching Speckle id", GH_ParamAccess.item);
|
||||
Params.Input[5].Optional = true;
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
|
||||
@@ -103,101 +93,39 @@ public class FilterSpeckleObjects : GH_Component
|
||||
dataAccess.GetData(2, ref property);
|
||||
string material = "";
|
||||
dataAccess.GetData(3, ref material);
|
||||
|
||||
// optional parameters - only read if they've been added via ⊕
|
||||
string appId = "";
|
||||
dataAccess.GetData(4, ref appId);
|
||||
string speckleId = "";
|
||||
dataAccess.GetData(5, ref speckleId);
|
||||
int? appIdIndex = FindInputIndexByName("Application Id");
|
||||
int? speckleIdIndex = FindInputIndexByName("Speckle Id");
|
||||
|
||||
if (appIdIndex.HasValue)
|
||||
{
|
||||
dataAccess.GetData(appIdIndex.Value, ref appId);
|
||||
}
|
||||
|
||||
if (speckleIdIndex.HasValue)
|
||||
{
|
||||
dataAccess.GetData(speckleIdIndex.Value, ref speckleId);
|
||||
}
|
||||
|
||||
bool filterByAppId = appIdIndex.HasValue;
|
||||
bool filterBySpeckleId = speckleIdIndex.HasValue;
|
||||
|
||||
List<SpeckleWrapper> matchedObjects = new();
|
||||
List<SpeckleWrapper> removedObjects = new();
|
||||
for (int i = 0; i < objects.Count; i++)
|
||||
|
||||
foreach (SpeckleWrapper wrapper in objects.Cast<SpeckleWrapper>())
|
||||
{
|
||||
SpeckleWrapper wrapper = objects[i]!;
|
||||
|
||||
// filter by name
|
||||
if (!MatchesSearchPattern(name, wrapper.Name))
|
||||
if (MatchesAllFilters(wrapper, name, property, material, appId, filterByAppId, speckleId, filterBySpeckleId))
|
||||
{
|
||||
removedObjects.Add(wrapper);
|
||||
continue;
|
||||
}
|
||||
|
||||
// filter by property
|
||||
bool foundProperty = false;
|
||||
if (string.IsNullOrEmpty(property))
|
||||
{
|
||||
foundProperty = true;
|
||||
matchedObjects.Add(wrapper);
|
||||
}
|
||||
else
|
||||
{
|
||||
SpecklePropertyGroupGoo? properties = wrapper is SpeckleDataObjectWrapper dataObjPropWrapper
|
||||
? dataObjPropWrapper.Properties
|
||||
: wrapper is SpeckleGeometryWrapper geoPropWrapper
|
||||
? geoPropWrapper.Properties
|
||||
: null;
|
||||
|
||||
if (properties is not null)
|
||||
{
|
||||
// use flattened properties to search ALL nested property keys
|
||||
// fix for [CNX-2512](https://linear.app/speckle/issue/CNX-2512/filter-objects-material-and-property-key-inputs-dont-work-as-expected)
|
||||
Dictionary<string, SpecklePropertyGoo> flattenedProps = properties.Flatten();
|
||||
foreach (string key in flattenedProps.Keys)
|
||||
{
|
||||
if (MatchesSearchPattern(property, key))
|
||||
{
|
||||
foundProperty = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundProperty)
|
||||
{
|
||||
removedObjects.Add(wrapper);
|
||||
continue;
|
||||
}
|
||||
|
||||
// filter by material name
|
||||
bool materialMatches = true;
|
||||
if (!string.IsNullOrEmpty(material))
|
||||
{
|
||||
materialMatches = false;
|
||||
|
||||
if (wrapper is SpeckleGeometryWrapper geoWrapper)
|
||||
{
|
||||
materialMatches = MatchesSearchPattern(material, geoWrapper.Material?.Name ?? "");
|
||||
}
|
||||
else if (wrapper is SpeckleDataObjectWrapper dataObjWrapper)
|
||||
{
|
||||
// check if ANY geometry in the data object has a matching material (not sure about this...)
|
||||
// fix for [CNX-2512](https://linear.app/speckle/issue/CNX-2512/filter-objects-material-and-property-key-inputs-dont-work-as-expected)
|
||||
materialMatches = dataObjWrapper.Geometries.Any(geo =>
|
||||
MatchesSearchPattern(material, geo.Material?.Name ?? "")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!materialMatches)
|
||||
{
|
||||
removedObjects.Add(wrapper);
|
||||
continue;
|
||||
}
|
||||
|
||||
// filter by application id
|
||||
if (!MatchesSearchPattern(appId, wrapper.Base.applicationId ?? ""))
|
||||
{
|
||||
removedObjects.Add(wrapper);
|
||||
continue;
|
||||
}
|
||||
|
||||
// filter by speckle id
|
||||
if (!MatchesSearchPattern(speckleId, wrapper.Base.id ?? ""))
|
||||
{
|
||||
removedObjects.Add(wrapper);
|
||||
continue;
|
||||
}
|
||||
|
||||
matchedObjects.Add(wrapper);
|
||||
}
|
||||
|
||||
// Set output objects
|
||||
@@ -214,4 +142,190 @@ public class FilterSpeckleObjects : GH_Component
|
||||
|
||||
return Operator.IsSymbolNameLike(target, searchPattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if a wrapper matches all active filter criteria.
|
||||
/// </summary>
|
||||
private bool MatchesAllFilters(
|
||||
SpeckleWrapper wrapper,
|
||||
string name,
|
||||
string property,
|
||||
string material,
|
||||
string appId,
|
||||
bool filterByAppId,
|
||||
string speckleId,
|
||||
bool filterBySpeckleId
|
||||
)
|
||||
{
|
||||
// filter by name
|
||||
if (!MatchesSearchPattern(name, wrapper.Name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// filter by property
|
||||
if (!MatchesPropertyFilter(wrapper, property))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// filter by material name
|
||||
if (!MatchesMaterialFilter(wrapper, material))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// filter by application id (only if parameter was added)
|
||||
if (filterByAppId && !MatchesSearchPattern(appId, wrapper.Base.applicationId ?? ""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// filter by speckle id (only if parameter was added)
|
||||
if (filterBySpeckleId && !MatchesSearchPattern(speckleId, wrapper.Base.id ?? ""))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool MatchesPropertyFilter(SpeckleWrapper wrapper, string property)
|
||||
{
|
||||
if (string.IsNullOrEmpty(property))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
SpecklePropertyGroupGoo? properties = wrapper is SpeckleDataObjectWrapper dataObjPropWrapper
|
||||
? dataObjPropWrapper.Properties
|
||||
: wrapper is SpeckleGeometryWrapper geoPropWrapper
|
||||
? geoPropWrapper.Properties
|
||||
: null;
|
||||
|
||||
if (properties is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// use flattened properties to search ALL nested property keys
|
||||
return properties.Flatten().Keys.Any(key => MatchesSearchPattern(property, key));
|
||||
}
|
||||
|
||||
private bool MatchesMaterialFilter(SpeckleWrapper wrapper, string material)
|
||||
{
|
||||
if (string.IsNullOrEmpty(material))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (wrapper is SpeckleGeometryWrapper geoWrapper)
|
||||
{
|
||||
return MatchesSearchPattern(material, geoWrapper.Material?.Name ?? "");
|
||||
}
|
||||
|
||||
if (wrapper is SpeckleDataObjectWrapper dataObjWrapper)
|
||||
{
|
||||
// check if ANY geometry in the data object has a matching material
|
||||
return dataObjWrapper.Geometries.Any(geo => MatchesSearchPattern(material, geo.Material?.Name ?? ""));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the index of an input parameter by its Name.
|
||||
/// Returns null if the parameter doesn't exist.
|
||||
/// </summary>
|
||||
private int? FindInputIndexByName(string paramName)
|
||||
{
|
||||
for (int i = 0; i < Params.Input.Count; i++)
|
||||
{
|
||||
if (Params.Input[i].Name == paramName)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
#region IGH_VariableParameterComponent
|
||||
|
||||
public bool CanInsertParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
if (side != GH_ParameterSide.Input)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// only allow inserting after the fixed parameters (index 4+)
|
||||
if (index < 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// check how many optional params are already added (total inputs - 4 fixed)
|
||||
int addedOptionalCount = Params.Input.Count - 4;
|
||||
|
||||
// we have 2 optional parameters available
|
||||
return addedOptionalCount < 2;
|
||||
}
|
||||
|
||||
public bool CanRemoveParameter(GH_ParameterSide side, int index) =>
|
||||
// only allow removing optional input parameters (index 4+)
|
||||
side == GH_ParameterSide.Input
|
||||
&& index >= 4;
|
||||
|
||||
/// <remarks>
|
||||
/// The ternary operator for NickName is needed due to a Grasshopper quirk where
|
||||
/// dynamically created parameters don't respect the "Draw Full Names" setting automatically.
|
||||
/// We check CanvasFullNames at creation time to set the appropriate NickName.
|
||||
/// This does not handle the case where the user toggles "Draw Full Names" while the
|
||||
/// component is already on the canvas. Handling that would require subscribing to
|
||||
/// Grasshopper.CentralSettings.CanvasFullNamesChanged event, which is overkill for now.
|
||||
/// </remarks>
|
||||
public IGH_Param CreateParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
bool hasAppId = FindInputIndexByName("Application Id").HasValue;
|
||||
bool hasSpeckleId = FindInputIndexByName("Speckle Id").HasValue;
|
||||
|
||||
if (!hasAppId)
|
||||
{
|
||||
return new Param_String
|
||||
{
|
||||
Name = "Application Id",
|
||||
NickName = Grasshopper.CentralSettings.CanvasFullNames ? "Application Id" : "aID", // see remarks
|
||||
Description = "Find objects with a matching applicationId",
|
||||
Access = GH_ParamAccess.item,
|
||||
Optional = true
|
||||
};
|
||||
}
|
||||
|
||||
if (!hasSpeckleId)
|
||||
{
|
||||
return new Param_String
|
||||
{
|
||||
Name = "Speckle Id",
|
||||
NickName = Grasshopper.CentralSettings.CanvasFullNames ? "Speckle Id" : "sID", // see remarks
|
||||
Description = "Find objects with a matching Speckle id",
|
||||
Access = GH_ParamAccess.item,
|
||||
Optional = true
|
||||
};
|
||||
}
|
||||
|
||||
return new Param_String();
|
||||
}
|
||||
|
||||
public bool DestroyParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Input && index >= 4;
|
||||
|
||||
public void VariableParameterMaintenance()
|
||||
{
|
||||
// ensure all optional parameters stay marked as optional
|
||||
for (int i = 4; i < Params.Input.Count; i++)
|
||||
{
|
||||
Params.Input[i].Optional = true;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
+10
-3
@@ -9,7 +9,7 @@ namespace Speckle.Connectors.GrasshopperShared.Components.Objects;
|
||||
|
||||
[Guid("8D2E3F4A-1B5C-4E7F-9A8B-3C6D9E2F1A4B")]
|
||||
public class SpeckleBlockDefinitionPassthrough()
|
||||
: SpeckleSolveInstance(
|
||||
: SpecklePassthroughComponentBase(
|
||||
"Speckle Block Definition",
|
||||
"SBD",
|
||||
"Create or modify a Speckle Block Definition",
|
||||
@@ -21,6 +21,9 @@ public class SpeckleBlockDefinitionPassthrough()
|
||||
protected override Bitmap Icon => Resources.speckle_objects_block_def;
|
||||
public override GH_Exposure Exposure => GH_Exposure.tertiary;
|
||||
|
||||
protected override int FixedInputCount => 3;
|
||||
protected override int FixedOutputCount => 3;
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
pManager.AddParameter(
|
||||
@@ -122,12 +125,16 @@ public class SpeckleBlockDefinitionPassthrough()
|
||||
result.Value.Name = inputName;
|
||||
}
|
||||
|
||||
// no need to process application Id.
|
||||
// New definitions should have a new appID generated in the new() constructor, and we want to preserve old appID otherwise for changetracking.
|
||||
// process application id (only if user provided one, otherwise preserve existing)
|
||||
if (TryGetApplicationIdInput(da, out string? inputAppId))
|
||||
{
|
||||
result.Value.ApplicationId = inputAppId;
|
||||
}
|
||||
|
||||
// set outputs
|
||||
da.SetData(0, result);
|
||||
da.SetDataList(1, result.Value.Objects.Select(o => o.CreateGoo()));
|
||||
da.SetData(2, result.Value.Name);
|
||||
SetApplicationIdOutput(da, result.Value.ApplicationId);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-3
@@ -9,7 +9,7 @@ namespace Speckle.Connectors.GrasshopperShared.Components.Objects;
|
||||
|
||||
[Guid("2F8A9B1C-3D4E-5F6A-7B8C-9D0E1F2A3B4C")]
|
||||
public class SpeckleBlockInstancePassthrough()
|
||||
: SpeckleSolveInstance(
|
||||
: SpecklePassthroughComponentBase(
|
||||
"Speckle Block Instance",
|
||||
"SBI",
|
||||
"Create or modify a Speckle Block Instance",
|
||||
@@ -21,6 +21,9 @@ public class SpeckleBlockInstancePassthrough()
|
||||
protected override Bitmap Icon => Resources.speckle_objects_block_inst;
|
||||
public override GH_Exposure Exposure => GH_Exposure.tertiary;
|
||||
|
||||
protected override int FixedInputCount => 7;
|
||||
protected override int FixedOutputCount => 7;
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
int instanceIndex = pManager.AddParameter(
|
||||
@@ -205,8 +208,11 @@ public class SpeckleBlockInstancePassthrough()
|
||||
result.Value.Material = inputMaterial.Value;
|
||||
}
|
||||
|
||||
// no need to process application id.
|
||||
// new appids are generated if this is a new object, otherwise the input object appID should be preserved for change tracking.
|
||||
// process application id (only if user provided one, otherwise preserve existing)
|
||||
if (TryGetApplicationIdInput(da, out string? inputAppId))
|
||||
{
|
||||
result.Value.ApplicationId = inputAppId;
|
||||
}
|
||||
|
||||
// Set outputs
|
||||
da.SetData(0, result);
|
||||
@@ -216,6 +222,7 @@ public class SpeckleBlockInstancePassthrough()
|
||||
da.SetData(4, result.Value.Properties);
|
||||
da.SetData(5, result.Value.Color);
|
||||
da.SetData(6, result.Value.Material);
|
||||
SetApplicationIdOutput(da, result.Value.ApplicationId);
|
||||
}
|
||||
|
||||
private Transform? ExtractTransform(IGH_Goo input) =>
|
||||
|
||||
+16
-4
@@ -8,7 +8,7 @@ namespace Speckle.Connectors.GrasshopperShared.Components.Objects;
|
||||
|
||||
[Guid("5CE8AA40-7706-4893-853D-4C77604548FA")]
|
||||
public class SpeckleDataObjectPassthrough()
|
||||
: SpeckleSolveInstance(
|
||||
: SpecklePassthroughComponentBase(
|
||||
"Speckle Data Object",
|
||||
"SDO",
|
||||
"Create or modify a Speckle Data Object",
|
||||
@@ -20,6 +20,9 @@ public class SpeckleDataObjectPassthrough()
|
||||
protected override Bitmap Icon => Resources.speckle_objects_dataobject;
|
||||
public override GH_Exposure Exposure => GH_Exposure.secondary;
|
||||
|
||||
protected override int FixedInputCount => 4;
|
||||
protected override int FixedOutputCount => 5;
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
int objIndex = pManager.AddParameter(
|
||||
@@ -158,9 +161,17 @@ public class SpeckleDataObjectPassthrough()
|
||||
result.Properties = inputProperties;
|
||||
}
|
||||
|
||||
// generate application ID for new data objects. Unlike SpeckleGeometry, DataObject wrappers aren't created
|
||||
// through casting (which auto-generates IDs), so we must explicitly ensure an ID exists here
|
||||
result.ApplicationId ??= Guid.NewGuid().ToString();
|
||||
// process application id (only if user provided one)
|
||||
if (TryGetApplicationIdInput(da, out string? inputAppId))
|
||||
{
|
||||
result.ApplicationId = inputAppId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// generate application ID for new data objects. Unlike SpeckleGeometry, DataObject wrappers aren't created
|
||||
// through casting (which auto-generates IDs), so we must explicitly ensure an ID exists here
|
||||
result.ApplicationId ??= Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
// get the path
|
||||
string? path =
|
||||
@@ -172,5 +183,6 @@ public class SpeckleDataObjectPassthrough()
|
||||
da.SetData(2, result.Name);
|
||||
da.SetData(3, result.Properties);
|
||||
da.SetData(4, path);
|
||||
SetApplicationIdOutput(da, result.ApplicationId);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-3
@@ -10,7 +10,7 @@ namespace Speckle.Connectors.GrasshopperShared.Components.Objects;
|
||||
|
||||
[Guid("F9418610-ACAE-4417-B010-19EBEA6A121F")]
|
||||
public class SpeckleGeometryPassthrough()
|
||||
: SpeckleSolveInstance(
|
||||
: SpecklePassthroughComponentBase(
|
||||
"Speckle Geometry",
|
||||
"SG",
|
||||
"Create or modify a Speckle Geometry",
|
||||
@@ -22,6 +22,9 @@ public class SpeckleGeometryPassthrough()
|
||||
protected override Bitmap Icon => Resources.speckle_objects_geometry;
|
||||
public override GH_Exposure Exposure => GH_Exposure.secondary;
|
||||
|
||||
protected override int FixedInputCount => 6;
|
||||
protected override int FixedOutputCount => 7;
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
int objIndex = pManager.AddGenericParameter(
|
||||
@@ -220,8 +223,11 @@ public class SpeckleGeometryPassthrough()
|
||||
result.Material = inputMaterial.Value;
|
||||
}
|
||||
|
||||
// no need to process application Id.
|
||||
// New definitions should have a new appID generated in the new() constructor, and we want to preserve old appID otherwise for changetracking.
|
||||
// process application id (only if user provided one, otherwise preserve existing)
|
||||
if (TryGetApplicationIdInput(da, out string? inputAppId))
|
||||
{
|
||||
result.ApplicationId = inputAppId;
|
||||
}
|
||||
|
||||
// get the path
|
||||
string? path =
|
||||
@@ -235,6 +241,7 @@ public class SpeckleGeometryPassthrough()
|
||||
da.SetData(4, result.Color);
|
||||
da.SetData(5, result.Material);
|
||||
da.SetData(6, path);
|
||||
SetApplicationIdOutput(da, result.ApplicationId);
|
||||
}
|
||||
|
||||
// keeps the geometry and wrapped base the same while assigning all other props from the inut wrapper
|
||||
|
||||
+2
-1
@@ -36,13 +36,14 @@ public class AccountManagerComponent : GH_Component, IDisposable
|
||||
ComponentCategories.OPERATIONS
|
||||
)
|
||||
{
|
||||
Attributes = new AccountManagerComponentAttributes(this);
|
||||
_accountManager = PriorityLoader.Container.GetRequiredService<IAccountManager>();
|
||||
Accounts = _accountManager.GetAccounts().ToList();
|
||||
|
||||
SignInButton = new GhContextMenuButton("Sign In", "Sign In", "Click to sign into Speckle account.", AuthFlow);
|
||||
}
|
||||
|
||||
public override void CreateAttributes() => m_attributes = new AccountManagerComponentAttributes(this);
|
||||
|
||||
private bool AuthFlow(ToolStripDropDown menu)
|
||||
{
|
||||
_isAddingAccount = true;
|
||||
|
||||
+13
-1
@@ -1,8 +1,19 @@
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Sdk.Credentials;
|
||||
using Version = Speckle.Sdk.Api.GraphQL.Models.Version;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components.Operations.Receive;
|
||||
|
||||
/// <param name="Account"></param>
|
||||
/// <param name="WorkspaceId"></param>
|
||||
/// <param name="ProjectId"></param>
|
||||
/// <param name="ProjectName"></param>
|
||||
/// <param name="ModelId"></param>
|
||||
/// <param name="ModelName"></param>
|
||||
/// <param name="SelectedVersionId"></param>
|
||||
/// <param name="SourceApplication">See <see cref="Version.sourceApplication"/></param>
|
||||
/// <param name="ReceivingApplicationSlug">Slug of the application doing the receiving (i.e. the current host app)</param>
|
||||
/// <param name="SelectedVersionUserId"></param>
|
||||
public record GrasshopperReceiveInfo(
|
||||
Account Account,
|
||||
string? WorkspaceId,
|
||||
@@ -12,5 +23,6 @@ public record GrasshopperReceiveInfo(
|
||||
string ModelName,
|
||||
string SelectedVersionId,
|
||||
string SourceApplication,
|
||||
string ReceivingApplicationSlug,
|
||||
string? SelectedVersionUserId
|
||||
) : ReceiveInfo(Account, ProjectId, ProjectName, ModelId, ModelName, SelectedVersionId, SourceApplication);
|
||||
) : ReceiveInfo(Account, ProjectId, ProjectName, ModelId, ModelName, SelectedVersionId, ReceivingApplicationSlug);
|
||||
|
||||
+2
-9
@@ -32,9 +32,10 @@ public class ReceiveAsyncComponent : GH_AsyncComponent<ReceiveAsyncComponent>
|
||||
: base("Load", "L", "Load a model from Speckle", ComponentCategories.PRIMARY_RIBBON, ComponentCategories.OPERATIONS)
|
||||
{
|
||||
BaseWorker = new ReceiveComponentWorker(this);
|
||||
Attributes = new ReceiveAsyncComponentAttributes(this);
|
||||
}
|
||||
|
||||
public override void CreateAttributes() => m_attributes = new ReceiveAsyncComponentAttributes(this);
|
||||
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
protected override Bitmap Icon => Resources.speckle_operations_load;
|
||||
|
||||
@@ -535,19 +536,11 @@ public sealed class ReceiveComponentWorker : WorkerInstance<ReceiveAsyncComponen
|
||||
|
||||
public class ReceiveAsyncComponentAttributes : GH_ComponentAttributes
|
||||
{
|
||||
private bool _selected;
|
||||
|
||||
public ReceiveAsyncComponentAttributes(GH_Component owner)
|
||||
: base(owner) { }
|
||||
|
||||
private Rectangle ButtonBounds { get; set; }
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
get => _selected;
|
||||
set => _selected = value;
|
||||
}
|
||||
|
||||
protected override void Layout()
|
||||
{
|
||||
base.Layout();
|
||||
|
||||
+3
-8
@@ -1,12 +1,7 @@
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Sdk.Credentials;
|
||||
using Speckle.Sdk.Api;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components.Operations.Send;
|
||||
|
||||
public record GrasshopperSendInfo(
|
||||
Account Account,
|
||||
string? WorkspaceId,
|
||||
string ProjectId,
|
||||
string ModelId,
|
||||
string SourceApplication
|
||||
) : SendInfo(Account, ProjectId, ModelId, SourceApplication);
|
||||
public record GrasshopperSendInfo(IClient Client, string? WorkspaceId, string ProjectId, string ModelId)
|
||||
: SendInfo(Client, ProjectId, ModelId);
|
||||
|
||||
+13
-20
@@ -35,9 +35,10 @@ public class SendAsyncComponent : GH_AsyncComponent<SendAsyncComponent>
|
||||
)
|
||||
{
|
||||
BaseWorker = new SendComponentWorker(this);
|
||||
Attributes = new SendAsyncComponentAttributes(this);
|
||||
}
|
||||
|
||||
public override void CreateAttributes() => m_attributes = new SendAsyncComponentAttributes(this);
|
||||
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
|
||||
protected override Bitmap Icon => Resources.speckle_operations_publish;
|
||||
@@ -87,6 +88,7 @@ public class SendAsyncComponent : GH_AsyncComponent<SendAsyncComponent>
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
|
||||
{
|
||||
pManager.AddParameter(new SpeckleUrlModelResourceParam());
|
||||
pManager.AddTextParameter("Version ID", "V", "ID of the created version", GH_ParamAccess.item);
|
||||
}
|
||||
|
||||
public override void AppendAdditionalMenuItems(ToolStripDropDown menu)
|
||||
@@ -321,6 +323,7 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
|
||||
private Stopwatch? _stopwatch;
|
||||
public SpeckleUrlModelResource? OutputParam { get; set; }
|
||||
public string? OutputVersionId { get; set; }
|
||||
private List<(GH_RuntimeMessageLevel, string)> RuntimeMessages { get; } = new();
|
||||
|
||||
public override WorkerInstance<SendAsyncComponent> Duplicate(string id, CancellationToken cancellationToken)
|
||||
@@ -332,6 +335,7 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
{
|
||||
_stopwatch = new Stopwatch();
|
||||
_stopwatch.Start();
|
||||
OutputVersionId = null;
|
||||
}
|
||||
|
||||
public override void SetData(IGH_DataAccess da)
|
||||
@@ -342,6 +346,7 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
{
|
||||
Parent.JustPastedIn = false;
|
||||
da.SetData(0, Parent.OutputParam);
|
||||
da.SetData(1, OutputVersionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -357,6 +362,7 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
}
|
||||
|
||||
da.SetData(0, OutputParam);
|
||||
da.SetData(1, OutputVersionId);
|
||||
|
||||
Parent.CurrentComponentState = ComponentState.UpToDate;
|
||||
Parent.OutputParam = OutputParam; // ref the outputs in the parent too, so we can serialise them on write/read
|
||||
@@ -373,7 +379,7 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
*/
|
||||
Parent.AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Remark,
|
||||
$"Successfully published to Speckle. Right-click on the component to view online."
|
||||
"Successfully published to Speckle. Right-click on the component to view online."
|
||||
);
|
||||
Parent.AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Remark,
|
||||
@@ -432,22 +438,16 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
// Step 1 - SEND TO SERVER
|
||||
var sendInfo = await urlModelResource.GetSendInfo(Parent.ApiClient, CancellationToken).ConfigureAwait(false);
|
||||
|
||||
var (fileName, fileBytes) = SendComponent.GetGrasshopperFileInfo();
|
||||
var progress = new Progress<CardProgress>(p =>
|
||||
{
|
||||
reportProgress(Id, p.Progress ?? 0);
|
||||
//sendComponent.Message = $"{p.Status}";
|
||||
});
|
||||
|
||||
using var scope = PriorityLoader.CreateScopeForActiveDocument();
|
||||
var sendOperation = scope.ServiceProvider.GetRequiredService<SendOperation<SpeckleCollectionWrapperGoo>>();
|
||||
SendOperationResult? result = await sendOperation
|
||||
.Execute(
|
||||
new List<SpeckleCollectionWrapperGoo> { rootCollectionWrapper },
|
||||
sendInfo,
|
||||
Parent.VersionMessage,
|
||||
progress,
|
||||
CancellationToken
|
||||
)
|
||||
(SendOperationResult result, string versionId) = await sendOperation
|
||||
.Send([rootCollectionWrapper], sendInfo, fileName, fileBytes, Parent.VersionMessage, progress, CancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
// TODO: If we have NodeRun events later, better to have `ComponentTracker` to use across components
|
||||
@@ -468,28 +468,21 @@ public class SendComponentWorker : WorkerInstance<SendAsyncComponent>
|
||||
sendInfo.WorkspaceId,
|
||||
sendInfo.ProjectId,
|
||||
sendInfo.ModelId,
|
||||
result.VersionId
|
||||
versionId
|
||||
);
|
||||
OutputParam = createdVersion;
|
||||
OutputVersionId = versionId;
|
||||
Parent.Url = $"{createdVersion.Account.Server}/projects/{sendInfo.ProjectId}/models/{sendInfo.ModelId}";
|
||||
}
|
||||
}
|
||||
|
||||
public class SendAsyncComponentAttributes : GH_ComponentAttributes
|
||||
{
|
||||
private bool _selected;
|
||||
|
||||
public SendAsyncComponentAttributes(GH_Component owner)
|
||||
: base(owner) { }
|
||||
|
||||
private Rectangle ButtonBounds { get; set; }
|
||||
|
||||
public override bool Selected
|
||||
{
|
||||
get => _selected;
|
||||
set => _selected = value;
|
||||
}
|
||||
|
||||
protected override void Layout()
|
||||
{
|
||||
base.Layout();
|
||||
|
||||
+26
-11
@@ -1,4 +1,5 @@
|
||||
using System.Diagnostics;
|
||||
using Grasshopper;
|
||||
using Grasshopper.Kernel;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connectors.Common.Analytics;
|
||||
@@ -36,9 +37,10 @@ public class SendComponentInput
|
||||
}
|
||||
}
|
||||
|
||||
public class SendComponentOutput(SpeckleUrlModelResource? resource)
|
||||
public class SendComponentOutput(SpeckleUrlModelResource? resource, string? versionId = null)
|
||||
{
|
||||
public SpeckleUrlModelResource? Resource { get; } = resource;
|
||||
public string? VersionId { get; } = versionId;
|
||||
}
|
||||
|
||||
public class SendComponent : SpeckleTaskCapableComponent<SendComponentInput, SendComponentOutput>
|
||||
@@ -86,8 +88,11 @@ public class SendComponent : SpeckleTaskCapableComponent<SendComponentInput, Sen
|
||||
pManager.AddBooleanParameter("Run", "r", "Run the publish operation", GH_ParamAccess.item);
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) =>
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
|
||||
{
|
||||
pManager.AddParameter(new SpeckleUrlModelResourceParam());
|
||||
pManager.AddTextParameter("Version ID", "V", "ID of the created version", GH_ParamAccess.item);
|
||||
}
|
||||
|
||||
protected override SendComponentInput GetInput(IGH_DataAccess da)
|
||||
{
|
||||
@@ -134,6 +139,7 @@ public class SendComponent : SpeckleTaskCapableComponent<SendComponentInput, Sen
|
||||
else
|
||||
{
|
||||
da.SetData(0, result.Resource);
|
||||
da.SetData(1, result.VersionId);
|
||||
Message = "Done";
|
||||
}
|
||||
}
|
||||
@@ -208,6 +214,8 @@ public class SendComponent : SpeckleTaskCapableComponent<SendComponentInput, Sen
|
||||
throw new SpeckleAccountManagerException("No default account was found");
|
||||
}
|
||||
|
||||
var (fileName, fileBytes) = GetGrasshopperFileInfo();
|
||||
|
||||
var progress = new Progress<CardProgress>(_ =>
|
||||
{
|
||||
// TODO: Progress only makes sense in non-blocking async receive, which is not supported yet.
|
||||
@@ -216,14 +224,8 @@ public class SendComponent : SpeckleTaskCapableComponent<SendComponentInput, Sen
|
||||
|
||||
using var client = clientFactory.Create(account);
|
||||
var sendInfo = await input.Resource.GetSendInfo(client, cancellationToken).ConfigureAwait(false);
|
||||
await sendOperation
|
||||
.Execute(
|
||||
new List<SpeckleCollectionWrapperGoo> { collectionToSend },
|
||||
sendInfo,
|
||||
VersionMessage,
|
||||
progress,
|
||||
cancellationToken
|
||||
)
|
||||
var (result, versionId) = await sendOperation
|
||||
.Send([collectionToSend], sendInfo, fileName, fileBytes, VersionMessage, progress, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
// TODO: If we have NodeRun events later, better to have `ComponentTracker` to use across components
|
||||
@@ -244,6 +246,19 @@ public class SendComponent : SpeckleTaskCapableComponent<SendComponentInput, Sen
|
||||
sendInfo.ModelId
|
||||
);
|
||||
Url = $"{sendInfo.Account.serverInfo.url}/projects/{sendInfo.ProjectId}/models/{sendInfo.ModelId}";
|
||||
return new SendComponentOutput(createdVersionResource);
|
||||
return new SendComponentOutput(createdVersionResource, versionId);
|
||||
}
|
||||
|
||||
public static (string? fileName, long? fileSizeBytes) GetGrasshopperFileInfo()
|
||||
{
|
||||
var doc = Instances.ActiveCanvas?.Document;
|
||||
|
||||
if (doc is null || !File.Exists(doc.FilePath))
|
||||
{
|
||||
return (null, null);
|
||||
}
|
||||
var fileInfo = new FileInfo(doc.FilePath);
|
||||
|
||||
return (fileInfo.Name, fileInfo.Length);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-6
@@ -43,7 +43,6 @@ public class SpeckleSelectModelComponent : GH_Component
|
||||
ComponentCategories.OPERATIONS
|
||||
)
|
||||
{
|
||||
Attributes = new SpeckleSelectModelComponentAttributes(this);
|
||||
SpeckleOperationWizard = new SpeckleOperationWizard(RefreshComponent, UpdateComponentMessage, false);
|
||||
|
||||
WorkspaceContextMenuButton = SpeckleOperationWizard.WorkspaceMenuHandler.WorkspaceContextMenuButton;
|
||||
@@ -52,6 +51,8 @@ public class SpeckleSelectModelComponent : GH_Component
|
||||
VersionContextMenuButton = SpeckleOperationWizard!.VersionMenuHandler!.VersionContextMenuButton; // TODO: fix this shit later when we split
|
||||
}
|
||||
|
||||
public override void CreateAttributes() => m_attributes = new SpeckleSelectModelComponentAttributes(this);
|
||||
|
||||
private Task RefreshComponent()
|
||||
{
|
||||
ExpireSolution(true);
|
||||
@@ -108,11 +109,13 @@ public class SpeckleSelectModelComponent : GH_Component
|
||||
try
|
||||
{
|
||||
// NOTE: once we split the logic in Sender and Receiver components, we need to set flag correctly
|
||||
var (resource, hasPermission) = SpeckleOperationWizard.SolveInstanceWithUrlInput(urlInput, true, null);
|
||||
if (!hasPermission)
|
||||
var (resource, permissionCheck) = SpeckleOperationWizard.SolveInstanceWithUrlInput(urlInput, true, null);
|
||||
|
||||
if (!permissionCheck.authorized)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "You do not have enough permission for this project.");
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, permissionCheck.message);
|
||||
}
|
||||
|
||||
_storedUserId = SpeckleOperationWizard.SelectedAccount?.id;
|
||||
_storedServer = resource.Account.Server;
|
||||
da.SetData(0, resource);
|
||||
@@ -162,11 +165,14 @@ public class SpeckleSelectModelComponent : GH_Component
|
||||
SpeckleOperationWizard.SetWorkspaceFromSavedIdSync(_storedWorkspaceId!);
|
||||
}
|
||||
|
||||
// NOTE FOR LATER: Need to be handled in SDK... and will come later by Jeddward Morgan...
|
||||
if (SpeckleOperationWizard.WorkspaceMenuHandler.Workspaces == null)
|
||||
{
|
||||
var workspaces = SpeckleOperationWizard.FetchWorkspacesSync("");
|
||||
if (workspaces.items.Count == 0)
|
||||
if (workspaces == null)
|
||||
{
|
||||
_storedWorkspaceId = null;
|
||||
}
|
||||
else if (workspaces.items.Count == 0)
|
||||
{
|
||||
// Create a workspace flow
|
||||
SpeckleOperationWizard.CreateNewWorkspaceUIState();
|
||||
|
||||
+23
-65
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connectors.Common.Extensions;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Connectors.GrasshopperShared.HostApp;
|
||||
using Speckle.Connectors.GrasshopperShared.Registration;
|
||||
@@ -66,7 +67,7 @@ public class SpeckleOperationWizard
|
||||
ModelMenuHandler.ModelSelected += OnModelSelected;
|
||||
}
|
||||
|
||||
public (SpeckleUrlModelResource resource, bool hasPermission) SolveInstanceWithUrlInput(
|
||||
public (SpeckleUrlModelResource, PermissionCheckResult) SolveInstanceWithUrlInput(
|
||||
string input,
|
||||
bool isSender,
|
||||
string? token
|
||||
@@ -114,7 +115,7 @@ public class SpeckleOperationWizard
|
||||
$"No appropriate account found for the given '{urlDerivedAccount?.serverInfo.url}' server"
|
||||
);
|
||||
}
|
||||
|
||||
using var userScope = UserActivityScope.AddUserScope(SelectedAccount);
|
||||
IClient client = _clientFactory.Create(SelectedAccount);
|
||||
|
||||
var project = client.Project.Get(resource.ProjectId).Result;
|
||||
@@ -127,18 +128,20 @@ public class SpeckleOperationWizard
|
||||
|
||||
ProjectMenuHandler.RedrawMenuButton(project);
|
||||
|
||||
ModelPermissionChecks modelPermissions;
|
||||
switch (resource)
|
||||
{
|
||||
case SpeckleUrlLatestModelVersionResource latestVersionResource:
|
||||
var model = client.Model.Get(latestVersionResource.ModelId, latestVersionResource.ProjectId).Result;
|
||||
case SpeckleUrlLatestModelVersionResource r:
|
||||
var model = client.Model.Get(r.ModelId, r.ProjectId).Result;
|
||||
modelPermissions = client.Model.GetPermissions(r.ProjectId, r.ModelId).Result;
|
||||
ModelMenuHandler.RedrawMenuButton(model);
|
||||
break;
|
||||
case SpeckleUrlModelVersionResource versionResource:
|
||||
var m = client.Model.Get(versionResource.ModelId, versionResource.ProjectId).Result;
|
||||
case SpeckleUrlModelVersionResource r:
|
||||
var m = client.Model.Get(r.ModelId, r.ProjectId).Result;
|
||||
ModelMenuHandler.RedrawMenuButton(m);
|
||||
|
||||
modelPermissions = client.Model.GetPermissions(r.ProjectId, r.ModelId).Result;
|
||||
// TODO: this wont be the case when we have separation between send and receive components
|
||||
var v = client.Version.Get(versionResource.VersionId, versionResource.ProjectId).Result;
|
||||
var v = client.Version.Get(r.VersionId, r.ProjectId).Result;
|
||||
VersionMenuHandler?.RedrawMenuButton(v, false);
|
||||
break;
|
||||
case SpeckleUrlModelObjectResource:
|
||||
@@ -147,7 +150,7 @@ public class SpeckleOperationWizard
|
||||
throw new SpeckleException("Unknown Speckle resource type");
|
||||
}
|
||||
|
||||
return (resource, isSender ? projectPermissions.canPublish.authorized : projectPermissions.canLoad.authorized);
|
||||
return (resource, isSender ? modelPermissions.canCreateVersion : projectPermissions.canLoad);
|
||||
}
|
||||
|
||||
public void SetAccount(Account? account, bool refreshComponent = true)
|
||||
@@ -267,7 +270,7 @@ public class SpeckleOperationWizard
|
||||
/// <summary>
|
||||
/// Callback function to retrieve workspaces with the search text
|
||||
/// </summary>
|
||||
public async Task<ResourceCollection<Workspace>> FetchWorkspaces(string searchText)
|
||||
public async Task<ResourceCollection<Workspace>?> FetchWorkspaces(string searchText)
|
||||
{
|
||||
if (SelectedAccount == null)
|
||||
{
|
||||
@@ -275,6 +278,11 @@ public class SpeckleOperationWizard
|
||||
}
|
||||
|
||||
using IClient client = _clientFactory.Create(SelectedAccount);
|
||||
if (!await client.Server.IsWorkspaceEnabled())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var workspaces = await client.ActiveUser.GetWorkspaces(10, null, new UserWorkspacesFilter(searchText));
|
||||
WorkspaceMenuHandler.Workspaces = workspaces;
|
||||
return workspaces;
|
||||
@@ -283,17 +291,9 @@ public class SpeckleOperationWizard
|
||||
/// <summary>
|
||||
/// Callback function to retrieve workspaces with the search text sync
|
||||
/// </summary>
|
||||
public ResourceCollection<Workspace> FetchWorkspacesSync(string searchText)
|
||||
public ResourceCollection<Workspace>? FetchWorkspacesSync(string searchText)
|
||||
{
|
||||
if (SelectedAccount == null)
|
||||
{
|
||||
return new ResourceCollection<Workspace>();
|
||||
}
|
||||
|
||||
using IClient client = _clientFactory.Create(SelectedAccount);
|
||||
var workspaces = client.ActiveUser.GetWorkspaces(10, null, new UserWorkspacesFilter(searchText)).Result;
|
||||
WorkspaceMenuHandler.Workspaces = workspaces;
|
||||
return workspaces;
|
||||
return Task.Run(async () => await FetchWorkspaces(searchText)).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -327,27 +327,7 @@ public class SpeckleOperationWizard
|
||||
/// </summary>
|
||||
public ResourceCollection<ProjectWithPermissions> FetchProjectsSync(string searchText)
|
||||
{
|
||||
if (SelectedAccount == null)
|
||||
{
|
||||
return new ResourceCollection<ProjectWithPermissions>();
|
||||
}
|
||||
|
||||
using IClient client = _clientFactory.Create(SelectedAccount);
|
||||
var workspaceId = SelectedWorkspace?.id ?? null;
|
||||
var projects = client
|
||||
.ActiveUser.GetProjectsWithPermissions(
|
||||
10,
|
||||
null,
|
||||
new UserProjectsFilter(
|
||||
searchText,
|
||||
workspaceId: workspaceId,
|
||||
includeImplicitAccess: true,
|
||||
personalOnly: WorkspaceMenuHandler.IsPersonalProjects
|
||||
)
|
||||
)
|
||||
.Result;
|
||||
ProjectMenuHandler.Projects = projects;
|
||||
return projects;
|
||||
return Task.Run(async () => await FetchProjects(searchText)).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -373,17 +353,7 @@ public class SpeckleOperationWizard
|
||||
/// </summary>
|
||||
public ResourceCollection<Model> FetchModelsSync(string searchText)
|
||||
{
|
||||
if (SelectedAccount == null || SelectedProject == null)
|
||||
{
|
||||
return new ResourceCollection<Model>();
|
||||
}
|
||||
|
||||
IClient client = _clientFactory.Create(SelectedAccount);
|
||||
var projectWithModels = client
|
||||
.Project.GetWithModels(SelectedProject.id, 10, modelsFilter: new ProjectModelsFilter(search: searchText))
|
||||
.Result;
|
||||
ModelMenuHandler.Models = projectWithModels.models;
|
||||
return projectWithModels.models;
|
||||
return Task.Run(async () => await FetchModels(searchText)).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -413,19 +383,7 @@ public class SpeckleOperationWizard
|
||||
/// </summary>
|
||||
public ResourceCollection<Version> FetchVersionsSync(int versionCount)
|
||||
{
|
||||
if (SelectedAccount == null || SelectedProject == null || SelectedModel == null)
|
||||
{
|
||||
return new ResourceCollection<Version>();
|
||||
}
|
||||
|
||||
using IClient client = _clientFactory.Create(SelectedAccount);
|
||||
var newVersionsResult = client.Model.GetWithVersions(SelectedModel.id, SelectedProject.id, versionCount).Result;
|
||||
if (VersionMenuHandler != null)
|
||||
{
|
||||
VersionMenuHandler.Versions = newVersionsResult.versions;
|
||||
}
|
||||
|
||||
return newVersionsResult.versions;
|
||||
return Task.Run(async () => await FetchVersions(versionCount)).GetAwaiter().GetResult();
|
||||
}
|
||||
|
||||
public void SetDefaultWorkspaceSync()
|
||||
|
||||
+14
-14
@@ -10,9 +10,9 @@ public class WorkspaceSelectedEventArgs(LimitedWorkspace? model) : EventArgs
|
||||
|
||||
public class WorkspaceMenuHandler
|
||||
{
|
||||
private readonly Func<string, Task<ResourceCollection<Workspace>>> _fetchWorkspaces;
|
||||
private readonly Func<string, Task<ResourceCollection<Workspace>?>> _fetchWorkspaces;
|
||||
private ToolStripDropDown? _menu;
|
||||
public bool IsPersonalProjects { get; set; }
|
||||
public bool IsPersonalProjects { get; private set; }
|
||||
private SearchToolStripMenuItem? _searchItem;
|
||||
private readonly Func<Task> _createWorkspace;
|
||||
private LimitedWorkspace? SelectedWorkspace { get; set; }
|
||||
@@ -24,7 +24,7 @@ public class WorkspaceMenuHandler
|
||||
public GhContextMenuButton WorkspaceContextMenuButton { get; }
|
||||
|
||||
public WorkspaceMenuHandler(
|
||||
Func<string, Task<ResourceCollection<Workspace>>> fetchWorkspaces,
|
||||
Func<string, Task<ResourceCollection<Workspace>?>> fetchWorkspaces,
|
||||
Func<Task> createWorkspace
|
||||
)
|
||||
{
|
||||
@@ -44,6 +44,7 @@ public class WorkspaceMenuHandler
|
||||
_menu?.Close();
|
||||
Workspaces = null;
|
||||
SelectedWorkspace = null;
|
||||
IsPersonalProjects = false;
|
||||
RedrawMenuButton(null);
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ public class WorkspaceMenuHandler
|
||||
{
|
||||
Workspaces = await _fetchWorkspaces.Invoke(searchText);
|
||||
// NOTE: We shouldn't call PopulateMenu here bc it will reset the search item when search is happening, it borks the state.
|
||||
PopulateModelMenuItems(_menu!, _searchItem!);
|
||||
PopulateModelMenuItems(_menu!, _searchItem);
|
||||
}
|
||||
|
||||
private bool PopulateMenu(ToolStripDropDown menu)
|
||||
@@ -60,7 +61,7 @@ public class WorkspaceMenuHandler
|
||||
_menu = menu;
|
||||
_searchItem = new SearchToolStripMenuItem(menu, Refetch);
|
||||
|
||||
if (Workspaces == null || Workspaces.items.Count == 0)
|
||||
if (Workspaces?.items.Count == 0)
|
||||
{
|
||||
menu.Items.Clear();
|
||||
_searchItem.AddMenuItem("Create a new workspace", (_, _) => _createWorkspace.Invoke());
|
||||
@@ -72,7 +73,7 @@ public class WorkspaceMenuHandler
|
||||
return true;
|
||||
}
|
||||
|
||||
private void PopulateModelMenuItems(ToolStripDropDown menu, SearchToolStripMenuItem searchItem)
|
||||
private void PopulateModelMenuItems(ToolStripDropDown menu, SearchToolStripMenuItem? searchItem)
|
||||
{
|
||||
for (int i = menu.Items.Count - 1; i > 1; i--)
|
||||
{
|
||||
@@ -81,6 +82,12 @@ public class WorkspaceMenuHandler
|
||||
|
||||
if (Workspaces == null)
|
||||
{
|
||||
searchItem?.AddMenuItem(
|
||||
"Personal Projects",
|
||||
(_, _) => OnWorkspaceSelected(null),
|
||||
!IsPersonalProjects,
|
||||
IsPersonalProjects
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,13 +101,6 @@ public class WorkspaceMenuHandler
|
||||
Base64ToImage(workspace.logo)
|
||||
);
|
||||
}
|
||||
|
||||
searchItem?.AddMenuItem(
|
||||
"Personal Projects",
|
||||
(_, _) => OnWorkspaceSelected(null),
|
||||
!IsPersonalProjects,
|
||||
IsPersonalProjects
|
||||
);
|
||||
}
|
||||
|
||||
private void OnWorkspaceSelected(LimitedWorkspace? workspace)
|
||||
@@ -130,7 +130,7 @@ public class WorkspaceMenuHandler
|
||||
WorkspaceContextMenuButton.SetIconOverride(null);
|
||||
WorkspaceContextMenuButton.Name = "Personal Projects";
|
||||
WorkspaceContextMenuButton.NickName = "Personal Projects";
|
||||
WorkspaceContextMenuButton.Description = "Legacy";
|
||||
WorkspaceContextMenuButton.Description = "Legacy"; //Servers that don't have workspaces enabled (e.g. public opensource server (v2.x))
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
+231
@@ -0,0 +1,231 @@
|
||||
using GH_IO.Serialization;
|
||||
using Grasshopper.Kernel;
|
||||
using Grasshopper.Kernel.Parameters;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components;
|
||||
|
||||
/// <summary>
|
||||
/// Base class for passthrough components with "hidden" Application ID parameter.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Users can click ⊕ to add an optional Application ID input and output.
|
||||
/// </remarks>
|
||||
public abstract class SpecklePassthroughComponentBase : SpeckleSolveInstance, IGH_VariableParameterComponent
|
||||
{
|
||||
private const string APP_ID_NAME = "Application Id";
|
||||
private const string APP_ID_NICKNAME = "aID";
|
||||
private const string APP_ID_DESCRIPTION = "The application id of the Speckle objects";
|
||||
|
||||
protected abstract int FixedInputCount { get; }
|
||||
protected abstract int FixedOutputCount { get; }
|
||||
|
||||
private bool HasApplicationIdParam => Params.Input.Count > FixedInputCount;
|
||||
|
||||
protected SpecklePassthroughComponentBase(
|
||||
string name,
|
||||
string nickname,
|
||||
string description,
|
||||
string category,
|
||||
string subCategory
|
||||
)
|
||||
: base(name, nickname, description, category, subCategory) { }
|
||||
|
||||
/// <summary>
|
||||
/// Reads the optional Application Id input. Returns true if user provided a valid value.
|
||||
/// </summary>
|
||||
protected bool TryGetApplicationIdInput(IGH_DataAccess da, out string? applicationId)
|
||||
{
|
||||
applicationId = null;
|
||||
|
||||
if (!HasApplicationIdParam)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string appId = string.Empty;
|
||||
if (da.GetData(FixedInputCount, ref appId))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(appId))
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Warning,
|
||||
"Empty Application Id ignored - existing or auto-generated id will be used"
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
applicationId = appId;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Application Id output (if the parameter exists).
|
||||
/// </summary>
|
||||
protected void SetApplicationIdOutput(IGH_DataAccess da, string? applicationId)
|
||||
{
|
||||
if (!HasApplicationIdParam)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
da.SetData(FixedOutputCount, applicationId);
|
||||
}
|
||||
|
||||
public bool CanInsertParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
// only allow inserting if not yet added
|
||||
if (HasApplicationIdParam)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// only allow at the end position
|
||||
return side switch
|
||||
{
|
||||
GH_ParameterSide.Input => index == FixedInputCount,
|
||||
GH_ParameterSide.Output => index == FixedOutputCount,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
public bool CanRemoveParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
if (!HasApplicationIdParam)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return side switch
|
||||
{
|
||||
GH_ParameterSide.Input => index == FixedInputCount,
|
||||
GH_ParameterSide.Output => index == FixedOutputCount,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// The ternary for NickName handles a Grasshopper quirk where dynamically created parameters
|
||||
/// don't respect the "Draw Full Names" setting automatically.
|
||||
/// </remarks>
|
||||
public IGH_Param CreateParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
// when adding on either side, add both input and output together
|
||||
if (side == GH_ParameterSide.Input && Params.Output.Count == FixedOutputCount)
|
||||
{
|
||||
OnPingDocument()?.ScheduleSolution(5, _ => AddApplicationIdOutput());
|
||||
}
|
||||
else if (side == GH_ParameterSide.Output && Params.Input.Count == FixedInputCount)
|
||||
{
|
||||
OnPingDocument()?.ScheduleSolution(5, _ => AddApplicationIdInput());
|
||||
}
|
||||
|
||||
return CreateApplicationIdParam();
|
||||
}
|
||||
|
||||
public bool DestroyParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
// when removing from either side, remove both input and output together
|
||||
if (side == GH_ParameterSide.Input && index == FixedInputCount && Params.Output.Count > FixedOutputCount)
|
||||
{
|
||||
OnPingDocument()?.ScheduleSolution(5, _ => RemoveApplicationIdOutput());
|
||||
}
|
||||
else if (side == GH_ParameterSide.Output && index == FixedOutputCount && Params.Input.Count > FixedInputCount)
|
||||
{
|
||||
OnPingDocument()?.ScheduleSolution(5, _ => RemoveApplicationIdInput());
|
||||
}
|
||||
|
||||
return side switch
|
||||
{
|
||||
GH_ParameterSide.Input => index == FixedInputCount,
|
||||
GH_ParameterSide.Output => index == FixedOutputCount,
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
public void VariableParameterMaintenance()
|
||||
{
|
||||
// ensure the Application Id input stays optional
|
||||
if (HasApplicationIdParam && Params.Input.Count > FixedInputCount)
|
||||
{
|
||||
Params.Input[FixedInputCount].Optional = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static IGH_Param CreateApplicationIdParam() =>
|
||||
new Param_String
|
||||
{
|
||||
Name = APP_ID_NAME,
|
||||
NickName = Grasshopper.CentralSettings.CanvasFullNames ? APP_ID_NAME : APP_ID_NICKNAME,
|
||||
Description = APP_ID_DESCRIPTION,
|
||||
Access = GH_ParamAccess.item,
|
||||
Optional = true
|
||||
};
|
||||
|
||||
private void AddApplicationIdInput()
|
||||
{
|
||||
if (Params.Input.Count > FixedInputCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Params.RegisterInputParam(CreateApplicationIdParam());
|
||||
Params.OnParametersChanged();
|
||||
VariableParameterMaintenance();
|
||||
ExpireSolution(true);
|
||||
}
|
||||
|
||||
private void AddApplicationIdOutput()
|
||||
{
|
||||
if (Params.Output.Count > FixedOutputCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Params.RegisterOutputParam(CreateApplicationIdParam());
|
||||
Params.OnParametersChanged();
|
||||
ExpireSolution(true);
|
||||
}
|
||||
|
||||
private void RemoveApplicationIdInput()
|
||||
{
|
||||
if (Params.Input.Count <= FixedInputCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Params.UnregisterInputParameter(Params.Input[FixedInputCount]);
|
||||
Params.OnParametersChanged();
|
||||
ExpireSolution(true);
|
||||
}
|
||||
|
||||
private void RemoveApplicationIdOutput()
|
||||
{
|
||||
if (Params.Output.Count <= FixedOutputCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Params.UnregisterOutputParameter(Params.Output[FixedOutputCount]);
|
||||
Params.OnParametersChanged();
|
||||
ExpireSolution(true);
|
||||
}
|
||||
|
||||
public override bool Write(GH_IWriter writer)
|
||||
{
|
||||
var result = base.Write(writer);
|
||||
writer.SetBoolean("HasApplicationIdParam", HasApplicationIdParam);
|
||||
return result;
|
||||
}
|
||||
|
||||
public override bool Read(GH_IReader reader)
|
||||
{
|
||||
var result = base.Read(reader);
|
||||
// parameters are restored by GH serialization, this flag is for reference
|
||||
bool hasAppIdParam = false;
|
||||
reader.TryGetBoolean("HasApplicationIdParam", ref hasAppIdParam);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using Speckle.Connectors.GrasshopperShared.Parameters;
|
||||
using Speckle.Sdk.Models.Collections;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components.Collections;
|
||||
|
||||
/// <summary>
|
||||
/// Shared helper methods for collection components to avoid code duplication
|
||||
/// </summary>
|
||||
public static class CollectionHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a root collection wrapper with default values
|
||||
/// </summary>
|
||||
public static SpeckleCollectionWrapper CreateRootCollection(string instanceGuid) =>
|
||||
new SpeckleCollectionWrapper
|
||||
{
|
||||
Base = new Collection(),
|
||||
Name = "Unnamed",
|
||||
Path = new List<string> { "Unnamed" },
|
||||
Color = null,
|
||||
Material = null,
|
||||
ApplicationId = instanceGuid
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Validates that all application IDs are unique across the entire collection hierarchy.
|
||||
/// </summary>
|
||||
/// <returns>True if duplicates exist, false if all IDs are unique</returns>
|
||||
public static bool HasDuplicateApplicationIds(SpeckleCollectionWrapper rootCollection)
|
||||
{
|
||||
var seenIds = new HashSet<string>();
|
||||
var duplicateIds = new HashSet<string>();
|
||||
|
||||
ProcessAndCheckForDuplicateApplicationIds(rootCollection, seenIds, duplicateIds);
|
||||
|
||||
return duplicateIds.Count > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recursively collects application IDs from all wrappers in the collection hierarchy.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Only checks the wrapper's ApplicationId, not for example geometries within DataObjects.
|
||||
/// </remarks>
|
||||
private static void ProcessAndCheckForDuplicateApplicationIds(
|
||||
SpeckleCollectionWrapper collection,
|
||||
HashSet<string> seenIds,
|
||||
HashSet<string> duplicateIds
|
||||
)
|
||||
{
|
||||
foreach (var element in collection.Elements)
|
||||
{
|
||||
switch (element)
|
||||
{
|
||||
case null:
|
||||
break; // skip nulls (CNX-2855)
|
||||
case SpeckleCollectionWrapper childCollection:
|
||||
// recurse into child collections
|
||||
ProcessAndCheckForDuplicateApplicationIds(childCollection, seenIds, duplicateIds);
|
||||
break;
|
||||
|
||||
case SpeckleWrapper wrapper:
|
||||
if (wrapper.ApplicationId != null && !seenIds.Add(wrapper.ApplicationId))
|
||||
{
|
||||
duplicateIds.Add(wrapper.ApplicationId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recursively checks if collection or any descendants contain valid geometry/data objects
|
||||
/// </summary>
|
||||
public static bool HasAnyValidContent(ISpeckleCollectionObject? element) =>
|
||||
element switch
|
||||
{
|
||||
SpeckleGeometryWrapper => true,
|
||||
SpeckleDataObjectWrapper => true,
|
||||
SpeckleCollectionWrapper collection => collection.Elements.Any(HasAnyValidContent),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connectors.Common;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Connectors.GrasshopperShared.Components.Operations.Receive;
|
||||
using Speckle.Connectors.GrasshopperShared.Components.Operations.Send;
|
||||
@@ -50,6 +51,7 @@ public record SpeckleUrlLatestModelVersionResource(
|
||||
model.name,
|
||||
version.id,
|
||||
version.sourceApplication.NotNull(),
|
||||
HostApplications.Grasshopper.Slug,
|
||||
version.authorUser?.id
|
||||
);
|
||||
|
||||
@@ -65,13 +67,7 @@ public record SpeckleUrlLatestModelVersionResource(
|
||||
await client.Project.Get(ProjectId, cancellationToken).ConfigureAwait(false);
|
||||
await client.Model.Get(ModelId, ProjectId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new GrasshopperSendInfo(
|
||||
client.Account,
|
||||
WorkspaceId,
|
||||
ProjectId,
|
||||
ModelId,
|
||||
"Grasshopper8" // TODO: Grab from the right place!
|
||||
);
|
||||
return new GrasshopperSendInfo(client, WorkspaceId, ProjectId, ModelId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +97,7 @@ public record SpeckleUrlModelVersionResource(
|
||||
model.name,
|
||||
VersionId,
|
||||
version.sourceApplication.NotNull(),
|
||||
HostApplications.Grasshopper.Slug,
|
||||
version.authorUser?.id
|
||||
);
|
||||
|
||||
@@ -116,13 +113,7 @@ public record SpeckleUrlModelVersionResource(
|
||||
await client.Project.Get(ProjectId, cancellationToken).ConfigureAwait(false);
|
||||
await client.Model.Get(ModelId, ProjectId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return new GrasshopperSendInfo(
|
||||
client.Account,
|
||||
WorkspaceId,
|
||||
ProjectId,
|
||||
ModelId,
|
||||
"Grasshopper8" // TODO: Grab from the right place!
|
||||
);
|
||||
return new GrasshopperSendInfo(client, WorkspaceId, ProjectId, ModelId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ public class GrasshopperReceiveOperation
|
||||
.ConfigureAwait(false);
|
||||
|
||||
await apiClient
|
||||
.Version.Received(new(version.id, receiveInfo.ProjectId, receiveInfo.SourceApplication), cancellationToken)
|
||||
.Version.Received(new(version.id, receiveInfo.ProjectId, receiveInfo.ReceivingApplicationSlug), cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
return commitObject;
|
||||
}
|
||||
|
||||
+8
@@ -225,6 +225,14 @@ internal sealed class LocalToGlobalMapHandler
|
||||
|
||||
var entry = _dataObjectInstanceRegistry.GetEntries()[dataObjectId];
|
||||
var resolvedGeometries = ResolveInstanceProxiesToGeometries(entry.InstanceProxies);
|
||||
|
||||
var primitiveConverted = dataObject
|
||||
.displayValue.Where(item => item is not InstanceProxy)
|
||||
.SelectMany(item => SpeckleConversionContext.Current.ConvertToHost(item))
|
||||
.ToList();
|
||||
|
||||
resolvedGeometries.AddRange(ConvertToGeometryWrappers(primitiveConverted));
|
||||
|
||||
var dataObjectWrapper = CreateDataObjectWrapper(dataObject, resolvedGeometries, path, objectCollection);
|
||||
|
||||
CollectionRebuilder.AppendSpeckleGrasshopperObject(dataObjectWrapper, path, _colorUnpacker, _materialUnpacker);
|
||||
|
||||
+3
@@ -14,6 +14,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\BaseComponents\ValueSet.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\BaseComponents\VariableParameterComponentBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Collections\CollectionPathsSelector.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Collections\CollectionsByName.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Collections\CreateCollection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Collections\ExpandCollection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Objects\ExpandSpeckleProperties.cs" />
|
||||
@@ -41,7 +42,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Operations\Wizard\VersionMenuHandler.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Operations\Wizard\WorkspaceMenuHandler.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\Operations\Wizard\SpeckleOperationWizard.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\SpecklePassthroughComponentBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Components\SpeckleSolveInstance.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CollectionHelpers.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Extras\StateTag.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\KeyWatcher.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\GrasshopperBlockUnpacker.cs" />
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user