Compare commits
191 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d174597770 | |||
| d9289787b7 | |||
| 77c1c3b511 | |||
| 5a1c542832 | |||
| 091d7cc897 | |||
| 21f4fb52a8 | |||
| 656ed709f3 | |||
| 868ca8db66 | |||
| a9360e5fac | |||
| 3414599f72 | |||
| 84e92aa8a8 | |||
| edd842763f | |||
| 867ee0f928 | |||
| 29ee648d7f | |||
| 5b9c610856 | |||
| 769ddf6407 | |||
| dd7205f855 | |||
| 30ee410309 | |||
| 2d0b1a3a24 | |||
| 2cdf036172 | |||
| c14aa28e76 | |||
| 0e7d2554f8 | |||
| cdfc618bab | |||
| 1005edb609 | |||
| 3b4da8de52 | |||
| 58c6370cda | |||
| 0e72adba36 | |||
| d5084dc334 | |||
| 0aeecfd00a | |||
| 9ceb5621bc | |||
| 94c1d4921e | |||
| a4ff20106c | |||
| 289e25be6c | |||
| edebc8e98f | |||
| 8c21e2362b | |||
| 5d40645aef | |||
| b5ad4ac32f | |||
| 2a2801eced | |||
| 6289565f66 | |||
| 8ed6eebc2c | |||
| 58afaecce2 | |||
| 93c6df41fd | |||
| f3bcb55d8a | |||
| 0f32cb3c6d | |||
| f948417e31 | |||
| 2ddd96ebea | |||
| 06fd46a7e3 | |||
| 333ef4bb71 | |||
| 2c13c4ff79 | |||
| 4bf7fc9ce1 | |||
| 7e0014bdcc | |||
| b695a95032 | |||
| fa1a6d0ac2 | |||
| a42c8bd825 | |||
| 9ef3768845 | |||
| 94f04c9aeb | |||
| 0dcd9b2626 | |||
| 475a76f765 | |||
| b79c547027 | |||
| f09e60fe02 | |||
| b708d2d265 | |||
| 66302f5ab3 | |||
| 7f343596fc | |||
| 3f74a7aa3e | |||
| d63b6604fc | |||
| 66c73e17bf | |||
| f03c4c00a3 | |||
| 607c5dc58d | |||
| dc94724800 | |||
| 62835613e6 | |||
| 6f88da92bb | |||
| 083548b33c | |||
| 20bc675ad2 | |||
| fe3d4e5544 | |||
| ff5cdf47df | |||
| c04cdacef9 | |||
| ee32f320ee | |||
| 57ede4cabd | |||
| dc575a9f78 | |||
| 41e1faf655 | |||
| e4b26c92fd | |||
| 12ea8a4597 | |||
| 0023ab1622 | |||
| c5a6208f7e | |||
| 35a185c65f | |||
| 1796cacee6 | |||
| 9f99cb593f | |||
| df4c065dfe | |||
| edb022f7c5 | |||
| 27a7d72de3 | |||
| 678f113d05 | |||
| 92da66bbbb | |||
| 79a5228899 | |||
| 4d9411de42 | |||
| 3780747992 | |||
| 4514b1b831 | |||
| 2bbbbf6204 | |||
| e1b5dea3f7 | |||
| 2d2c274030 | |||
| 81dd72a281 | |||
| b82349478c | |||
| 7d0690f7a0 | |||
| 62a0cb895d | |||
| f28ce73d33 | |||
| 15425c5328 | |||
| 7c645e3c51 | |||
| 795d068175 | |||
| 90c2bd2873 | |||
| bd7a3c7c43 | |||
| ea976309bc | |||
| 1b5787274a | |||
| 7e595deabc | |||
| 66091b2b73 | |||
| 4f8d8d4f07 | |||
| 4fba12f966 | |||
| 348975c33d | |||
| cd6888868e | |||
| f2d4e64005 | |||
| a92b88f6d3 | |||
| abfdbdeffa | |||
| efe66e7e98 | |||
| c3fa1bb0dc | |||
| e487981e5b | |||
| 9a6dda629b | |||
| 46e7d6e432 | |||
| b9f4845fa7 | |||
| 36863efc5a | |||
| a0ce883a3f | |||
| bc0fe17d08 | |||
| 2e52409db6 | |||
| f434cde7b3 | |||
| 3e596cac29 | |||
| 876d5c1bfe | |||
| 3424de9130 | |||
| 279e900105 | |||
| ac7398be49 | |||
| 0bfeef637b | |||
| 0b5984b410 | |||
| ad1b6fd74c | |||
| f1f17eea3d | |||
| 642607acad | |||
| 7f3b23e71e | |||
| d2ed8d3ea9 | |||
| 1d8f9dd97f | |||
| a7c82c4958 | |||
| 81555d1657 | |||
| 9b0a6c3202 | |||
| 2aee54e8c7 | |||
| e3248efeb4 | |||
| 35bbf2d6c9 | |||
| 4129b1a579 | |||
| ef90a94c34 | |||
| 71df86750c | |||
| 7f2649a5dd | |||
| de662e4a2b | |||
| 2cb7211734 | |||
| 82c84bee97 | |||
| 3e6ceb3546 | |||
| 2d13849b2c | |||
| 952d95851a | |||
| 84fc2801ef | |||
| 07f272f453 | |||
| 8085065027 | |||
| 31e26ca9d0 | |||
| 088cbb3b97 | |||
| 57fd7de027 | |||
| 85fc828036 | |||
| c288ea0088 | |||
| 81924e2027 | |||
| c9b637b92e | |||
| 4779d406b8 | |||
| a945e35a2a | |||
| 509d3275af | |||
| c562190973 | |||
| e7ee172f90 | |||
| d49b1eea33 | |||
| d8afd74171 | |||
| b88f50ced6 | |||
| e130045930 | |||
| ae72cc3adb | |||
| 816539ce18 | |||
| c6cdb0d893 | |||
| dd026e24a3 | |||
| 76015ed30c | |||
| b9fbf60df5 | |||
| 50d69a0f0e | |||
| 2f8477e072 | |||
| 973a91ac5a | |||
| 60a39b775c | |||
| f84b5e7c90 | |||
| 5e93f23d06 |
+16
-30
@@ -1,39 +1,21 @@
|
||||
name: .NET Build
|
||||
name: .NET Test
|
||||
|
||||
on: pull_request
|
||||
on:
|
||||
pull_request: {}
|
||||
push:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
|
||||
|
||||
- name: Cache Nuget
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
|
||||
- name: ⚒️ Run build
|
||||
run: ./build.ps1 test
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
|
||||
|
||||
@@ -43,14 +25,18 @@ jobs:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
|
||||
- name: ⚒️ Run Build on Linux
|
||||
run: ./build.sh build-linux
|
||||
|
||||
- name: ⚒️ Run tests
|
||||
run: ./build.sh test-only
|
||||
- name: ⚒️ Run Test
|
||||
run: ./build.sh test-and-pack
|
||||
|
||||
- name: Upload coverage reports to Codecov with GitHub Action
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: Converters/**/coverage.xml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
# Disabling this code for now, since we no longer need to publish nugets from this repo
|
||||
# But keeping it around incase we ever need in the future.
|
||||
# Ideally, I'd also like to move the nuget token to be an environment secret, and to have tight package scopes
|
||||
# - name: Push to nuget.org
|
||||
# if: ${{ inputs.deployNugets }}
|
||||
# run: dotnet nuget push output/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.CONNECTORS_NUGET_TOKEN }}
|
||||
|
||||
@@ -6,8 +6,8 @@ on:
|
||||
tags: ["v3.*.*"] # Manual delivery on every 3.x tag
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
build-connectors:
|
||||
runs-on: windows-latest # Keeping on windows for now, for cross platform building of exe projects, we need to use dotnet publish
|
||||
env:
|
||||
SEMVER: "unset"
|
||||
FILE_VERSION: "unset"
|
||||
@@ -16,12 +16,12 @@ jobs:
|
||||
file_version: ${{ steps.set-version.outputs.file_version }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
|
||||
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
|
||||
- name: ⚒️ Run build on Windows
|
||||
- name: ⚒️ Run build and zip connectors
|
||||
run: ./build.ps1 zip
|
||||
|
||||
- name: ⬆️ Upload artifacts
|
||||
@@ -48,10 +48,10 @@ jobs:
|
||||
run: |
|
||||
echo "semver=${{ env.SEMVER }}" >> "$Env:GITHUB_OUTPUT"
|
||||
echo "file_version=${{ env.FILE_VERSION }}" >> "$Env:GITHUB_OUTPUT"
|
||||
|
||||
|
||||
deploy-installers:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-windows
|
||||
needs: build-connectors
|
||||
env:
|
||||
IS_PUBLIC_RELEASE: ${{ github.ref_type == 'tag' }}
|
||||
steps:
|
||||
@@ -63,8 +63,8 @@ jobs:
|
||||
token: ${{ secrets.CONNECTORS_GH_TOKEN }}
|
||||
inputs: '{
|
||||
"run_id": "${{ github.run_id }}",
|
||||
"semver": "${{ needs.build-windows.outputs.semver }}",
|
||||
"file_version": "${{ needs.build-windows.outputs.file_version }}",
|
||||
"semver": "${{ needs.build-connectors.outputs.semver }}",
|
||||
"file_version": "${{ needs.build-connectors.outputs.file_version }}",
|
||||
"repo": "${{ github.repository }}",
|
||||
"is_public_release": ${{ env.IS_PUBLIC_RELEASE }}
|
||||
}'
|
||||
@@ -74,42 +74,8 @@ jobs:
|
||||
wait-for-completion-timeout: 10m
|
||||
display-workflow-run-url: true
|
||||
display-workflow-run-url-interval: 10s
|
||||
|
||||
|
||||
# Allows us to inspect the artifacts of failed builds, since this below step will be skipped if the above step fails
|
||||
- uses: geekyeggo/delete-artifact@v5
|
||||
with:
|
||||
name: output-*
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 8.0.4xx # Align with global.json (including roll forward rules)
|
||||
|
||||
- name: Cache Nuget
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.nuget/packages
|
||||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
|
||||
|
||||
- name: ⚒️ Run tests on Linux
|
||||
run: ./build.sh test-only
|
||||
|
||||
- name: ⚒️ Run Build and Pack on Linux
|
||||
run: ./build.sh build-linux
|
||||
|
||||
- name: Upload coverage reports to Codecov with GitHub Action
|
||||
uses: codecov/codecov-action@v5
|
||||
with:
|
||||
files: Converters/**/coverage.xml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
|
||||
- name: Push to nuget.org
|
||||
if: (github.ref_type == 'tag')
|
||||
run: dotnet nuget push output/*.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{secrets.CONNECTORS_NUGET_TOKEN }} --skip-duplicate
|
||||
|
||||
+2
-1
@@ -69,7 +69,8 @@ public static class Consts
|
||||
new("Connectors/CSi/Speckle.Connectors.ETABS21", "net48"),
|
||||
new("Connectors/CSi/Speckle.Connectors.ETABS22", "net8.0-windows"),
|
||||
]
|
||||
)
|
||||
),
|
||||
new("rhino-importer", [new("Importers/Rhino/Speckle.Importers.JobProcessor", "net8.0-windows")]),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+17
-21
@@ -7,9 +7,9 @@ using static SimpleExec.Command;
|
||||
const string CLEAN = "clean";
|
||||
const string RESTORE = "restore";
|
||||
const string BUILD = "build";
|
||||
const string BUILD_LINUX = "build-linux";
|
||||
const string PACK = "pack";
|
||||
const string TEST_AFFECTED = "test-affected";
|
||||
const string TEST = "test";
|
||||
const string TEST_ONLY = "test-only";
|
||||
const string FORMAT = "format";
|
||||
const string ZIP = "zip";
|
||||
const string RESTORE_TOOLS = "restore-tools";
|
||||
@@ -19,6 +19,7 @@ const string GEN_SOLUTIONS = "generate-solutions";
|
||||
const string DEEP_CLEAN = "deep-clean";
|
||||
const string DEEP_CLEAN_LOCAL = "deep-clean-local";
|
||||
const string DETECT_AFFECTED = "detect-affected";
|
||||
const string TEST_AND_PACK = "test-and-pack";
|
||||
|
||||
//need to pass arguments
|
||||
/*var arguments = new List<string>();
|
||||
@@ -150,7 +151,7 @@ Target(
|
||||
|
||||
Target(
|
||||
RESTORE,
|
||||
DependsOn(FORMAT, DETECT_AFFECTED),
|
||||
DependsOn(FORMAT),
|
||||
Consts.Solutions,
|
||||
async s =>
|
||||
{
|
||||
@@ -181,8 +182,8 @@ Target(CHECK_SOLUTIONS, Solutions.CompareConnectorsToLocal);
|
||||
Target(GEN_SOLUTIONS, Solutions.GenerateSolutions);
|
||||
|
||||
Target(
|
||||
TEST,
|
||||
DependsOn(BUILD, CHECK_SOLUTIONS),
|
||||
TEST_AFFECTED,
|
||||
DependsOn(DETECT_AFFECTED, BUILD, CHECK_SOLUTIONS),
|
||||
async () =>
|
||||
{
|
||||
foreach (var s in await Affected.GetTestProjects())
|
||||
@@ -192,14 +193,12 @@ Target(
|
||||
}
|
||||
);
|
||||
|
||||
//all tests on purpose
|
||||
Target(
|
||||
TEST_ONLY,
|
||||
DependsOn(FORMAT),
|
||||
TEST,
|
||||
DependsOn(BUILD, CHECK_SOLUTIONS),
|
||||
Glob.Files(".", "**/*.Tests.csproj"),
|
||||
file =>
|
||||
{
|
||||
Run("dotnet", $"build \"{file}\" -c Release --no-incremental");
|
||||
Run(
|
||||
"dotnet",
|
||||
$"test \"{file}\" -c Release --no-build --verbosity=minimal /p:AltCover=true /p:AltCoverAttributeFilter=ExcludeFromCodeCoverage /p:AltCoverVerbosity=Warning"
|
||||
@@ -207,31 +206,28 @@ Target(
|
||||
}
|
||||
);
|
||||
|
||||
Target(TEST_AND_PACK, DependsOn(TEST, PACK));
|
||||
|
||||
Target(
|
||||
BUILD_LINUX,
|
||||
DependsOn(FORMAT),
|
||||
Glob.Files(".", "**/Speckle.Importers.Ifc.csproj"),
|
||||
async file =>
|
||||
PACK,
|
||||
DependsOn(BUILD),
|
||||
Consts.Solutions,
|
||||
async solution =>
|
||||
{
|
||||
await RunAsync("dotnet", $"restore \"{file}\" --locked-mode");
|
||||
var version = await Versions.ComputeVersion();
|
||||
var fileVersion = await Versions.ComputeFileVersion();
|
||||
Console.WriteLine($"Version: {version} & {fileVersion}");
|
||||
await RunAsync(
|
||||
"dotnet",
|
||||
$"build \"{file}\" -c Release --no-restore -warnaserror -p:Version={version} -p:FileVersion={fileVersion} -v:m"
|
||||
);
|
||||
|
||||
await RunAsync(
|
||||
"dotnet",
|
||||
$"pack \"{file}\" -c Release -o output --no-build -p:Version={version} -p:FileVersion={fileVersion} -v:m"
|
||||
$"pack \"{solution}\" -c Release -o output --no-build -p:Version={version} -p:FileVersion={fileVersion} -v:m"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
Target(
|
||||
ZIP,
|
||||
DependsOn(TEST),
|
||||
DependsOn(TEST_AFFECTED),
|
||||
async () =>
|
||||
{
|
||||
var version = await Versions.ComputeVersion();
|
||||
@@ -282,6 +278,6 @@ Target(
|
||||
}
|
||||
);
|
||||
|
||||
Target("default", DependsOn(TEST), () => Console.WriteLine("Done!"));
|
||||
Target("default", DependsOn(TEST_AFFECTED), () => Console.WriteLine("Done!"));
|
||||
|
||||
await RunTargetsAndExitAsync(args).ConfigureAwait(true);
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -292,7 +292,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -336,18 +336,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -357,14 +357,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -292,7 +292,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -336,18 +336,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -357,14 +357,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -293,7 +293,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,9 +210,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -244,7 +244,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -288,18 +288,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -307,14 +307,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
"net8.0-windows7.0/win-x64": {
|
||||
|
||||
@@ -210,9 +210,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -244,7 +244,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -288,18 +288,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -307,14 +307,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
"net8.0-windows7.0/win-x64": {
|
||||
|
||||
+12
-21
@@ -60,7 +60,7 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
)]
|
||||
public Task<RootObjectBuilderResult> Build(
|
||||
IReadOnlyList<AutocadRootObject> objects,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
@@ -95,28 +95,19 @@ public abstract class AutocadRootObjectBaseBuilder : IRootObjectBuilder<AutocadR
|
||||
foreach (var (entity, applicationId) in atomicObjects)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using (var convertActivity = _activityFactory.Start("Converting object"))
|
||||
// Create and add a collection for this entity if not done so already.
|
||||
(Collection objectCollection, LayerTableRecord? autocadLayer) = CreateObjectCollection(entity, tr);
|
||||
|
||||
if (autocadLayer is not null)
|
||||
{
|
||||
// Create and add a collection for this entity if not done so already.
|
||||
(Collection objectCollection, LayerTableRecord? autocadLayer) = CreateObjectCollection(entity, tr);
|
||||
|
||||
if (autocadLayer is not null)
|
||||
{
|
||||
usedAcadLayers.Add(autocadLayer);
|
||||
root.elements.Add(objectCollection);
|
||||
}
|
||||
|
||||
var result = ConvertAutocadEntity(
|
||||
entity,
|
||||
applicationId,
|
||||
objectCollection,
|
||||
instanceProxies,
|
||||
sendInfo.ProjectId
|
||||
);
|
||||
results.Add(result);
|
||||
|
||||
onOperationProgressed.Report(new("Converting", (double)++count / atomicObjects.Count));
|
||||
usedAcadLayers.Add(autocadLayer);
|
||||
root.elements.Add(objectCollection);
|
||||
}
|
||||
|
||||
var result = ConvertAutocadEntity(entity, applicationId, objectCollection, instanceProxies, projectId);
|
||||
results.Add(result);
|
||||
|
||||
onOperationProgressed.Report(new("Converting", (double)++count / atomicObjects.Count));
|
||||
}
|
||||
|
||||
if (results.All(x => x.Status == Status.ERROR))
|
||||
|
||||
+9
@@ -3,6 +3,15 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{41BC679F-887F-44CF-971D-A5502EE87DB0}</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Local|AnyCPU' ">
|
||||
<OutputPath>bin\Local\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
|
||||
Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"/>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props"/>
|
||||
|
||||
@@ -268,9 +268,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -302,7 +302,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -346,18 +346,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -367,14 +367,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,9 +268,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -302,7 +302,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -346,18 +346,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -367,14 +367,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,9 +268,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -302,7 +302,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -346,18 +346,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -367,14 +367,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,9 +219,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -254,7 +254,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -298,18 +298,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -317,14 +317,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
"net8.0-windows7.0/win-x64": {
|
||||
|
||||
@@ -219,9 +219,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -254,7 +254,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"Microsoft.Extensions.DependencyInjection": {
|
||||
@@ -298,18 +298,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -317,14 +317,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
"net8.0-windows7.0/win-x64": {
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CsiSharedSelectionBinding : ISelectionBinding, IDisposable
|
||||
var typeKey = (ModelObjectType)objectType[i];
|
||||
var typeName = typeKey.ToString();
|
||||
encodedIds.Add(ObjectIdentifier.Encode(objectType[i], objectName[i]));
|
||||
typeCounts[typeName] = (typeCounts.TryGetValue(typeName, out var count) ? count : 0) + 1; // NOTE: Cross-framework compatibility (net 48 and net8)
|
||||
typeCounts[typeName] = (typeCounts.TryGetValue(typeName, out var count) ? count : 0) + 1;
|
||||
}
|
||||
var summary =
|
||||
encodedIds.Count == 0
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connectors.Common.Cancellation;
|
||||
using Speckle.Connectors.CSiShared.HostApp;
|
||||
using Speckle.Connectors.CSiShared.Operations.Send.Settings;
|
||||
using Speckle.Connectors.CSiShared.Settings;
|
||||
using Speckle.Connectors.CSiShared.Utils;
|
||||
using Speckle.Connectors.DUI.Bindings;
|
||||
using Speckle.Connectors.DUI.Bridge;
|
||||
@@ -23,6 +25,7 @@ public sealed class CsiSharedSendBinding : ISendBinding
|
||||
private readonly ICsiApplicationService _csiApplicationService;
|
||||
private readonly ICsiConversionSettingsFactory _csiConversionSettingsFactory;
|
||||
private readonly ISendOperationManagerFactory _sendOperationManagerFactory;
|
||||
private readonly ToSpeckleSettingsManager _toSpeckleSettingsManager;
|
||||
|
||||
public CsiSharedSendBinding(
|
||||
IBrowserBridge parent,
|
||||
@@ -30,7 +33,8 @@ public sealed class CsiSharedSendBinding : ISendBinding
|
||||
ICancellationManager cancellationManager,
|
||||
ICsiConversionSettingsFactory csiConversionSettingsFactory,
|
||||
ICsiApplicationService csiApplicationService,
|
||||
ISendOperationManagerFactory sendOperationManagerFactory
|
||||
ISendOperationManagerFactory sendOperationManagerFactory,
|
||||
ToSpeckleSettingsManager toSpeckleSettingsManager
|
||||
)
|
||||
{
|
||||
_sendFilters = sendFilters.ToList();
|
||||
@@ -40,11 +44,13 @@ public sealed class CsiSharedSendBinding : ISendBinding
|
||||
_csiConversionSettingsFactory = csiConversionSettingsFactory;
|
||||
_csiApplicationService = csiApplicationService;
|
||||
_sendOperationManagerFactory = sendOperationManagerFactory;
|
||||
_toSpeckleSettingsManager = toSpeckleSettingsManager;
|
||||
}
|
||||
|
||||
public List<ISendFilter> GetSendFilters() => _sendFilters;
|
||||
|
||||
public List<ICardSetting> GetSendSettings() => [];
|
||||
public List<ICardSetting> GetSendSettings() =>
|
||||
[new LoadCaseCombinationSetting([], _csiApplicationService.SapModel), new ResultTypeSetting([])];
|
||||
|
||||
public async Task Send(string modelCardId)
|
||||
{
|
||||
@@ -52,9 +58,17 @@ public sealed class CsiSharedSendBinding : ISendBinding
|
||||
await manager.Process(
|
||||
Commands,
|
||||
modelCardId,
|
||||
(sp, _) =>
|
||||
(sp, card) =>
|
||||
{
|
||||
sp.GetRequiredService<IConverterSettingsStore<CsiConversionSettings>>()
|
||||
.Initialize(_csiConversionSettingsFactory.Create(_csiApplicationService.SapModel)),
|
||||
.Initialize(
|
||||
_csiConversionSettingsFactory.Create(
|
||||
_csiApplicationService.SapModel,
|
||||
_toSpeckleSettingsManager.GetLoadCasesAndCombinations(card),
|
||||
_toSpeckleSettingsManager.GetResultTypes(card)
|
||||
)
|
||||
);
|
||||
},
|
||||
card => card.SendFilter.NotNull().RefreshObjectIds().Select(DecodeObjectIdentifier).ToList()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,11 @@ public class CsiDocumentModelStore : DocumentModelStore, IDisposable
|
||||
_speckleApplication.Slug
|
||||
);
|
||||
DocumentStateFile = Path.Combine(HostAppUserDataPath, $"{ModelPathHash}.json");
|
||||
_logger.LogDebug($"Paths set - Hash: {ModelPathHash}, File: {DocumentStateFile}");
|
||||
_logger.LogDebug(
|
||||
"Paths set - Hash: {ModelPathHash}, File: {DocumentStateFile}",
|
||||
ModelPathHash,
|
||||
DocumentStateFile
|
||||
);
|
||||
}
|
||||
catch (Exception ex) when (!ex.IsFatal())
|
||||
{
|
||||
|
||||
+13
-55
@@ -20,23 +20,8 @@ public class CsiFrameSectionPropertyExtractor : IFrameSectionPropertyExtractor
|
||||
_settingsStore = settingsStore;
|
||||
}
|
||||
|
||||
public void ExtractProperties(string sectionName, Dictionary<string, object?> properties)
|
||||
{
|
||||
GetMaterialName(sectionName, properties);
|
||||
public void ExtractProperties(string sectionName, Dictionary<string, object?> properties) =>
|
||||
GetSectionProperties(sectionName, properties);
|
||||
GetPropertyModifiers(sectionName, properties);
|
||||
}
|
||||
|
||||
private void GetMaterialName(string sectionName, Dictionary<string, object?> properties)
|
||||
{
|
||||
// get material name
|
||||
string materialName = string.Empty;
|
||||
_settingsStore.Current.SapModel.PropFrame.GetMaterial(sectionName, ref materialName);
|
||||
|
||||
// append to General Data of properties dictionary
|
||||
Dictionary<string, object?> generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
|
||||
generalData["Material"] = materialName;
|
||||
}
|
||||
|
||||
private void GetSectionProperties(string sectionName, Dictionary<string, object?> properties)
|
||||
{
|
||||
@@ -69,47 +54,20 @@ public class CsiFrameSectionPropertyExtractor : IFrameSectionPropertyExtractor
|
||||
ref radiusOfGyrationAboutMinorAxis
|
||||
);
|
||||
|
||||
string distanceUnit = _settingsStore.Current.SpeckleUnits;
|
||||
string areaUnit = $"{distanceUnit}²"; // // TODO: Formalize this better
|
||||
string modulusUnit = $"{distanceUnit}³"; // // TODO: Formalize this better
|
||||
string inertiaUnit = $"{distanceUnit}\u2074"; // TODO: Formalize this better
|
||||
|
||||
Dictionary<string, object?> mechanicalProperties = properties.EnsureNested(
|
||||
SectionPropertyCategory.SECTION_PROPERTIES
|
||||
);
|
||||
mechanicalProperties.AddWithUnits("Area", crossSectionalArea, areaUnit);
|
||||
mechanicalProperties.AddWithUnits("As2", shearAreaInMajorAxisDirection, areaUnit);
|
||||
mechanicalProperties.AddWithUnits("As3", shearAreaInMinorAxisDirection, areaUnit);
|
||||
mechanicalProperties.AddWithUnits("J", torsionalConstant, inertiaUnit);
|
||||
mechanicalProperties.AddWithUnits("I22", momentOfInertiaAboutMajorAxis, inertiaUnit);
|
||||
mechanicalProperties.AddWithUnits("I33", momentOfInertiaAboutMinorAxis, inertiaUnit);
|
||||
mechanicalProperties.AddWithUnits("S22", sectionModulusAboutMajorAxis, modulusUnit);
|
||||
mechanicalProperties.AddWithUnits("S33", sectionModulusAboutMinorAxis, modulusUnit);
|
||||
mechanicalProperties.AddWithUnits("Z22", plasticModulusAboutMajorAxis, modulusUnit);
|
||||
mechanicalProperties.AddWithUnits("Z33", plasticModulusAboutMinorAxis, modulusUnit);
|
||||
mechanicalProperties.AddWithUnits("R22", radiusOfGyrationAboutMajorAxis, distanceUnit);
|
||||
mechanicalProperties.AddWithUnits("R33", radiusOfGyrationAboutMinorAxis, distanceUnit);
|
||||
}
|
||||
|
||||
private void GetPropertyModifiers(string sectionName, Dictionary<string, object?> properties)
|
||||
{
|
||||
double[] stiffnessModifiersArray = [];
|
||||
_settingsStore.Current.SapModel.PropFrame.GetModifiers(sectionName, ref stiffnessModifiersArray);
|
||||
|
||||
Dictionary<string, object?> modifiers =
|
||||
new()
|
||||
{
|
||||
["Cross-section (Axial) Area"] = stiffnessModifiersArray[0],
|
||||
["Shear Area in 2 Direction"] = stiffnessModifiersArray[1],
|
||||
["Shear Area in 3 Direction"] = stiffnessModifiersArray[2],
|
||||
["Torsional Constant"] = stiffnessModifiersArray[3],
|
||||
["Moment of Inertia about 2 Axis"] = stiffnessModifiersArray[4],
|
||||
["Moment of Inertia about 3 Axis"] = stiffnessModifiersArray[5],
|
||||
["Mass"] = stiffnessModifiersArray[6],
|
||||
["Weight"] = stiffnessModifiersArray[7],
|
||||
};
|
||||
|
||||
Dictionary<string, object?> generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
|
||||
generalData["Modifiers"] = modifiers;
|
||||
mechanicalProperties.Add("Area", crossSectionalArea);
|
||||
mechanicalProperties.Add("As2", shearAreaInMajorAxisDirection);
|
||||
mechanicalProperties.Add("As3", shearAreaInMinorAxisDirection);
|
||||
mechanicalProperties.Add("J", torsionalConstant);
|
||||
mechanicalProperties.Add("I22", momentOfInertiaAboutMajorAxis);
|
||||
mechanicalProperties.Add("I33", momentOfInertiaAboutMinorAxis);
|
||||
mechanicalProperties.Add("S22", sectionModulusAboutMajorAxis);
|
||||
mechanicalProperties.Add("S33", sectionModulusAboutMinorAxis);
|
||||
mechanicalProperties.Add("Z22", plasticModulusAboutMajorAxis);
|
||||
mechanicalProperties.Add("Z33", plasticModulusAboutMinorAxis);
|
||||
mechanicalProperties.Add("R22", radiusOfGyrationAboutMajorAxis);
|
||||
mechanicalProperties.Add("R33", radiusOfGyrationAboutMinorAxis);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-7
@@ -11,7 +11,7 @@ namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
/// Currently, all material property extraction can happen on a CsiShared level which simplifies things a lot.
|
||||
/// Properties depend on the directional symmetry of the material, hence the switch statements.
|
||||
/// </remarks>
|
||||
public class CsiMaterialPropertyExtractor
|
||||
public class CsiMaterialPropertyExtractor : IMaterialPropertyExtractor
|
||||
{
|
||||
/// <summary>
|
||||
/// Property strings for all mechanical properties, used by numerous methods.
|
||||
@@ -35,11 +35,11 @@ public class CsiMaterialPropertyExtractor
|
||||
_settingsStore = settingsStore;
|
||||
}
|
||||
|
||||
public void ExtractProperties(string materialName, Dictionary<string, object?> properties)
|
||||
public void ExtractProperties(string name, Dictionary<string, object?> properties)
|
||||
{
|
||||
GetGeneralProperties(materialName, properties);
|
||||
GetWeightAndMassProperties(materialName, properties); // TODO: Add units
|
||||
GetMechanicalProperties(materialName, properties); // TODO: Add units
|
||||
GetGeneralProperties(name, properties);
|
||||
GetWeightAndMassProperties(name, properties);
|
||||
GetMechanicalProperties(name, properties);
|
||||
}
|
||||
|
||||
private void GetGeneralProperties(string materialName, Dictionary<string, object?> properties)
|
||||
@@ -76,7 +76,7 @@ public class CsiMaterialPropertyExtractor
|
||||
ref massPerUnitVolume
|
||||
);
|
||||
|
||||
var weightAndMass = properties.EnsureNested("Weight and Mass");
|
||||
var weightAndMass = properties.EnsureNested(SectionPropertyCategory.WEIGHT_AND_MASS);
|
||||
weightAndMass["Weight per Unit Volume"] = weightPerUnitVolume;
|
||||
weightAndMass["Mass per Unit Volume"] = massPerUnitVolume;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ public class CsiMaterialPropertyExtractor
|
||||
_ => throw new ArgumentException($"Unknown symmetry type: {materialDirectionalSymmetryKey}")
|
||||
};
|
||||
|
||||
var mechanicalProperties = properties.EnsureNested("Mechanical Properties");
|
||||
var mechanicalProperties = properties.EnsureNested(SectionPropertyCategory.MECHANICAL_DATA);
|
||||
mechanicalProperties["Directional Symmetry Type"] = materialDirectionalSymmetryValue.ToString();
|
||||
|
||||
GetMechanicalPropertiesByType(materialName, materialDirectionalSymmetryValue, mechanicalProperties);
|
||||
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Converters.CSiShared.ToSpeckle.Helpers;
|
||||
using Speckle.Converters.CSiShared.Utils;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
|
||||
public class CsiResultsExtractorFactory
|
||||
{
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
public CsiResultsExtractorFactory(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public IApplicationResultsExtractor GetExtractor(string resultsKey) =>
|
||||
resultsKey switch
|
||||
{
|
||||
ResultsKey.BASE_REACT => _serviceProvider.GetRequiredService<CsiBaseReactResultsExtractor>(),
|
||||
ResultsKey.FRAME_FORCES => _serviceProvider.GetRequiredService<CsiFrameForceResultsExtractor>(),
|
||||
ResultsKey.JOINT_REACT => _serviceProvider.GetRequiredService<CsiJointReactResultsExtractor>(),
|
||||
ResultsKey.MODAL_PERIOD => _serviceProvider.GetRequiredService<CsiModalPeriodExtractor>(),
|
||||
ResultsKey.PIER_FORCES => _serviceProvider.GetRequiredService<CsiPierForceResultsExtractor>(),
|
||||
ResultsKey.SPANDREL_FORCES => _serviceProvider.GetRequiredService<CsiSpandrelForceResultsExtractor>(),
|
||||
ResultsKey.STORY_DRIFTS => _serviceProvider.GetRequiredService<CsiStoryDriftsResultsExtractor>(),
|
||||
ResultsKey.STORY_FORCES => _serviceProvider.GetRequiredService<CsiStoryForceResultsExtractor>(),
|
||||
_ => throw new InvalidOperationException($"{resultsKey} not accounted for in CsiResultsExtractorFactory")
|
||||
};
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Contract for host application specific material property extraction.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Mirrors property extraction system pattern by composing with base extractor.
|
||||
/// Enables both shared and application-specific property extraction in one call.
|
||||
/// </remarks>
|
||||
public interface IApplicationMaterialPropertyExtractor
|
||||
{
|
||||
void ExtractProperties(string name, Dictionary<string, object?> properties);
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Core contract for material property extraction common across CSi products.
|
||||
/// </summary>
|
||||
public interface IMaterialPropertyExtractor
|
||||
{
|
||||
void ExtractProperties(string name, Dictionary<string, object?> properties);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Speckle.Sdk.Models.Proxies;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
|
||||
// NOTE: Interface because Etabs and Sap2000 material unpacking and extraction is different.
|
||||
// At ServiceRegistration, we inject the correct implementation of the IMaterialUnpacker
|
||||
public interface IMaterialUnpacker
|
||||
{
|
||||
IEnumerable<IProxyCollection> UnpackMaterials();
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Converters.CSiShared.ToSpeckle.Helpers;
|
||||
using Speckle.Sdk.Models.Proxies;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.HostApp;
|
||||
|
||||
/// <summary>
|
||||
/// Creates material proxies based on stored entries from the materials cache
|
||||
/// </summary>
|
||||
public class MaterialUnpacker
|
||||
{
|
||||
private readonly CsiMaterialPropertyExtractor _propertyExtractor;
|
||||
private readonly CsiToSpeckleCacheSingleton _csiToSpeckleCacheSingleton;
|
||||
|
||||
public MaterialUnpacker(
|
||||
CsiMaterialPropertyExtractor propertyExtractor,
|
||||
CsiToSpeckleCacheSingleton csiToSpeckleCacheSingleton
|
||||
)
|
||||
{
|
||||
_propertyExtractor = propertyExtractor;
|
||||
_csiToSpeckleCacheSingleton = csiToSpeckleCacheSingleton;
|
||||
}
|
||||
|
||||
// Creates a list of material proxies from the csi materials cache
|
||||
public IEnumerable<IProxyCollection> UnpackMaterials()
|
||||
{
|
||||
foreach (var kvp in _csiToSpeckleCacheSingleton.MaterialCache)
|
||||
{
|
||||
// get the cached entry
|
||||
string materialName = kvp.Key;
|
||||
List<string> sectionIds = kvp.Value;
|
||||
|
||||
// get the properties of the material
|
||||
Dictionary<string, object?> properties = new(); // create empty dictionary
|
||||
_propertyExtractor.ExtractProperties(materialName, properties); // dictionary mutated with respective properties
|
||||
|
||||
// create the material proxy
|
||||
GroupProxy materialProxy =
|
||||
new()
|
||||
{
|
||||
id = materialName,
|
||||
name = materialName,
|
||||
applicationId = materialName,
|
||||
objects = sectionIds,
|
||||
["properties"] = properties
|
||||
};
|
||||
|
||||
yield return materialProxy;
|
||||
}
|
||||
}
|
||||
}
|
||||
+91
-10
@@ -4,9 +4,11 @@ using Speckle.Connectors.Common.Conversion;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Connectors.CSiShared.HostApp;
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Connectors.CSiShared.Utils;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.CSiShared;
|
||||
using Speckle.Converters.CSiShared.Extensions;
|
||||
using Speckle.Converters.CSiShared.Utils;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Logging;
|
||||
using Speckle.Sdk.Models;
|
||||
@@ -32,21 +34,23 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
private readonly IRootToSpeckleConverter _rootToSpeckleConverter;
|
||||
private readonly IConverterSettingsStore<CsiConversionSettings> _converterSettings;
|
||||
private readonly CsiSendCollectionManager _sendCollectionManager;
|
||||
private readonly MaterialUnpacker _materialUnpacker;
|
||||
private readonly IMaterialUnpacker _materialUnpacker;
|
||||
private readonly ISectionUnpacker _sectionUnpacker;
|
||||
private readonly ILogger<CsiRootObjectBuilder> _logger;
|
||||
private readonly ISdkActivityFactory _activityFactory;
|
||||
private readonly ICsiApplicationService _csiApplicationService;
|
||||
private readonly AnalysisResultsExtractor _analysisResultsExtractor;
|
||||
|
||||
public CsiRootObjectBuilder(
|
||||
IRootToSpeckleConverter rootToSpeckleConverter,
|
||||
IConverterSettingsStore<CsiConversionSettings> converterSettings,
|
||||
CsiSendCollectionManager sendCollectionManager,
|
||||
MaterialUnpacker materialUnpacker,
|
||||
IMaterialUnpacker materialUnpacker,
|
||||
ISectionUnpacker sectionUnpacker,
|
||||
ILogger<CsiRootObjectBuilder> logger,
|
||||
ISdkActivityFactory activityFactory,
|
||||
ICsiApplicationService csiApplicationService
|
||||
ICsiApplicationService csiApplicationService,
|
||||
AnalysisResultsExtractor analysisResultsExtractor
|
||||
)
|
||||
{
|
||||
_converterSettings = converterSettings;
|
||||
@@ -57,6 +61,7 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
_logger = logger;
|
||||
_activityFactory = activityFactory;
|
||||
_csiApplicationService = csiApplicationService;
|
||||
_analysisResultsExtractor = analysisResultsExtractor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -70,7 +75,7 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
/// </remarks>
|
||||
public async Task<RootObjectBuilderResult> Build(
|
||||
IReadOnlyList<ICsiWrapper> csiObjects,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
@@ -78,8 +83,16 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
using var activity = _activityFactory.Start("Build");
|
||||
|
||||
string modelFileName = _csiApplicationService.SapModel.GetModelFilename(false) ?? "Unnamed model";
|
||||
(string forceUnit, string tempUnit) = GetForceAndTemperatureUnits();
|
||||
|
||||
Collection rootObjectCollection =
|
||||
new() { name = modelFileName, ["units"] = _converterSettings.Current.SpeckleUnits };
|
||||
new()
|
||||
{
|
||||
name = modelFileName,
|
||||
["units"] = _converterSettings.Current.SpeckleUnits,
|
||||
["forceUnits"] = forceUnit,
|
||||
["temperatureUnits"] = tempUnit
|
||||
};
|
||||
|
||||
List<SendConversionResult> results = new(csiObjects.Count);
|
||||
int count = 0;
|
||||
@@ -89,8 +102,6 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
foreach (ICsiWrapper csiObject in csiObjects)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
using var _2 = _activityFactory.Start("Convert");
|
||||
|
||||
var result = ConvertCsiObject(csiObject, rootObjectCollection);
|
||||
results.Add(result);
|
||||
|
||||
@@ -102,7 +113,7 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
|
||||
if (results.All(x => x.Status == Status.ERROR))
|
||||
{
|
||||
throw new SpeckleException("Failed to convert all objects.");
|
||||
throw new SpeckleException("Failed to convert all objects");
|
||||
}
|
||||
|
||||
using (var _ = _activityFactory.Start("Process Proxies"))
|
||||
@@ -114,6 +125,42 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
rootObjectCollection[ProxyKeys.SECTION] = _sectionUnpacker.UnpackSections().ToList();
|
||||
}
|
||||
|
||||
// Extract analysis results (if applicable)
|
||||
// NOTE: objectSelectionSummary used to extract results for objects being published ONLY
|
||||
// NOTE: etabs is complicated and we can't get specifics from original selection
|
||||
var objectSelectionSummary = GetObjectSummary(csiObjects);
|
||||
var selectedCasesAndCombinations = _converterSettings.Current.SelectedLoadCasesAndCombinations;
|
||||
var requestedResultTypes = _converterSettings.Current.SelectedResultTypes;
|
||||
|
||||
if (selectedCasesAndCombinations?.Count > 0)
|
||||
{
|
||||
if (requestedResultTypes == null || requestedResultTypes.Count == 0)
|
||||
{
|
||||
throw new SpeckleException(
|
||||
"Adjust publish settings - no result type input for the requested load cases and combinations"
|
||||
);
|
||||
}
|
||||
|
||||
if (!_csiApplicationService.SapModel.GetModelIsLocked())
|
||||
{
|
||||
throw new SpeckleException("Model unlocked, no access to analysis results");
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var analysisResults = _analysisResultsExtractor.ExtractAnalysisResults(
|
||||
selectedCasesAndCombinations,
|
||||
requestedResultTypes,
|
||||
objectSelectionSummary
|
||||
);
|
||||
rootObjectCollection["analysisResults"] = analysisResults;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new SpeckleException("Analysis result extraction failed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
return new RootObjectBuilderResult(rootObjectCollection, results);
|
||||
}
|
||||
|
||||
@@ -151,13 +198,47 @@ public class CsiRootObjectBuilder : IRootObjectBuilder<ICsiWrapper>
|
||||
// NOTE: CsiTendonWrapper - not typically modelled in ETABS, rather SAFE
|
||||
catch (NotImplementedException ex)
|
||||
{
|
||||
_logger.LogError(ex, sourceType);
|
||||
_logger.LogError(ex, "Failed to convert object {sourceType}", sourceType);
|
||||
return new(Status.WARNING, applicationId, sourceType, null, ex);
|
||||
}
|
||||
catch (Exception ex) when (!ex.IsFatal())
|
||||
{
|
||||
_logger.LogError(ex, sourceType);
|
||||
_logger.LogError(ex, "Failed to convert object {sourceType}", sourceType);
|
||||
return new(Status.ERROR, applicationId, sourceType, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates a summary of object types and their associated names from the collection of CSI wrappers.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A summary of object names for each object type is needed for getting analysis results of the selected objects only.
|
||||
/// During object conversion, however, we lose the selection (like a clear selection)(presumably because of other api calls).
|
||||
/// This has to be recreated since GetSelection() return type is bound by the interface.
|
||||
/// The LINQ-based implementation is computationally inexpensive as it operates on an already-loaded collection without additional API calls.
|
||||
/// Also, we don't want to rely on user selection remaining active, what if someone re-publishes using model card cache?
|
||||
/// </remarks>
|
||||
private Dictionary<ModelObjectType, List<string>> GetObjectSummary(IReadOnlyList<ICsiWrapper> csiObjects) =>
|
||||
csiObjects
|
||||
.GroupBy(csiObject => csiObject.ObjectType)
|
||||
.ToDictionary(
|
||||
group => group.Key, // ModelObjectType (FRAME, JOINT, etc.)
|
||||
group => group.Select(obj => obj.Name).ToList() // Extract Name from each ICsiWrapper and convert to List<string>
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a Base object and pre-populates it with the models defined force units.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="SpeckleException"></exception>
|
||||
private (string, string) GetForceAndTemperatureUnits()
|
||||
{
|
||||
var forceUnit = eForce.NotApplicable;
|
||||
var lengthUnit = eLength.NotApplicable;
|
||||
var temperatureUnit = eTemperature.NotApplicable;
|
||||
|
||||
_converterSettings.Current.SapModel.GetDatabaseUnits_2(ref forceUnit, ref lengthUnit, ref temperatureUnit);
|
||||
|
||||
return (forceUnit.ToString(), temperatureUnit.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.DUI.Models.Card;
|
||||
using Speckle.InterfaceGenerator;
|
||||
using Speckle.Newtonsoft.Json.Linq;
|
||||
using Speckle.Sdk.Common;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.Operations.Send.Settings;
|
||||
|
||||
[GenerateAutoInterface]
|
||||
public class ToSpeckleSettingsManager : IToSpeckleSettingsManager
|
||||
{
|
||||
private readonly ISendConversionCache _sendConversionCache;
|
||||
private readonly Dictionary<string, List<string>?> _loadCaseCombinationCache = new();
|
||||
private readonly Dictionary<string, List<string>?> _resultTypeCache = new();
|
||||
|
||||
public ToSpeckleSettingsManager(ISendConversionCache sendConversionCache)
|
||||
{
|
||||
_sendConversionCache = sendConversionCache;
|
||||
}
|
||||
|
||||
public List<string> GetLoadCasesAndCombinations(SenderModelCard modelCard)
|
||||
{
|
||||
var setting = modelCard.Settings?.FirstOrDefault(s => s.Id == "loadCasesAndCombinations");
|
||||
var returnValue = (setting?.Value as JArray)?.Select(x => x.ToString()).ToList() ?? [];
|
||||
|
||||
if (_loadCaseCombinationCache.TryGetValue(modelCard.ModelCardId.NotNull(), out List<string>? previousValue))
|
||||
{
|
||||
if (!AreListsEqual(previousValue, returnValue))
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
_loadCaseCombinationCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public List<string> GetResultTypes(SenderModelCard modelCard)
|
||||
{
|
||||
var setting = modelCard.Settings?.FirstOrDefault(s => s.Id == "resultTypes");
|
||||
var returnValue = (setting?.Value as JArray)?.Select(x => x.ToString()).ToList() ?? [];
|
||||
|
||||
if (_resultTypeCache.TryGetValue(modelCard.ModelCardId.NotNull(), out List<string>? previousValue))
|
||||
{
|
||||
if (!AreListsEqual(previousValue, returnValue))
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
_resultTypeCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private static bool AreListsEqual(List<string>? list1, List<string>? list2)
|
||||
{
|
||||
if (list1 == null && list2 == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (list1 == null || list2 == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return list1.Count == list2.Count && list1.OrderBy(x => x).SequenceEqual(list2.OrderBy(x => x));
|
||||
}
|
||||
|
||||
private void EvictCacheForModelCard(SenderModelCard modelCard)
|
||||
{
|
||||
var objectIds = modelCard.SendFilter != null ? modelCard.SendFilter.NotNull().RefreshObjectIds() : [];
|
||||
_sendConversionCache.EvictObjects(objectIds);
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,8 @@ using Speckle.Connectors.CSiShared.Builders;
|
||||
using Speckle.Connectors.CSiShared.Filters;
|
||||
using Speckle.Connectors.CSiShared.HostApp;
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Connectors.CSiShared.Operations.Send.Settings;
|
||||
using Speckle.Connectors.CSiShared.Utils;
|
||||
using Speckle.Connectors.DUI;
|
||||
using Speckle.Connectors.DUI.Bindings;
|
||||
using Speckle.Connectors.DUI.Bridge;
|
||||
@@ -44,13 +46,18 @@ public static class ServiceRegistration
|
||||
services.AddScoped<SendOperation<ICsiWrapper>>();
|
||||
|
||||
services.AddScoped<CsiMaterialPropertyExtractor>();
|
||||
services.AddScoped<MaterialUnpacker>();
|
||||
services.AddScoped<CsiResultsExtractorFactory>();
|
||||
services.AddScoped<IMaterialPropertyExtractor, CsiMaterialPropertyExtractor>();
|
||||
services.AddScoped<IFrameSectionPropertyExtractor, CsiFrameSectionPropertyExtractor>();
|
||||
services.AddScoped<IShellSectionPropertyExtractor, CsiShellSectionPropertyExtractor>();
|
||||
services.AddScoped<AnalysisResultsExtractor>();
|
||||
|
||||
// add converter caches
|
||||
services.AddScoped<CsiToSpeckleCacheSingleton>();
|
||||
|
||||
// add settings manager
|
||||
services.AddScoped<ToSpeckleSettingsManager>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using Speckle.Connectors.CSiShared.Utils;
|
||||
using Speckle.Connectors.DUI.Settings;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.Settings;
|
||||
|
||||
public class LoadCaseCombinationSetting(List<string> values, cSapModel sapModel) : ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "loadCasesAndCombinations";
|
||||
public string? Title { get; set; } = "Load Cases & Combinations";
|
||||
public string? Type { get; set; } = "array";
|
||||
public object? Value { get; set; } = values;
|
||||
public List<string>? Enum { get; set; } = LoadCaseHelper.GetLoadCasesAndCombinations(sapModel);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Speckle.Connectors.DUI.Settings;
|
||||
using Speckle.Converters.CSiShared.Utils;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.Settings;
|
||||
|
||||
public class ResultTypeSetting(List<string> values) : ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "resultTypes";
|
||||
public string? Title { get; set; } = "Result Type";
|
||||
public string? Type { get; set; } = "array";
|
||||
public object? Value { get; set; } = values;
|
||||
public List<string>? Enum { get; set; } = ResultsKey.All.OrderBy(x => x).ToList();
|
||||
}
|
||||
@@ -18,7 +18,10 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bindings\CsiSharedSelectionBinding.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bindings\CsiSharedSendBinding.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Filters\CsiSharedSelectionFilter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\MaterialUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\CsiResultsExtractorFactory.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\IApplicationMaterialPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\IMaterialPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\IMaterialUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CsiSendCollectionManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\CsiFrameSectionPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\CsiMaterialPropertyExtractor.cs" />
|
||||
@@ -27,12 +30,17 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\ISectionPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\ISectionUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\CsiRootObjectBuilder.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ToSpeckleSettingsManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\CsiPluginBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\SpeckleFormBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)GlobalUsing.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CsiApplicationService.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\CsiDocumentModelStore.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ServiceRegistration.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Settings\LoadCaseCombinationSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Settings\ResultTypeSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utils\LoadCaseHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utils\AnalysisResultsExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utils\ObjectIdentifiers.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.CSiShared;
|
||||
using Speckle.Converters.CSiShared.Utils;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Models;
|
||||
|
||||
namespace Speckle.Connectors.CSiShared.Utils;
|
||||
|
||||
public class AnalysisResultsExtractor
|
||||
{
|
||||
private readonly IConverterSettingsStore<CsiConversionSettings> _converterSettingsStore;
|
||||
private readonly CsiResultsExtractorFactory _resultsExtractorFactory;
|
||||
|
||||
public AnalysisResultsExtractor(
|
||||
IConverterSettingsStore<CsiConversionSettings> converterSettingsStore,
|
||||
CsiResultsExtractorFactory resultsExtractorFactory
|
||||
)
|
||||
{
|
||||
_converterSettingsStore = converterSettingsStore;
|
||||
_resultsExtractorFactory = resultsExtractorFactory;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts complete analysis results including units retrieval, load case configuration, and results extraction.
|
||||
/// Assumes inputs have been validated by caller.
|
||||
/// </summary>
|
||||
public Base ExtractAnalysisResults(
|
||||
List<string> selectedCasesAndCombinations,
|
||||
List<string> requestedResultTypes,
|
||||
Dictionary<ModelObjectType, List<string>> objectSelectionSummary
|
||||
)
|
||||
{
|
||||
// Step 1: create base object that will hold analysis results
|
||||
var analysisResults = new Base();
|
||||
|
||||
// Step 2: configure and validate load cases
|
||||
ConfigureAndValidateSelectedLoadCases(selectedCasesAndCombinations);
|
||||
|
||||
// Step 3: extract results using clean factory pattern
|
||||
ExtractResults(requestedResultTypes, objectSelectionSummary, analysisResults);
|
||||
|
||||
return analysisResults;
|
||||
}
|
||||
|
||||
private void ExtractResults(
|
||||
List<string> requestedResultTypes,
|
||||
Dictionary<ModelObjectType, List<string>> objectSelectionSummary,
|
||||
Base analysisResults
|
||||
)
|
||||
{
|
||||
foreach (var resultType in requestedResultTypes)
|
||||
{
|
||||
var extractor = _resultsExtractorFactory.GetExtractor(resultType);
|
||||
objectSelectionSummary.TryGetValue(extractor.TargetObjectType, out var objectNames);
|
||||
analysisResults[extractor.ResultsKey] = extractor.GetResults(objectNames);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Responsible for two things. Firstly, we need to setup the results so that only the requested cases and combinations
|
||||
/// are published. Secondly, we need to ensure that the requested cases and combinations are actually run.
|
||||
/// </summary>
|
||||
private void ConfigureAndValidateSelectedLoadCases(List<string> selectedLoadCases)
|
||||
{
|
||||
// step 1: configure load cases for output
|
||||
ConfigureSelectedLoadCases(selectedLoadCases);
|
||||
|
||||
// step 2: validate they are complete (throws on failure)
|
||||
ValidateSelectedCasesAreComplete(selectedLoadCases);
|
||||
}
|
||||
|
||||
private void ConfigureSelectedLoadCases(List<string> selectedLoadCases)
|
||||
{
|
||||
// deselect all load cases and combos
|
||||
_converterSettingsStore.Current.SapModel.Results.Setup.DeselectAllCasesAndCombosForOutput();
|
||||
|
||||
// ui presents cases and combinations as a flat list. we need to distinguish if the string is a case or combo
|
||||
// do this by seeing if the string is within the list of defined cases
|
||||
// typically defined load cases << defined load combinations, so this approach should be more efficient
|
||||
int numberOfLoadCases = 0;
|
||||
string[] loadCaseNames = [];
|
||||
_converterSettingsStore.Current.SapModel.LoadCases.GetNameList(ref numberOfLoadCases, ref loadCaseNames);
|
||||
|
||||
// set user selected combos to true (i.e. to export)
|
||||
foreach (var selectedLoadCase in selectedLoadCases)
|
||||
{
|
||||
int success = loadCaseNames.Contains(selectedLoadCase)
|
||||
? _converterSettingsStore.Current.SapModel.Results.Setup.SetCaseSelectedForOutput(selectedLoadCase)
|
||||
: _converterSettingsStore.Current.SapModel.Results.Setup.SetComboSelectedForOutput(selectedLoadCase);
|
||||
|
||||
// ui should only present valid options
|
||||
// `AnalysisResultsExtractor` only fetches load cases and load combinations (not patterns), so this should never throw
|
||||
if (success != 0)
|
||||
{
|
||||
throw new InvalidOperationException($"Failed to set {selectedLoadCase} for output.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ValidateSelectedCasesAreComplete(List<string> selectedCasesAndCombinations)
|
||||
{
|
||||
// get status for all load cases (combinations not included in this API call)
|
||||
int numberItems = 0;
|
||||
string[] caseNames = [];
|
||||
int[] statuses = [];
|
||||
|
||||
int result = _converterSettingsStore.Current.SapModel.Analyze.GetCaseStatus(
|
||||
ref numberItems,
|
||||
ref caseNames,
|
||||
ref statuses
|
||||
);
|
||||
|
||||
if (result != 0)
|
||||
{
|
||||
throw new SpeckleException("Failed to retrieve load case status from model.");
|
||||
}
|
||||
|
||||
// build lookup dictionary for load cases only
|
||||
var caseStatusLookup = caseNames
|
||||
.Zip(statuses, (name, status) => new { name, status })
|
||||
.ToDictionary(x => x.name, x => x.status);
|
||||
|
||||
// separate selected items into cases and combinations
|
||||
var selectedCases = selectedCasesAndCombinations.Where(item => caseStatusLookup.ContainsKey(item)).ToList();
|
||||
var selectedCombinations = selectedCasesAndCombinations.Except(selectedCases).ToList();
|
||||
|
||||
// validate load cases status
|
||||
var notFinishedCases = new List<string>();
|
||||
foreach (var caseName in selectedCases)
|
||||
{
|
||||
int status = caseStatusLookup[caseName];
|
||||
if (status != 4) // 1 = Not run, 2 = Could not start, 3 = Not finished, 4 = Finished
|
||||
{
|
||||
notFinishedCases.Add($"{caseName}");
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Validate load combinations status
|
||||
// for now, assume combinations are valid if we can't validate them
|
||||
if (selectedCombinations.Count != 0)
|
||||
{
|
||||
// combinations validation not implemented - assuming they're valid for now
|
||||
// it'll get complicated, we can't get the status of a combination, so we need to check the constituent cases
|
||||
}
|
||||
|
||||
if (notFinishedCases.Count != 0)
|
||||
{
|
||||
string errorMessage =
|
||||
$"Analysis not complete for load cases: {string.Join(", ", notFinishedCases)}. Run analysis first.";
|
||||
throw new SpeckleException(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
namespace Speckle.Connectors.CSiShared.Utils;
|
||||
|
||||
public static class LoadCaseHelper
|
||||
{
|
||||
public static List<string> GetLoadCasesAndCombinations(cSapModel sapModel)
|
||||
{
|
||||
var loadCasesAndCombos = new List<string>();
|
||||
|
||||
try
|
||||
{
|
||||
// Check if model is loaded to prevent crashes
|
||||
var modelFilename = sapModel.GetModelFilename();
|
||||
if (string.IsNullOrEmpty(modelFilename))
|
||||
{
|
||||
return loadCasesAndCombos; // Return empty list if no model
|
||||
}
|
||||
|
||||
// Get Load Cases
|
||||
int numberItems = 0;
|
||||
string[]? names = null;
|
||||
|
||||
int ret = sapModel.LoadCases.GetNameList(ref numberItems, ref names);
|
||||
if (ret == 0 && names != null)
|
||||
{
|
||||
for (int i = 0; i < numberItems; i++)
|
||||
{
|
||||
loadCasesAndCombos.Add(names[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Get Load Combinations
|
||||
numberItems = 0;
|
||||
names = null;
|
||||
ret = sapModel.RespCombo.GetNameList(ref numberItems, ref names);
|
||||
if (ret == 0 && names != null)
|
||||
{
|
||||
for (int i = 0; i < numberItems; i++)
|
||||
{
|
||||
loadCasesAndCombos.Add(names[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (System.Runtime.InteropServices.COMException)
|
||||
{
|
||||
// Return empty list on COM errors to prevent crashes
|
||||
return new List<string>();
|
||||
}
|
||||
catch (System.InvalidOperationException)
|
||||
{
|
||||
// Return empty list on invalid operations to prevent crashes
|
||||
return new List<string>();
|
||||
}
|
||||
|
||||
return loadCasesAndCombos.Distinct().OrderBy(x => x).ToList();
|
||||
}
|
||||
}
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -285,7 +285,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.etabs21": {
|
||||
@@ -335,18 +335,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -356,14 +356,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,9 +210,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -236,7 +236,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.etabs22": {
|
||||
@@ -286,18 +286,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -305,14 +305,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Converters.CSiShared.ToSpeckle.Helpers;
|
||||
using Speckle.Sdk.Models.Proxies;
|
||||
|
||||
namespace Speckle.Connectors.ETABSShared.HostApp;
|
||||
|
||||
public class EtabsMaterialUnpacker : IMaterialUnpacker
|
||||
{
|
||||
private readonly CsiToSpeckleCacheSingleton _csiToSpeckleCacheSingleton;
|
||||
private readonly IMaterialPropertyExtractor _csiMaterialPropertyExtractor;
|
||||
private readonly IApplicationMaterialPropertyExtractor _etabsMaterialPropertyExtractor;
|
||||
|
||||
public EtabsMaterialUnpacker(
|
||||
CsiToSpeckleCacheSingleton csiToSpeckleCacheSingleton,
|
||||
IMaterialPropertyExtractor csiMaterialPropertyExtractor,
|
||||
IApplicationMaterialPropertyExtractor etabsMaterialPropertyExtractor
|
||||
)
|
||||
{
|
||||
_csiToSpeckleCacheSingleton = csiToSpeckleCacheSingleton;
|
||||
_csiMaterialPropertyExtractor = csiMaterialPropertyExtractor;
|
||||
_etabsMaterialPropertyExtractor = etabsMaterialPropertyExtractor;
|
||||
}
|
||||
|
||||
public IEnumerable<IProxyCollection> UnpackMaterials()
|
||||
{
|
||||
foreach (var kvp in _csiToSpeckleCacheSingleton.MaterialCache)
|
||||
{
|
||||
string name = kvp.Key;
|
||||
var sectionIds = kvp.Value;
|
||||
|
||||
// get the properties of the material
|
||||
Dictionary<string, object?> properties = [];
|
||||
_csiMaterialPropertyExtractor.ExtractProperties(name, properties);
|
||||
_etabsMaterialPropertyExtractor.ExtractProperties(name, properties);
|
||||
|
||||
// create the material proxy
|
||||
GroupProxy materialProxy =
|
||||
new()
|
||||
{
|
||||
id = name,
|
||||
name = name,
|
||||
applicationId = name,
|
||||
objects = sectionIds,
|
||||
["properties"] = properties
|
||||
};
|
||||
|
||||
yield return materialProxy;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,18 +47,17 @@ public class EtabsSectionUnpacker : ISectionUnpacker
|
||||
string sectionName = entry.Key;
|
||||
List<string> frameIds = entry.Value;
|
||||
|
||||
// Initialize properties outside the if statement
|
||||
Dictionary<string, object?> properties = new Dictionary<string, object?>();
|
||||
// initialize properties
|
||||
Dictionary<string, object?> properties = [];
|
||||
|
||||
// get the properties of the section
|
||||
// openings will have objects assigned to them, but won't have properties
|
||||
// sectionName is initialized with string.Empty, but api ref returns string "None"
|
||||
if (sectionName != "None")
|
||||
// Extract properties if valid section name
|
||||
// "None" is weird but api returns that string if an opening, null element etc.
|
||||
if (sectionName != "None" && !string.IsNullOrEmpty(sectionName))
|
||||
{
|
||||
properties = _propertyExtractor.ExtractFrameSectionProperties(sectionName);
|
||||
}
|
||||
|
||||
// create the section proxy
|
||||
// create section proxy
|
||||
GroupProxy sectionProxy =
|
||||
new()
|
||||
{
|
||||
@@ -66,8 +65,8 @@ public class EtabsSectionUnpacker : ISectionUnpacker
|
||||
name = sectionName,
|
||||
applicationId = sectionName,
|
||||
objects = frameIds,
|
||||
["type"] = "Frame Section", // since sectionProxies are a flat list, need some way to distinguish from shell
|
||||
["properties"] = properties // openings will just have an empty dict here
|
||||
["type"] = "Frame Section",
|
||||
["properties"] = properties
|
||||
};
|
||||
|
||||
yield return sectionProxy;
|
||||
@@ -81,8 +80,8 @@ public class EtabsSectionUnpacker : ISectionUnpacker
|
||||
string sectionName = entry.Key;
|
||||
List<string> frameIds = entry.Value;
|
||||
|
||||
// Initialize properties outside the if statement
|
||||
Dictionary<string, object?> properties = new Dictionary<string, object?>();
|
||||
// initialize properties outside the if statement
|
||||
Dictionary<string, object?> properties = [];
|
||||
|
||||
// get the properties of the section
|
||||
// openings will have objects assigned to them, but won't have properties
|
||||
@@ -92,7 +91,7 @@ public class EtabsSectionUnpacker : ISectionUnpacker
|
||||
properties = _propertyExtractor.ExtractShellSectionProperties(sectionName);
|
||||
}
|
||||
|
||||
// create the section proxy
|
||||
// create section proxy
|
||||
GroupProxy sectionProxy =
|
||||
new()
|
||||
{
|
||||
|
||||
+75
-47
@@ -1,4 +1,5 @@
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Connectors.ETABSShared.HostApp.Services;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.CSiShared;
|
||||
using Speckle.Converters.CSiShared.Utils;
|
||||
@@ -8,69 +9,96 @@ namespace Speckle.Connectors.ETABSShared.HostApp.Helpers;
|
||||
/// <summary>
|
||||
/// Extracts ETABS-specific frame section properties.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The bulk loading strategy is necessary here because we can't know which database table contains which section
|
||||
/// beforehand - there are multiple tables like "Frame Section Property Definitions - Steel",
|
||||
/// "Frame Section Property Definitions - Concrete", etc.
|
||||
/// </remarks>
|
||||
public class EtabsFrameSectionPropertyExtractor : IApplicationFrameSectionPropertyExtractor
|
||||
{
|
||||
private readonly IConverterSettingsStore<CsiConversionSettings> _settingsStore;
|
||||
private readonly EtabsSectionPropertyDefinitionService _definitionService;
|
||||
|
||||
public EtabsFrameSectionPropertyExtractor(IConverterSettingsStore<CsiConversionSettings> settingsStore)
|
||||
public EtabsFrameSectionPropertyExtractor(
|
||||
IConverterSettingsStore<CsiConversionSettings> settingsStore,
|
||||
EtabsSectionPropertyDefinitionService definitionService
|
||||
)
|
||||
{
|
||||
_settingsStore = settingsStore;
|
||||
_definitionService = definitionService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets generalised frame section properties
|
||||
/// Gets frame section properties from preloaded database table data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Sap2000 doesn't support this method, unfortunately
|
||||
/// Alternative is to account for extraction according to section type - we're talking over 40 section types!
|
||||
/// This way, we get basic information with minimal computational costs.
|
||||
/// Property categorization is done heuristically - order matters in the parsing logic.
|
||||
/// </remarks>
|
||||
public void ExtractProperties(string sectionName, Dictionary<string, object?> properties)
|
||||
{
|
||||
// Get all frame properties
|
||||
int numberOfNames = 0;
|
||||
string[] names = [];
|
||||
eFramePropType[] propTypes = [];
|
||||
double[] t3 = [],
|
||||
t2 = [],
|
||||
tf = [],
|
||||
tw = [],
|
||||
t2b = [],
|
||||
tfb = [],
|
||||
area = [];
|
||||
|
||||
_settingsStore.Current.SapModel.PropFrame.GetAllFrameProperties_2(
|
||||
ref numberOfNames,
|
||||
ref names,
|
||||
ref propTypes,
|
||||
ref t3,
|
||||
ref t2,
|
||||
ref tf,
|
||||
ref tw,
|
||||
ref t2b,
|
||||
ref tfb,
|
||||
ref area
|
||||
);
|
||||
|
||||
// Find the index of the current section
|
||||
int sectionIndex = Array.IndexOf(names, sectionName);
|
||||
|
||||
if (sectionIndex != -1)
|
||||
// get frame definitions from the service (which uses database table extraction)
|
||||
// this is a fast dictionary lookup since all data is preloaded
|
||||
if (!_definitionService.FrameDefinitions.TryGetValue(sectionName, out var rawDatabaseTableProperties))
|
||||
{
|
||||
// General Data
|
||||
var generalData = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
|
||||
generalData["Section Shape"] = propTypes[sectionIndex].ToString();
|
||||
return; // no definitions found for this section
|
||||
}
|
||||
|
||||
// Section Dimensions
|
||||
string unit = _settingsStore.Current.SpeckleUnits;
|
||||
var sectionDimensions = properties.EnsureNested(SectionPropertyCategory.SECTION_DIMENSIONS);
|
||||
sectionDimensions.AddWithUnits("t3", t3[sectionIndex], unit);
|
||||
sectionDimensions.AddWithUnits("t2", t2[sectionIndex], unit);
|
||||
sectionDimensions.AddWithUnits("tf", tf[sectionIndex], unit);
|
||||
sectionDimensions.AddWithUnits("tw", tw[sectionIndex], unit);
|
||||
sectionDimensions.AddWithUnits("t2b", t2b[sectionIndex], unit);
|
||||
sectionDimensions.AddWithUnits("tfb", tfb[sectionIndex], unit);
|
||||
sectionDimensions.AddWithUnits("Area", area[sectionIndex], $"{unit}²");
|
||||
// define table keys that we don't want to include in the section proxy properties
|
||||
var keysToExclude = new HashSet<string>
|
||||
{
|
||||
"GUID",
|
||||
"Name",
|
||||
"Color",
|
||||
"Notes",
|
||||
"FileName",
|
||||
"FromFile",
|
||||
"SectInFile",
|
||||
"NotAutoFact"
|
||||
};
|
||||
|
||||
// get the section type / shape using the dedicated api query (exception to the database approach)
|
||||
// this specific property isn't available in the database table extraction
|
||||
eFramePropType framePropType = 0;
|
||||
_settingsStore.Current.SapModel.PropFrame.GetTypeOAPI(sectionName, ref framePropType);
|
||||
Dictionary<string, object?> generalProperties = properties.EnsureNested(SectionPropertyCategory.GENERAL_DATA);
|
||||
generalProperties.Add("Section Shape", framePropType.ToString());
|
||||
|
||||
// heuristic property categorization based on key patterns and parse-ability
|
||||
// NOTE: this is gross and quite dangerous 🤨 but beats specific frame prop sect. property extractions imo
|
||||
// order matters here! we check for known string props first, then modifiers, then assume doubles are dimensions
|
||||
foreach (KeyValuePair<string, string> rawDatabaseTableProperty in rawDatabaseTableProperties)
|
||||
{
|
||||
string key = rawDatabaseTableProperty.Key;
|
||||
string value = rawDatabaseTableProperty.Value;
|
||||
|
||||
// skip metadata fields we don't care about
|
||||
if (!keysToExclude.Contains(key))
|
||||
{
|
||||
// material is always a string, grab it first
|
||||
if (key == "Material")
|
||||
{
|
||||
generalProperties.Add(key, value);
|
||||
}
|
||||
// modifier properties end with "Mod" and should be numeric
|
||||
else if (key.EndsWith("Mod") && double.TryParse(value, out double parsedModValue))
|
||||
{
|
||||
Dictionary<string, object?> modificationProperties = properties.EnsureNested(
|
||||
SectionPropertyCategory.MODIFIERS
|
||||
);
|
||||
modificationProperties.Add(key, parsedModValue);
|
||||
}
|
||||
// anything else that parses as a double is assumed to be a section dimension
|
||||
// this covers things like t3, t2, tf, tw, area, etc. without having to enumerate them all
|
||||
else if (double.TryParse(value, out double parsedDimensionValue))
|
||||
{
|
||||
Dictionary<string, object?> sectionDimensions = properties.EnsureNested(
|
||||
SectionPropertyCategory.SECTION_DIMENSIONS
|
||||
);
|
||||
sectionDimensions.Add(key, parsedDimensionValue);
|
||||
}
|
||||
// if it doesn't parse as double and isn't a known string property, we skip it
|
||||
// this is acceptable - we'd rather miss some edge case properties than crash
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.CSiShared;
|
||||
using Speckle.Converters.CSiShared.Utils;
|
||||
|
||||
namespace Speckle.Connectors.ETABS22.HostApp.Helpers;
|
||||
|
||||
public class EtabsMaterialPropertyExtractor : IApplicationMaterialPropertyExtractor
|
||||
{
|
||||
private readonly IConverterSettingsStore<CsiConversionSettings> _settingsStore;
|
||||
|
||||
private readonly Dictionary<int, string?> _ssTypeDict =
|
||||
new()
|
||||
{
|
||||
{ 0, "User defined" },
|
||||
{ 1, "Parametric - Simple" },
|
||||
{ 2, "Parametric - Mander" }
|
||||
};
|
||||
|
||||
private readonly Dictionary<int, string?> _ssHysTypeDict =
|
||||
new()
|
||||
{
|
||||
{ 0, "Elastic" },
|
||||
{ 1, "Kinematic" },
|
||||
{ 2, "Takeda" },
|
||||
{ 3, "Pivot" },
|
||||
{ 4, "Concrete" },
|
||||
{ 5, "BRB Hardening" },
|
||||
{ 6, "Degrading" },
|
||||
{ 7, "Isotropic" }
|
||||
};
|
||||
|
||||
private const int TEMP = 0;
|
||||
|
||||
public EtabsMaterialPropertyExtractor(IConverterSettingsStore<CsiConversionSettings> settingsStore)
|
||||
{
|
||||
_settingsStore = settingsStore;
|
||||
}
|
||||
|
||||
public void ExtractProperties(string name, Dictionary<string, object?> properties)
|
||||
{
|
||||
// we want to get some of the "other" material property data that is type specific
|
||||
// csi extractor populates "type" string, but api query arguably simpler and more reliable than dict string access
|
||||
int symType = 0;
|
||||
eMatType matType = 0;
|
||||
_settingsStore.Current.SapModel.PropMaterial.GetTypeOAPI(name, ref matType, ref symType);
|
||||
|
||||
// we don't have design data api queries for these, so early return to avoid creating that specific dictionary
|
||||
if (matType is eMatType.NoDesign or eMatType.Aluminum or eMatType.ColdFormed or eMatType.Masonry)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// ensure design data specific properties dictionary that will be mutated in switch expression
|
||||
var designData = properties.EnsureNested(SectionPropertyCategory.DESIGN_DATA);
|
||||
|
||||
// can't do a switch expression here because not all enums have an api query (e.g. masonry, aluminium)
|
||||
switch (matType)
|
||||
{
|
||||
case eMatType.Steel:
|
||||
ExtractSteelProperties(name, designData);
|
||||
break;
|
||||
case eMatType.Concrete:
|
||||
ExtractConcreteProperties(name, designData);
|
||||
break;
|
||||
case eMatType.Rebar:
|
||||
ExtractRebarProperties(name, designData);
|
||||
break;
|
||||
case eMatType.Tendon:
|
||||
ExtractTendonProperties(name, designData);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void ExtractSteelProperties(string name, Dictionary<string, object?> designData)
|
||||
{
|
||||
// step 1: stubs for api query
|
||||
int ssType = 0,
|
||||
ssHysType = 0;
|
||||
double fy = 0,
|
||||
fu = 0,
|
||||
eFy = 0,
|
||||
eFu = 0,
|
||||
strainAtHardening = 0,
|
||||
strainAtMaxStress = 0,
|
||||
strainAtRupture = 0;
|
||||
|
||||
// step 2: api query
|
||||
// NOTE: using the "older" method. Not sure if _1 is unsupported in etabs 21
|
||||
// also, _1 doesn't give a lot more MEANINGFUL data
|
||||
_settingsStore.Current.SapModel.PropMaterial.GetOSteel(
|
||||
name,
|
||||
ref fy,
|
||||
ref fu,
|
||||
ref eFy,
|
||||
ref eFu,
|
||||
ref ssType,
|
||||
ref ssHysType,
|
||||
ref strainAtHardening,
|
||||
ref strainAtMaxStress,
|
||||
ref strainAtRupture
|
||||
);
|
||||
|
||||
// step 3: mutate properties dictionary
|
||||
designData["Fy"] = fy;
|
||||
designData["Fu"] = fu;
|
||||
designData["EFy"] = eFy;
|
||||
designData["EFu"] = eFu;
|
||||
designData["SSType"] = _ssTypeDict.TryGetValue(ssType, out string? ssTypeValue) ? ssTypeValue : "";
|
||||
designData["SSHysType"] = _ssHysTypeDict.TryGetValue(ssHysType, out string? ssHysTypeValue) ? ssHysTypeValue : "";
|
||||
designData["StrainAtHardening"] = strainAtHardening;
|
||||
designData["StrainAtMaxStress"] = strainAtMaxStress;
|
||||
designData["StrainAtRupture"] = strainAtRupture;
|
||||
designData["Temp"] = TEMP;
|
||||
}
|
||||
|
||||
private void ExtractConcreteProperties(string name, Dictionary<string, object?> designData)
|
||||
{
|
||||
// step 1: stubs for api query
|
||||
int ssType = 0,
|
||||
ssHysType = 0;
|
||||
bool isLightweight = false;
|
||||
double fc = 0,
|
||||
fcsFactor = 0,
|
||||
strainAtFc = 0,
|
||||
strainUltimate = 0,
|
||||
frictionAngle = 0,
|
||||
dilatationalAngle = 0;
|
||||
|
||||
// step 2: api query
|
||||
// NOTE: using the "older" method. Not sure if _1 or _2 are unsupported in etabs 21
|
||||
// also, _1 or _2 doesn't give a lot more MEANINGFUL data
|
||||
_settingsStore.Current.SapModel.PropMaterial.GetOConcrete(
|
||||
name,
|
||||
ref fc,
|
||||
ref isLightweight,
|
||||
ref fcsFactor,
|
||||
ref ssType,
|
||||
ref ssHysType,
|
||||
ref strainAtFc,
|
||||
ref strainUltimate,
|
||||
ref frictionAngle,
|
||||
ref dilatationalAngle
|
||||
);
|
||||
|
||||
// step 3: mutate properties dictionary
|
||||
designData["Fc"] = fc;
|
||||
designData["FcsFactor"] = fcsFactor;
|
||||
designData["StrainAtFc"] = strainAtFc;
|
||||
designData["StrainUltimate"] = strainUltimate;
|
||||
designData["FrictionAngle"] = frictionAngle;
|
||||
designData["DilatationalAngle"] = dilatationalAngle;
|
||||
designData["IsLightweight"] = isLightweight.ToString();
|
||||
designData["SSType"] = _ssTypeDict.TryGetValue(ssType, out string? ssTypeValue) ? ssTypeValue : "";
|
||||
designData["SSHysType"] = _ssHysTypeDict.TryGetValue(ssHysType, out string? ssHysTypeValue) ? ssHysTypeValue : "";
|
||||
designData["Temp"] = TEMP;
|
||||
}
|
||||
|
||||
private void ExtractRebarProperties(string name, Dictionary<string, object?> designData)
|
||||
{
|
||||
// step 1: stubs for api query
|
||||
bool useCaltransSsDefaults = false;
|
||||
int ssType = 0,
|
||||
ssHysType = 0;
|
||||
double fy = 0,
|
||||
fu = 0,
|
||||
eFy = 0,
|
||||
eFu = 0,
|
||||
strainAtHardening = 0,
|
||||
strainUltimate = 0;
|
||||
|
||||
// step 2: api query
|
||||
// NOTE: using the "older" method. Not sure if _1 is unsupported in etabs 21
|
||||
// also, _1 doesn't give a lot more MEANINGFUL data
|
||||
_settingsStore.Current.SapModel.PropMaterial.GetORebar(
|
||||
name,
|
||||
ref fy,
|
||||
ref fu,
|
||||
ref eFy,
|
||||
ref eFu,
|
||||
ref ssType,
|
||||
ref ssHysType,
|
||||
ref strainAtHardening,
|
||||
ref strainUltimate,
|
||||
ref useCaltransSsDefaults
|
||||
);
|
||||
|
||||
// step 3: mutate properties dictionary
|
||||
designData["Fy"] = fy;
|
||||
designData["Fu"] = fu;
|
||||
designData["EFy"] = eFy;
|
||||
designData["EFu"] = eFu;
|
||||
designData["StrainAtHardening"] = strainAtHardening;
|
||||
designData["StrainUltimate"] = strainUltimate;
|
||||
designData["SSType"] = _ssTypeDict.TryGetValue(ssType, out string? ssTypeValue) ? ssTypeValue : "";
|
||||
designData["SSHysType"] = _ssHysTypeDict.TryGetValue(ssHysType, out string? ssHysTypeValue) ? ssHysTypeValue : "";
|
||||
designData["UseCaltransSsDefaults"] = useCaltransSsDefaults.ToString();
|
||||
designData["Temp"] = TEMP;
|
||||
}
|
||||
|
||||
private void ExtractTendonProperties(string name, Dictionary<string, object?> designData)
|
||||
{
|
||||
// step 1: stubs for api query
|
||||
int ssType = 0,
|
||||
ssHysType = 0;
|
||||
double fy = 0,
|
||||
fu = 0;
|
||||
|
||||
// step 2: api query
|
||||
_settingsStore.Current.SapModel.PropMaterial.GetOTendon(name, ref fy, ref fu, ref ssType, ref ssHysType);
|
||||
|
||||
// step 3: mutate properties dictionary
|
||||
designData["Fy"] = fy;
|
||||
designData["Fu"] = fu;
|
||||
designData["SSType"] = _ssTypeDict.TryGetValue(ssType, out string? ssTypeValue) ? ssTypeValue : "";
|
||||
designData["SSHysType"] = _ssHysTypeDict.TryGetValue(ssHysType, out string? ssHysTypeValue) ? ssHysTypeValue : "";
|
||||
designData["Temp"] = TEMP;
|
||||
}
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.CSiShared;
|
||||
using Speckle.Converters.CSiShared.ToSpeckle.Helpers;
|
||||
|
||||
namespace Speckle.Connectors.ETABSShared.HostApp.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Loads and caches section property definitions from database tables for both frame and shell sections.
|
||||
/// </summary>
|
||||
public class EtabsSectionPropertyDefinitionService
|
||||
{
|
||||
private readonly IConverterSettingsStore<CsiConversionSettings> _settingsStore;
|
||||
public IReadOnlyDictionary<string, IReadOnlyDictionary<string, string>> FrameDefinitions { get; }
|
||||
public IReadOnlyDictionary<string, IReadOnlyDictionary<string, string>> ShellDefinitions { get; }
|
||||
|
||||
public EtabsSectionPropertyDefinitionService(
|
||||
DatabaseTableExtractor databaseTableExtractor,
|
||||
IConverterSettingsStore<CsiConversionSettings> settingsStore
|
||||
)
|
||||
{
|
||||
_settingsStore = settingsStore;
|
||||
|
||||
var availableTableKeys = GetAvailableTableKeys();
|
||||
|
||||
FrameDefinitions = LoadFrameDefinitions(databaseTableExtractor, availableTableKeys);
|
||||
ShellDefinitions = LoadShellDefinitions(databaseTableExtractor, availableTableKeys);
|
||||
}
|
||||
|
||||
private static IReadOnlyDictionary<string, IReadOnlyDictionary<string, string>> LoadFrameDefinitions(
|
||||
DatabaseTableExtractor databaseTableExtractor,
|
||||
string[] availableTableKeys
|
||||
)
|
||||
{
|
||||
var frameTableKeys = GetFrameSectionPropertyDefinitionTableKeys(availableTableKeys);
|
||||
return LoadDefinitionsFromTables(databaseTableExtractor, frameTableKeys);
|
||||
}
|
||||
|
||||
private static IReadOnlyDictionary<string, IReadOnlyDictionary<string, string>> LoadShellDefinitions(
|
||||
DatabaseTableExtractor databaseTableExtractor,
|
||||
string[] availableTableKeys
|
||||
)
|
||||
{
|
||||
var shellTableKeys = GetShellSectionPropertyDefinitionTableKeys(availableTableKeys);
|
||||
return LoadDefinitionsFromTables(databaseTableExtractor, shellTableKeys);
|
||||
}
|
||||
|
||||
private static IReadOnlyDictionary<string, IReadOnlyDictionary<string, string>> LoadDefinitionsFromTables(
|
||||
DatabaseTableExtractor databaseTableExtractor,
|
||||
IEnumerable<string> tableKeys
|
||||
)
|
||||
{
|
||||
var definitions = new Dictionary<string, IReadOnlyDictionary<string, string>>();
|
||||
|
||||
foreach (string tableKey in tableKeys)
|
||||
{
|
||||
var tableData = databaseTableExtractor.GetTableData(tableKey, "Name");
|
||||
foreach (var row in tableData.Rows)
|
||||
{
|
||||
definitions[row.Key] = row.Value;
|
||||
}
|
||||
}
|
||||
|
||||
return definitions;
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetFrameSectionPropertyDefinitionTableKeys(string[] availableTableKeys)
|
||||
{
|
||||
var keysToExclude = new HashSet<string>
|
||||
{
|
||||
"Frame Section Property Definitions - Summary",
|
||||
"Frame Section Property Definitions - Concrete Beam Reinforcing",
|
||||
"Frame Section Property Definitions - Concrete Column Reinforcing"
|
||||
};
|
||||
|
||||
return availableTableKeys.Where(key =>
|
||||
key.StartsWith("Frame Section Property Definitions") && !keysToExclude.Contains(key)
|
||||
);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetShellSectionPropertyDefinitionTableKeys(string[] availableTableKeys)
|
||||
{
|
||||
var keysToExclude = new HashSet<string> { "Area Section Property Definitions - Summary" };
|
||||
|
||||
return availableTableKeys.Where(key =>
|
||||
key.StartsWith("Area Section Property Definitions") && !keysToExclude.Contains(key)
|
||||
);
|
||||
}
|
||||
|
||||
private string[] GetAvailableTableKeys()
|
||||
{
|
||||
int numberTables = 0;
|
||||
string[] tableKey = [],
|
||||
tableName = [];
|
||||
int[] importType = [];
|
||||
|
||||
_ = _settingsStore.Current.SapModel.DatabaseTables.GetAvailableTables(
|
||||
ref numberTables,
|
||||
ref tableKey,
|
||||
ref tableName,
|
||||
ref importType
|
||||
);
|
||||
|
||||
return tableKey;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -34,7 +34,7 @@ public class EtabsSectionPropertyExtractor
|
||||
/// </summary>
|
||||
public Dictionary<string, object?> ExtractFrameSectionProperties(string sectionName)
|
||||
{
|
||||
Dictionary<string, object?> properties = new();
|
||||
Dictionary<string, object?> properties = [];
|
||||
_csiFrameExtractor.ExtractProperties(sectionName, properties);
|
||||
_etabsFrameExtractor.ExtractProperties(sectionName, properties);
|
||||
return properties;
|
||||
@@ -45,7 +45,7 @@ public class EtabsSectionPropertyExtractor
|
||||
/// </summary>
|
||||
public Dictionary<string, object?> ExtractShellSectionProperties(string sectionName)
|
||||
{
|
||||
Dictionary<string, object?> properties = new();
|
||||
Dictionary<string, object?> properties = [];
|
||||
_csiShellExtractor.ExtractProperties(sectionName, properties);
|
||||
_etabsShellExtractor.ExtractProperties(sectionName, properties);
|
||||
return properties;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Speckle.Connectors.CSiShared.HostApp;
|
||||
using Speckle.Connectors.CSiShared.HostApp.Helpers;
|
||||
using Speckle.Connectors.ETABS22.HostApp.Helpers;
|
||||
using Speckle.Connectors.ETABSShared.HostApp;
|
||||
using Speckle.Connectors.ETABSShared.HostApp.Helpers;
|
||||
using Speckle.Connectors.ETABSShared.HostApp.Services;
|
||||
using Speckle.Converters.ETABSShared;
|
||||
|
||||
namespace Speckle.Connectors.ETABSShared;
|
||||
@@ -12,12 +14,19 @@ public static class ServiceRegistration
|
||||
public static IServiceCollection AddEtabs(this IServiceCollection services)
|
||||
{
|
||||
services.AddEtabsConverters();
|
||||
services.AddScoped<CsiSendCollectionManager, EtabsSendCollectionManager>();
|
||||
|
||||
// material services
|
||||
services.AddScoped<IMaterialUnpacker, EtabsMaterialUnpacker>();
|
||||
services.AddScoped<IApplicationMaterialPropertyExtractor, EtabsMaterialPropertyExtractor>();
|
||||
|
||||
// section services
|
||||
services.AddScoped<ISectionUnpacker, EtabsSectionUnpacker>();
|
||||
services.AddScoped<IApplicationFrameSectionPropertyExtractor, EtabsFrameSectionPropertyExtractor>();
|
||||
services.AddScoped<IApplicationShellSectionPropertyExtractor, EtabsShellSectionPropertyExtractor>();
|
||||
services.AddScoped<EtabsSectionPropertyDefinitionService>();
|
||||
services.AddScoped<EtabsSectionPropertyExtractor>();
|
||||
services.AddScoped<EtabsShellSectionResolver>();
|
||||
services.AddScoped<CsiSendCollectionManager, EtabsSendCollectionManager>();
|
||||
services.AddScoped<ISectionUnpacker, EtabsSectionUnpacker>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
<Import_RootNamespace>Speckle.Connectors.ETABSShared</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\EtabsMaterialUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\EtabsSectionUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\EtabsSendCollectionManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\EtabsFrameSectionPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\EtabsMaterialPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\EtabsSectionPropertyDefinitionService.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\EtabsSectionPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\EtabsShellSectionPropertyExtractor.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Helpers\EtabsShellSectionResolver.cs" />
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -285,7 +285,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2020": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -285,7 +285,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2021": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -285,7 +285,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2022": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -285,7 +285,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2023": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
@@ -259,9 +259,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -285,7 +285,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2024": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
@@ -265,9 +265,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -291,7 +291,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2025": {
|
||||
@@ -337,18 +337,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -358,14 +358,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
@@ -266,9 +266,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -292,7 +292,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.navisworks2026": {
|
||||
@@ -339,18 +339,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -360,14 +360,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.8/win-x64": {
|
||||
|
||||
+3
-1
@@ -73,6 +73,7 @@ public class NavisworksSendBinding : ISendBinding
|
||||
new IncludeInternalPropertiesSetting(false),
|
||||
new ConvertHiddenElementsSetting(false),
|
||||
new PreserveModelHierarchySetting(false),
|
||||
new RevitCategoryMappingSetting(false)
|
||||
];
|
||||
|
||||
public async Task Send(string modelCardId) =>
|
||||
@@ -93,7 +94,8 @@ public class NavisworksSendBinding : ISendBinding
|
||||
visualRepresentationMode: _toSpeckleSettingsManagerNavisworks.GetVisualRepresentationMode(modelCard),
|
||||
convertHiddenElements: _toSpeckleSettingsManagerNavisworks.GetConvertHiddenElements(modelCard),
|
||||
includeInternalProperties: _toSpeckleSettingsManagerNavisworks.GetIncludeInternalProperties(modelCard),
|
||||
preserveModelHierarchy: _toSpeckleSettingsManagerNavisworks.GetPreserveModelHierarchy(modelCard)
|
||||
preserveModelHierarchy: _toSpeckleSettingsManagerNavisworks.GetPreserveModelHierarchy(modelCard),
|
||||
mappingToRevitCategories: _toSpeckleSettingsManagerNavisworks.GetMappingToRevitCategories(modelCard)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
+13
-13
@@ -151,22 +151,22 @@ public class NavisworksSavedViewsFilter : DiscriminatedObject, ISendFilterSelect
|
||||
|
||||
foreach (NAV.SavedItem item in ((NAV.GroupItem)parentItem).Children)
|
||||
{
|
||||
switch (item.IsGroup)
|
||||
switch (item)
|
||||
{
|
||||
// THIS IS COMMENTED OUT AS IT IS LEGACY DEFENSIVE BEHAVIOUR - DISCUSSION REQUIRED
|
||||
// case false when item is NAV.SavedViewpoint { ContainsVisibilityOverrides: false }:
|
||||
// // If the saved view does not contain visibility overrides, this is effectively everything in the model.
|
||||
// // This will need to be the documented behaviour.
|
||||
// break;
|
||||
case false:
|
||||
collectedSets.Add((NAV.SavedViewpoint)item);
|
||||
// case NAV.SavedViewpoint { ContainsVisibilityOverrides: false }:
|
||||
// Legacy defensive behaviour: skip viewpoints without visibility overrides.
|
||||
// Essentially, send everything, or whatever the current view state for hidden elements is.
|
||||
// break;
|
||||
case NAV.SavedViewpointAnimationCut:
|
||||
// Skip animation cuts.
|
||||
break;
|
||||
default: // handles item.IsGroup == true
|
||||
if (((NAV.GroupItem)item).Children.Count > 0) // Don't add empty groups
|
||||
{
|
||||
CollectSavedViews(item, collectedSets);
|
||||
}
|
||||
case NAV.SavedViewpoint savedViewpoint:
|
||||
collectedSets.Add(savedViewpoint);
|
||||
break;
|
||||
case NAV.GroupItem groupItem when groupItem.Children.Count > 0:
|
||||
CollectSavedViews(groupItem, collectedSets);
|
||||
break;
|
||||
// No action for empty groups or unknown types.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-19
@@ -32,18 +32,9 @@ public class NavisworksRootObjectBuilder(
|
||||
|
||||
internal NavisworksConversionSettings GetCurrentSettings() => converterSettings.Current;
|
||||
|
||||
/// <summary>
|
||||
/// Asynchronously builds a Speckle object hierarchy from Navisworks model items.
|
||||
/// </summary>
|
||||
/// <param name="navisworksModelItems">The list of Navisworks items to convert.</param>
|
||||
/// <param name="sendInfo">Information about the send operation.</param>
|
||||
/// <param name="onOperationProgressed">Progress reporting callback.</param>
|
||||
/// <param name="cancellationToken">Token to cancel the operation.</param>
|
||||
/// <returns>A result containing the root collection and conversion results.</returns>
|
||||
/// <exception cref="SpeckleException">Thrown when no objects can be converted.</exception>
|
||||
public async Task<RootObjectBuilderResult> Build(
|
||||
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
@@ -54,7 +45,7 @@ public class NavisworksRootObjectBuilder(
|
||||
#endif
|
||||
using var activity = activityFactory.Start("Build");
|
||||
|
||||
ValidateInputs(navisworksModelItems, sendInfo, onOperationProgressed);
|
||||
ValidateInputs(navisworksModelItems, projectId, onOperationProgressed);
|
||||
|
||||
// 2. Initialize root collection
|
||||
var rootCollection = InitializeRootCollection();
|
||||
@@ -62,7 +53,7 @@ public class NavisworksRootObjectBuilder(
|
||||
// 3. Convert all model items and store results
|
||||
var (convertedElements, conversionResults) = await ConvertModelItemsAsync(
|
||||
navisworksModelItems,
|
||||
sendInfo,
|
||||
projectId,
|
||||
onOperationProgressed,
|
||||
cancellationToken
|
||||
);
|
||||
@@ -80,7 +71,7 @@ public class NavisworksRootObjectBuilder(
|
||||
|
||||
private static void ValidateInputs(
|
||||
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed
|
||||
)
|
||||
{
|
||||
@@ -94,9 +85,11 @@ public class NavisworksRootObjectBuilder(
|
||||
throw new ArgumentNullException(nameof(navisworksModelItems));
|
||||
}
|
||||
|
||||
if (onOperationProgressed == null || sendInfo == null)
|
||||
if (onOperationProgressed == null || projectId == null)
|
||||
{
|
||||
throw new ArgumentNullException(onOperationProgressed == null ? nameof(onOperationProgressed) : nameof(sendInfo));
|
||||
throw new ArgumentNullException(
|
||||
onOperationProgressed == null ? nameof(onOperationProgressed) : nameof(projectId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +102,7 @@ public class NavisworksRootObjectBuilder(
|
||||
|
||||
private Task<(Dictionary<string, Base?> converted, List<SendConversionResult> results)> ConvertModelItemsAsync(
|
||||
IReadOnlyList<NAV.ModelItem> navisworksModelItems,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
@@ -122,7 +115,7 @@ public class NavisworksRootObjectBuilder(
|
||||
foreach (var item in navisworksModelItems)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
var converted = ConvertNavisworksItem(item, convertedBases, sendInfo);
|
||||
var converted = ConvertNavisworksItem(item, convertedBases, projectId);
|
||||
results.Add(converted);
|
||||
processedCount++;
|
||||
onOperationProgressed.Report(new CardProgress("Converting", (double)processedCount / totalCount));
|
||||
@@ -310,7 +303,7 @@ public class NavisworksRootObjectBuilder(
|
||||
private SendConversionResult ConvertNavisworksItem(
|
||||
NAV.ModelItem navisworksItem,
|
||||
Dictionary<string, Base?> convertedBases,
|
||||
SendInfo sendInfo
|
||||
string projectId
|
||||
)
|
||||
{
|
||||
string applicationId = elementSelectionService.GetModelItemPath(navisworksItem);
|
||||
@@ -318,7 +311,7 @@ public class NavisworksRootObjectBuilder(
|
||||
|
||||
try
|
||||
{
|
||||
Base converted = sendConversionCache.TryGetValue(applicationId, sendInfo.ProjectId, out ObjectReference? cached)
|
||||
Base converted = sendConversionCache.TryGetValue(applicationId, projectId, out ObjectReference? cached)
|
||||
? cached
|
||||
: rootToSpeckleConverter.Convert(navisworksItem);
|
||||
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
using Speckle.Connectors.DUI.Settings;
|
||||
|
||||
namespace Speckle.Connector.Navisworks.Operations.Send.Settings;
|
||||
|
||||
public class RevitCategoryMappingSetting(bool value) : ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "mappingToRevitCategories";
|
||||
public string? Title { get; set; } = "Map to Revit Categories";
|
||||
public string? Type { get; set; } = "boolean";
|
||||
public List<string>? Enum { get; set; }
|
||||
public object? Value { get; set; } = value;
|
||||
}
|
||||
+33
-14
@@ -18,6 +18,7 @@ public class ToSpeckleSettingsManagerNavisworks : IToSpeckleSettingsManagerNavis
|
||||
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)
|
||||
{
|
||||
@@ -63,23 +64,41 @@ public class ToSpeckleSettingsManagerNavisworks : IToSpeckleSettingsManagerNavis
|
||||
throw new ArgumentNullException(nameof(modelCard));
|
||||
}
|
||||
|
||||
var originString = modelCard.Settings?.First(s => s.Id == "originMode").Value as string;
|
||||
|
||||
if (originString is not null && OriginModeSetting.OriginModeMap.TryGetValue(originString, out OriginMode origin))
|
||||
var originString = modelCard.Settings?.FirstOrDefault(s => s.Id == "originMode")?.Value as string;
|
||||
if (!OriginModeSetting.OriginModeMap.TryGetValue(originString ?? string.Empty, out var origin))
|
||||
{
|
||||
if (_originModeCache.TryGetValue(modelCard.ModelCardId.NotNull(), out OriginMode previousType))
|
||||
{
|
||||
if (previousType != origin)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
|
||||
_originModeCache[modelCard.ModelCardId.NotNull()] = origin;
|
||||
return origin;
|
||||
return OriginMode.ModelOrigin; // Default to ModelOrigin if not specified or invalid
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid origin mode value: {originString}");
|
||||
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;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public bool GetConvertHiddenElements(SenderModelCard modelCard)
|
||||
|
||||
+3
@@ -6,6 +6,7 @@ using Speckle.Connector.Navisworks.DependencyInjection;
|
||||
using Speckle.Connector.Navisworks.HostApp;
|
||||
using Speckle.Connector.Navisworks.Plugin.Tools;
|
||||
using Speckle.Connectors.Common;
|
||||
using Speckle.Connectors.Common.Operations;
|
||||
using Speckle.Connectors.DUI;
|
||||
using Speckle.Connectors.DUI.WebView;
|
||||
using Speckle.Converter.Navisworks.DependencyInjection;
|
||||
@@ -46,6 +47,8 @@ internal sealed class Connector : NAV.Plugins.DockPanePlugin
|
||||
Container = services.BuildServiceProvider();
|
||||
Container.UseDUI();
|
||||
Container.GetRequiredService<NavisworksDocumentEvents>();
|
||||
Container.GetRequiredService<ISerializationOptions>().SkipCacheRead = true;
|
||||
Container.GetRequiredService<ISerializationOptions>().SkipCacheWrite = true;
|
||||
|
||||
var u = Container.GetRequiredService<DUI3ControlWebView>();
|
||||
|
||||
|
||||
+2
-1
@@ -25,10 +25,11 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\GeometryNodeMerger.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\NavisworksHierarchyBuilder.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\NavisworksRootObjectBuilder.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ConvertHiddenEleementsSetting.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ConvertHiddenElementsSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\IncludeInternalPropertiesSetting.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\OriginModeSetting.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\PreserveModelHierarchySetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\RevitCategoryMapping.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ToSpeckleSettingsManagerNavisworks.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\VisualRepresentationSetting.cs"/>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Filters\NavisworksSelectionFilter.cs"/>
|
||||
|
||||
@@ -281,9 +281,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -306,7 +306,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2022": {
|
||||
@@ -351,11 +351,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
@@ -366,9 +366,9 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -378,14 +378,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,9 +281,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -306,7 +306,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2023": {
|
||||
@@ -351,11 +351,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
@@ -366,9 +366,9 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -378,14 +378,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -281,9 +281,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -306,7 +306,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2024": {
|
||||
@@ -351,11 +351,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
@@ -366,9 +366,9 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -378,14 +378,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,9 +226,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -251,7 +251,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2025": {
|
||||
@@ -296,11 +296,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
@@ -311,9 +311,9 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -321,14 +321,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
"net8.0-windows7.0/win-x64": {
|
||||
|
||||
@@ -219,9 +219,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.dui": {
|
||||
@@ -244,7 +244,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.revit2026": {
|
||||
@@ -280,11 +280,11 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Revit.API": {
|
||||
@@ -295,9 +295,9 @@
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Data.Sqlite": "7.0.5",
|
||||
@@ -305,14 +305,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
},
|
||||
"net8.0-windows7.0/win-x64": {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Threading;
|
||||
using Autodesk.Revit.UI;
|
||||
@@ -15,18 +16,30 @@ public partial class CefSharpPanel : Page, Autodesk.Revit.UI.IDockablePaneProvid
|
||||
|
||||
public void ExecuteScript(string script)
|
||||
{
|
||||
Browser.Dispatcher.Invoke(
|
||||
() =>
|
||||
{
|
||||
//avoid exceptions by checking if IBrowser is there
|
||||
if (!Browser.IsBrowserInitialized || Browser.GetBrowser() is null)
|
||||
try
|
||||
{
|
||||
Browser.Dispatcher.Invoke(
|
||||
() =>
|
||||
{
|
||||
return;
|
||||
}
|
||||
Browser.ExecuteScriptAsync(script);
|
||||
},
|
||||
DispatcherPriority.Background
|
||||
);
|
||||
//avoid exceptions by checking if IBrowser is there
|
||||
if (!Browser.IsBrowserInitialized || Browser.GetBrowser() is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Browser.ExecuteScriptAsync(script);
|
||||
},
|
||||
DispatcherPriority.Background
|
||||
);
|
||||
}
|
||||
catch (SEHException)
|
||||
{
|
||||
//do nothing as we can't control external components
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//do nothing, happens when closing Revit while a script is being executed
|
||||
}
|
||||
}
|
||||
|
||||
public void SendProgress(string script) => ExecuteScript(script);
|
||||
|
||||
+2
-1
@@ -72,6 +72,7 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
|
||||
return new DocumentInfo("", "", "") { Message = "Family environment files not supported by Speckle." };
|
||||
}
|
||||
|
||||
//should this use the Hashcode of the document instead of something like CreationGUID?
|
||||
var info = new DocumentInfo(doc.PathName, doc.Title, doc.GetHashCode().ToString());
|
||||
|
||||
return info;
|
||||
@@ -105,7 +106,7 @@ internal sealed class BasicConnectorBindingRevit : IBasicConnectorBinding
|
||||
|
||||
if (senderModelCard.SendFilter is RevitViewsFilter revitViewsFilter)
|
||||
{
|
||||
var view = revitViewsFilter.GetView();
|
||||
var view = revitViewsFilter.GetView(activeUIDoc.Document);
|
||||
if (view is not null)
|
||||
{
|
||||
await _revitTask
|
||||
|
||||
@@ -14,7 +14,7 @@ public sealed class RevitReceiveBinding(
|
||||
ICancellationManager cancellationManager,
|
||||
IBrowserBridge parent,
|
||||
ILogger<RevitReceiveBinding> logger,
|
||||
Speckle.Connectors.Revit.Operations.Receive.Settings.ToHostSettingsManager toHostSettingsManager,
|
||||
Operations.Receive.Settings.ToHostSettingsManager toHostSettingsManager,
|
||||
IRevitConversionSettingsFactory revitConversionSettingsFactory,
|
||||
IReceiveOperationManagerFactory receiveOperationManagerFactory
|
||||
) : IReceiveBinding
|
||||
@@ -24,8 +24,7 @@ public sealed class RevitReceiveBinding(
|
||||
private IReceiveBindingUICommands Commands { get; } = new ReceiveBindingUICommands(parent);
|
||||
|
||||
#pragma warning disable CA1024
|
||||
public List<ICardSetting> GetReceiveSettings() =>
|
||||
[new Speckle.Connectors.Revit.Operations.Receive.Settings.ReferencePointSetting(ReceiveReferencePointType.Source)];
|
||||
public List<ICardSetting> GetReceiveSettings() => [new Operations.Receive.Settings.ReceiveReferencePointSetting()];
|
||||
#pragma warning restore CA1024
|
||||
|
||||
public void CancelReceive(string modelCardId) => cancellationManager.CancelOperation(modelCardId);
|
||||
|
||||
@@ -97,11 +97,11 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
|
||||
public List<ICardSetting> GetSendSettings() =>
|
||||
[
|
||||
new DetailLevelSetting(DetailLevelType.Medium),
|
||||
new ReferencePointSetting(ReferencePointType.InternalOrigin),
|
||||
new SendParameterNullOrEmptyStringsSetting(false),
|
||||
new LinkedModelsSetting(true),
|
||||
new SendRebarsAsVolumetricSetting(false)
|
||||
new DetailLevelSetting(),
|
||||
new SendReferencePointSetting(),
|
||||
new SendParameterNullOrEmptyStringsSetting(),
|
||||
new LinkedModelsSetting(),
|
||||
new SendRebarsAsVolumetricSetting()
|
||||
];
|
||||
|
||||
public void CancelSend(string modelCardId) => _cancellationManager.CancelOperation(modelCardId);
|
||||
@@ -110,6 +110,11 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
|
||||
public async Task Send(string modelCardId)
|
||||
{
|
||||
var document = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
if (document == null)
|
||||
{
|
||||
throw new SpeckleException("No document is active for sending.");
|
||||
}
|
||||
using var manager = _sendOperationManagerFactory.Create();
|
||||
|
||||
await manager.Process<DocumentToConvert>(
|
||||
@@ -120,24 +125,20 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
sp.GetRequiredService<IConverterSettingsStore<RevitConversionSettings>>()
|
||||
.Initialize(
|
||||
_revitConversionSettingsFactory.Create(
|
||||
_toSpeckleSettingsManager.GetDetailLevelSetting(card),
|
||||
_toSpeckleSettingsManager.GetReferencePointSetting(card),
|
||||
_toSpeckleSettingsManager.GetSendParameterNullOrEmptyStringsSetting(card),
|
||||
_toSpeckleSettingsManager.GetLinkedModelsSetting(card),
|
||||
_toSpeckleSettingsManager.GetSendRebarsAsVolumetric(card)
|
||||
_toSpeckleSettingsManager.GetDetailLevelSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetReferencePointSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetSendParameterNullOrEmptyStringsSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetLinkedModelsSetting(document, card),
|
||||
_toSpeckleSettingsManager.GetSendRebarsAsVolumetric(document, card)
|
||||
)
|
||||
);
|
||||
},
|
||||
async x => await RefreshElementsIdsOnSender(x.NotNull())
|
||||
async x => await RefreshElementsIdsOnSender(document, x.NotNull())
|
||||
);
|
||||
}
|
||||
|
||||
private async Task<List<DocumentToConvert>> RefreshElementsIdsOnSender(SenderModelCard modelCard)
|
||||
private async Task<List<DocumentToConvert>> RefreshElementsIdsOnSender(Document document, SenderModelCard modelCard)
|
||||
{
|
||||
var activeUIDoc =
|
||||
_revitContext.UIApplication.NotNull().ActiveUIDocument
|
||||
?? throw new SpeckleException("Unable to retrieve active UI document");
|
||||
|
||||
if (modelCard.SendFilter.NotNull() is IRevitSendFilter viewFilter)
|
||||
{
|
||||
viewFilter.SetContext(_revitContext);
|
||||
@@ -147,10 +148,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
() => Task.FromResult(modelCard.SendFilter.NotNull().RefreshObjectIds())
|
||||
);
|
||||
|
||||
var allElements = selectedObjects
|
||||
.Select(uid => activeUIDoc.Document.GetElement(uid))
|
||||
.Where(el => el is not null)
|
||||
.ToList();
|
||||
var allElements = selectedObjects.Select(uid => document.GetElement(uid)).Where(el => el is not null).ToList();
|
||||
|
||||
// split elements between main model and linked models
|
||||
var elementsOnMainModel = allElements.Where(el => el is not RevitLinkInstance).ToList();
|
||||
@@ -158,14 +156,11 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
|
||||
// should ideally reuse the initialized value from the scoped IConverterSettingsStore<RevitConversionSettings>.
|
||||
// but, it's scoped and to avoid bigger scarier changes I'm re-fetching the setting here (inexpensive operation?)
|
||||
Transform? mainModelTransform = _toSpeckleSettingsManager.GetReferencePointSetting(modelCard);
|
||||
List<DocumentToConvert> documentElementContexts =
|
||||
[
|
||||
new(mainModelTransform, activeUIDoc.Document, elementsOnMainModel)
|
||||
];
|
||||
Transform? mainModelTransform = _toSpeckleSettingsManager.GetReferencePointSetting(document, modelCard);
|
||||
List<DocumentToConvert> documentElementContexts = [new(mainModelTransform, document, elementsOnMainModel)];
|
||||
|
||||
// get the linked models setting - this decision belongs at this level
|
||||
bool includeLinkedModels = _toSpeckleSettingsManager.GetLinkedModelsSetting(modelCard);
|
||||
bool includeLinkedModels = _toSpeckleSettingsManager.GetLinkedModelsSetting(document, modelCard);
|
||||
|
||||
// ⚠️ process linked models - RevitSendBinding controls the flow based on settings!
|
||||
// If setting not enabled, we won't unpack (see if-else block)
|
||||
@@ -192,7 +187,12 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
if (includeLinkedModels)
|
||||
{
|
||||
// handler is only responsible for element collection mechanics
|
||||
var linkedElements = _linkedModelHandler.GetLinkedModelElements(modelCard.SendFilter, linkedDoc, transform);
|
||||
var linkedElements = _linkedModelHandler.GetLinkedModelElements(
|
||||
document,
|
||||
modelCard.SendFilter,
|
||||
linkedDoc,
|
||||
transform
|
||||
);
|
||||
linkedDocumentContexts.Add(new(transform, linkedDoc, linkedElements));
|
||||
}
|
||||
// ⚠️ when disabled, still adds empty contexts to maintain warning generation in RevitRootObjectBuilder
|
||||
@@ -216,12 +216,13 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
newSelectedObjectIds.Add(element.UniqueId);
|
||||
}
|
||||
|
||||
// We update the state on the UI SenderModelCard to prevent potential inconsistencies between hostApp IdMap in sendfilters.
|
||||
await Commands.SetFilterObjectIds(
|
||||
modelCard.ModelCardId.NotNull(),
|
||||
modelCard.SendFilter.IdMap,
|
||||
newSelectedObjectIds
|
||||
);
|
||||
// NOTE: preserve & persist original user selection for selection filter implemented during
|
||||
// [CNX-2400](https://linear.app/speckle/issue/CNX-2400/object-dont-update-on-publish)
|
||||
// NOTE: update with current document for views and categories filter since these represent dynamic queries
|
||||
// View & categories filters self-update their SelectedObjectIds in RefreshObjectIds(), maintaining consistency
|
||||
var objectIds =
|
||||
modelCard.SendFilter is RevitSelectionFilter ? modelCard.SendFilter.SelectedObjectIds : newSelectedObjectIds;
|
||||
await Commands.SetFilterObjectIds(modelCard.ModelCardId.NotNull(), modelCard.SendFilter.IdMap, objectIds);
|
||||
}
|
||||
|
||||
return documentElementContexts;
|
||||
@@ -235,13 +236,16 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
private void DocChangeHandler(Autodesk.Revit.DB.Events.DocumentChangedEventArgs e)
|
||||
{
|
||||
ICollection<ElementId> modifiedElementIds = e.GetModifiedElementIds();
|
||||
|
||||
var doc = e.GetDocument();
|
||||
if (doc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
// NOTE: Whenever we save data into file this event also trigger changes on its DataStorage.
|
||||
// On every add/remove/update model attempt triggers this handler and was causing unnecessary calls on `RunExpirationChecks`
|
||||
// Re-check it once we implement Linked Documents
|
||||
if (modifiedElementIds.Count == 1)
|
||||
{
|
||||
var doc = e.GetDocument();
|
||||
if (modifiedElementIds.All(el => doc.GetElement(el) is DataStorage))
|
||||
{
|
||||
return;
|
||||
@@ -271,7 +275,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
_idleManager.SubscribeToIdle(nameof(PostSetObjectIds), PostSetObjectIds);
|
||||
}
|
||||
|
||||
if (HaveUnitsChanged(e.GetDocument()))
|
||||
if (HaveUnitsChanged(doc))
|
||||
{
|
||||
var objectIds = new List<string>();
|
||||
foreach (var sender in _store.GetSenders().ToList())
|
||||
@@ -284,7 +288,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
var selectedObjects = sender.SendFilter.NotNull().SelectedObjectIds;
|
||||
objectIds.AddRange(selectedObjects);
|
||||
}
|
||||
var unpackedObjectIds = _elementUnpacker.GetUnpackedElementIds(objectIds);
|
||||
var unpackedObjectIds = _elementUnpacker.GetUnpackedElementIds(objectIds, doc);
|
||||
_sendConversionCache.EvictObjects(unpackedObjectIds);
|
||||
}
|
||||
|
||||
@@ -328,9 +332,14 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
|
||||
private async Task PostSetObjectIds()
|
||||
{
|
||||
var document = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
if (document == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var sender in _store.GetSenders().ToList())
|
||||
{
|
||||
await RefreshElementsIdsOnSender(sender);
|
||||
await RefreshElementsIdsOnSender(document, sender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,10 +356,13 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
// {
|
||||
// await Commands.RefreshSendFilters();
|
||||
// }
|
||||
var doc = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
if (doc == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
ChangedObjectIds.Any(e => _revitContext.UIApplication.NotNull().ActiveUIDocument.Document.GetElement(e) is View)
|
||||
)
|
||||
if (ChangedObjectIds.Any(e => doc.GetElement(e) is View))
|
||||
{
|
||||
await Commands.RefreshSendFilters();
|
||||
}
|
||||
@@ -360,7 +372,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
{
|
||||
var senders = _store.GetSenders().ToList();
|
||||
// string[] objectIdsList = ChangedObjectIds.Keys.ToArray();
|
||||
var doc = _revitContext.UIApplication.NotNull().ActiveUIDocument.Document;
|
||||
var doc = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
|
||||
if (doc == null)
|
||||
{
|
||||
@@ -402,7 +414,7 @@ internal sealed class RevitSendBinding : RevitBaseBinding, ISendBinding
|
||||
}
|
||||
}
|
||||
|
||||
var unpackedObjectIds = _elementUnpacker.GetUnpackedElementIds(objUniqueIds);
|
||||
var unpackedObjectIds = _elementUnpacker.GetUnpackedElementIds(objUniqueIds, doc);
|
||||
_sendConversionCache.EvictObjects(unpackedObjectIds);
|
||||
|
||||
// Note: we're doing object selection and card expiry management by old school ids
|
||||
|
||||
-1
@@ -37,7 +37,6 @@ public static class ServiceRegistration
|
||||
serviceCollection.AddMatchingInterfacesAsTransient(Assembly.GetExecutingAssembly());
|
||||
|
||||
// Storage Schema
|
||||
serviceCollection.AddScoped<DocumentModelStorageSchema>();
|
||||
serviceCollection.AddScoped<IdStorageSchema>();
|
||||
|
||||
// POC: we need to review the scopes and create a document on what the policy is
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
using Autodesk.Revit.DB.ExtensibleStorage;
|
||||
|
||||
namespace Speckle.Connectors.Revit.HostApp;
|
||||
|
||||
public class DocumentModelStorageSchema : IStorageSchema
|
||||
{
|
||||
private readonly Guid _schemaGuid = new("D690F2B4-BDB0-4CB4-8657-17844ADF42AA");
|
||||
|
||||
public Schema GetSchema()
|
||||
{
|
||||
Schema schema = Schema.Lookup(_schemaGuid);
|
||||
if (schema != null)
|
||||
{
|
||||
return schema;
|
||||
}
|
||||
|
||||
using SchemaBuilder builder = new(_schemaGuid);
|
||||
builder.SetSchemaName("DUI3State");
|
||||
builder.AddSimpleField("contents", typeof(string));
|
||||
return builder.Finish();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Architecture;
|
||||
using Speckle.Converters.Common;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Converters.RevitShared.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.HostApp;
|
||||
|
||||
@@ -11,15 +8,6 @@ namespace Speckle.Connectors.Revit.HostApp;
|
||||
/// </summary>
|
||||
public class ElementUnpacker
|
||||
{
|
||||
private readonly RevitContext _revitContext;
|
||||
private readonly IConverterSettingsStore<RevitConversionSettings> _converterSettings;
|
||||
|
||||
public ElementUnpacker(RevitContext revitContext, IConverterSettingsStore<RevitConversionSettings> converterSettings)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
_converterSettings = converterSettings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unpacks a random set of revit objects into atomic objects. It currently unpacks groups recurisvely, 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).
|
||||
@@ -29,7 +17,7 @@ public class ElementUnpacker
|
||||
/// 1- RootObjectBuilder with linked model document - otherwise we cannot unpack elements from correct document.<br/>
|
||||
/// 2- Evicting the cache while introducing the settings</param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<Element> UnpackSelectionForConversion(IEnumerable<Element> selectionElements, Document? doc = null)
|
||||
public IEnumerable<Element> UnpackSelectionForConversion(IEnumerable<Element> selectionElements, Document doc)
|
||||
{
|
||||
// Note: steps kept separate on purpose.
|
||||
// Step 1: unpack groups
|
||||
@@ -50,24 +38,19 @@ public class ElementUnpacker
|
||||
/// <remarks>
|
||||
/// This is used to invalidate object ids in the send conversion cache when the selected object id is only the parent element id
|
||||
/// </remarks>
|
||||
public IEnumerable<string> GetUnpackedElementIds(IEnumerable<string> objectIds)
|
||||
public IEnumerable<string> GetUnpackedElementIds(IEnumerable<string> objectIds, Document doc)
|
||||
{
|
||||
var doc = _revitContext.UIApplication?.ActiveUIDocument.Document!;
|
||||
var docElements = doc.GetElements(objectIds);
|
||||
return UnpackSelectionForConversion(docElements).Select(o => o.UniqueId).ToList();
|
||||
|
||||
return UnpackSelectionForConversion(docElements, doc).Select(o => o.UniqueId).ToList();
|
||||
}
|
||||
|
||||
// We use the nullable document (happiness level 5/10) for the sake of linked models - bc we use this function in 2 different places
|
||||
// 1- RootObjectBuilder with linked model document - otherwise we cannot unpack elements from correct document.
|
||||
// 2- Evicting the cache while introducing the settings
|
||||
private List<Element> UnpackElements(IEnumerable<Element> elements, Document? doc = null)
|
||||
private List<Element> UnpackElements(IEnumerable<Element> elements, Document doc)
|
||||
{
|
||||
var unpackedElements = new List<Element>(); // note: could be a hashset/map so we prevent duplicates (?)
|
||||
if (doc == null)
|
||||
{
|
||||
doc = _revitContext.UIApplication?.ActiveUIDocument.Document!;
|
||||
}
|
||||
|
||||
foreach (var element in elements)
|
||||
{
|
||||
// UNPACK: Groups
|
||||
@@ -77,7 +60,7 @@ public class ElementUnpacker
|
||||
// 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));
|
||||
unpackedElements.AddRange(UnpackElements(groupElements, doc));
|
||||
}
|
||||
else if (element is BaseArray baseArray)
|
||||
{
|
||||
@@ -85,8 +68,8 @@ public class ElementUnpacker
|
||||
// This handles cases where some elements might not resolve in linked contexts
|
||||
var arrayElements = baseArray.GetCopiedMemberIds().Select(doc.GetElement).Where(el => el != null);
|
||||
var originalElements = baseArray.GetOriginalMemberIds().Select(doc.GetElement).Where(el => el != null);
|
||||
unpackedElements.AddRange(UnpackElements(arrayElements));
|
||||
unpackedElements.AddRange(UnpackElements(originalElements));
|
||||
unpackedElements.AddRange(UnpackElements(arrayElements, doc));
|
||||
unpackedElements.AddRange(UnpackElements(originalElements, doc));
|
||||
}
|
||||
// UNPACK: Family instances (as they potentially have nested families inside)
|
||||
else if (element is FamilyInstance familyInstance)
|
||||
@@ -99,7 +82,7 @@ public class ElementUnpacker
|
||||
|
||||
if (familyElements.Length != 0)
|
||||
{
|
||||
unpackedElements.AddRange(UnpackElements(familyElements));
|
||||
unpackedElements.AddRange(UnpackElements(familyElements, doc));
|
||||
}
|
||||
|
||||
unpackedElements.Add(familyInstance);
|
||||
@@ -107,7 +90,7 @@ public class ElementUnpacker
|
||||
else if (element is MultistoryStairs multistoryStairs)
|
||||
{
|
||||
var stairs = multistoryStairs.GetAllStairsIds().Select(doc.GetElement).Where(el => el != null);
|
||||
unpackedElements.AddRange(UnpackElements(stairs));
|
||||
unpackedElements.AddRange(UnpackElements(stairs, doc));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -125,13 +108,11 @@ public class ElementUnpacker
|
||||
// We use the nullable document (happiness level 5/10) for the sake of linked models - bc we use this function in 2 different places
|
||||
// 1- RootObjectBuilder with linked model document - otherwise we cannot unpack elements from correct document.
|
||||
// 2- Evicting the cache while introducing the settings
|
||||
private List<Element> PackCurtainWallElementsAndStackedWalls(List<Element> elements, Document? doc = null)
|
||||
private List<Element> PackCurtainWallElementsAndStackedWalls(List<Element> elements, Document doc)
|
||||
{
|
||||
var ids = elements.Select(el => el.Id).ToArray();
|
||||
if (doc == null)
|
||||
{
|
||||
doc = _revitContext.UIApplication?.ActiveUIDocument.Document!;
|
||||
}
|
||||
//just used for contains so use ToHashSet
|
||||
var ids = elements.Select(el => el.Id).ToHashSet();
|
||||
|
||||
elements.RemoveAll(element =>
|
||||
(element is Mullion { Host: not null } m && ids.Contains(m.Host.Id))
|
||||
|| (
|
||||
|
||||
@@ -3,7 +3,6 @@ using Autodesk.Revit.DB;
|
||||
using Speckle.Connectors.DUI.Models.Card.SendFilter;
|
||||
using Speckle.Connectors.RevitShared;
|
||||
using Speckle.Connectors.RevitShared.Operations.Send.Filters;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Common;
|
||||
|
||||
@@ -17,20 +16,19 @@ namespace Speckle.Connectors.Revit.HostApp;
|
||||
/// </summary>
|
||||
public class LinkedModelHandler
|
||||
{
|
||||
private readonly RevitContext _revitContext;
|
||||
public Dictionary<string, string> LinkedModelDisplayNames { get; } = new();
|
||||
|
||||
public LinkedModelHandler(RevitContext revitContext)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets elements from a linked document based on the provided send filter.
|
||||
/// This method handles the specifics of element collection but doesn't make decisions
|
||||
/// about whether the linked model should be processed - that's the caller's responsibility.
|
||||
/// </summary>
|
||||
public List<Element> GetLinkedModelElements(ISendFilter sendFilter, Document linkedDocument, Transform? transform)
|
||||
public List<Element> GetLinkedModelElements(
|
||||
Document currentDocument,
|
||||
ISendFilter sendFilter,
|
||||
Document linkedDocument,
|
||||
Transform? transform
|
||||
)
|
||||
{
|
||||
// send mode → Categories
|
||||
if (sendFilter is RevitCategoriesFilter categoryFilter && categoryFilter.SelectedCategories is not null)
|
||||
@@ -48,19 +46,15 @@ public class LinkedModelHandler
|
||||
}
|
||||
|
||||
// send mode → Views (taken from the legacy code)
|
||||
if (sendFilter is RevitViewsFilter viewFilter && viewFilter.GetView() != null)
|
||||
if (sendFilter is RevitViewsFilter viewFilter && viewFilter.GetView(currentDocument) != null)
|
||||
{
|
||||
RevitLinkInstance linkInstance = FindLinkInstanceForDocument(
|
||||
linkedDocument.PathName,
|
||||
_revitContext.UIApplication.NotNull().ActiveUIDocument.Document,
|
||||
transform
|
||||
);
|
||||
RevitLinkInstance linkInstance = FindLinkInstanceForDocument(linkedDocument.PathName, currentDocument, transform);
|
||||
|
||||
#if REVIT2024_OR_GREATER
|
||||
// revit 2024 and 2025 we can use the three-parameter constructor to get only visible elements
|
||||
using var viewCollector = new FilteredElementCollector(
|
||||
_revitContext.UIApplication.ActiveUIDocument.Document,
|
||||
viewFilter.GetView().NotNull().Id,
|
||||
currentDocument,
|
||||
viewFilter.GetView(currentDocument).NotNull().Id,
|
||||
linkInstance.Id
|
||||
);
|
||||
|
||||
@@ -70,7 +64,7 @@ public class LinkedModelHandler
|
||||
// 🚨 LIMITATION: in Revit 2023 and below, we can only check if the entire linked model is visible,
|
||||
// not individual elements within it. If the linked model is visible, all its elements will be included.
|
||||
// constructor overload pertaining to searching and filtering visible elements from a revit link only added 2024.
|
||||
if (linkInstance.IsHidden(viewFilter.GetView().NotNull()))
|
||||
if (linkInstance.IsHidden(viewFilter.GetView(currentDocument).NotNull()))
|
||||
{
|
||||
return new List<Element>(); // if the linked model is hidden, return no elements
|
||||
}
|
||||
|
||||
@@ -1,50 +1,43 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.ExtensibleStorage;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Events;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Common.Threading;
|
||||
using Speckle.Connectors.DUI.Bridge;
|
||||
using Speckle.Connectors.DUI.Models;
|
||||
using Speckle.Connectors.DUI.Utils;
|
||||
using Speckle.Connectors.Revit.Plugin;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Sdk;
|
||||
using Speckle.Sdk.Common;
|
||||
using Speckle.Sdk.SQLite;
|
||||
|
||||
namespace Speckle.Connectors.Revit.HostApp;
|
||||
|
||||
// POC: should be interfaced out
|
||||
internal sealed class RevitDocumentStore : DocumentModelStore
|
||||
{
|
||||
// POC: move to somewhere central?
|
||||
private static readonly Guid s_revitDocumentStoreId = new("D35B3695-EDC9-4E15-B62A-D3FC2CB83FA3");
|
||||
|
||||
private readonly ILogger<RevitDocumentStore> _logger;
|
||||
private readonly IAppIdleManager _idleManager;
|
||||
private readonly RevitContext _revitContext;
|
||||
private readonly DocumentModelStorageSchema _documentModelStorageSchema;
|
||||
private readonly IdStorageSchema _idStorageSchema;
|
||||
private readonly ITopLevelExceptionHandler _topLevelExceptionHandler;
|
||||
private readonly IThreadContext _threadContext;
|
||||
private readonly ISqLiteJsonCacheManager _jsonCacheManager;
|
||||
|
||||
public RevitDocumentStore(
|
||||
ILogger<DocumentModelStore> logger,
|
||||
IAppIdleManager idleManager,
|
||||
RevitContext revitContext,
|
||||
IJsonSerializer jsonSerializer,
|
||||
DocumentModelStorageSchema documentModelStorageSchema,
|
||||
IdStorageSchema idStorageSchema,
|
||||
ITopLevelExceptionHandler topLevelExceptionHandler,
|
||||
IThreadContext threadContext,
|
||||
IRevitTask revitTask
|
||||
IRevitTask revitTask,
|
||||
ISqLiteJsonCacheManagerFactory jsonCacheManagerFactory,
|
||||
ILogger<RevitDocumentStore> logger
|
||||
)
|
||||
: base(logger, jsonSerializer)
|
||||
{
|
||||
_jsonCacheManager = jsonCacheManagerFactory.CreateForUser("ConnectorsFileData");
|
||||
_idleManager = idleManager;
|
||||
_revitContext = revitContext;
|
||||
_documentModelStorageSchema = documentModelStorageSchema;
|
||||
_idStorageSchema = idStorageSchema;
|
||||
_topLevelExceptionHandler = topLevelExceptionHandler;
|
||||
_threadContext = threadContext;
|
||||
_logger = logger;
|
||||
|
||||
UIApplication uiApplication = _revitContext.UIApplication.NotNull();
|
||||
|
||||
@@ -101,103 +94,54 @@ internal sealed class RevitDocumentStore : DocumentModelStore
|
||||
return;
|
||||
}
|
||||
|
||||
_threadContext
|
||||
.RunOnMain(() =>
|
||||
try
|
||||
{
|
||||
var key = GetKeyForDocument(document);
|
||||
if (key is null)
|
||||
{
|
||||
//if not the same active document then don't save the current cards to a bad document!
|
||||
if (!EnsureActiveDocumentIsSame(document))
|
||||
{
|
||||
return;
|
||||
}
|
||||
using Transaction t = new(document, "Speckle Write State");
|
||||
t.Start();
|
||||
using DataStorage ds = GetSettingsDataStorage(document) ?? DataStorage.Create(document);
|
||||
|
||||
using Entity stateEntity = new(_documentModelStorageSchema.GetSchema());
|
||||
string serializedModels = Serialize();
|
||||
stateEntity.Set("contents", serializedModels);
|
||||
|
||||
using Entity idEntity = new(_idStorageSchema.GetSchema());
|
||||
idEntity.Set("Id", s_revitDocumentStoreId);
|
||||
|
||||
ds.SetEntity(idEntity);
|
||||
ds.SetEntity(stateEntity);
|
||||
t.Commit();
|
||||
})
|
||||
.FireAndForget();
|
||||
LoadFromString(null);
|
||||
return;
|
||||
}
|
||||
_jsonCacheManager.UpdateObject(key, modelCardState);
|
||||
}
|
||||
catch (Exception ex) when (!ex.IsFatal())
|
||||
{
|
||||
var key = GetKeyForDocument(document);
|
||||
_logger.LogError(ex, "Failed to save model card state for document {DocumentId}", key);
|
||||
}
|
||||
}
|
||||
|
||||
private bool EnsureActiveDocumentIsSame(Document document)
|
||||
private string? GetKeyForDocument(Document doc)
|
||||
{
|
||||
var localDoc = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
if (localDoc == null)
|
||||
#if REVIT2024_OR_GREATER
|
||||
return doc.CreationGUID.ToString();
|
||||
#else
|
||||
//basically, no document state will ever be saved when it's a new document. It must be saved first for path name to be a valid value.
|
||||
var x = doc.PathName;
|
||||
if (string.IsNullOrEmpty(x))
|
||||
{
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
return localDoc.Equals(document);
|
||||
return x;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void LoadState()
|
||||
{
|
||||
var stateEntity = GetSpeckleEntity(_revitContext.UIApplication?.ActiveUIDocument?.Document);
|
||||
if (stateEntity == null || !stateEntity.IsValid())
|
||||
var document = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
// POC: this can happen? A: Not really, imho (dim) (Adam seyz yes it can if loading also triggers a save)
|
||||
if (document == null)
|
||||
{
|
||||
ClearAndSave();
|
||||
return;
|
||||
}
|
||||
|
||||
string modelsString = stateEntity.Get<string>("contents");
|
||||
LoadFromString(modelsString);
|
||||
}
|
||||
|
||||
private DataStorage? GetSettingsDataStorage(Document doc)
|
||||
{
|
||||
using FilteredElementCollector collector = new(doc);
|
||||
FilteredElementCollector dataStorages = collector.OfClass(typeof(DataStorage));
|
||||
|
||||
foreach (Element element in dataStorages)
|
||||
var key = GetKeyForDocument(document);
|
||||
if (key is null)
|
||||
{
|
||||
DataStorage dataStorage = (DataStorage)element;
|
||||
Entity settingIdEntity = dataStorage.GetEntity(_idStorageSchema.GetSchema());
|
||||
if (!settingIdEntity.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Guid id = settingIdEntity.Get<Guid>("Id");
|
||||
if (!id.Equals(s_revitDocumentStoreId))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return dataStorage;
|
||||
LoadFromString(null);
|
||||
return;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Entity? GetSpeckleEntity(Document? doc)
|
||||
{
|
||||
if (doc is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using FilteredElementCollector collector = new(doc);
|
||||
|
||||
FilteredElementCollector dataStorages = collector.OfClass(typeof(DataStorage));
|
||||
foreach (Element element in dataStorages)
|
||||
{
|
||||
DataStorage dataStorage = (DataStorage)element;
|
||||
Entity settingEntity = dataStorage.GetEntity(_documentModelStorageSchema.GetSchema());
|
||||
if (!settingEntity.IsValid())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return settingEntity;
|
||||
}
|
||||
|
||||
return null;
|
||||
var state = _jsonCacheManager.GetObject(key);
|
||||
LoadFromString(state);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -3,9 +3,13 @@ using Speckle.Converters.RevitShared.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Receive.Settings;
|
||||
|
||||
public class ReferencePointSetting(ReceiveReferencePointType value) : ICardSetting
|
||||
public class ReceiveReferencePointSetting(ReceiveReferencePointType value = ReceiveReferencePointSetting.DEFAULT_VALUE)
|
||||
: ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "referencePoint";
|
||||
public const string SETTING_ID = "referencePoint";
|
||||
public const ReceiveReferencePointType DEFAULT_VALUE = ReceiveReferencePointType.Source;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Reference Point";
|
||||
public string? Type { get; set; } = "string";
|
||||
public List<string>? Enum { get; set; } = System.Enum.GetNames(typeof(ReceiveReferencePointType)).ToList();
|
||||
+18
-5
@@ -1,5 +1,6 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.DUI.Models.Card;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Converters.RevitShared.Settings;
|
||||
@@ -11,18 +12,21 @@ namespace Speckle.Connectors.Revit.Operations.Receive.Settings;
|
||||
public class ToHostSettingsManager : IToHostSettingsManager
|
||||
{
|
||||
private readonly RevitContext _revitContext;
|
||||
private readonly ILogger<ToHostSettingsManager> _logger;
|
||||
|
||||
public ToHostSettingsManager(RevitContext revitContext)
|
||||
public ToHostSettingsManager(RevitContext revitContext, ILogger<ToHostSettingsManager> logger)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public Transform? GetReferencePointSetting(ModelCard modelCard)
|
||||
{
|
||||
var referencePointString = modelCard.Settings?.First(s => s.Id == "referencePoint").Value as string;
|
||||
var referencePointString =
|
||||
modelCard.Settings?.FirstOrDefault(s => s.Id == ReceiveReferencePointSetting.SETTING_ID)?.Value as string;
|
||||
if (
|
||||
referencePointString is not null
|
||||
&& ReferencePointSetting.ReferencePointMap.TryGetValue(
|
||||
&& ReceiveReferencePointSetting.ReferencePointMap.TryGetValue(
|
||||
referencePointString,
|
||||
out ReceiveReferencePointType referencePoint
|
||||
)
|
||||
@@ -34,7 +38,16 @@ public class ToHostSettingsManager : IToHostSettingsManager
|
||||
return currentTransform;
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid reference point value: {referencePointString}");
|
||||
// log the issue
|
||||
_logger.LogWarning(
|
||||
"Invalid reference point setting received: '{ReferencePointString}' for model {ModelCardId}, using default: {DefaultValue}",
|
||||
referencePointString,
|
||||
modelCard.ModelCardId,
|
||||
ReceiveReferencePointSetting.DEFAULT_VALUE
|
||||
);
|
||||
|
||||
// return default (null for Source means no transform)
|
||||
return null;
|
||||
}
|
||||
|
||||
private Transform? GetTransform(ReceiveReferencePointType referencePointType)
|
||||
@@ -91,7 +104,7 @@ public class ToHostSettingsManager : IToHostSettingsManager
|
||||
}
|
||||
|
||||
throw new InvalidOperationException(
|
||||
"Revit Context UI Application was null when retrieving reference point transform."
|
||||
"Revit Context UI Application was null when retrieving reference point transform"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+65
-14
@@ -2,21 +2,22 @@ using Autodesk.Revit.DB;
|
||||
using Speckle.Connectors.DUI.Exceptions;
|
||||
using Speckle.Connectors.DUI.Models.Card.SendFilter;
|
||||
using Speckle.Connectors.DUI.Utils;
|
||||
using Speckle.Converters.RevitShared.Extensions;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Sdk;
|
||||
|
||||
namespace Speckle.Connectors.RevitShared.Operations.Send.Filters;
|
||||
|
||||
public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilter
|
||||
{
|
||||
private RevitContext _revitContext;
|
||||
private Document? _doc;
|
||||
public string Id { get; set; } = "revitViews";
|
||||
public string Name { get; set; } = "Views";
|
||||
public string Type { get; set; } = "Custom";
|
||||
public string? Summary { get; set; }
|
||||
public bool IsDefault { get; set; }
|
||||
public string? SelectedView { get; set; }
|
||||
public List<string> SelectedObjectIds { get; set; }
|
||||
public List<string> SelectedObjectIds { get; set; } = new();
|
||||
public Dictionary<string, string>? IdMap { get; set; } = new();
|
||||
public List<string>? AvailableViews { get; set; }
|
||||
|
||||
@@ -25,12 +26,14 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
public RevitViewsFilter(RevitContext revitContext)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
_doc = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
|
||||
GetViews();
|
||||
var doc = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
if (doc is not null)
|
||||
{
|
||||
GetViews(doc);
|
||||
}
|
||||
}
|
||||
|
||||
public View? GetView()
|
||||
public View? GetView(Document document)
|
||||
{
|
||||
if (SelectedView is null)
|
||||
{
|
||||
@@ -40,7 +43,7 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
var viewFamilyString = result[0];
|
||||
var viewString = result[1];
|
||||
|
||||
using var collector = new FilteredElementCollector(_doc);
|
||||
using var collector = new FilteredElementCollector(document);
|
||||
return collector
|
||||
.OfClass(typeof(View))
|
||||
.Cast<View>()
|
||||
@@ -54,7 +57,8 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
/// <exception cref="SpeckleSendFilterException">Whenever no view is found.</exception>
|
||||
public List<string> RefreshObjectIds()
|
||||
{
|
||||
if (SelectedView is null)
|
||||
var document = _revitContext.UIApplication?.ActiveUIDocument?.Document;
|
||||
if (SelectedView is null || document is null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
@@ -64,7 +68,7 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
var viewFamilyString = result[0];
|
||||
var viewString = result[1];
|
||||
|
||||
using var collector = new FilteredElementCollector(_doc);
|
||||
using var collector = new FilteredElementCollector(document);
|
||||
View? view = collector
|
||||
.OfClass(typeof(View))
|
||||
.Cast<View>()
|
||||
@@ -75,8 +79,8 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
//this used to throw an exception, but we don't want to fail loudly if the view is not found
|
||||
return [];
|
||||
}
|
||||
using var viewCollector = new FilteredElementCollector(_doc, view.Id);
|
||||
var elementsInView = viewCollector.ToElements();
|
||||
|
||||
IEnumerable<Element> elementsInView = GetFilteredElementsForView(document, view);
|
||||
|
||||
// NOTE: FilteredElementCollector() includes sweeps and reveals from a wall family's definition and includes them as additional objects
|
||||
// on this return. displayValue for Wall already includes these, therefore we end up with duplicate elements on wall sweeps
|
||||
@@ -92,9 +96,9 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
return objectIds;
|
||||
}
|
||||
|
||||
private void GetViews()
|
||||
private void GetViews(Document document)
|
||||
{
|
||||
using var collector = new FilteredElementCollector(_doc);
|
||||
using var collector = new FilteredElementCollector(document);
|
||||
var views = collector
|
||||
.OfClass(typeof(View))
|
||||
.Cast<View>()
|
||||
@@ -123,6 +127,53 @@ public class RevitViewsFilter : DiscriminatedObject, ISendFilter, IRevitSendFilt
|
||||
public void SetContext(RevitContext revitContext)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
_doc = _revitContext.UIApplication?.ActiveUIDocument.Document;
|
||||
}
|
||||
|
||||
// NOTE: Element collector returns parts and source elements even when Parts Visibility is set as "Show Parts" only.
|
||||
// Below function collects list of ids to exclude from final list.
|
||||
private HashSet<ElementId> GetSourceElementIdsToExclude(IEnumerable<Element> elements)
|
||||
{
|
||||
var elementsToExclude = new HashSet<ElementId>();
|
||||
|
||||
foreach (var element in elements)
|
||||
{
|
||||
// check if element is a part
|
||||
if (element.Category?.GetBuiltInCategory() == BuiltInCategory.OST_Parts && element is Part part)
|
||||
{
|
||||
try
|
||||
{
|
||||
// get source element ids from the part
|
||||
var sourceIds = part.GetSourceElementIds();
|
||||
if (sourceIds != null)
|
||||
{
|
||||
foreach (var sourceId in sourceIds)
|
||||
{
|
||||
elementsToExclude.Add(sourceId.HostElementId);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) when (!e.IsFatal())
|
||||
{
|
||||
// silently continue processing other Parts if one fails
|
||||
// this follows the pattern used elsewhere in the codebase
|
||||
}
|
||||
}
|
||||
}
|
||||
return elementsToExclude;
|
||||
}
|
||||
|
||||
private IEnumerable<Element> GetFilteredElementsForView(Document document, View view)
|
||||
{
|
||||
using var viewCollector = new FilteredElementCollector(document, view.Id);
|
||||
var allElements = viewCollector.ToElements();
|
||||
|
||||
// parts filtering when view is set to show Parts only (and overwrites allElements)
|
||||
if (view.PartsVisibility == PartsVisibility.ShowPartsOnly)
|
||||
{
|
||||
var idsToExclude = GetSourceElementIdsToExclude(allElements);
|
||||
return allElements.Where(e => !idsToExclude.Contains(e.Id));
|
||||
}
|
||||
|
||||
return allElements;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-8
@@ -33,17 +33,17 @@ public class RevitRootObjectBuilder(
|
||||
{
|
||||
public Task<RootObjectBuilderResult> Build(
|
||||
IReadOnlyList<DocumentToConvert> documentElementContexts,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed,
|
||||
CancellationToken ct = default
|
||||
) =>
|
||||
threadContext.RunOnMainAsync(
|
||||
() => Task.FromResult(BuildSync(documentElementContexts, sendInfo, onOperationProgressed, ct))
|
||||
() => Task.FromResult(BuildSync(documentElementContexts, projectId, onOperationProgressed, ct))
|
||||
);
|
||||
|
||||
private RootObjectBuilderResult BuildSync(
|
||||
IReadOnlyList<DocumentToConvert> documentElementContexts,
|
||||
SendInfo sendInfo,
|
||||
string projectId,
|
||||
IProgress<CardProgress> onOperationProgressed,
|
||||
CancellationToken cancellationToken
|
||||
)
|
||||
@@ -183,10 +183,7 @@ public class RevitRootObjectBuilder(
|
||||
// non-transformed elements can safely rely on cache
|
||||
// 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(sendInfo.ProjectId, applicationId, out ObjectReference? value)
|
||||
)
|
||||
if (!hasTransform && sendConversionCache.TryGetValue(projectId, applicationId, out ObjectReference? value))
|
||||
{
|
||||
converted = value;
|
||||
cacheHitCount++;
|
||||
@@ -228,7 +225,16 @@ public class RevitRootObjectBuilder(
|
||||
}
|
||||
}
|
||||
|
||||
if (results.All(x => x.Status == Status.ERROR) || skippedObjectCount == atomicObjectCount)
|
||||
// if we ended up skipping everything, there is a reason for this, that users can diagnose themselves
|
||||
// this can occur if a published view contains only unsupported objects or if user trying to ONLY send linked model
|
||||
// docs but the setting is disabled
|
||||
if (skippedObjectCount == atomicObjectCount)
|
||||
{
|
||||
throw new SpeckleException("No supported objects visible. Update publish filter or check publish settings.");
|
||||
}
|
||||
|
||||
// this is, I suppose, fully on us?
|
||||
if (results.All(x => x.Status == Status.ERROR))
|
||||
{
|
||||
throw new SpeckleException("Failed to convert all objects.");
|
||||
}
|
||||
|
||||
+5
-2
@@ -3,9 +3,12 @@ using Speckle.Converters.RevitShared.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
public class DetailLevelSetting(DetailLevelType value) : ICardSetting
|
||||
public class DetailLevelSetting(DetailLevelType value = DetailLevelSetting.DEFAULT_VALUE) : ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "detailLevel";
|
||||
public const string SETTING_ID = "detailLevel";
|
||||
public const DetailLevelType DEFAULT_VALUE = DetailLevelType.Medium;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Detail Level";
|
||||
public string? Type { get; set; } = "string";
|
||||
public List<string>? Enum { get; set; } = System.Enum.GetNames(typeof(DetailLevelType)).ToList();
|
||||
|
||||
+5
-2
@@ -2,9 +2,12 @@ using Speckle.Connectors.DUI.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
public class LinkedModelsSetting(bool value) : ICardSetting
|
||||
public class LinkedModelsSetting(bool value = LinkedModelsSetting.DEFAULT_VALUE) : ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "includeLinkedModels";
|
||||
public const string SETTING_ID = "includeLinkedModels";
|
||||
public const bool DEFAULT_VALUE = true;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Include Linked Models";
|
||||
public string? Type { get; set; } = "boolean";
|
||||
public object? Value { get; set; } = value;
|
||||
|
||||
+6
-2
@@ -2,9 +2,13 @@ using Speckle.Connectors.DUI.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
public class SendParameterNullOrEmptyStringsSetting(bool value) : ICardSetting
|
||||
public class SendParameterNullOrEmptyStringsSetting(bool value = SendParameterNullOrEmptyStringsSetting.DEFAULT_VALUE)
|
||||
: ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "nullemptyparams";
|
||||
public const string SETTING_ID = "nullemptyparams";
|
||||
public const bool DEFAULT_VALUE = false;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Send null/empty parameters";
|
||||
public string? Type { get; set; } = "boolean";
|
||||
public List<string>? Enum { get; set; }
|
||||
|
||||
+5
-2
@@ -2,9 +2,12 @@ using Speckle.Connectors.DUI.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
public class SendRebarsAsVolumetricSetting(bool value) : ICardSetting
|
||||
public class SendRebarsAsVolumetricSetting(bool value = SendRebarsAsVolumetricSetting.DEFAULT_VALUE) : ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "sendRebarsAsVolumetric";
|
||||
public const string SETTING_ID = "sendRebarsAsVolumetric";
|
||||
public const bool DEFAULT_VALUE = false;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Send Rebars As Volumetric (disable for better performance)";
|
||||
public string? Type { get; set; } = "boolean";
|
||||
public object? Value { get; set; } = value;
|
||||
|
||||
+6
-2
@@ -3,9 +3,13 @@ using Speckle.Converters.RevitShared.Settings;
|
||||
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
public class ReferencePointSetting(ReferencePointType value) : ICardSetting
|
||||
public class SendReferencePointSetting(ReferencePointType value = SendReferencePointSetting.DEFAULT_VALUE)
|
||||
: ICardSetting
|
||||
{
|
||||
public string? Id { get; set; } = "referencePoint";
|
||||
public const string SETTING_ID = "referencePoint";
|
||||
public const ReferencePointType DEFAULT_VALUE = ReferencePointType.InternalOrigin;
|
||||
|
||||
public string? Id { get; set; } = SETTING_ID;
|
||||
public string? Title { get; set; } = "Reference Point";
|
||||
public string? Type { get; set; } = "string";
|
||||
public List<string>? Enum { get; set; } = System.Enum.GetNames(typeof(ReferencePointType)).ToList();
|
||||
+143
-116
@@ -1,9 +1,8 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Speckle.Connectors.Common.Caching;
|
||||
using Speckle.Connectors.DUI.Models.Card;
|
||||
using Speckle.Connectors.Revit.HostApp;
|
||||
using Speckle.Converters.RevitShared.Helpers;
|
||||
using Speckle.Converters.RevitShared.Settings;
|
||||
using Speckle.InterfaceGenerator;
|
||||
using Speckle.Sdk.Common;
|
||||
@@ -11,33 +10,23 @@ using Speckle.Sdk.Common;
|
||||
namespace Speckle.Connectors.Revit.Operations.Send.Settings;
|
||||
|
||||
[GenerateAutoInterface]
|
||||
public class ToSpeckleSettingsManager : IToSpeckleSettingsManager
|
||||
public class ToSpeckleSettingsManager(
|
||||
ISendConversionCache sendConversionCache,
|
||||
ElementUnpacker elementUnpacker,
|
||||
ILogger<ToSpeckleSettingsManager> logger
|
||||
) : IToSpeckleSettingsManager
|
||||
{
|
||||
private readonly RevitContext _revitContext;
|
||||
private readonly ISendConversionCache _sendConversionCache;
|
||||
private readonly ElementUnpacker _elementUnpacker;
|
||||
|
||||
// cache invalidation process run with ModelCardId since the settings are model specific
|
||||
private readonly Dictionary<string, DetailLevelType> _detailLevelCache = new();
|
||||
private readonly Dictionary<string, Transform?> _referencePointCache = new();
|
||||
private readonly Dictionary<string, bool?> _sendNullParamsCache = new();
|
||||
private readonly Dictionary<string, bool?> _sendLinkedModelsCache = new();
|
||||
private readonly Dictionary<string, bool?> _sendRebarsAsVolumetricCache = new();
|
||||
private readonly Dictionary<string, DetailLevelType> _detailLevelCache = [];
|
||||
private readonly Dictionary<string, Transform?> _referencePointCache = [];
|
||||
private readonly Dictionary<string, bool?> _sendNullParamsCache = [];
|
||||
private readonly Dictionary<string, bool?> _sendLinkedModelsCache = [];
|
||||
private readonly Dictionary<string, bool?> _sendRebarsAsVolumetricCache = [];
|
||||
|
||||
public ToSpeckleSettingsManager(
|
||||
RevitContext revitContext,
|
||||
ISendConversionCache sendConversionCache,
|
||||
ElementUnpacker elementUnpacker
|
||||
)
|
||||
public DetailLevelType GetDetailLevelSetting(Document document, SenderModelCard modelCard)
|
||||
{
|
||||
_revitContext = revitContext;
|
||||
_elementUnpacker = elementUnpacker;
|
||||
_sendConversionCache = sendConversionCache;
|
||||
}
|
||||
|
||||
public DetailLevelType GetDetailLevelSetting(SenderModelCard modelCard)
|
||||
{
|
||||
var fidelityString = modelCard.Settings?.First(s => s.Id == "detailLevel").Value as string;
|
||||
var fidelityString =
|
||||
modelCard.Settings?.FirstOrDefault(s => s.Id == DetailLevelSetting.SETTING_ID)?.Value as string;
|
||||
if (
|
||||
fidelityString is not null
|
||||
&& DetailLevelSetting.GeometryFidelityMap.TryGetValue(fidelityString, out DetailLevelType fidelity)
|
||||
@@ -47,22 +36,34 @@ public class ToSpeckleSettingsManager : IToSpeckleSettingsManager
|
||||
{
|
||||
if (previousType != fidelity)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
EvictCacheForModelCard(document, modelCard);
|
||||
}
|
||||
}
|
||||
_detailLevelCache[modelCard.ModelCardId.NotNull()] = fidelity;
|
||||
return fidelity;
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid geometry fidelity value: {fidelityString}");
|
||||
// log the issue
|
||||
logger.LogWarning(
|
||||
"Invalid detail level setting received: '{FidelityString}' for model {ModelCardId}, using default: {DefaultValue}",
|
||||
fidelityString,
|
||||
modelCard.ModelCardId,
|
||||
DetailLevelSetting.DEFAULT_VALUE
|
||||
);
|
||||
|
||||
// return sensible default
|
||||
DetailLevelType defaultValue = DetailLevelSetting.DEFAULT_VALUE;
|
||||
_detailLevelCache[modelCard.ModelCardId.NotNull()] = defaultValue;
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public Transform? GetReferencePointSetting(ModelCard modelCard)
|
||||
public Transform? GetReferencePointSetting(Document document, ModelCard modelCard)
|
||||
{
|
||||
var referencePointString = modelCard.Settings?.First(s => s.Id == "referencePoint").Value as string;
|
||||
var referencePointString =
|
||||
modelCard.Settings?.FirstOrDefault(s => s.Id == SendReferencePointSetting.SETTING_ID)?.Value as string;
|
||||
if (
|
||||
referencePointString is not null
|
||||
&& ReferencePointSetting.ReferencePointMap.TryGetValue(
|
||||
&& SendReferencePointSetting.ReferencePointMap.TryGetValue(
|
||||
referencePointString,
|
||||
out ReferencePointType referencePoint
|
||||
)
|
||||
@@ -70,14 +71,14 @@ public class ToSpeckleSettingsManager : IToSpeckleSettingsManager
|
||||
{
|
||||
// get the current transform from setting first
|
||||
// we are doing this because we can't track if reference points were changed between send operations.
|
||||
Transform? currentTransform = GetTransform(referencePoint);
|
||||
Transform? currentTransform = GetTransform(document, referencePoint);
|
||||
|
||||
if (_referencePointCache.TryGetValue(modelCard.ModelCardId.NotNull(), out Transform? previousTransform))
|
||||
{
|
||||
// invalidate conversion cache if the transform has changed
|
||||
if (modelCard is SenderModelCard senderModelCard && previousTransform != currentTransform)
|
||||
{
|
||||
EvictCacheForModelCard(senderModelCard);
|
||||
EvictCacheForModelCard(document, senderModelCard);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,118 +86,144 @@ public class ToSpeckleSettingsManager : IToSpeckleSettingsManager
|
||||
return currentTransform;
|
||||
}
|
||||
|
||||
throw new ArgumentException($"Invalid reference point value: {referencePointString}");
|
||||
// log the issue
|
||||
logger.LogWarning(
|
||||
"Invalid reference point setting received: '{ReferencePointString}' for model {ModelCardId}, using default: {DefaultValue}",
|
||||
referencePointString,
|
||||
modelCard.ModelCardId,
|
||||
SendReferencePointSetting.DEFAULT_VALUE
|
||||
);
|
||||
|
||||
// return default (null for InternalOrigin means no transform)
|
||||
_referencePointCache[modelCard.ModelCardId.NotNull()] = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool GetSendParameterNullOrEmptyStringsSetting(SenderModelCard modelCard)
|
||||
{
|
||||
var value = modelCard.Settings?.First(s => s.Id == "nullemptyparams").Value as bool?;
|
||||
var returnValue = value != null && value.NotNull();
|
||||
if (_sendNullParamsCache.TryGetValue(modelCard.ModelCardId.NotNull(), out bool? previousValue))
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
}
|
||||
|
||||
_sendNullParamsCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
public bool GetSendParameterNullOrEmptyStringsSetting(Document document, SenderModelCard modelCard) =>
|
||||
GetBooleanSettingWithCache(
|
||||
document,
|
||||
SendParameterNullOrEmptyStringsSetting.SETTING_ID,
|
||||
SendParameterNullOrEmptyStringsSetting.DEFAULT_VALUE,
|
||||
modelCard,
|
||||
_sendNullParamsCache,
|
||||
"Send null/empty parameters"
|
||||
);
|
||||
|
||||
// NOTE: Cache invalidation currently a placeholder until we have more understanding on the sends
|
||||
// TODO: Evaluate cache invalidation for GetLinkedModelsSetting
|
||||
public bool GetLinkedModelsSetting(SenderModelCard modelCard)
|
||||
{
|
||||
var value = modelCard.Settings?.First(s => s.Id == "includeLinkedModels").Value as bool?;
|
||||
var returnValue = value != null && value.NotNull();
|
||||
public bool GetLinkedModelsSetting(Document document, SenderModelCard modelCard) =>
|
||||
GetBooleanSettingWithCache(
|
||||
document,
|
||||
LinkedModelsSetting.SETTING_ID,
|
||||
LinkedModelsSetting.DEFAULT_VALUE,
|
||||
modelCard,
|
||||
_sendLinkedModelsCache,
|
||||
"Linked models"
|
||||
);
|
||||
|
||||
if (_sendLinkedModelsCache.TryGetValue(modelCard.ModelCardId.NotNull(), out bool? previousValue))
|
||||
public bool GetSendRebarsAsVolumetric(Document document, SenderModelCard modelCard) =>
|
||||
GetBooleanSettingWithCache(
|
||||
document,
|
||||
SendRebarsAsVolumetricSetting.SETTING_ID,
|
||||
SendRebarsAsVolumetricSetting.DEFAULT_VALUE,
|
||||
modelCard,
|
||||
_sendRebarsAsVolumetricCache,
|
||||
"Send rebars as volumetric"
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Helper method to handle boolean settings with caching and logging
|
||||
/// </summary>
|
||||
private bool GetBooleanSettingWithCache(
|
||||
Document document,
|
||||
string settingId,
|
||||
bool defaultValue,
|
||||
SenderModelCard modelCard,
|
||||
Dictionary<string, bool?> cache,
|
||||
string settingName
|
||||
)
|
||||
{
|
||||
var settingValue = modelCard.Settings?.FirstOrDefault(s => s.Id == settingId)?.Value as bool?;
|
||||
bool returnValue = settingValue ?? defaultValue;
|
||||
|
||||
if (cache.TryGetValue(modelCard.ModelCardId.NotNull(), out bool? previousValue))
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
EvictCacheForModelCard(document, modelCard);
|
||||
}
|
||||
}
|
||||
_sendLinkedModelsCache[modelCard.ModelCardId] = returnValue;
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public bool GetSendRebarsAsVolumetric(SenderModelCard modelCard)
|
||||
{
|
||||
var value = modelCard.Settings?.First(s => s.Id == "sendRebarsAsVolumetric").Value as bool?;
|
||||
var returnValue = value != null && value.NotNull();
|
||||
if (_sendRebarsAsVolumetricCache.TryGetValue(modelCard.ModelCardId.NotNull(), out bool? previousValue))
|
||||
cache[modelCard.ModelCardId] = returnValue;
|
||||
|
||||
// NOTE: we probably don't need to log here BUT considering users might complain that a setting might not have been
|
||||
// respected (linked models disabled but still sent linked models), I think we should note this occurence so we know
|
||||
if (settingValue == null)
|
||||
{
|
||||
if (previousValue != returnValue)
|
||||
{
|
||||
EvictCacheForModelCard(modelCard);
|
||||
}
|
||||
logger.LogWarning(
|
||||
"{SettingName} setting was null for model {ModelCardId}, using default: {DefaultValue}",
|
||||
settingName,
|
||||
modelCard.ModelCardId,
|
||||
defaultValue
|
||||
);
|
||||
}
|
||||
_sendRebarsAsVolumetricCache[modelCard.ModelCardId] = returnValue;
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
private void EvictCacheForModelCard(SenderModelCard modelCard)
|
||||
private void EvictCacheForModelCard(Document document, SenderModelCard modelCard)
|
||||
{
|
||||
var objectIds = modelCard.SendFilter != null ? modelCard.SendFilter.NotNull().SelectedObjectIds : [];
|
||||
var unpackedObjectIds = _elementUnpacker.GetUnpackedElementIds(objectIds);
|
||||
_sendConversionCache.EvictObjects(unpackedObjectIds);
|
||||
var objectIds = modelCard.SendFilter?.SelectedObjectIds ?? [];
|
||||
var unpackedObjectIds = elementUnpacker.GetUnpackedElementIds(objectIds, document);
|
||||
sendConversionCache.EvictObjects(unpackedObjectIds);
|
||||
}
|
||||
|
||||
private Transform? GetTransform(ReferencePointType referencePointType)
|
||||
private Transform? GetTransform(Document document, ReferencePointType referencePointType)
|
||||
{
|
||||
Transform? referencePointTransform = null;
|
||||
|
||||
if (_revitContext.UIApplication is UIApplication uiApplication)
|
||||
// first get the main doc base points and reference setting transform
|
||||
using FilteredElementCollector filteredElementCollector = new(document);
|
||||
var points = filteredElementCollector.OfClass(typeof(BasePoint)).Cast<BasePoint>().ToList();
|
||||
BasePoint? projectPoint = points.FirstOrDefault(o => !o.IsShared);
|
||||
BasePoint? surveyPoint = points.FirstOrDefault(o => o.IsShared);
|
||||
|
||||
switch (referencePointType)
|
||||
{
|
||||
// first get the main doc base points and reference setting transform
|
||||
using FilteredElementCollector filteredElementCollector = new(uiApplication.ActiveUIDocument.Document);
|
||||
var points = filteredElementCollector.OfClass(typeof(BasePoint)).Cast<BasePoint>().ToList();
|
||||
BasePoint? projectPoint = points.FirstOrDefault(o => !o.IsShared);
|
||||
BasePoint? surveyPoint = points.FirstOrDefault(o => o.IsShared);
|
||||
// note that the project base (ui) rotation is registered on the survey pt, not on the base point
|
||||
case ReferencePointType.ProjectBase:
|
||||
if (projectPoint is not null)
|
||||
{
|
||||
referencePointTransform = Transform.CreateTranslation(projectPoint.Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Couldn't retrieve Project Point from document");
|
||||
}
|
||||
break;
|
||||
|
||||
switch (referencePointType)
|
||||
{
|
||||
// note that the project base (ui) rotation is registered on the survey pt, not on the base point
|
||||
case ReferencePointType.ProjectBase:
|
||||
if (projectPoint is not null)
|
||||
{
|
||||
referencePointTransform = Transform.CreateTranslation(projectPoint.Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Couldn't retrieve Project Point from document");
|
||||
}
|
||||
break;
|
||||
// note that the project base (ui) rotation is registered on the survey pt, not on the base point
|
||||
case ReferencePointType.Survey:
|
||||
if (surveyPoint is not null && projectPoint is not null)
|
||||
{
|
||||
// POC: should a null angle resolve to 0?
|
||||
// retrieve the survey point rotation from the project point
|
||||
var angle = projectPoint.get_Parameter(BuiltInParameter.BASEPOINT_ANGLETON_PARAM)?.AsDouble() ?? 0;
|
||||
|
||||
// note that the project base (ui) rotation is registered on the survey pt, not on the base point
|
||||
case ReferencePointType.Survey:
|
||||
if (surveyPoint is not null && projectPoint is not null)
|
||||
{
|
||||
// POC: should a null angle resolve to 0?
|
||||
// retrieve the survey point rotation from the project point
|
||||
var angle = projectPoint.get_Parameter(BuiltInParameter.BASEPOINT_ANGLETON_PARAM)?.AsDouble() ?? 0;
|
||||
// POC: following disposed incorrectly or early or maybe a false negative?
|
||||
using Transform translation = Transform.CreateTranslation(surveyPoint.Position);
|
||||
referencePointTransform = translation.Multiply(Transform.CreateRotation(XYZ.BasisZ, angle));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Couldn't retrieve Survey and Project Point from document");
|
||||
}
|
||||
break;
|
||||
|
||||
// POC: following disposed incorrectly or early or maybe a false negative?
|
||||
using Transform translation = Transform.CreateTranslation(surveyPoint.Position);
|
||||
referencePointTransform = translation.Multiply(Transform.CreateRotation(XYZ.BasisZ, angle));
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("Couldn't retrieve Survey and Project Point from document");
|
||||
}
|
||||
break;
|
||||
|
||||
case ReferencePointType.InternalOrigin:
|
||||
break;
|
||||
}
|
||||
|
||||
return referencePointTransform;
|
||||
case ReferencePointType.InternalOrigin:
|
||||
break;
|
||||
}
|
||||
|
||||
throw new InvalidOperationException(
|
||||
"Revit Context UI Application was null when retrieving reference point transform."
|
||||
);
|
||||
return referencePointTransform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,10 @@ public class RevitThreadContext : ThreadContext
|
||||
return default;
|
||||
}
|
||||
});
|
||||
if (ex is OperationCanceledException operation)
|
||||
{
|
||||
throw operation;
|
||||
}
|
||||
if (ex is not null)
|
||||
{
|
||||
throw new SpeckleRevitTaskException(ex);
|
||||
@@ -61,6 +65,10 @@ public class RevitThreadContext : ThreadContext
|
||||
return default;
|
||||
}
|
||||
});
|
||||
if (ex is OperationCanceledException operation)
|
||||
{
|
||||
throw operation;
|
||||
}
|
||||
if (ex is not null)
|
||||
{
|
||||
throw new SpeckleRevitTaskException(ex);
|
||||
@@ -104,6 +112,11 @@ public class RevitThreadContext : ThreadContext
|
||||
ex = e;
|
||||
}
|
||||
});
|
||||
|
||||
if (ex is OperationCanceledException operation)
|
||||
{
|
||||
throw operation;
|
||||
}
|
||||
if (ex is not null)
|
||||
{
|
||||
throw new SpeckleRevitTaskException(ex);
|
||||
|
||||
@@ -7,7 +7,7 @@ using Speckle.Sdk.Common;
|
||||
namespace Speckle.Connectors.Revit.Plugin;
|
||||
|
||||
#pragma warning disable CA1032
|
||||
public class SpeckleRevitTaskException(Exception exception) : SpeckleException("Revit operation failed", exception)
|
||||
public class SpeckleRevitTaskException(Exception exception) : SpeckleException(exception.Message, exception)
|
||||
#pragma warning restore CA1032
|
||||
{
|
||||
public static async Task ProcessException<T>(
|
||||
|
||||
+4
-5
@@ -19,7 +19,6 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bindings\SelectionBinding.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Bindings\RevitSendBinding.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ElementIdHelper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\DocumentModelStorageSchema.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\DocumentToConvert.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\Elements.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\LevelUnpacker.cs" />
|
||||
@@ -37,9 +36,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\SendCollectionManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)HostApp\ElementUnpacker.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\ITransactionManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)operations\receive\ReferencePointSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\ReceiveReferencePointSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\RevitHostObjectBuilder.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)operations\receive\ToHostSettingsManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\ToHostSettingsManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Receive\TransactionManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Filters\IRevitSendFilter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Filters\RevitCategoriesFilter.cs" />
|
||||
@@ -50,7 +49,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\SendParameterNullOrEmptyStringsSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\SendRebarsAsVolumetricSetting.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ToSpeckleSettingsManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Operations\Send\Settings\ReferencePointSetting.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" />
|
||||
@@ -61,4 +60,4 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\RevitCefPlugin.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Plugin\SpeckleRevitTaskException.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</ItemGroup>
|
||||
<Target AfterTargets="Build" Name="WarnIfPublicReleaseVersionInstalled" Condition="'$(RhinoVersion)' != '' And '$(ContinuousIntegrationBuild)' != 'true' And '$(OS)' == 'Windows_NT'">
|
||||
<Warning
|
||||
Text="Conflicting Rhino plugin detected - Do you have a public release installed?"
|
||||
Text="Conflicting Rhino plugin detected - Do you have a public release installed? at '@(PublicReleasePath)'"
|
||||
Condition="Exists(@(PublicReleasePath))" />
|
||||
</Target>
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -13,9 +13,9 @@
|
||||
},
|
||||
"GrasshopperAsyncComponent": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.0.1, )",
|
||||
"resolved": "2.0.1",
|
||||
"contentHash": "K/LyJbYscXIdV07tPhsZgyUdwzf7vsXJBraVik6ge35T9lLYrriG5Dy9XF8ox7Q2ko5y5aTzh768+vYCdDkL5g==",
|
||||
"requested": "[2.0.3, )",
|
||||
"resolved": "2.0.3",
|
||||
"contentHash": "AZvHP96WhYZWftVi7J3J65LiZmXO3hGS6W4AntMMb099gkrLqeiBKC2DOYD6YM9cOyQqly3S5knbUL2yr0jc4Q==",
|
||||
"dependencies": {
|
||||
"PolySharp": "1.14.1"
|
||||
}
|
||||
@@ -325,9 +325,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.logging": {
|
||||
@@ -337,7 +337,7 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.rhino7": {
|
||||
@@ -382,18 +382,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -403,14 +403,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
},
|
||||
"GrasshopperAsyncComponent": {
|
||||
"type": "Direct",
|
||||
"requested": "[2.0.1, )",
|
||||
"resolved": "2.0.1",
|
||||
"contentHash": "K/LyJbYscXIdV07tPhsZgyUdwzf7vsXJBraVik6ge35T9lLYrriG5Dy9XF8ox7Q2ko5y5aTzh768+vYCdDkL5g==",
|
||||
"requested": "[2.0.3, )",
|
||||
"resolved": "2.0.3",
|
||||
"contentHash": "AZvHP96WhYZWftVi7J3J65LiZmXO3hGS6W4AntMMb099gkrLqeiBKC2DOYD6YM9cOyQqly3S5knbUL2yr0jc4Q==",
|
||||
"dependencies": {
|
||||
"PolySharp": "1.14.1"
|
||||
}
|
||||
@@ -325,9 +325,9 @@
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyInjection": "[2.2.0, )",
|
||||
"Speckle.Connectors.Logging": "[1.0.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )",
|
||||
"Speckle.Sdk": "[3.4.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )",
|
||||
"Speckle.Sdk": "[3.5.4, )",
|
||||
"Speckle.Sdk.Dependencies": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.connectors.logging": {
|
||||
@@ -337,13 +337,12 @@
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.Logging.Abstractions": "[2.2.0, )",
|
||||
"Speckle.Objects": "[3.4.4, )"
|
||||
"Speckle.Objects": "[3.5.4, )"
|
||||
}
|
||||
},
|
||||
"speckle.converters.rhino8": {
|
||||
"type": "Project",
|
||||
"dependencies": {
|
||||
"RhinoCommon": "[8.9.24194.18121, )",
|
||||
"Speckle.Converters.Common": "[1.0.0, )"
|
||||
}
|
||||
},
|
||||
@@ -382,18 +381,18 @@
|
||||
},
|
||||
"Speckle.Objects": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "zLYhOAPKdaFYN+YOjDDKyXK/9WMvv+EB2bmemdIf+xU8SzKeXOLMqf+Zo2pokkc1Wjc7ZmggphBbmSBkHmS9Dw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o7ex4+yHJYI8pJbsjNqw+D8r8WjkBoB5aK/GQlGJd/0zydrPxN4SMKS4arpRBR3CUD6JhtQMatScXZOrslGXQg==",
|
||||
"dependencies": {
|
||||
"Speckle.Sdk": "3.4.4"
|
||||
"Speckle.Sdk": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "tzQR3tcTFGzzu2R1EQbG2JM+Us57JGFm+tH9wScSrDQE1X5XRjJfaxf1st09D26Ale2B+pVst/AVxr9OlLs1Kw==",
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "o4bEJTz+OBI1koy9xqXSIq3UtUFCKtk6Btg82rdVM2aFMPT3ZoYVarG+ylPcUOHd684XpgGASxE6dIgXz2pvng==",
|
||||
"dependencies": {
|
||||
"GraphQL.Client": "6.0.0",
|
||||
"Microsoft.Bcl.AsyncInterfaces": "5.0.0",
|
||||
@@ -403,14 +402,14 @@
|
||||
"Microsoft.Extensions.Logging": "2.2.0",
|
||||
"Speckle.DoubleNumerics": "4.1.0",
|
||||
"Speckle.Newtonsoft.Json": "13.0.2",
|
||||
"Speckle.Sdk.Dependencies": "3.4.4"
|
||||
"Speckle.Sdk.Dependencies": "3.5.4"
|
||||
}
|
||||
},
|
||||
"Speckle.Sdk.Dependencies": {
|
||||
"type": "CentralTransitive",
|
||||
"requested": "[3.4.4, )",
|
||||
"resolved": "3.4.4",
|
||||
"contentHash": "c5fRdts5l/xS842CjhxOCOvrCq7tZ6eO3x2SB1GRECBzpQ9Y9I2Yn4FXOrgznFSb5HFur+ReJsZZH7Ml8pW/iQ=="
|
||||
"requested": "[3.5.4, )",
|
||||
"resolved": "3.5.4",
|
||||
"contentHash": "d0ZOHiK11Hq9r7YEkfTvVu33ygWtsrgysIWdCRAz6rdlcAgMCEkWVBoe3jDjxdmUy20TToaQlFKfMH4hTyzWXg=="
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+80
-19
@@ -399,6 +399,33 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
|
||||
public string SearchPattern { get; set; } = string.Empty;
|
||||
|
||||
private bool _autoSelectAllItemsItems;
|
||||
|
||||
/// <summary>
|
||||
/// When enabled, all available items will be selected automatically and persistently.
|
||||
/// </summary>
|
||||
public bool AutoSelectAllItems
|
||||
{
|
||||
get => _autoSelectAllItemsItems;
|
||||
set
|
||||
{
|
||||
if (_autoSelectAllItemsItems == value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_autoSelectAllItemsItems = value;
|
||||
|
||||
if (value && _listItems.Count > 0)
|
||||
{
|
||||
SelectAllItems();
|
||||
ResetPersistentData(_listItems.Select(x => x.Value), "Enable auto-select all items");
|
||||
}
|
||||
|
||||
OnDisplayExpired(false);
|
||||
}
|
||||
}
|
||||
|
||||
protected internal int LayoutLevel { get; set; } = 1;
|
||||
|
||||
sealed class ListItem
|
||||
@@ -437,16 +464,14 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
public RectangleF BoxName;
|
||||
}
|
||||
|
||||
private List<ListItem> _listItems = new List<ListItem>();
|
||||
private List<ListItem> _listItems = [];
|
||||
IEnumerable<ListItem> SelectedItems => _listItems.Where(x => x.Selected);
|
||||
|
||||
public override void AppendAdditionalMenuItems(ToolStripDropDown menu)
|
||||
{
|
||||
if (Kind == GH_ParamKind.floating || Kind == GH_ParamKind.input)
|
||||
{
|
||||
Menu_AppendDestroyPersistent(menu);
|
||||
|
||||
if (Exposure != GH_Exposure.hidden) { }
|
||||
Menu_AppendInternaliseData(menu);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,6 +574,8 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
|
||||
protected override GH_GetterResult Prompt_Singular(ref T value) => GH_GetterResult.cancel;
|
||||
|
||||
// NOTE: removed from AppendAdditionalMenuItems as clearing selection simple enough. Keeping here just in case
|
||||
// we want to bring it back
|
||||
protected override void Menu_AppendDestroyPersistent(ToolStripDropDown menu) =>
|
||||
Menu_AppendItem(menu, "Clear selection", Menu_DestroyPersistentData, PersistentDataCount > 0);
|
||||
|
||||
@@ -569,11 +596,36 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
|
||||
protected override void Menu_AppendInternaliseData(ToolStripDropDown menu)
|
||||
{
|
||||
Menu_AppendItem(menu, "Invert selection", Menu_InvertSelectionClicked, _listItems.Count != PersistentDataCount);
|
||||
Menu_AppendItem(menu, "Select all", Menu_SelectAllClicked, _listItems.Count != PersistentDataCount);
|
||||
// Disabled Invert selection and one-off select all according to Discord chat. These are easy enough
|
||||
// Select all also enabled through ctrl+a
|
||||
//Menu_AppendItem(menu, "Invert selection", Menu_InvertSelectionClicked, _listItems.Count != PersistentDataCount);
|
||||
//Menu_AppendItem(menu, "Select all", Menu_SelectAllClicked, _listItems.Count != PersistentDataCount);
|
||||
|
||||
var alwaysSelectAllItem = Menu_AppendItem(
|
||||
menu,
|
||||
"Auto-select all items",
|
||||
Menu_AlwaysSelectAllClicked,
|
||||
true,
|
||||
_autoSelectAllItemsItems
|
||||
);
|
||||
alwaysSelectAllItem.ToolTipText = _autoSelectAllItemsItems
|
||||
? "Currently auto-selecting all available items. Click to disable."
|
||||
: "Enable automatic selection of all available items. Will persist when new data is input.";
|
||||
|
||||
Menu_AppendItem(menu, "Internalise selection", Menu_InternaliseDataClicked, SourceCount > 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Helper method that reduces code duplication to select all items
|
||||
/// </summary>
|
||||
private void SelectAllItems()
|
||||
{
|
||||
foreach (var item in _listItems)
|
||||
{
|
||||
item.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_InternaliseDataClicked(object sender, EventArgs e)
|
||||
{
|
||||
if (SourceCount == 0)
|
||||
@@ -610,14 +662,16 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
|
||||
protected void Menu_SelectAllClicked(object sender, EventArgs e)
|
||||
{
|
||||
foreach (var item in _listItems)
|
||||
{
|
||||
item.Selected = true;
|
||||
}
|
||||
|
||||
SelectAllItems();
|
||||
ResetPersistentData(_listItems.Select(x => x.Value), "Select all");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event handler for auto-select all items menu item
|
||||
/// </summary>
|
||||
private void Menu_AlwaysSelectAllClicked(object sender, EventArgs e) =>
|
||||
AutoSelectAllItems = !_autoSelectAllItemsItems;
|
||||
|
||||
sealed class ResizableAttributes : GH_ResizableAttributes<ValueSet<T>>
|
||||
{
|
||||
public override bool HasInputGrip => true;
|
||||
@@ -1336,11 +1390,6 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
return GH_ObjectResponse.Ignore;
|
||||
}
|
||||
|
||||
public override GH_ObjectResponse RespondToKeyDown(GH_Canvas sender, KeyEventArgs e)
|
||||
{
|
||||
return base.RespondToKeyDown(sender, e);
|
||||
}
|
||||
|
||||
private sealed class SearchInputBox : Grasshopper.GUI.Base.GH_TextBoxInputBase
|
||||
{
|
||||
private readonly ResizableAttributes _parentAttributes;
|
||||
@@ -1398,6 +1447,12 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
reader.TryGetInt32("LayoutLevel", ref layoutLevel);
|
||||
LayoutLevel = Rhino.RhinoMath.Clamp(layoutLevel, 1, 2);
|
||||
|
||||
bool alwaysSelectAll = false;
|
||||
if (reader.TryGetBoolean("AutoSelectAllItems", ref alwaysSelectAll))
|
||||
{
|
||||
_autoSelectAllItemsItems = alwaysSelectAll;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1423,6 +1478,8 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
writer.SetInt32("LayoutLevel", LayoutLevel);
|
||||
}
|
||||
|
||||
writer.SetBoolean("AutoSelectAllItems", _autoSelectAllItemsItems);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1684,11 +1741,8 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
public sealed override void PostProcessData()
|
||||
{
|
||||
LoadVolatileData();
|
||||
|
||||
PreProcessVolatileData();
|
||||
|
||||
ProcessVolatileData();
|
||||
|
||||
SortItems();
|
||||
|
||||
// Order by fuzzy token if suits.
|
||||
@@ -1701,6 +1755,13 @@ public abstract class ValueSet<T> : GH_PersistentParam<T>, IGH_InitCodeAware, IG
|
||||
}
|
||||
|
||||
PostProcessVolatileData();
|
||||
|
||||
// auto-select if enabled
|
||||
if (_autoSelectAllItemsItems && _listItems.Count > 0 && _listItems.Any(item => !item.Selected))
|
||||
{
|
||||
SelectAllItems();
|
||||
ResetPersistentData(_listItems.Select(x => x.Value), null);
|
||||
}
|
||||
}
|
||||
|
||||
public override void RegisterRemoteIDs(GH_GuidTable id_list)
|
||||
|
||||
+10
-2
@@ -1,3 +1,4 @@
|
||||
using Grasshopper.Kernel;
|
||||
using Grasshopper.Kernel.Types;
|
||||
using Speckle.Connectors.GrasshopperShared.Components.BaseComponents;
|
||||
using Speckle.Connectors.GrasshopperShared.HostApp;
|
||||
@@ -12,7 +13,7 @@ public class CollectionPathsSelector : ValueSet<IGH_Goo>
|
||||
: base(
|
||||
"Collection Selector",
|
||||
"cSelect",
|
||||
"Allows you to select a set of collection paths for querying",
|
||||
"Allows you to select a set of collection paths for querying. Right-click for 'Auto-select all items' option.",
|
||||
ComponentCategories.PRIMARY_RIBBON,
|
||||
ComponentCategories.COLLECTIONS
|
||||
) { }
|
||||
@@ -22,11 +23,18 @@ public class CollectionPathsSelector : ValueSet<IGH_Goo>
|
||||
|
||||
protected override void LoadVolatileData()
|
||||
{
|
||||
var collections = VolatileData
|
||||
List<SpeckleCollectionWrapper> collections = VolatileData
|
||||
.AllData(true)
|
||||
.OfType<SpeckleCollectionWrapperGoo>()
|
||||
.Select(goo => goo.Value)
|
||||
.ToList();
|
||||
|
||||
if (VolatileDataCount > collections.Count)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Only Speckle Collections are accepted as inputs.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (collections.Count == 0)
|
||||
{
|
||||
return;
|
||||
|
||||
+12
-3
@@ -158,10 +158,19 @@ public class CreateCollection : VariableParameterComponentBase
|
||||
{
|
||||
foreach (var obj in objects)
|
||||
{
|
||||
// deep copy to avoid mutations
|
||||
if (obj?.ToSpeckleObjectWrapper() is SpeckleObjectWrapper objWrapper)
|
||||
// handle data objects directly (deep copy to avoid mutations)
|
||||
// NOTE: DataObject first, since a DataObject with one geo is castable to speckle geometry
|
||||
if (obj is SpeckleDataObjectWrapperGoo dataObjectWrapperGoo)
|
||||
{
|
||||
SpeckleObjectWrapper wrapper = objWrapper.DeepCopy();
|
||||
var dataObjectWrapper = dataObjectWrapperGoo.Value.DeepCopy();
|
||||
dataObjectWrapper.Path = childPath;
|
||||
dataObjectWrapper.Parent = parentCollection;
|
||||
parentCollection.Elements.Add(dataObjectWrapper);
|
||||
}
|
||||
// handle geometry objects (deep copy to avoid mutations)
|
||||
else if (obj?.ToSpeckleGeometryWrapper() is SpeckleGeometryWrapper objWrapper)
|
||||
{
|
||||
SpeckleGeometryWrapper wrapper = objWrapper.DeepCopy();
|
||||
wrapper.Path = childPath;
|
||||
wrapper.Parent = parentCollection;
|
||||
parentCollection.Elements.Add(wrapper);
|
||||
|
||||
+9
-13
@@ -1,7 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using Grasshopper.Kernel;
|
||||
using Grasshopper.Kernel.Parameters;
|
||||
using Grasshopper.Kernel.Types;
|
||||
using Speckle.Connectors.GrasshopperShared.HostApp;
|
||||
using Speckle.Connectors.GrasshopperShared.Parameters;
|
||||
@@ -55,18 +54,18 @@ public class ExpandCollection : GH_Component, IGH_VariableParameterComponent
|
||||
// Separate objects and collections
|
||||
// Note: SpeckleBlockInstanceWrapper inherits from SpeckleObjectWrapper,
|
||||
// so it will be included in objects
|
||||
var objects = wrapper.Elements.OfType<SpeckleObjectWrapper>().ToList();
|
||||
var collections = wrapper.Elements.OfType<SpeckleCollectionWrapper>().ToList();
|
||||
List<SpeckleWrapper> objects = wrapper.GetAtomicObjects().ToList();
|
||||
List<SpeckleCollectionWrapper> collections = wrapper.Elements.OfType<SpeckleCollectionWrapper>().ToList();
|
||||
|
||||
var outputParams = new List<OutputParamWrapper>();
|
||||
if (objects.Count != 0)
|
||||
{
|
||||
var param = new Param_GenericObject()
|
||||
var param = new SpeckleOutputParam
|
||||
{
|
||||
Name = "_objects",
|
||||
NickName = "_objs",
|
||||
Description =
|
||||
"Some collections may contain a mix of objects and other collections. Here we output the atomic objects from within this collection.",
|
||||
"Some collections may contain a mix of objects and other collections. These are the objects directly contained in this collection.",
|
||||
Access = GH_ParamAccess.list
|
||||
};
|
||||
|
||||
@@ -94,7 +93,7 @@ public class ExpandCollection : GH_Component, IGH_VariableParameterComponent
|
||||
nickName += "..." + childWrapper.Name[^6..];
|
||||
}
|
||||
|
||||
var param = new Param_GenericObject()
|
||||
var param = new SpeckleOutputParam
|
||||
{
|
||||
Name = childWrapper.Name,
|
||||
NickName = nickName,
|
||||
@@ -113,10 +112,7 @@ public class ExpandCollection : GH_Component, IGH_VariableParameterComponent
|
||||
else
|
||||
{
|
||||
// Create appropriate Goo types for child objects
|
||||
List<IGH_Goo> childObjectGoos = childWrapper
|
||||
.Elements.OfType<SpeckleObjectWrapper>()
|
||||
.Select(obj => obj.CreateGoo())
|
||||
.ToList();
|
||||
List<IGH_Goo> childObjectGoos = childWrapper.GetAtomicObjects().Select(obj => obj.CreateGoo()).ToList();
|
||||
outputValue = childObjectGoos;
|
||||
}
|
||||
|
||||
@@ -194,7 +190,7 @@ public class ExpandCollection : GH_Component, IGH_VariableParameterComponent
|
||||
|
||||
foreach (var newParam in outputParams)
|
||||
{
|
||||
var param = new Param_GenericObject
|
||||
var param = new SpeckleOutputParam
|
||||
{
|
||||
Name = newParam.Param.Name,
|
||||
NickName = newParam.Param.NickName,
|
||||
@@ -217,7 +213,7 @@ public class ExpandCollection : GH_Component, IGH_VariableParameterComponent
|
||||
|
||||
public IGH_Param CreateParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
var myParam = new Param_GenericObject
|
||||
var myParam = new SpeckleOutputParam
|
||||
{
|
||||
Name = GH_ComponentParamServer.InventUniqueNickname("ABCD", Params.Input),
|
||||
MutableNickName = true,
|
||||
@@ -230,4 +226,4 @@ public class ExpandCollection : GH_Component, IGH_VariableParameterComponent
|
||||
public bool DestroyParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Output;
|
||||
}
|
||||
|
||||
public record OutputParamWrapper(Param_GenericObject Param, object Values, string? Topology);
|
||||
public record OutputParamWrapper(SpeckleOutputParam Param, object Values, string? Topology);
|
||||
|
||||
@@ -8,8 +8,8 @@ public static class ComponentCategories
|
||||
|
||||
// categories
|
||||
public const string OPERATIONS = " Models";
|
||||
public const string OBJECTS = " Objects";
|
||||
public const string COLLECTIONS = " Collections";
|
||||
public const string OBJECTS = " Objects";
|
||||
public const string COLLECTIONS = " Collections";
|
||||
public const string PARAMETERS = " Params";
|
||||
public const string DEVELOPER = "Dev";
|
||||
}
|
||||
|
||||
+303
-171
@@ -28,99 +28,202 @@ public class DeconstructSpeckleParam : GH_Component, IGH_VariableParameterCompon
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
protected override Bitmap Icon => Resources.speckle_deconstruct;
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager) =>
|
||||
pManager.AddGenericParameter("Speckle Param", "SP", "Speckle param to deconstruct", GH_ParamAccess.item);
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) { }
|
||||
|
||||
protected override void SolveInstance(IGH_DataAccess da)
|
||||
{
|
||||
object data = new();
|
||||
da.GetData(0, ref data);
|
||||
|
||||
List<OutputParamWrapper> outputParams = new();
|
||||
|
||||
switch (data)
|
||||
// on first iteration, discover all fields from all objects to create stable output structure
|
||||
if (da.Iteration == 0)
|
||||
{
|
||||
case SpeckleCollectionWrapperGoo collectionGoo when collectionGoo.Value != null:
|
||||
// get children elements from the wrapper to override the elements prop while parsing
|
||||
List<IGH_Goo> children = collectionGoo.Value.Elements.Select(o => ((SpeckleWrapper)o).CreateGoo()).ToList();
|
||||
outputParams = ParseSpeckleWrapper(collectionGoo.Value, children);
|
||||
break;
|
||||
case SpeckleObjectWrapperGoo objectGoo when objectGoo.Value != null:
|
||||
outputParams = ParseSpeckleWrapper(objectGoo.Value);
|
||||
break;
|
||||
case SpeckleBlockInstanceWrapperGoo blockInstanceGoo when blockInstanceGoo.Value != null:
|
||||
outputParams = ParseSpeckleWrapper(blockInstanceGoo.Value);
|
||||
break;
|
||||
case SpeckleBlockDefinitionWrapperGoo blockDef:
|
||||
outputParams = ParseSpeckleWrapper(blockDef.Value);
|
||||
break;
|
||||
case SpeckleMaterialWrapperGoo materialGoo when materialGoo.Value != null:
|
||||
outputParams = ParseSpeckleWrapper(materialGoo.Value);
|
||||
break;
|
||||
var allFields = DiscoverAllFieldsFromInput();
|
||||
|
||||
case SpecklePropertyGroupGoo propGoo:
|
||||
Name = $"properties ({propGoo.Value.Count})";
|
||||
outputParams = new();
|
||||
foreach (var key in propGoo.Value.Keys)
|
||||
if (allFields.Count > 0)
|
||||
{
|
||||
var requiredOutputs = CreateOutputParamsFromFieldNames(allFields);
|
||||
|
||||
if (OutputMismatch(requiredOutputs))
|
||||
{
|
||||
ISpecklePropertyGoo value = propGoo.Value[key];
|
||||
object? outputValue = value is SpecklePropertyGoo prop
|
||||
? prop.Value
|
||||
: value is SpecklePropertyGroupGoo propGroup
|
||||
? propGroup
|
||||
: value;
|
||||
outputParams.Add(CreateOutputParamByKeyValue(key, outputValue, GH_ParamAccess.item));
|
||||
OnPingDocument()?.ScheduleSolution(5, _ => CreateOutputs(requiredOutputs));
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Type cannot be deconstructed: {data.GetType().Name}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// process current object normally
|
||||
object data = new();
|
||||
if (!da.GetData(0, ref data))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var outputParams = DeconstructObject(data);
|
||||
if (outputParams == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// set component name based on the current object
|
||||
NickName = Name;
|
||||
|
||||
if (da.Iteration == 0 && OutputMismatch(outputParams))
|
||||
// set output data - fill missing fields with nulls for objects that don't have all fields
|
||||
SetOutputData(da, outputParams);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Discovers all unique field names and their access types from all input objects by looking at volatile data directly.
|
||||
/// </summary>
|
||||
/// <returns>A dictionary mapping field names to their required parameter access types.</returns>
|
||||
private IReadOnlyDictionary<string, GH_ParamAccess> DiscoverAllFieldsFromInput()
|
||||
{
|
||||
Dictionary<string, GH_ParamAccess> allFields = [];
|
||||
|
||||
foreach (var item in Params.Input[0].VolatileData.AllData(true))
|
||||
{
|
||||
OnPingDocument()
|
||||
.ScheduleSolution(
|
||||
5,
|
||||
_ =>
|
||||
{
|
||||
CreateOutputs(outputParams);
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < outputParams.Count; i++)
|
||||
var objectOutputs = DeconstructObject(item);
|
||||
if (objectOutputs != null)
|
||||
{
|
||||
var outParam = Params.Output[i];
|
||||
var outParamWrapper = outputParams[i];
|
||||
switch (outParam.Access)
|
||||
foreach (var output in objectOutputs)
|
||||
{
|
||||
case GH_ParamAccess.item:
|
||||
da.SetData(i, outParamWrapper.Value);
|
||||
break;
|
||||
case GH_ParamAccess.list:
|
||||
da.SetDataList(i, outParamWrapper.Value as IList);
|
||||
break;
|
||||
string fieldName = output.Param.Name;
|
||||
allFields[fieldName] = output.Param.Access;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return allFields;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates output parameter wrappers from field names and their corresponding access types.
|
||||
/// </summary>
|
||||
/// <param name="fieldAccessTypes">Dictionary mapping field names to their required parameter access types.</param>
|
||||
/// <returns>List of output parameter wrappers with correct access types.</returns>
|
||||
private List<OutputParamWrapper> CreateOutputParamsFromFieldNames(
|
||||
IReadOnlyDictionary<string, GH_ParamAccess> fieldAccessTypes
|
||||
) => fieldAccessTypes.Select(kvp => CreateOutputParamByKeyValue(kvp.Key, null, kvp.Value)).ToList();
|
||||
|
||||
/// <summary>
|
||||
/// Deconstructs a single object into its constituent fields/properties.
|
||||
/// </summary>
|
||||
private List<OutputParamWrapper>? DeconstructObject(object data) =>
|
||||
data switch
|
||||
{
|
||||
// get children elements from wrapper to override elements prop while parsing
|
||||
SpeckleCollectionWrapperGoo collectionGoo when collectionGoo.Value != null
|
||||
=> ParseSpeckleWrapper(
|
||||
collectionGoo.Value,
|
||||
collectionGoo.Value.Elements.Select(o => ((SpeckleWrapper)o).CreateGoo()).ToList()
|
||||
),
|
||||
|
||||
// get geometries from wrapper to override displayValue prop while parsing
|
||||
SpeckleDataObjectWrapperGoo dataObjectGoo when dataObjectGoo.Value != null
|
||||
=> ParseSpeckleWrapper(
|
||||
dataObjectGoo.Value,
|
||||
null,
|
||||
dataObjectGoo.Value.Geometries.Select(o => o.CreateGoo()).ToList()
|
||||
),
|
||||
|
||||
SpeckleGeometryWrapperGoo objectGoo when objectGoo.Value != null => ParseSpeckleWrapper(objectGoo.Value),
|
||||
|
||||
SpeckleBlockInstanceWrapperGoo blockInstanceGoo when blockInstanceGoo.Value != null
|
||||
=> ParseSpeckleWrapper(blockInstanceGoo.Value),
|
||||
|
||||
SpeckleBlockDefinitionWrapperGoo blockDef when blockDef.Value != null => ParseSpeckleWrapper(blockDef.Value),
|
||||
|
||||
SpeckleMaterialWrapperGoo materialGoo when materialGoo.Value != null => ParseSpeckleWrapper(materialGoo.Value),
|
||||
|
||||
SpecklePropertyGroupGoo propGoo when propGoo.Value != null => ParsePropertyGroup(propGoo),
|
||||
|
||||
_ => HandleUnsupportedType(data)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Handles SpecklePropertyGroupGoo objects by extracting their key-value pairs.
|
||||
/// </summary>
|
||||
private List<OutputParamWrapper> ParsePropertyGroup(SpecklePropertyGroupGoo propGoo)
|
||||
{
|
||||
Name = $"properties ({propGoo.Value.Count})";
|
||||
List<OutputParamWrapper> objectOutputs = new();
|
||||
|
||||
foreach (var key in propGoo.Value.Keys)
|
||||
{
|
||||
ISpecklePropertyGoo value = propGoo.Value[key];
|
||||
object? outputValue = value switch
|
||||
{
|
||||
SpecklePropertyGoo prop => prop.Value,
|
||||
SpecklePropertyGroupGoo propGroup => propGroup,
|
||||
_ => value
|
||||
};
|
||||
|
||||
// determine access type based on the value
|
||||
GH_ParamAccess access = outputValue is IList ? GH_ParamAccess.list : GH_ParamAccess.item;
|
||||
objectOutputs.Add(CreateOutputParamByKeyValue(key, outputValue, access));
|
||||
}
|
||||
|
||||
return objectOutputs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles unsupported object types by logging an error and returning null.
|
||||
/// </summary>
|
||||
private List<OutputParamWrapper>? HandleUnsupportedType(object data)
|
||||
{
|
||||
AddRuntimeMessage(GH_RuntimeMessageLevel.Error, $"Type cannot be deconstructed: {data.GetType().Name}");
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets output data for the current iteration, filling missing fields with null values.
|
||||
/// Uses a lookup dictionary for efficient field matching.
|
||||
/// </summary>
|
||||
private void SetOutputData(IGH_DataAccess da, List<OutputParamWrapper> currentOutputs)
|
||||
{
|
||||
if (Params.Output.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// create a lookup for current outputs by field name
|
||||
var outputLookup = currentOutputs.ToDictionary(o => o.Param.Name, o => o.Value);
|
||||
|
||||
// set data for each output parameter
|
||||
for (int i = 0; i < Params.Output.Count; i++)
|
||||
{
|
||||
var outputParam = Params.Output[i];
|
||||
|
||||
// set the value if it exists, otherwise set null
|
||||
object? value = outputLookup.TryGetValue(outputParam.Name, out var fieldValue) ? fieldValue : null;
|
||||
|
||||
switch (outputParam.Access)
|
||||
{
|
||||
case GH_ParamAccess.item:
|
||||
da.SetData(i, value);
|
||||
break;
|
||||
case GH_ParamAccess.list:
|
||||
da.SetDataList(i, value as IList ?? new List<object?>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<OutputParamWrapper> ParseSpeckleWrapper(SpeckleWrapper wrapper, List<IGH_Goo>? collElements = null)
|
||||
private List<OutputParamWrapper> ParseSpeckleWrapper(
|
||||
SpeckleWrapper wrapper,
|
||||
List<IGH_Goo>? elements = null,
|
||||
List<IGH_Goo>? displayValue = null
|
||||
)
|
||||
{
|
||||
Name = string.IsNullOrEmpty(wrapper.Name) ? wrapper.Base.speckle_type : wrapper.Name;
|
||||
return CreateOutputParamsFromBase(wrapper.Base, collElements);
|
||||
return CreateOutputParamsFromBase(wrapper.Base, elements, displayValue);
|
||||
}
|
||||
|
||||
private List<OutputParamWrapper> CreateOutputParamsFromBase(Base @base, List<IGH_Goo>? collElements = null)
|
||||
private List<OutputParamWrapper> CreateOutputParamsFromBase(
|
||||
Base @base,
|
||||
List<IGH_Goo>? elements = null,
|
||||
List<IGH_Goo>? displayValue = null
|
||||
)
|
||||
{
|
||||
List<OutputParamWrapper> result = new();
|
||||
if (@base == null)
|
||||
@@ -128,121 +231,149 @@ public class DeconstructSpeckleParam : GH_Component, IGH_VariableParameterCompon
|
||||
return result;
|
||||
}
|
||||
|
||||
// cycle through base props
|
||||
// process each property of the Base object
|
||||
foreach (var prop in @base.GetMembers(DynamicBaseMemberType.Instance | DynamicBaseMemberType.Dynamic))
|
||||
{
|
||||
// Convert and add to corresponding output structure
|
||||
var value = prop.Value;
|
||||
switch (value)
|
||||
// skip internal dynamic property keys
|
||||
if (prop.Key == nameof(Base.DynamicPropertyKeys))
|
||||
{
|
||||
case null:
|
||||
result.Add(CreateOutputParamByKeyValue(prop.Key, null, GH_ParamAccess.item));
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
case IList list:
|
||||
List<object> nativeObjects = new();
|
||||
|
||||
// override list value if base is a collection and this is the elements prop, since this is empty if coming from a collectionwrapper
|
||||
if (@base is Collection && prop.Key == "elements" && collElements != null)
|
||||
{
|
||||
list = collElements;
|
||||
}
|
||||
|
||||
foreach (var x in list)
|
||||
{
|
||||
switch (x)
|
||||
{
|
||||
case SpeckleWrapper wrapper:
|
||||
nativeObjects.Add(wrapper.CreateGoo());
|
||||
break;
|
||||
|
||||
case Base xBase:
|
||||
nativeObjects.AddRange(ConvertOrCreateWrapper(xBase));
|
||||
break;
|
||||
|
||||
default:
|
||||
nativeObjects.Add(x);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
result.Add(CreateOutputParamByKeyValue(prop.Key, nativeObjects, GH_ParamAccess.list));
|
||||
break;
|
||||
|
||||
case Dictionary<string, object?> dict: // this should be treated a properties dict
|
||||
SpecklePropertyGroupGoo propertyGoo = new();
|
||||
propertyGoo.CastFrom(dict);
|
||||
result.Add(CreateOutputParamByKeyValue(prop.Key, propertyGoo, GH_ParamAccess.item));
|
||||
break;
|
||||
|
||||
case SpeckleWrapper wrapper:
|
||||
result.Add(CreateOutputParamByKeyValue(prop.Key, wrapper.CreateGoo(), GH_ParamAccess.item));
|
||||
break;
|
||||
|
||||
case Base baseValue:
|
||||
result.Add(CreateOutputParamByKeyValue(prop.Key, ConvertOrCreateWrapper(baseValue), GH_ParamAccess.list));
|
||||
break;
|
||||
|
||||
default:
|
||||
// we don't want to output dynamic property keys
|
||||
if (prop.Key == nameof(Base.DynamicPropertyKeys))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
result.Add(CreateOutputParamByKeyValue(prop.Key, prop.Value, GH_ParamAccess.item));
|
||||
break;
|
||||
var outputParam = CreateOutputParamForProperty(prop, @base, elements, displayValue);
|
||||
if (outputParam != null)
|
||||
{
|
||||
result.Add(outputParam);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<SpeckleObjectWrapperGoo> ConvertOrCreateWrapper(Base @base)
|
||||
/// <summary>
|
||||
/// Creates an output parameter for a single property, handling different value types appropriately.
|
||||
/// </summary>
|
||||
private OutputParamWrapper CreateOutputParamForProperty(
|
||||
KeyValuePair<string, object?> prop,
|
||||
Base @base,
|
||||
List<IGH_Goo>? elements,
|
||||
List<IGH_Goo>? displayValue
|
||||
) =>
|
||||
prop.Value switch
|
||||
{
|
||||
null => CreateOutputParamByKeyValue(prop.Key, null, GH_ParamAccess.item),
|
||||
IList list => CreateListOutputParam(prop.Key, list, @base, elements, displayValue),
|
||||
Dictionary<string, object?> dict => CreateDictionaryOutputParam(prop.Key, dict),
|
||||
SpeckleWrapper wrapper => CreateOutputParamByKeyValue(prop.Key, wrapper.CreateGoo(), GH_ParamAccess.item),
|
||||
Base baseValue => CreateOutputParamByKeyValue(prop.Key, ConvertOrCreateWrapper(baseValue), GH_ParamAccess.list),
|
||||
_ => CreateOutputParamByKeyValue(prop.Key, prop.Value, GH_ParamAccess.item)
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Creates an output parameter for list properties, with special handling for collection elements and display values.
|
||||
/// </summary>
|
||||
private OutputParamWrapper CreateListOutputParam(
|
||||
string key,
|
||||
IList list,
|
||||
Base @base,
|
||||
List<IGH_Goo>? elements,
|
||||
List<IGH_Goo>? displayValue
|
||||
)
|
||||
{
|
||||
// override list value for special cases
|
||||
IList actualList = key switch
|
||||
{
|
||||
"elements" when @base is Collection && elements != null => elements,
|
||||
"displayValue" when @base is Speckle.Objects.Data.DataObject && displayValue != null => displayValue,
|
||||
_ => list
|
||||
};
|
||||
|
||||
List<object> nativeObjects = new();
|
||||
foreach (var item in actualList)
|
||||
{
|
||||
switch (item)
|
||||
{
|
||||
case SpeckleWrapper wrapper:
|
||||
nativeObjects.Add(wrapper.CreateGoo());
|
||||
break;
|
||||
case Base baseItem:
|
||||
nativeObjects.AddRange(ConvertOrCreateWrapper(baseItem));
|
||||
break;
|
||||
default:
|
||||
nativeObjects.Add(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CreateOutputParamByKeyValue(key, nativeObjects, GH_ParamAccess.list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an output parameter for dictionary properties, converting them to SpecklePropertyGroupGoo.
|
||||
/// </summary>
|
||||
private OutputParamWrapper CreateDictionaryOutputParam(string key, Dictionary<string, object?> dict)
|
||||
{
|
||||
SpecklePropertyGroupGoo propertyGoo = new();
|
||||
propertyGoo.CastFrom(dict);
|
||||
return CreateOutputParamByKeyValue(key, propertyGoo, GH_ParamAccess.item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a Speckle Base object to host geometry or creates a wrapper if conversion fails.
|
||||
/// Returns a list of SpeckleGeometryWrapperGoo objects.
|
||||
/// </summary>
|
||||
private List<SpeckleGeometryWrapperGoo> ConvertOrCreateWrapper(Base @base)
|
||||
{
|
||||
try
|
||||
{
|
||||
// convert the base and create a wrapper for each result
|
||||
List<(GeometryBase, Base)> convertedBase = SpeckleConversionContext.ConvertToHost(@base);
|
||||
List<SpeckleObjectWrapperGoo> convertedWrappers = new();
|
||||
foreach ((GeometryBase g, Base b) in convertedBase)
|
||||
{
|
||||
SpeckleObjectWrapper convertedWrapper =
|
||||
new()
|
||||
{
|
||||
Base = b,
|
||||
GeometryBase = g,
|
||||
Name = b["name"] as string ?? "",
|
||||
Color = null,
|
||||
Material = null
|
||||
};
|
||||
|
||||
convertedWrappers.Add(new(convertedWrapper));
|
||||
}
|
||||
|
||||
return convertedWrappers;
|
||||
// attempt conversion to host geometry
|
||||
List<(object, Base)> convertedBase = SpeckleConversionContext.Current.ConvertToHost(@base);
|
||||
return convertedBase.Select(CreateGeometryWrapper).ToList();
|
||||
}
|
||||
catch (ConversionException)
|
||||
{
|
||||
// some classes, like RawEncoding, have no direct conversion or fallback value.
|
||||
// when this is the case, wrap it to allow users to further expand the object.
|
||||
SpeckleObjectWrapper convertedWrapper =
|
||||
new()
|
||||
{
|
||||
Base = @base,
|
||||
GeometryBase = null,
|
||||
Name = @base[Constants.NAME_PROP] as string ?? "",
|
||||
Color = null,
|
||||
Material = null
|
||||
};
|
||||
|
||||
return new() { new SpeckleObjectWrapperGoo(convertedWrapper) };
|
||||
// fallback: create wrapper without conversion for objects that can't be converted
|
||||
return new List<SpeckleGeometryWrapperGoo> { CreateFallbackWrapper(@base) };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a SpeckleGeometryWrapperGoo from a converted geometry and base object pair.
|
||||
/// </summary>
|
||||
private SpeckleGeometryWrapperGoo CreateGeometryWrapper((object geometry, Base @base) converted)
|
||||
{
|
||||
SpeckleGeometryWrapper wrapper =
|
||||
new()
|
||||
{
|
||||
Base = converted.@base,
|
||||
GeometryBase = converted.geometry as GeometryBase,
|
||||
Name = converted.@base["name"] as string ?? "",
|
||||
Color = null,
|
||||
Material = null
|
||||
};
|
||||
return new SpeckleGeometryWrapperGoo(wrapper);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a fallback wrapper for Base objects that cannot be converted to host geometry.
|
||||
/// </summary>
|
||||
private SpeckleGeometryWrapperGoo CreateFallbackWrapper(Base @base)
|
||||
{
|
||||
SpeckleGeometryWrapper wrapper =
|
||||
new()
|
||||
{
|
||||
Base = @base,
|
||||
GeometryBase = null,
|
||||
Name = @base[Constants.NAME_PROP] as string ?? "",
|
||||
Color = null,
|
||||
Material = null
|
||||
};
|
||||
return new SpeckleGeometryWrapperGoo(wrapper);
|
||||
}
|
||||
|
||||
private OutputParamWrapper CreateOutputParamByKeyValue(string key, object? value, GH_ParamAccess access)
|
||||
{
|
||||
Param_GenericObject param =
|
||||
SpeckleOutputParam param =
|
||||
new()
|
||||
{
|
||||
Name = key,
|
||||
@@ -272,22 +403,20 @@ public class DeconstructSpeckleParam : GH_Component, IGH_VariableParameterCompon
|
||||
return myParam;
|
||||
}
|
||||
|
||||
public bool DestroyParameter(GH_ParameterSide side, int index)
|
||||
{
|
||||
return side == GH_ParameterSide.Output;
|
||||
}
|
||||
public bool DestroyParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Output;
|
||||
|
||||
private void CreateOutputs(List<OutputParamWrapper> outputParams)
|
||||
{
|
||||
// TODO: better, nicer handling of creation/removal
|
||||
// remove all existing output parameters
|
||||
while (Params.Output.Count > 0)
|
||||
{
|
||||
Params.UnregisterOutputParameter(Params.Output[^1]);
|
||||
}
|
||||
|
||||
// add new output parameters
|
||||
foreach (var newParam in outputParams)
|
||||
{
|
||||
var param = new Param_GenericObject
|
||||
var param = new SpeckleOutputParam
|
||||
{
|
||||
Name = newParam.Param.Name,
|
||||
NickName = newParam.Param.NickName,
|
||||
@@ -297,11 +426,15 @@ public class DeconstructSpeckleParam : GH_Component, IGH_VariableParameterCompon
|
||||
Params.RegisterOutputParam(param);
|
||||
}
|
||||
|
||||
// notify Grasshopper of parameter changes
|
||||
Params.OnParametersChanged();
|
||||
VariableParameterMaintenance();
|
||||
ExpireSolution(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the current output parameter structure differs from the required structure.
|
||||
/// </summary>
|
||||
private bool OutputMismatch(List<OutputParamWrapper> outputParams)
|
||||
{
|
||||
if (Params.Output.Count != outputParams.Count)
|
||||
@@ -309,10 +442,10 @@ public class DeconstructSpeckleParam : GH_Component, IGH_VariableParameterCompon
|
||||
return true;
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
foreach (var newParam in outputParams)
|
||||
for (int i = 0; i < outputParams.Count; i++)
|
||||
{
|
||||
var oldParam = Params.Output[count];
|
||||
var newParam = outputParams[i];
|
||||
var oldParam = Params.Output[i];
|
||||
if (
|
||||
oldParam.NickName != newParam.Param.NickName
|
||||
|| oldParam.Name != newParam.Param.Name
|
||||
@@ -321,7 +454,6 @@ public class DeconstructSpeckleParam : GH_Component, IGH_VariableParameterCompon
|
||||
{
|
||||
return true;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
+11
-1
@@ -28,7 +28,12 @@ public class TokenUrlComponent : GH_Component
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
pManager.AddTextParameter("Speckle Url", "Url", "Speckle URL", GH_ParamAccess.item);
|
||||
pManager.AddTextParameter("Speckle Token", "Token", "Speckle Authorization Token", GH_ParamAccess.item);
|
||||
pManager.AddTextParameter(
|
||||
"Speckle Token",
|
||||
"Token",
|
||||
"Speckle Authorization Token. Requires profile:read, profile:email, stream:read, and workspace:read (unless on a non-workspace enable server), as well as any other write scopes needed",
|
||||
GH_ParamAccess.item
|
||||
);
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
|
||||
@@ -99,6 +104,11 @@ public class TokenUrlComponent : GH_Component
|
||||
throw new SpeckleException("No account found for server URL");
|
||||
}
|
||||
|
||||
if (account.userInfo.id is null || account.userInfo.email is null)
|
||||
{
|
||||
throw new SpeckleException("Token requires profile:read and profile:email scopes");
|
||||
}
|
||||
|
||||
IClient client = scope.Get<IClientFactory>().Create(account);
|
||||
|
||||
var project = client.Project.Get(resource.ProjectId).Result;
|
||||
|
||||
+28
-10
@@ -17,7 +17,7 @@ public class CreateSpeckleProperties : VariableParameterComponentBase
|
||||
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
protected override Bitmap Icon => Resources.speckle_properties_create;
|
||||
public override GH_Exposure Exposure => GH_Exposure.tertiary;
|
||||
public override GH_Exposure Exposure => GH_Exposure.quarternary;
|
||||
|
||||
public CreateSpeckleProperties()
|
||||
: base(
|
||||
@@ -34,8 +34,7 @@ public class CreateSpeckleProperties : VariableParameterComponentBase
|
||||
pManager.AddParameter(param);
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager)
|
||||
{
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) =>
|
||||
pManager.AddParameter(
|
||||
new SpecklePropertyGroupParam(),
|
||||
"Properties",
|
||||
@@ -43,7 +42,6 @@ public class CreateSpeckleProperties : VariableParameterComponentBase
|
||||
"Properties for Speckle Objects",
|
||||
GH_ParamAccess.item
|
||||
);
|
||||
}
|
||||
|
||||
protected override void SolveInstance(IGH_DataAccess da)
|
||||
{
|
||||
@@ -67,13 +65,15 @@ public class CreateSpeckleProperties : VariableParameterComponentBase
|
||||
{
|
||||
var paramName = Params.Input[i].NickName;
|
||||
|
||||
var data = Params.Input[i].VolatileData.AllData(true).ToList();
|
||||
if (data.Count == 0)
|
||||
if (Params.Input[i].VolatileDataCount == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var propertyValue = ExtractPropertyValue(da, i, paramName);
|
||||
ISpecklePropertyGoo? propertyValue =
|
||||
Params.Input[i].Access == GH_ParamAccess.item
|
||||
? ExtractPropertyValue(da, i, paramName)
|
||||
: ExtractPropertyListValue(da, i, paramName);
|
||||
|
||||
if (propertyValue != null)
|
||||
{
|
||||
@@ -114,6 +114,26 @@ public class CreateSpeckleProperties : VariableParameterComponentBase
|
||||
return propertyGoo;
|
||||
}
|
||||
|
||||
private ISpecklePropertyGoo? ExtractPropertyListValue(IGH_DataAccess da, int index, string paramName)
|
||||
{
|
||||
List<object?> value = new();
|
||||
da.GetDataList(index, value);
|
||||
|
||||
var propertyGoo = new SpecklePropertyGoo();
|
||||
|
||||
if (!propertyGoo.CastFrom(value))
|
||||
{
|
||||
AddRuntimeMessage(
|
||||
GH_RuntimeMessageLevel.Error,
|
||||
$"Parameter '{paramName}' contains invalid data type. Only strings, numbers, and booleans are supported."
|
||||
);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return propertyGoo;
|
||||
}
|
||||
|
||||
protected override void AppendComponentSpecificMenuItems(ToolStripDropDown menu)
|
||||
{
|
||||
Menu_AppendSeparator(menu);
|
||||
@@ -145,10 +165,8 @@ public class CreateSpeckleProperties : VariableParameterComponentBase
|
||||
ExpireSolution(true);
|
||||
}
|
||||
|
||||
protected override void WriteComponentSpecificData(GH_IWriter writer)
|
||||
{
|
||||
protected override void WriteComponentSpecificData(GH_IWriter writer) =>
|
||||
writer.SetBoolean("CreateEmptyProperties", CreateEmptyProperties);
|
||||
}
|
||||
|
||||
protected override void ReadComponentSpecificData(GH_IReader reader)
|
||||
{
|
||||
|
||||
+170
@@ -0,0 +1,170 @@
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using Grasshopper.Kernel;
|
||||
using Speckle.Connectors.GrasshopperShared.Parameters;
|
||||
using Speckle.Connectors.GrasshopperShared.Properties;
|
||||
|
||||
namespace Speckle.Connectors.GrasshopperShared.Components.Objects;
|
||||
|
||||
// NOTE: Why all this madness? The properties passthrough node is restrictive in output type being uniform
|
||||
// Properties whose values were lists were not being displayed and couldn't be given back to the user as native
|
||||
// lists. This was (it seemed) the only viable approach.
|
||||
// [CNX-2364](https://linear.app/speckle/issue/CNX-2364/grasshopper-properties-passthrough-does-not-handle-list-values)
|
||||
|
||||
[Guid("474F4699-D641-444F-BC78-E22AAF40B240")]
|
||||
public class ExpandSpeckleProperties : GH_Component, IGH_VariableParameterComponent
|
||||
{
|
||||
public ExpandSpeckleProperties()
|
||||
: base(
|
||||
"Expand Properties",
|
||||
"eP",
|
||||
"Expands Speckle Properties into their individual outputs with correct access types",
|
||||
ComponentCategories.PRIMARY_RIBBON,
|
||||
ComponentCategories.OBJECTS
|
||||
) { }
|
||||
|
||||
public override Guid ComponentGuid => GetType().GUID;
|
||||
protected override Bitmap Icon => Resources.speckle_properties_expand;
|
||||
public override GH_Exposure Exposure => GH_Exposure.secondary;
|
||||
|
||||
protected override void RegisterInputParams(GH_InputParamManager pManager)
|
||||
{
|
||||
pManager.AddParameter(
|
||||
new SpecklePropertyGroupParam(),
|
||||
"Properties",
|
||||
"P",
|
||||
"Speckle Properties to expand",
|
||||
GH_ParamAccess.item
|
||||
);
|
||||
}
|
||||
|
||||
protected override void RegisterOutputParams(GH_OutputParamManager pManager) { }
|
||||
|
||||
protected override void SolveInstance(IGH_DataAccess da)
|
||||
{
|
||||
SpecklePropertyGroupGoo? properties = null;
|
||||
if (!da.GetData(0, ref properties) || properties?.Value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Name = $"Properties ({properties.Value.Count})";
|
||||
NickName = Name;
|
||||
|
||||
var outputParams = new List<OutputParamWrapper>();
|
||||
|
||||
foreach (var key in properties.Value.Keys)
|
||||
{
|
||||
ISpecklePropertyGoo value = properties.Value[key];
|
||||
object? outputValue = value switch
|
||||
{
|
||||
SpecklePropertyGoo prop => prop.Value,
|
||||
SpecklePropertyGroupGoo propGroup => propGroup,
|
||||
_ => value
|
||||
};
|
||||
|
||||
var param = new SpeckleOutputParam
|
||||
{
|
||||
Name = key,
|
||||
NickName = key,
|
||||
Access = outputValue is IList ? GH_ParamAccess.list : GH_ParamAccess.item
|
||||
};
|
||||
|
||||
outputParams.Add(new OutputParamWrapper(param, outputValue));
|
||||
}
|
||||
|
||||
// handle parameter creation/update (only on first iteration)
|
||||
if (da.Iteration == 0 && OutputMismatch(outputParams))
|
||||
{
|
||||
OnPingDocument()?.ScheduleSolution(5, _ => CreateOutputs(outputParams));
|
||||
return; // exit early
|
||||
}
|
||||
// only set data if we have the correct parameter structure
|
||||
if (Params.Output.Count == outputParams.Count)
|
||||
{
|
||||
for (int i = 0; i < outputParams.Count; i++)
|
||||
{
|
||||
var outputParam = outputParams[i];
|
||||
switch (outputParam.Param.Access)
|
||||
{
|
||||
case GH_ParamAccess.item:
|
||||
da.SetData(i, outputParam.Value);
|
||||
break;
|
||||
case GH_ParamAccess.list:
|
||||
da.SetDataList(i, outputParam.Value as IList ?? new List<object?>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates output parameters based on discovered properties.
|
||||
/// </summary>
|
||||
private void CreateOutputs(List<OutputParamWrapper> outputParams)
|
||||
{
|
||||
// remove all existing output parameters
|
||||
while (Params.Output.Count > 0)
|
||||
{
|
||||
Params.UnregisterOutputParameter(Params.Output[^1]);
|
||||
}
|
||||
|
||||
// add new output parameters
|
||||
foreach (var newParam in outputParams)
|
||||
{
|
||||
var param = new SpeckleOutputParam
|
||||
{
|
||||
Name = newParam.Param.Name,
|
||||
NickName = newParam.Param.NickName,
|
||||
MutableNickName = false,
|
||||
Access = newParam.Param.Access
|
||||
};
|
||||
Params.RegisterOutputParam(param);
|
||||
}
|
||||
|
||||
// notify gh of parameter changes
|
||||
Params.OnParametersChanged();
|
||||
VariableParameterMaintenance();
|
||||
ExpireSolution(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the current output parameter structure differs from the required structure.
|
||||
/// </summary>
|
||||
private bool OutputMismatch(List<OutputParamWrapper> outputParams)
|
||||
{
|
||||
if (Params.Output.Count != outputParams.Count)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (int i = 0; i < outputParams.Count; i++)
|
||||
{
|
||||
var newParam = outputParams[i];
|
||||
var oldParam = Params.Output[i];
|
||||
if (
|
||||
oldParam.NickName != newParam.Param.NickName
|
||||
|| oldParam.Name != newParam.Param.Name
|
||||
|| oldParam.Access != newParam.Param.Access
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// IGH_VariableParameterComponent implementation
|
||||
public bool CanInsertParameter(GH_ParameterSide side, int index) => false;
|
||||
|
||||
public bool CanRemoveParameter(GH_ParameterSide side, int index) => false;
|
||||
|
||||
public void VariableParameterMaintenance() { }
|
||||
|
||||
public IGH_Param CreateParameter(GH_ParameterSide side, int index) => new SpeckleOutputParam();
|
||||
|
||||
public bool DestroyParameter(GH_ParameterSide side, int index) => side == GH_ParameterSide.Output;
|
||||
}
|
||||
|
||||
public record OutputParamWrapper(SpeckleOutputParam Param, object? Value);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user