Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 84b234f26b | |||
| b71728086c | |||
| 79570b4070 | |||
| e974b360c1 | |||
| ca52be3c48 | |||
| 38a5254b30 | |||
| 37e04368ed | |||
| 7ffdc289d0 | |||
| 09b7ae77d5 | |||
| 73df695458 | |||
| 03dd5e5f5d | |||
| d2dde18fdb | |||
| 8c12621772 | |||
| c0d42b8316 | |||
| a38e44f2ea | |||
| 5d0e8d3ae4 | |||
| de0c645f5b | |||
| 218a67d92d | |||
| d6b76cfd56 | |||
| 45ccebc710 | |||
| b7c1f75d6a | |||
| c51b67318d | |||
| 0343ac95ca | |||
| 53589d7ea0 | |||
| 98c6ac7c9e | |||
| 6d0cc1f7e6 | |||
| 077a74b2a3 | |||
| f019c88b27 | |||
| 246b9099c4 | |||
| 2f83e01f66 | |||
| 9e126e3dbf | |||
| c646129244 | |||
| 29e786574c | |||
| 86373c01c9 | |||
| 718c673845 | |||
| af8eb2c817 | |||
| 0d2d8028a2 | |||
| bed2cf9d42 | |||
| 5e4bcf48d6 | |||
| 59549e1065 | |||
| 16bbfae097 | |||
| 326cb80f89 | |||
| 787b2aa6e8 | |||
| 7d29bad9b5 | |||
| ba193c9dda | |||
| 794658ed9c | |||
| 141c503e81 | |||
| 319bc2826c | |||
| dee45512a1 | |||
| ce18804c95 | |||
| 2cfb66a872 | |||
| ed59150363 | |||
| 5715148cdd | |||
| 2f534e3fd0 | |||
| dd0cb8feb8 |
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"gitversion.tool": {
|
||||
"version": "6.0.2",
|
||||
"commands": ["dotnet-gitversion"],
|
||||
"rollForward": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
|
||||
name: MSBuild
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "develop", "release/*", "alan/*"] # Continuous delivery on every long-lived branch
|
||||
tags: ["v3.*"] # Manual delivery on every 3.x tag
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
outputs:
|
||||
version: ${{ steps.set-version.outputs.version }}
|
||||
file_version: ${{ steps.set-info-version.outputs.file_version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
path: speckle-cpp-connectors
|
||||
fetch-depth: 0
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: r-wessel/ActiveLib
|
||||
path: ActiveLib
|
||||
ref: develop
|
||||
|
||||
- name: Download zip file
|
||||
run: |
|
||||
New-Item -ItemType Directory -Path "Archicad 27" -Force
|
||||
Invoke-WebRequest -Uri "https://github.com/GRAPHISOFT/archicad-api-devkit/releases/download/27.3001/API.Development.Kit.WIN.27.3001.zip" -OutFile "file.zip"
|
||||
|
||||
- name: Extract zip file to Archicad 27 folder
|
||||
run: |
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("file.zip", "Archicad 27")
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
|
||||
- name: ⚒️ Run GitVersion
|
||||
working-directory: speckle-cpp-connectors
|
||||
run: ./build.ps1 build-server-version
|
||||
|
||||
- name: Build
|
||||
working-directory: speckle-cpp-connectors
|
||||
run: ./build.ps1
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: output-${{ env.GitVersion_FullSemVer }}
|
||||
path: speckle-cpp-connectors/output/*.zip
|
||||
retention-days: 1
|
||||
|
||||
- id: set-version
|
||||
name: Set version to output
|
||||
run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$Env:GITHUB_OUTPUT"
|
||||
|
||||
- id: set-info-version
|
||||
name: Set file version to output
|
||||
run: echo "file_version=${{ env.GitVersion_AssemblySemVer}}" >> "$Env:GITHUB_OUTPUT" # version will be retrieved from tag?
|
||||
deploy-installers:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
env:
|
||||
IS_TAG_BUILD: ${{ github.ref_type == 'tag' }}
|
||||
IS_RELEASE_BRANCH: true
|
||||
steps:
|
||||
- name: 🔫 Trigger Build Installers
|
||||
uses: ALEEF02/workflow-dispatch@v3.0.0
|
||||
continue-on-error: true
|
||||
with:
|
||||
workflow: build-cpp-installers
|
||||
repo: specklesystems/connector-installers
|
||||
token: ${{ secrets.CONNECTORS_GH_TOKEN }}
|
||||
inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build.outputs.version }}", "file_version": "${{needs.build.outputs.file_version}}", "public_release": ${{ env.IS_TAG_BUILD }}, "store_artifacts": ${{ env.IS_RELEASE_BRANCH }} }'
|
||||
ref: main
|
||||
wait-for-completion: true
|
||||
wait-for-completion-interval: 10s
|
||||
wait-for-completion-timeout: 10m
|
||||
display-workflow-run-url: true
|
||||
display-workflow-run-url-interval: 10s
|
||||
|
||||
- uses: geekyeggo/delete-artifact@v5
|
||||
with:
|
||||
name: output-*
|
||||
+4
-1
@@ -26,4 +26,7 @@ XCBuildData/
|
||||
*.log
|
||||
.idea
|
||||
*.mui
|
||||
*.aps
|
||||
*.aps
|
||||
**/obj
|
||||
**/bin
|
||||
output/
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
workflow: GitFlow/v1
|
||||
next-version: 3.0.0
|
||||
branches:
|
||||
release:
|
||||
prevent-increment:
|
||||
when-current-commit-tagged: true
|
||||
@@ -13,6 +13,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ActiveLib17", "..\..\Active
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SpeckleLib17", "..\SpeckleLib\SpeckleLib17.vcxproj", "{942743B7-B3CB-4F91-BE46-28937F5E3FD1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "..\ci-build\Build.csproj", "{702DE13A-1CCF-485D-A50D-846F645F07D3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug16|x64 = Debug16|x64
|
||||
@@ -143,6 +145,40 @@ Global
|
||||
{942743B7-B3CB-4F91-BE46-28937F5E3FD1}.ReleaseVS2022|x64.Build.0 = ReleaseAC27|x64
|
||||
{942743B7-B3CB-4F91-BE46-28937F5E3FD1}.ReleaseVS2022|x86.ActiveCfg = ReleaseAC27|Win32
|
||||
{942743B7-B3CB-4F91-BE46-28937F5E3FD1}.ReleaseVS2022|x86.Build.0 = ReleaseAC27|Win32
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug16|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Debug17|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugAC27|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugAC27|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugAC27|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.DebugVS2022|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release16|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.Release17|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseAC27|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseAC27|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2019|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x64.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x64.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x86.ActiveCfg = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseVS2022|x86.Build.0 = Debug|Any CPU
|
||||
{702DE13A-1CCF-485D-A50D-846F645F07D3}.ReleaseAC27|x64.ActiveCfg = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationName.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationVersion.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\HighlightModel.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\HighlightObjects.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\OpenUrl.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\RemoveModel.cpp" />
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\UpdateModel.cpp" />
|
||||
@@ -164,6 +165,7 @@
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationName.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\GetSourceApplicationVersion.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\HighlightModel.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\HighlightObjects.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\OpenUrl.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\RemoveModel.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\UpdateModel.h" />
|
||||
@@ -176,6 +178,7 @@
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Selection\GetSelection.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Selection\SelectionBridge.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\ConversionResult.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendConversionResult.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendError.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendObject.h" />
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendViaBrowserArgs.h" />
|
||||
|
||||
@@ -255,6 +255,9 @@
|
||||
<ClCompile Include="Connector\Environment\ConnectorProject.cpp">
|
||||
<Filter>Connector\Environment</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Connector\Interface\Browser\Bridge\Base\HighlightObjects.cpp">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Base</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Connector\ConnectorResource.h">
|
||||
@@ -432,5 +435,11 @@
|
||||
<ClInclude Include="Connector\Environment\ConnectorProject.h">
|
||||
<Filter>Connector\Environment</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Send\Arg\SendConversionResult.h">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Send\Arg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Connector\Interface\Browser\Bridge\Base\HighlightObjects.h">
|
||||
<Filter>Connector\Interface\Browser\Bridge\Base</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -32,6 +32,7 @@
|
||||
215F08462C9633A800CD343B /* EverythingSendFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 215F08452C9633A800CD343B /* EverythingSendFilter.cpp */; };
|
||||
2192460D2CA3469D00CF5703 /* ProjectCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2192460B2CA3469D00CF5703 /* ProjectCollection.cpp */; };
|
||||
2199BB552CDA4B1700A4BEEC /* ConnectorProject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2199BB522CDA4B1700A4BEEC /* ConnectorProject.cpp */; };
|
||||
2199BB7E2CDD3FA800A4BEEC /* HighlightObjects.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2199BB7C2CDD3FA800A4BEEC /* HighlightObjects.cpp */; };
|
||||
219F30422C769283009834E9 /* ConfigTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 219F30402C769282009834E9 /* ConfigTests.cpp */; };
|
||||
21A0FB982CB723240023F24E /* FinishProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A0FB942CB723240023F24E /* FinishProxy.cpp */; };
|
||||
21A79EC92CCDA45C001754E4 /* HighlightModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 21A79EC52CCDA45C001754E4 /* HighlightModel.cpp */; };
|
||||
@@ -321,6 +322,9 @@
|
||||
2199BB522CDA4B1700A4BEEC /* ConnectorProject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConnectorProject.cpp; sourceTree = "<group>"; };
|
||||
2199BB532CDA4B1700A4BEEC /* ConnectorProject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConnectorProject.h; sourceTree = "<group>"; };
|
||||
2199BB5C2CDA93CE00A4BEEC /* ConnectorImagesFix.grc */ = {isa = PBXFileReference; lastKnownFileType = text; name = ConnectorImagesFix.grc; path = RFIX/ConnectorImagesFix.grc; sourceTree = "<group>"; };
|
||||
2199BB792CDCEA3900A4BEEC /* SendConversionResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SendConversionResult.h; sourceTree = "<group>"; };
|
||||
2199BB7C2CDD3FA800A4BEEC /* HighlightObjects.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HighlightObjects.cpp; sourceTree = "<group>"; };
|
||||
2199BB7D2CDD3FA800A4BEEC /* HighlightObjects.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HighlightObjects.h; sourceTree = "<group>"; };
|
||||
219F30352C768F0A009834E9 /* Connector-AC27-Test.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Connector-AC27-Test.bundle"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
219F30402C769282009834E9 /* ConfigTests.cpp */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = ConfigTests.cpp; sourceTree = "<group>"; };
|
||||
219F30432C7693B6009834E9 /* Connector-AC27-Debug.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = "Connector-AC27-Debug.xctestplan"; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1026,6 +1030,7 @@
|
||||
children = (
|
||||
21AEF9F92CAC3897000B8681 /* ConversionResult.cpp */,
|
||||
21AEF9F82CAC3897000B8681 /* ConversionResult.h */,
|
||||
2199BB792CDCEA3900A4BEEC /* SendConversionResult.h */,
|
||||
21AEF9E32CAB56E5000B8681 /* SendError.cpp */,
|
||||
21AEF9E42CAB56E5000B8681 /* SendError.h */,
|
||||
21AEF9EE2CAB5720000B8681 /* SendObject.cpp */,
|
||||
@@ -1056,6 +1061,8 @@
|
||||
21B67CAA2C77329800FD64FC /* GetSourceApplicationVersion.h */,
|
||||
21A79EC52CCDA45C001754E4 /* HighlightModel.cpp */,
|
||||
21A79EC82CCDA45C001754E4 /* HighlightModel.h */,
|
||||
2199BB7C2CDD3FA800A4BEEC /* HighlightObjects.cpp */,
|
||||
2199BB7D2CDD3FA800A4BEEC /* HighlightObjects.h */,
|
||||
21384BC92CD2EE7400D4602B /* OpenUrl.cpp */,
|
||||
21384BCC2CD2EE7400D4602B /* OpenUrl.h */,
|
||||
21D0BDD52C935DAE0077E104 /* RemoveModel.cpp */,
|
||||
@@ -1528,6 +1535,7 @@
|
||||
21B67CAE2C77329800FD64FC /* GetSourceApplicationVersion.cpp in Sources */,
|
||||
21A0FB982CB723240023F24E /* FinishProxy.cpp in Sources */,
|
||||
21B67CC32C77649F00FD64FC /* GetDocumentState.cpp in Sources */,
|
||||
2199BB7E2CDD3FA800A4BEEC /* HighlightObjects.cpp in Sources */,
|
||||
21D0BD602C89BFEA0077E104 /* SendBridge.cpp in Sources */,
|
||||
21D0BD972C8F13F30077E104 /* GetSendFilters.cpp in Sources */,
|
||||
21B67CAC2C77329800FD64FC /* BaseBridge.cpp in Sources */,
|
||||
|
||||
Executable → Regular
@@ -58,6 +58,7 @@ enum ErrorString {
|
||||
modelCardNotFoundID,
|
||||
noProjectOpenID,
|
||||
accountNotFoundID,
|
||||
elementTypeNotConvertedID,
|
||||
};
|
||||
|
||||
#endif //CONNECTOR_RESOURCE
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Base/RemoveModel.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/UpdateModel.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/HighlightModel.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/HighlightObjects.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Base/OpenUrl.h"
|
||||
#include "Speckle/Event/Type/ProjectEvent.h"
|
||||
|
||||
@@ -23,25 +24,6 @@
|
||||
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
|
||||
namespace {
|
||||
#ifdef ARCHICAD
|
||||
void subscribeAllElementsToElementChangeEvents()
|
||||
{
|
||||
auto project = connector::connector()->getActiveProject().lock();
|
||||
if (!project)
|
||||
return;
|
||||
|
||||
auto elementDatabase = project->getElementDatabase();
|
||||
//auto table = elementDatabase->getTables(speckle::database::ElementStorage::TableType::primary2D);
|
||||
//auto allElements = elementDatabase->findElements(nullptr, *table.begin());
|
||||
auto allElements = elementDatabase->findElements();
|
||||
|
||||
for (const auto& id : allElements)
|
||||
ACAPI_Element_AttachObserver(id);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
@@ -53,14 +35,11 @@ BaseBridge::BaseBridge() : BrowserBridge{"baseBinding"} {
|
||||
addMethod<GetDocumentState>();
|
||||
addMethod<GetSourceApplicationName>();
|
||||
addMethod<GetSourceApplicationVersion>();
|
||||
addMethod<HighlightModel>();
|
||||
addMethod<HighlightObjects>();
|
||||
addMethod<OpenUrl>();
|
||||
addMethod<RemoveModel>();
|
||||
addMethod<UpdateModel>();
|
||||
addMethod<HighlightModel>();
|
||||
addMethod<OpenUrl>();
|
||||
|
||||
// POC: Attaching Observer to all elements is too slow, registration is commented out for now
|
||||
// subscribeAllElementsToElementChangeEvents();
|
||||
|
||||
} //BaseBridge::BaseBridge
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -73,11 +52,9 @@ BaseBridge::BaseBridge() : BrowserBridge{"baseBinding"} {
|
||||
bool BaseBridge::handle(const speckle::event::ProjectEvent& event) {
|
||||
using enum speckle::event::ProjectEvent::Type;
|
||||
switch (event.getType()) {
|
||||
case open: {
|
||||
case open:
|
||||
sendEvent("documentChanged");
|
||||
// POC: Attaching Observer to all elements is too slow, registration is commented out for now
|
||||
// subscribeAllElementsToElementChangeEvents();
|
||||
} break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ using namespace speckle::utility;
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
HighlightModel::HighlightModel() : BridgeMethod{"HighlightModel", [&](const SendArgs& args) {
|
||||
HighlightModel::HighlightModel() : BridgeMethod{"HighlightModel", [&](const HighlightModelArgs& args) {
|
||||
run(args);
|
||||
}} {}
|
||||
|
||||
@@ -43,19 +43,13 @@ void HighlightModel::run(const String& modelCardID) const {
|
||||
std::make_unique<SendError>(connector()->getLocalString(errorString, modelCardNotFoundID), modelCardID));
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto senderCard = dynamic_cast<SenderModelCard*>(modelCard.get())) {
|
||||
auto modelCardSelection = senderCard->getFilter().getElementIDs();
|
||||
|
||||
auto project = connector()->getActiveProject().lock();
|
||||
if (!project) {
|
||||
// TODO: is this OK? should this throw?
|
||||
return;
|
||||
}
|
||||
|
||||
if (!project)
|
||||
return; // TODO: is this OK? should this throw?
|
||||
auto elementDatabase = project->getElementDatabase();
|
||||
elementDatabase->clearSelection();
|
||||
elementDatabase->setSelection(modelCardSelection);
|
||||
}
|
||||
|
||||
} //HighlightModel::run
|
||||
|
||||
@@ -3,22 +3,19 @@
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
class ConnectorConfig;
|
||||
|
||||
///Argument parameter for a string
|
||||
using StringHold = active::serialise::CargoHold<active::serialise::ValueWrap<speckle::utility::String>, speckle::utility::String>;
|
||||
///Argument type for this method
|
||||
using SendArgs = speckle::interfac::browser::bridge::JSArgType<StringHold>;
|
||||
using HighlightModelArgs = speckle::interfac::browser::bridge::JSArgType<StringHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to highlight elements from the selected model card in the open document
|
||||
*/
|
||||
class HighlightModel : public speckle::interfac::browser::bridge::BridgeMethod<SendArgs, void> {
|
||||
class HighlightModel : public speckle::interfac::browser::bridge::BridgeMethod<HighlightModelArgs, void> {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Base/HighlightObjects.h"
|
||||
|
||||
#include "Connector/Connector.h"
|
||||
#include "Connector/Environment/ConnectorProject.h"
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
|
||||
using namespace connector::environment;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace speckle::database;
|
||||
using namespace speckle::utility;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
--------------------------------------------------------------------*/
|
||||
HighlightObjects::HighlightObjects() : BridgeMethod{"HighlightObjects", [&](const HighlightObjectArgs& args) {
|
||||
run(args);
|
||||
}} {}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Highlight specified objects
|
||||
|
||||
objectIDs: List of object IDs to be highlighted
|
||||
--------------------------------------------------------------------*/
|
||||
void HighlightObjects::run(const StringList& objectIDs) const {
|
||||
BIMLinkList objectSelection;
|
||||
for (const auto& text : objectIDs)
|
||||
if (Guid guid{text}; !guid.empty())
|
||||
objectSelection.emplace_back(guid);
|
||||
if (objectSelection.empty())
|
||||
return;
|
||||
auto project = connector()->getActiveProject().lock();
|
||||
auto connectorProject = dynamic_cast<ConnectorProject*>(project.get());
|
||||
if (!connectorProject)
|
||||
return;
|
||||
auto elementDatabase = project->getElementDatabase();
|
||||
elementDatabase->clearSelection();
|
||||
elementDatabase->setSelection(objectSelection);
|
||||
} //HighlightObjects::run
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_HIGHLIGHT_OBJECTS
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_HIGHLIGHT_OBJECTS
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
///List of strings
|
||||
using StringList = std::vector<active::utility::String>;
|
||||
///Argument parameter for a string
|
||||
using StringListHold = active::serialise::CargoHold<active::serialise::ContainerWrap<StringList>, StringList>;
|
||||
///Argument type for this method
|
||||
using HighlightObjectArgs = speckle::interfac::browser::bridge::JSArgType<StringListHold>;
|
||||
|
||||
/*!
|
||||
JS Function class to highlight objects using passed application IDs
|
||||
*/
|
||||
class HighlightObjects : public speckle::interfac::browser::bridge::BridgeMethod<HighlightObjectArgs, void> {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
*/
|
||||
HighlightObjects();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Highlight specified objects
|
||||
@param objectIDs List of object IDs to be highlighted
|
||||
*/
|
||||
void run(const StringList& objectIDs) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_HIGHLIGHT_OBJECTS
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/ConversionResult.h"
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
|
||||
#include <array>
|
||||
@@ -12,14 +13,30 @@ namespace {
|
||||
|
||||
///Serialisation fields
|
||||
enum FieldIndex {
|
||||
statusID,
|
||||
srcID,
|
||||
srcTypeID,
|
||||
resID,
|
||||
resTypeID,
|
||||
errorID,
|
||||
cardID,
|
||||
};
|
||||
|
||||
///Serialisation field IDs
|
||||
static std::array fieldID = {
|
||||
Identity{"status"},
|
||||
Identity{"sourceId"},
|
||||
Identity{"sourceType"},
|
||||
Identity{"resultId"},
|
||||
Identity{"resultType"},
|
||||
Identity{"error"},
|
||||
Identity{"modelCardId"},
|
||||
};
|
||||
|
||||
///Conversion status enumerator names
|
||||
std::array statusName{
|
||||
"success",
|
||||
"warning",
|
||||
"info",
|
||||
"error",
|
||||
};
|
||||
|
||||
}
|
||||
@@ -35,8 +52,12 @@ bool ConversionResult::fillInventory(active::serialise::Inventory& inventory) co
|
||||
using enum Entry::Type;
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ fieldID[errorID], errorID, element },
|
||||
{ fieldID[cardID], cardID, element },
|
||||
{ fieldID[statusID], statusID, element },
|
||||
{ fieldID[srcID], srcID, element, !sourceID.empty() },
|
||||
{ fieldID[srcTypeID], srcTypeID, element, !sourceType.empty() },
|
||||
{ fieldID[resID], resID, element, !resultID.empty() },
|
||||
{ fieldID[resTypeID], resTypeID, element, !resultType.empty() },
|
||||
{ fieldID[errorID], errorID, element, error.operator bool() },
|
||||
},
|
||||
}.withType(&typeid(ConversionResult)));
|
||||
return true;
|
||||
@@ -55,11 +76,46 @@ Cargo::Unique ConversionResult::getCargo(const active::serialise::Inventory::Ite
|
||||
return nullptr;
|
||||
using namespace active::serialise;
|
||||
switch (item.index) {
|
||||
case statusID:
|
||||
return Cargo::Unique{new CargoHold<ValueWrap<uint16_t>, uint16_t>(static_cast<uint16_t>(status))};
|
||||
case srcID:
|
||||
return std::make_unique<ValueWrap<String>>(sourceID);
|
||||
case srcTypeID:
|
||||
return std::make_unique<ValueWrap<String>>(sourceType);
|
||||
case resID:
|
||||
return std::make_unique<ValueWrap<String>>(resultID);
|
||||
case resTypeID:
|
||||
return std::make_unique<ValueWrap<String>>(resultType);
|
||||
case errorID:
|
||||
return std::make_unique<ValueWrap<String>>(message);
|
||||
case cardID:
|
||||
return std::make_unique<ValueWrap<String>>(modelCardID);
|
||||
return std::make_unique<PackageWrap>(*error);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
} //ConversionResult::getCargo
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get a conversion status enumerator from text
|
||||
|
||||
text; The incoming text
|
||||
|
||||
return: The equivalent conversion status (nullopt on failure)
|
||||
--------------------------------------------------------------------*/
|
||||
std::optional<ConversionResult::Status> connector::interfac::browser::bridge::toConversionStatus(const String& text) {
|
||||
for (auto i = 0; i < statusName.size(); ++i)
|
||||
if (text == statusName[i])
|
||||
return static_cast<ConversionResult::Status>(i + 1);
|
||||
return std::nullopt;
|
||||
} //active::geometry::toAnchor2D
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the text for a conversion status value
|
||||
|
||||
status: The incoming status
|
||||
|
||||
return: The conversion status as text
|
||||
--------------------------------------------------------------------*/
|
||||
String connector::interfac::browser::bridge::fromConversionStatus(ConversionResult::Status status) {
|
||||
return statusName.at(static_cast<size_t>(status) - 1);
|
||||
} //active::geometry::fromAnchor2D
|
||||
|
||||
@@ -1,47 +1,42 @@
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_SEND_CONVERSION_RESULT
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_SEND_CONVERSION_RESULT
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_CONVERSION_RESULT
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_CONVERSION_RESULT
|
||||
|
||||
#include "Active/Serialise/Package/Wrapper/PackageWrap.h"
|
||||
#include "Active/Serialise/Package/Package.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendError.h"
|
||||
#include "Speckle/Utility/String.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
A send error to return to the JS in the event of an error
|
||||
The result of a conversion process (BIM records to/from Speckle)
|
||||
*/
|
||||
class ConversionResult final : public active::serialise::Package {
|
||||
class ConversionResult : public active::serialise::Package {
|
||||
public:
|
||||
enum class Status {
|
||||
success = 1,
|
||||
info,
|
||||
warning,
|
||||
error,
|
||||
enum class Status : uint16_t {
|
||||
success = 1, ///<The conversion was successful
|
||||
info, ///<Not in use yet, maybe later as discussed
|
||||
warning, ///<Not in use yet, maybe later as discussed
|
||||
error, ///<An error occurred during conversion
|
||||
};
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param errMess The error message
|
||||
@param card The ID of the model card associated with the wrror
|
||||
Default constructor
|
||||
*/
|
||||
ConversionResult(const speckle::utility::String& errMess, const speckle::utility::String& card) : message{errMess}, modelCardID{card} {}
|
||||
ConversionResult() {}
|
||||
|
||||
// MARK: - Public variables
|
||||
|
||||
///The error message
|
||||
speckle::utility::String message;
|
||||
///The ID of the model card associated with the data
|
||||
speckle::utility::String modelCardID;
|
||||
///The element conversion status
|
||||
Status status = Status::info;
|
||||
///For receive conversion reports, this is the id of the speckle object. For send, it's the host app object id.
|
||||
speckle::utility::String sourceId;
|
||||
speckle::utility::String sourceID;
|
||||
///For receive conversion reports, this is the type of the speckle object. For send, it's the host app object type.
|
||||
speckle::utility::String sourceType;
|
||||
///For receive conversion reports, this is the id of the host app object. For send, it's the speckle object id.
|
||||
speckle::utility::String resultId;
|
||||
speckle::utility::String resultID;
|
||||
///For receive conversion reports, this is the type of the host app object. For send, it's the speckle object type.
|
||||
speckle::utility::String resultType;
|
||||
///The exception (nullopt = no exception)
|
||||
@@ -63,6 +58,60 @@ namespace connector::interfac::browser::bridge {
|
||||
Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
|
||||
};
|
||||
|
||||
/*!
|
||||
Get a conversion status enumerator from text
|
||||
@param text The incoming text
|
||||
@return The equivalent conversion status (nullopt on failure)
|
||||
*/
|
||||
std::optional<ConversionResult::Status> toConversionStatus(const speckle::utility::String& text);
|
||||
/*!
|
||||
Get the text for a conversion status value
|
||||
@param status The incoming status
|
||||
@return The conversion status as text
|
||||
*/
|
||||
speckle::utility::String fromConversionStatus(ConversionResult::Status status);
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_SEND_CONVERSION_RESULT
|
||||
namespace active::serialise {
|
||||
|
||||
/*!
|
||||
Import the object from the specified string (specialisation for bool)
|
||||
@param source The string to read
|
||||
@return True if the data was successfully read
|
||||
*/
|
||||
template<> inline
|
||||
bool ValueWrap<connector::interfac::browser::bridge::ConversionResult::Status>::read(const utility::String& source) {
|
||||
auto converted = connector::interfac::browser::bridge::toConversionStatus(source);
|
||||
if (!converted)
|
||||
return false;
|
||||
base::get() = *converted;
|
||||
return true;
|
||||
} //ValueWrap<bool>::read
|
||||
|
||||
|
||||
/*!
|
||||
Import the object from the specified string (specialisation for bool)
|
||||
@param source The string to read
|
||||
@return True if the data was successfully read
|
||||
*/
|
||||
template<> inline
|
||||
bool ValueWrap<std::optional<connector::interfac::browser::bridge::ConversionResult::Status>>::read(const utility::String& source) {
|
||||
auto converted = connector::interfac::browser::bridge::toConversionStatus(source);
|
||||
base::get() = converted;
|
||||
return converted.operator bool();
|
||||
} //ValueWrap<bool>::read
|
||||
|
||||
|
||||
/*!
|
||||
Export the object to the specified string (specialisation for bool)
|
||||
@param dest The string to write the data to
|
||||
@return True if the data was successfully written
|
||||
*/
|
||||
template<> inline
|
||||
bool ValueWrap<connector::interfac::browser::bridge::ConversionResult::Status>::write(utility::String& dest) const {
|
||||
dest = connector::interfac::browser::bridge::fromConversionStatus(get());
|
||||
return true;
|
||||
} //ValueWrap<bool>::write
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_CONVERSION_RESULT
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
#ifndef CONNECTOR_INTERFACE_BRIDGE_SEND_CONVERSION_RESULT
|
||||
#define CONNECTOR_INTERFACE_BRIDGE_SEND_CONVERSION_RESULT
|
||||
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/ConversionResult.h"
|
||||
#include "Speckle/Serialise/Collection/ConversionReporter.h"
|
||||
|
||||
namespace connector::interfac::browser::bridge {
|
||||
|
||||
/*!
|
||||
A result from converting a record to Speckle
|
||||
*/
|
||||
class SendConversionResult : public ConversionResult {
|
||||
public:
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
/*!
|
||||
Constructor
|
||||
@param stat The send/conversion status of the target record
|
||||
@param srcID The record application ID
|
||||
@param srcType The record application type name
|
||||
@param err An optional error report
|
||||
*/
|
||||
SendConversionResult(Status stat, speckle::utility::String srcID, speckle::utility::String srcType, SendError::Option err = std::nullopt) {
|
||||
status = stat;
|
||||
sourceID = srcID;
|
||||
sourceType = srcType;
|
||||
error = err;
|
||||
}
|
||||
/*!
|
||||
Constructor
|
||||
@param stat The send/conversion status of the target record
|
||||
@param srcID The record application ID
|
||||
@param srcType The record application type name
|
||||
@param err An optional error report
|
||||
*/
|
||||
SendConversionResult(const speckle::database::BIMRecordID& srcID, const speckle::serialise::ConversionReporter::Data& data) {
|
||||
status = data.status == speckle::serialise::ConversionReporter::Data::Status::success ?
|
||||
ConversionResult::Status::success : ConversionResult::Status::error;
|
||||
sourceID = srcID.operator speckle::utility::String();
|
||||
sourceType = data.typeName;
|
||||
if (!data.message.empty())
|
||||
error = SendError{data.message};
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //CONNECTOR_INTERFACE_BRIDGE_SEND_CONVERSION_RESULT
|
||||
@@ -12,14 +12,16 @@ namespace {
|
||||
|
||||
///Serialisation fields
|
||||
enum FieldIndex {
|
||||
errorID,
|
||||
messageID,
|
||||
cardID,
|
||||
stackID,
|
||||
};
|
||||
|
||||
///Serialisation field IDs
|
||||
static std::array fieldID = {
|
||||
Identity{"error"},
|
||||
Identity{"message"},
|
||||
Identity{"modelCardId"},
|
||||
Identity{"stackTrace"},
|
||||
};
|
||||
|
||||
}
|
||||
@@ -35,8 +37,9 @@ bool SendError::fillInventory(active::serialise::Inventory& inventory) const {
|
||||
using enum Entry::Type;
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ fieldID[errorID], errorID, element },
|
||||
{ fieldID[cardID], cardID, element },
|
||||
{ fieldID[messageID], messageID, element },
|
||||
{ fieldID[cardID], cardID, element, !modelCardID.empty() },
|
||||
{ fieldID[stackID], stackID, element, modelCardID.empty() }, //Field not included when a model card is sent
|
||||
},
|
||||
}.withType(&typeid(SendError)));
|
||||
return true;
|
||||
@@ -55,10 +58,12 @@ Cargo::Unique SendError::getCargo(const active::serialise::Inventory::Item& item
|
||||
return nullptr;
|
||||
using namespace active::serialise;
|
||||
switch (item.index) {
|
||||
case errorID:
|
||||
case messageID:
|
||||
return std::make_unique<ValueWrap<String>>(message);
|
||||
case cardID:
|
||||
return std::make_unique<ValueWrap<String>>(modelCardID);
|
||||
case stackID:
|
||||
return std::make_unique<ValueWrap<String>>(stackTrace);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace connector::interfac::browser::bridge {
|
||||
@param errMess The error message
|
||||
@param card The ID of the model card associated with the wrror
|
||||
*/
|
||||
SendError(const speckle::utility::String& errMess, const speckle::utility::String& card) : message{errMess}, modelCardID{card} {}
|
||||
SendError(const speckle::utility::String& errMess, const speckle::utility::String& card = {}) : message{errMess}, modelCardID{card} {}
|
||||
|
||||
// MARK: - Public variables
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace connector::interfac::browser::bridge {
|
||||
speckle::utility::String message;
|
||||
///The ID of the model card associated with the data
|
||||
speckle::utility::String modelCardID;
|
||||
///The error stack trace
|
||||
speckle::utility::String stackTrace;
|
||||
|
||||
// MARK: - Serialisation
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendObject.h"
|
||||
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Active/Serialise/Item/Wrapper/ValueWrap.h"
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Connector/Record/Collection/ProjectCollection.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace connector::record;
|
||||
using namespace speckle::serialise;
|
||||
using namespace speckle::utility;
|
||||
|
||||
@@ -67,3 +69,19 @@ Cargo::Unique SendObject::getCargo(const active::serialise::Inventory::Item& ite
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
} //SendObject::getCargo
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the conversion results from the send object serialisation
|
||||
|
||||
return: The serialisation conversion results
|
||||
--------------------------------------------------------------------*/
|
||||
std::vector<SendConversionResult> SendObject::getConversionResults() const {
|
||||
std::vector<SendConversionResult> convertResults;
|
||||
auto collection = dynamic_cast<const ProjectCollection*>(m_object.get());
|
||||
if (collection == nullptr)
|
||||
return convertResults;
|
||||
for (const auto& item : collection->getLog())
|
||||
convertResults.emplace_back(SendConversionResult{item.first, item.second});
|
||||
return convertResults;
|
||||
} //SendObject::getConversionResults
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Config/Arg/ConnectorConfig.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendConversionResult.h"
|
||||
#include "Speckle/Database/Content/Record.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BridgeMethod.h"
|
||||
|
||||
@@ -44,15 +45,20 @@ namespace connector::interfac::browser::bridge {
|
||||
*/
|
||||
Cargo::Unique getCargo(const active::serialise::Inventory::Item& item) const override;
|
||||
/*!
|
||||
Use a manager in (de)serialisation processes
|
||||
@param management The management to use
|
||||
*/
|
||||
Use a manager in (de)serialisation processes
|
||||
@param management The management to use
|
||||
*/
|
||||
void useManagement(active::serialise::Management* management) const override { m_object->useManagement(management); }
|
||||
/*!
|
||||
Get the cargo management
|
||||
@return The active management
|
||||
*/
|
||||
Get the cargo management
|
||||
@return The active management
|
||||
*/
|
||||
active::serialise::Management* management() const override { return m_object->management(); }
|
||||
/*!
|
||||
Get the conversion results from the send object serialisation
|
||||
@return The serialisation conversion results
|
||||
*/
|
||||
std::vector<SendConversionResult> getConversionResults() const;
|
||||
|
||||
private:
|
||||
///The object to send
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendViaBrowserArgs.h"
|
||||
|
||||
#include "Active/Serialise/Package/Wrapper/ContainerWrap.h"
|
||||
#include "Connector/Record/Model/ModelCard.h"
|
||||
#include "Speckle/Record/Credentials/Account.h"
|
||||
|
||||
@@ -25,6 +26,7 @@ namespace {
|
||||
accID,
|
||||
messageID,
|
||||
sendObjectID,
|
||||
convResultID,
|
||||
};
|
||||
|
||||
///Serialisation field IDs
|
||||
@@ -37,6 +39,7 @@ namespace {
|
||||
Identity{"accountId"},
|
||||
Identity{"message"},
|
||||
Identity{"sendObject"},
|
||||
Identity{"sendConversionResults"},
|
||||
};
|
||||
|
||||
}
|
||||
@@ -47,11 +50,11 @@ namespace {
|
||||
modelCard: The model card to populate into the send info for the browser
|
||||
account: The account linked to the send
|
||||
object: The object to be sent
|
||||
results: The conversion results (reporting any conversion errors etc)
|
||||
--------------------------------------------------------------------*/
|
||||
SendViaBrowserArgs::SendViaBrowserArgs(const ModelCard& modelCard, const Account& account, SendObject&& object) :
|
||||
modelCardID(modelCard.getID()), projectID(modelCard.getProjectID()), modelID(modelCard.getModelID()), token{account.getToken()},
|
||||
serverURL{account.getServerURL()}, accountID{account.getID()}, sendObject{std::move(object)} {
|
||||
|
||||
} //SendViaBrowserArgs::SendViaBrowserArgs
|
||||
|
||||
|
||||
@@ -74,6 +77,7 @@ bool SendViaBrowserArgs::fillInventory(active::serialise::Inventory& inventory)
|
||||
{ fieldID[accID], accID, element },
|
||||
{ fieldID[messageID], messageID, element },
|
||||
{ fieldID[sendObjectID], sendObjectID, element },
|
||||
{ fieldID[convResultID], convResultID, element },
|
||||
},
|
||||
}.withType(&typeid(SendViaBrowserArgs)));
|
||||
return true;
|
||||
@@ -108,6 +112,9 @@ Cargo::Unique SendViaBrowserArgs::getCargo(const active::serialise::Inventory::I
|
||||
return std::make_unique<StringWrap>(message);
|
||||
case sendObjectID:
|
||||
return std::make_unique<PackageWrap>(sendObject);
|
||||
case convResultID:
|
||||
sendConversionResults = sendObject.getConversionResults();
|
||||
return Cargo::Unique{new ContainerWrap{sendConversionResults}};
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "Active/Serialise/Package/Package.h"
|
||||
#include "Active/Utility/String.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/ConversionResult.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendConversionResult.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendObject.h"
|
||||
#include "Speckle/Database/Identity/RecordID.h"
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace connector::interfac::browser::bridge {
|
||||
///The send message
|
||||
speckle::utility::String message; //TODO: Clarify what this is used for
|
||||
///The conversion report (summarising the conversion results on an element-by-element basis)
|
||||
std::vector<ConversionResult> sendConversionResults;
|
||||
mutable std::vector<SendConversionResult> sendConversionResults;
|
||||
///The commit content
|
||||
SendObject sendObject;
|
||||
|
||||
|
||||
@@ -6,27 +6,29 @@
|
||||
#include "Connector/ConnectorResource.h"
|
||||
#include "Connector/Database/ModelCardDatabase.h"
|
||||
#include "Connector/Environment/ConnectorProject.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendError.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendConversionResult.h"
|
||||
#include "Connector/Interface/Browser/Bridge/Send/Arg/SendViaBrowserArgs.h"
|
||||
#include "Connector/Record/Collection/ProjectCollection.h"
|
||||
#include "Connector/Record/Model/SenderModelCard.h"
|
||||
#include "Connector/Record/Model/Filter/SendFilter.h"
|
||||
#include "Speckle/Database/AccountDatabase.h"
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Database/Content/BIMRecord.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Environment/Host.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
|
||||
#include "Speckle/Record/Credentials/Account.h"
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
#include "Speckle/Serialise/Detached/Storage/DetachedMemoryStore.h"
|
||||
#include "Speckle/Utility/Exception.h"
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
|
||||
using namespace speckle::record::element;
|
||||
using namespace active::serialise;
|
||||
using namespace connector::environment;
|
||||
using namespace connector::interfac::browser::bridge;
|
||||
using namespace connector::record;
|
||||
using namespace speckle::database;
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::record::element;
|
||||
using namespace speckle::serialise;
|
||||
using namespace speckle::utility;
|
||||
|
||||
@@ -44,13 +46,8 @@ Send::Send() : BridgeMethod{"Send", [&](const SendArgs& args) {
|
||||
modelCardID: The ID of the model card identifying the objects to send
|
||||
--------------------------------------------------------------------*/
|
||||
void Send::run(const String& modelCardID) const {
|
||||
|
||||
#ifdef ARCHICAD
|
||||
// we currently rely on the ModelerAPI instead of the ModelAccessAPI
|
||||
// we have to open a 3D window to get the Mesh data of the model elements
|
||||
ACAPI_View_ShowAllIn3D();
|
||||
#endif
|
||||
|
||||
//We can currently only send from the 3D model view
|
||||
host()->makeModelViewActive(true);
|
||||
//Get the active project
|
||||
auto project = connector()->getActiveProject().lock();
|
||||
if (!project) {
|
||||
@@ -83,12 +80,17 @@ void Send::run(const String& modelCardID) const {
|
||||
if (auto senderCard = dynamic_cast<SenderModelCard*>(modelCard.get())) {
|
||||
selected = senderCard->getFilter().getElementIDs();
|
||||
}
|
||||
|
||||
//Build a collection from the selected elements
|
||||
auto collection = std::make_unique<ProjectCollection>(project);
|
||||
auto collection = std::make_unique<ProjectCollection>(project, modelCard->getID());
|
||||
for (const auto& link : selected) {
|
||||
if (auto element = elementDatabase->getElement(link); element)
|
||||
collection->addElement(*element);
|
||||
else {
|
||||
//Report failure to convert element
|
||||
collection->logRecord(link, {ConversionReporter::Data::Status::failure, String{}, String{},
|
||||
connector()->getLocalString(errorString, elementTypeNotConvertedID)}, false);
|
||||
collection->incrementSkippedRecords();
|
||||
}
|
||||
}
|
||||
//Send the collected information
|
||||
auto result = std::make_unique<SendViaBrowserArgs>(*modelCard, *account, SendObject{std::move(collection)});
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
#include "Speckle/Record/Attribute/Finish.h"
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include <ACAPinc.h>
|
||||
#include <ModelMaterial.hpp>
|
||||
@@ -49,9 +51,12 @@ namespace {
|
||||
Constructor
|
||||
|
||||
project: The source project
|
||||
modelCardID: The model card ID for the send operation
|
||||
--------------------------------------------------------------------*/
|
||||
ProjectCollection::ProjectCollection(speckle::environment::Project::Shared project) : base{project->getInfo().name, project},
|
||||
m_management{std::make_unique<Management>()} {
|
||||
ProjectCollection::ProjectCollection(speckle::environment::Project::Shared project, const RecordID& modelCardID) :
|
||||
base{project->getInfo().name, project}, ConversionReporter{modelCardID}, m_management {
|
||||
std::make_unique<Management>()
|
||||
} {
|
||||
m_management->push_back(this);
|
||||
m_finishes = std::make_unique<FinishCache>();
|
||||
base::useManagement(m_management.get());
|
||||
@@ -103,7 +108,10 @@ bool ProjectCollection::addElement(const speckle::record::element::Element& elem
|
||||
RecordCollection* collection = this;
|
||||
for (const auto& childName : collectionNames)
|
||||
collection = collection->getChild(childName);
|
||||
return collection->addIndex(BIMIndex{element.getBIMID(), element.getTableID()});
|
||||
if (!collection->addIndex(BIMIndex{element.getBIMID(), element.getTableID()}))
|
||||
return false;
|
||||
incrementProjectedRecords();
|
||||
return true;
|
||||
} //ProjectCollection::addElement
|
||||
|
||||
|
||||
@@ -123,7 +131,6 @@ bool ProjectCollection::addFinishProxy(const speckle::database::BIMIndex& materi
|
||||
} //ProjectCollection::addFinishProxy
|
||||
|
||||
|
||||
#ifdef ARCHICAD
|
||||
/*--------------------------------------------------------------------
|
||||
Add a ModelerAPI material to the collection (NB: These are not persistent so need to be captured by this method)
|
||||
|
||||
@@ -138,7 +145,6 @@ bool ProjectCollection::addFinishProxy(const Finish& finish, const speckle::data
|
||||
iter = m_finishes->insert({finish.getBIMID(), finish}).first;
|
||||
return addFinishProxy(speckle::database::BIMIndex{finish.getBIMID()}, objectID);
|
||||
} //ProjectCollection::addFinishProxy
|
||||
#endif
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
@@ -153,7 +159,7 @@ bool ProjectCollection::fillInventory(active::serialise::Inventory& inventory) c
|
||||
base::fillInventory(inventory);
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ Identity{fieldID[finishProxyID]}, finishProxyID, 100, std::nullopt },
|
||||
{ Identity{fieldID[finishProxyID]}, finishProxyID, std::numeric_limits<size_t>::max(), std::nullopt },
|
||||
},
|
||||
}.withType(&typeid(ProjectCollection)));
|
||||
return true;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "Connector/Record/Collection/RecordCollection.h"
|
||||
#include "Speckle/Serialise/Collection/FinishCollector.h"
|
||||
#include "Speckle/Serialise/Collection/ConversionReporter.h"
|
||||
|
||||
#include <stack>
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace connector::record {
|
||||
- Other attributes, e.g. materials
|
||||
Add all this supplementary data to the root container as required
|
||||
*/
|
||||
class ProjectCollection : public RecordCollection, public speckle::serialise::FinishCollector {
|
||||
class ProjectCollection : public RecordCollection, public speckle::serialise::FinishCollector, public speckle::serialise::ConversionReporter {
|
||||
public:
|
||||
|
||||
// MARK: - Types
|
||||
@@ -37,8 +38,9 @@ namespace connector::record {
|
||||
/*!
|
||||
Constructor
|
||||
@param project The source project
|
||||
@param modelCardID The model card ID for the send operation
|
||||
*/
|
||||
ProjectCollection(speckle::environment::Project::Shared project);
|
||||
ProjectCollection(speckle::environment::Project::Shared project, const speckle::database::RecordID& modelCardID);
|
||||
ProjectCollection(const ProjectCollection&) = delete;
|
||||
/*!
|
||||
Destructor
|
||||
|
||||
@@ -9,4 +9,5 @@
|
||||
/* [ 2] */ "The specified model card cannot be found. Try another card or create a new one"
|
||||
/* [ 3] */ "Please open a project first"
|
||||
/* [ 4] */ "The specified Speckle account cannot be found. Check that you have logged into your Speckle account with the Speckle Manager"
|
||||
/* [ 5] */ "Unsupported conversion"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
'STR#' 32700 "Speckle Title strings" {
|
||||
/* [ 1] */ "Untitled"
|
||||
/* [ 2] */ "Unknown"
|
||||
/* [ 3] */ "Converting elements"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Speckle/Environment/Host.h"
|
||||
#include "Active/Utility/Memory.h"
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include "DG.h"
|
||||
@@ -21,6 +22,26 @@ Host::Host() {
|
||||
} //Host::Host
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Switch to the model view
|
||||
|
||||
isSelectionOnly: True to display just the selected elements
|
||||
|
||||
return: True if the model view is active
|
||||
--------------------------------------------------------------------*/
|
||||
bool Host::makeModelViewActive(bool isSelectionOnly) const {
|
||||
#ifdef ARCHICAD
|
||||
API_WindowInfo windowInfo;
|
||||
active::utility::Memory::erase(windowInfo);
|
||||
if ((ACAPI_Window_GetCurrentWindow(&windowInfo) == NoError) && (windowInfo.typeID == APIWind_3DModelID))
|
||||
return true;
|
||||
if (isSelectionOnly)
|
||||
return (ACAPI_View_ShowSelectionIn3D() == NoError);
|
||||
return (ACAPI_View_ShowAllIn3D() == NoError);
|
||||
#endif
|
||||
} //Host::makeModelViewActive
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Display an alert dialog
|
||||
|
||||
|
||||
@@ -20,6 +20,12 @@ namespace speckle::environment {
|
||||
|
||||
// MARK: Functions (const)
|
||||
|
||||
/*!
|
||||
Switch to the model view
|
||||
@param isSelectionOnly True to display just the selected elements
|
||||
@return True if the model view is active
|
||||
*/
|
||||
bool makeModelViewActive(bool isSelectionOnly = false) const;
|
||||
/*!
|
||||
Display an alert dialog
|
||||
@param message The alert message
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Active/Utility/BufferOut.h"
|
||||
#include "Speckle/Interface/Browser/Bridge/BrowserBridge.h"
|
||||
#include "Speckle/Record/Element/ModelElement.h"
|
||||
#include "Speckle/Utility/UserCancel.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
@@ -45,7 +46,15 @@ std::unique_ptr<WrappedResultArg> GetCallResult::getResult(const WrappedResultAr
|
||||
if (!item)
|
||||
return nullptr;
|
||||
String jsonOutput;
|
||||
JSONTransport().send(std::forward<Cargo&&>(*item), Identity{}, jsonOutput);
|
||||
try {
|
||||
JSONTransport().send(std::forward<Cargo&&>(*item), Identity{}, jsonOutput);
|
||||
} catch(const UserCancel& userCancel) {
|
||||
//If the user cancels and we have a model card ID, notify the JS UI that the operation is cancelled
|
||||
if (userCancel.getModelCardID())
|
||||
getBridge()->sendEvent("triggerCancelSend",
|
||||
std::make_unique<CargoHold<ValueWrap<String>, String>>(String{*userCancel.getModelCardID()}));
|
||||
jsonOutput = "null";
|
||||
}
|
||||
record::element::ModelElement::resetCache();
|
||||
return std::make_unique<WrappedResultArg>(jsonOutput);
|
||||
} //GetCallResult::getResult
|
||||
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
#include "Speckle/Interface/Component/Progress.h"
|
||||
|
||||
#include <mutex>
|
||||
|
||||
#ifdef ARCHICAD
|
||||
#include "ACAPI_Interface.h"
|
||||
#endif
|
||||
|
||||
using namespace speckle::interfac;
|
||||
using namespace speckle::utility;
|
||||
|
||||
namespace {
|
||||
|
||||
///The progress class instance - a weak reference is held so the object is released when active users complete
|
||||
std::weak_ptr<Progress> m_instance;
|
||||
///Mutex controlling management of the progress instance
|
||||
std::mutex m_mutex;
|
||||
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Destructor
|
||||
--------------------------------------------------------------------*/
|
||||
Progress::~Progress() {
|
||||
#ifdef ARCHICAD
|
||||
ACAPI_ProcessWindow_CloseProcessWindow();
|
||||
#endif
|
||||
} //Progress::~Progress
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get a progress component instance
|
||||
|
||||
title: The process title, i.e. for the overall operation. Ignored if an instance is already in operation
|
||||
stages: The number of stages for completing the overall operation. Ignored if an instance is already in operation
|
||||
|
||||
return: The progress instance - can be an active progress component if it has already been started (nullptr on failure)
|
||||
--------------------------------------------------------------------*/
|
||||
Progress::Shared Progress::getInstance(const String& title, size_t stages) {
|
||||
const std::lock_guard<std::mutex> lock(m_mutex);
|
||||
if (auto instance = m_instance.lock(); instance)
|
||||
return instance;
|
||||
#ifdef ARCHICAD
|
||||
GS::UniString gsTitle{title};
|
||||
auto phases = static_cast<Int32>(stages);
|
||||
if (ACAPI_ProcessWindow_InitProcessWindow(&gsTitle, &phases) != NoError)
|
||||
return nullptr;
|
||||
#endif
|
||||
auto result = Progress::Shared{new Progress};
|
||||
m_instance = result;
|
||||
return result;
|
||||
} //Progress::getInstance
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Addition with assignment
|
||||
|
||||
toAdd: The number of steps to add to the progress of the current stage
|
||||
--------------------------------------------------------------------*/
|
||||
void Progress::operator+= (size_t toAdd) {
|
||||
#ifdef ARCHICAD
|
||||
auto incVal = static_cast<Int32>(toAdd);
|
||||
ACAPI_ProcessWindow_IncProcessValue(&incVal);
|
||||
#endif
|
||||
} //Progress::operator+=
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Increment operator (increment the the progress of the current stage)
|
||||
--------------------------------------------------------------------*/
|
||||
void Progress::operator++ () {
|
||||
operator+=(1);
|
||||
} //Progress::operator++
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Start the next stage
|
||||
|
||||
title: The stage title
|
||||
stepCount: The number of steps in this stage
|
||||
showPercentage: True to estimate/display the process completion percentage
|
||||
--------------------------------------------------------------------*/
|
||||
void Progress::startStage(const String& title, size_t stepCount, bool showPercentage) {
|
||||
#ifdef ARCHICAD
|
||||
GS::UniString gsTitle{title};
|
||||
auto maxVal = static_cast<Int32>(stepCount);
|
||||
ACAPI_ProcessWindow_SetNextProcessPhase(&gsTitle, &maxVal, &showPercentage);
|
||||
#endif
|
||||
} //Progress::startStage
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Determine if the process has been cancelled, e.g. the user cancelling
|
||||
|
||||
return: True if the process has been cancelled
|
||||
--------------------------------------------------------------------*/
|
||||
bool Progress::isCancelled() {
|
||||
#ifdef ARCHICAD
|
||||
return (ACAPI_ProcessWindow_IsProcessCanceled() != NoError);
|
||||
#endif
|
||||
} //Progress::isCancelled
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
#ifndef SPECKLE_INTERFACE_PROGRESS
|
||||
#define SPECKLE_INTERFACE_PROGRESS
|
||||
|
||||
#include "Speckle/Utility/String.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace speckle::interfac {
|
||||
|
||||
/*!
|
||||
Interface component to provide progress feedback during some long process to the user, e.g. a progress meter
|
||||
|
||||
The structure of this component is intended for a host-wide singleton, i.e. a modal process that locks out other processes, rather than
|
||||
simply (say) a progress bar as a component in a dialog/palette. This reflects the behaviour of Archicad but may be adapted to other
|
||||
hosts
|
||||
*/
|
||||
class Progress {
|
||||
public:
|
||||
|
||||
// MARK: - Types
|
||||
|
||||
///Shared pointer
|
||||
using Shared = std::shared_ptr<Progress>;
|
||||
|
||||
// MARK: - Constructors
|
||||
|
||||
Progress(const Progress&) = delete;
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
~Progress();
|
||||
|
||||
/*!
|
||||
Get a progress component instance
|
||||
@param title The process title, i.e. for the overall operation. Ignored if an instance is already in operation
|
||||
@param stages The number of stages for completing the overall operation. Ignored if an instance is already in operation
|
||||
@return The progress instance - can be an active progress component if it has already been started (nullptr on failure)
|
||||
*/
|
||||
static Shared getInstance(const utility::String& title = {}, size_t stages = 1);
|
||||
|
||||
// MARK: - Operators
|
||||
|
||||
/*!
|
||||
Addition with assignment
|
||||
@param toAdd The number of steps to add to the progress of the current stage
|
||||
*/
|
||||
void operator+= (size_t toAdd);
|
||||
/*!
|
||||
Increment operator (increment the the progress of the current stage)
|
||||
*/
|
||||
void operator++ ();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Determine if the process has been cancelled, e.g. the user cancelling
|
||||
@return True if the process has been cancelled
|
||||
*/
|
||||
bool isCancelled();
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
/*!
|
||||
Start the next stage
|
||||
@param title The stage title
|
||||
@param stepCount The number of steps in this stage
|
||||
@param showPercentage True to estimate/display the process completion percentage
|
||||
*/
|
||||
void startStage(const utility::String& title, size_t stepCount, bool showPercentage = true);
|
||||
|
||||
private:
|
||||
/*!
|
||||
Default constructor
|
||||
*/
|
||||
Progress() {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_INTERFACE_PROGRESS
|
||||
@@ -1,21 +1,120 @@
|
||||
#include "Speckle/Record/Element/Element.h"
|
||||
|
||||
#include "Active/Serialise/CargoHold.h"
|
||||
#include "Active/Serialise/Management/Management.h"
|
||||
#include "Speckle/Database/BIMElementDatabase.h"
|
||||
#include "Speckle/Environment/Addon.h"
|
||||
#include "Speckle/Environment/Project.h"
|
||||
#include "Speckle/Record/Element/Memo.h"
|
||||
#include "Speckle/Record/Element/Setting/TypeSetting.h"
|
||||
#include "Speckle/Serialise/Collection/ConversionReporter.h"
|
||||
#include "Speckle/SpeckleResource.h"
|
||||
#include "Speckle/Utility/UserCancel.h"
|
||||
|
||||
using namespace active::serialise;
|
||||
using namespace speckle::database;
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::record::attribute;
|
||||
using namespace speckle::record::element;
|
||||
using namespace speckle::serialise;
|
||||
using namespace speckle::utility;
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace {
|
||||
///Serialisation fields
|
||||
enum FieldIndex {
|
||||
applicationTypeD,
|
||||
};
|
||||
|
||||
///Serialisation field IDs
|
||||
static std::array fieldID = {
|
||||
Identity{"applicationType"},
|
||||
};
|
||||
|
||||
#ifdef ARCHICAD
|
||||
String GetElemTypeName(API_ElemTypeID elemTypeID) {
|
||||
switch (elemTypeID) {
|
||||
case API_WallID: return "Wall";
|
||||
case API_ColumnID: return "Column";
|
||||
case API_BeamID: return "Beam";
|
||||
case API_WindowID: return "Window";
|
||||
case API_DoorID: return "Door";
|
||||
case API_ObjectID: return "Object";
|
||||
case API_LampID: return "Lamp";
|
||||
case API_SlabID: return "Slab";
|
||||
case API_RoofID: return "Roof";
|
||||
case API_MeshID: return "Mesh";
|
||||
case API_DimensionID: return "Dimension";
|
||||
case API_RadialDimensionID: return "RadialDimension";
|
||||
case API_LevelDimensionID: return "LevelDimension";
|
||||
case API_AngleDimensionID: return "AngleDimension";
|
||||
case API_TextID: return "Text";
|
||||
case API_LabelID: return "Label";
|
||||
case API_ZoneID: return "Zone";
|
||||
case API_HatchID: return "Hatch";
|
||||
case API_LineID: return "Line";
|
||||
case API_PolyLineID: return "PolyLine";
|
||||
case API_ArcID: return "Arc";
|
||||
case API_CircleID: return "Circle";
|
||||
case API_SplineID: return "Spline";
|
||||
case API_HotspotID: return "Hotspot";
|
||||
case API_CutPlaneID: return "CutPlane";
|
||||
case API_CameraID: return "Camera";
|
||||
case API_CamSetID: return "CamSet";
|
||||
case API_GroupID: return "Group";
|
||||
case API_SectElemID: return "SectElem";
|
||||
case API_DrawingID: return "Drawing";
|
||||
case API_PictureID: return "Picture";
|
||||
case API_DetailID: return "Detail";
|
||||
case API_ElevationID: return "Elevation";
|
||||
case API_InteriorElevationID: return "InteriorElevation";
|
||||
case API_WorksheetID: return "Worksheet";
|
||||
case API_HotlinkID: return "Hotlink";
|
||||
case API_CurtainWallID: return "CurtainWall";
|
||||
case API_CurtainWallSegmentID: return "CurtainWallSegment";
|
||||
case API_CurtainWallFrameID: return "CurtainWallFrame";
|
||||
case API_CurtainWallPanelID: return "CurtainWallPanel";
|
||||
case API_CurtainWallJunctionID: return "CurtainWallJunction";
|
||||
case API_CurtainWallAccessoryID: return "CurtainWallAccessory";
|
||||
case API_ShellID: return "Shell";
|
||||
case API_SkylightID: return "Skylight";
|
||||
case API_MorphID: return "Morph";
|
||||
case API_ChangeMarkerID: return "ChangeMarker";
|
||||
case API_StairID: return "Stair";
|
||||
case API_RiserID: return "Riser";
|
||||
case API_TreadID: return "Tread";
|
||||
case API_StairStructureID: return "StairStructure";
|
||||
case API_RailingID: return "Railing";
|
||||
case API_RailingToprailID: return "RailingToprail";
|
||||
case API_RailingHandrailID: return "RailingHandrail";
|
||||
case API_RailingRailID: return "RailingRail";
|
||||
case API_RailingPostID: return "RailingPost";
|
||||
case API_RailingInnerPostID: return "RailingInnerPost";
|
||||
case API_RailingBalusterID: return "RailingBaluster";
|
||||
case API_RailingPanelID: return "RailingPanel";
|
||||
case API_RailingSegmentID: return "RailingSegment";
|
||||
case API_RailingNodeID: return "RailingNode";
|
||||
case API_RailingBalusterSetID: return "RailingBalusterSet";
|
||||
case API_RailingPatternID: return "RailingPattern";
|
||||
case API_RailingToprailEndID: return "RailingToprailEnd";
|
||||
case API_RailingHandrailEndID: return "RailingHandrailEnd";
|
||||
case API_RailingRailEndID: return "RailingRailEnd";
|
||||
case API_RailingToprailConnectionID: return "RailingToprailConnection";
|
||||
case API_RailingHandrailConnectionID: return "RailingHandrailConnection";
|
||||
case API_RailingRailConnectionID: return "RailingRailConnection";
|
||||
case API_RailingEndFinishID: return "RailingEndFinish";
|
||||
case API_BeamSegmentID: return "BeamSegment";
|
||||
case API_ColumnSegmentID: return "ColumnSegment";
|
||||
case API_OpeningID: return "Opening";
|
||||
case API_ExternalElemID: return "ExternalElem";
|
||||
default: return "UnknownElemType";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Default constructor
|
||||
@@ -86,17 +185,28 @@ BIMLink Element::getBIMLink() const {
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the element type name, e.g. "Wall", "Roof" etc
|
||||
Get the localised element type name, e.g. "Wall", "Roof" etc
|
||||
|
||||
return: The type name
|
||||
--------------------------------------------------------------------*/
|
||||
String Element::getTypeName() const {
|
||||
String Element::getLocalisedTypeName() const {
|
||||
#ifdef ARCHICAD
|
||||
GS::UniString typeName;
|
||||
if (auto err = ACAPI_Element_GetElemTypeName(getHead().type, typeName); err != NoError)
|
||||
return addon()->getLocalString(titleStringLib, unknownElementTypeID);
|
||||
return typeName;
|
||||
#endif
|
||||
} //Element::getLocalisedTypeName
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Get the element type name, e.g. "Wall", "Roof" etc
|
||||
|
||||
return: The type name
|
||||
--------------------------------------------------------------------*/
|
||||
#include "Speckle/Environment/Platform.h"
|
||||
String Element::getTypeName() const {
|
||||
return GetElemTypeName(getHead().type.typeID);
|
||||
} //Element::getTypeName
|
||||
|
||||
|
||||
@@ -108,6 +218,12 @@ String Element::getTypeName() const {
|
||||
return: True if the package has added items to the inventory
|
||||
--------------------------------------------------------------------*/
|
||||
bool Element::fillInventory(Inventory& inventory) const {
|
||||
using enum Entry::Type;
|
||||
inventory.merge(Inventory{
|
||||
{
|
||||
{ fieldID[applicationTypeD], applicationTypeD, element },
|
||||
},
|
||||
}.withType(&typeid(Element)));
|
||||
return base::fillInventory(inventory);
|
||||
} //Element::fillInventory
|
||||
|
||||
@@ -120,7 +236,15 @@ bool Element::fillInventory(Inventory& inventory) const {
|
||||
return: The requested cargo (nullptr on failure)
|
||||
--------------------------------------------------------------------*/
|
||||
Cargo::Unique Element::getCargo(const Inventory::Item& item) const {
|
||||
return base::getCargo(item);
|
||||
if (item.ownerType != &typeid(Element))
|
||||
return base::getCargo(item);
|
||||
using namespace active::serialise;
|
||||
switch (item.index) {
|
||||
case applicationTypeD:
|
||||
return Cargo::Unique{ new CargoHold<ValueWrap<String>, String>{ getTypeName() } };
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
} //Element::getCargo
|
||||
|
||||
|
||||
@@ -132,6 +256,22 @@ void Element::setDefault() {
|
||||
} //Element::setDefault
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Use a manager in (de)serialisation processes
|
||||
|
||||
management: The management to use
|
||||
--------------------------------------------------------------------*/
|
||||
void Element::useManagement(Management* management) const {
|
||||
if (management != nullptr) {
|
||||
//If a conversion report is collected, add this record to the report (also updates progress display in the UI)
|
||||
if (auto reporter = management->get<ConversionReporter>(); reporter != nullptr) {
|
||||
if (!reporter->logRecord(getBIMID(), {ConversionReporter::Data::Status::success, getTypeName(), getSpeckleType()}))
|
||||
throw UserCancel{reporter->getModelCardID()};
|
||||
}
|
||||
}
|
||||
} //Element::useManagement
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Load the element memo structure (elements must override according to requirements)
|
||||
|
||||
|
||||
@@ -62,7 +62,12 @@ namespace speckle::record::element {
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the elmeent type name, e.g. "Wall", "Roof" etc
|
||||
Get the localised element type name, e.g. "Wall", "Roof" etc
|
||||
@return The type name
|
||||
*/
|
||||
virtual speckle::utility::String getLocalisedTypeName() const;
|
||||
/*!
|
||||
Get the element type name, e.g. "Wall", "Roof" etc
|
||||
@return The type name
|
||||
*/
|
||||
virtual speckle::utility::String getTypeName() const;
|
||||
@@ -112,6 +117,11 @@ namespace speckle::record::element {
|
||||
Set to the default package content
|
||||
*/
|
||||
void setDefault() override;
|
||||
/*!
|
||||
Use a manager in (de)serialisation processes
|
||||
@param management The management to use
|
||||
*/
|
||||
void useManagement(active::serialise::Management* management) const override;
|
||||
|
||||
protected:
|
||||
/*!
|
||||
|
||||
@@ -428,7 +428,8 @@ Cargo::Unique ModelElement::getCargo(const Inventory::Item& item) const {
|
||||
return Cargo::Unique{new CargoHold<ContainerWrap<MaterialQuantityList>, MaterialQuantityList>{quants}};
|
||||
return nullptr;
|
||||
case propertyID:
|
||||
return std::make_unique<PropertiedWrapper>(*this);
|
||||
return nullptr;
|
||||
//return std::make_unique<PropertiedWrapper>(*this);
|
||||
default:
|
||||
return nullptr; //Requested an unknown index
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#include "Speckle/Serialise/Collection/ConversionReporter.h"
|
||||
|
||||
#include "Speckle/Environment/Addon.h"
|
||||
#include "Speckle/Interface/Component/Progress.h"
|
||||
#include "Speckle/SpeckleResource.h"
|
||||
|
||||
using namespace speckle::database;
|
||||
using namespace speckle::environment;
|
||||
using namespace speckle::interfac;
|
||||
using namespace speckle::serialise;
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Destructor
|
||||
--------------------------------------------------------------------*/
|
||||
ConversionReporter::~ConversionReporter() {}
|
||||
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Log the conversion/serialisation of a record
|
||||
|
||||
recordID: The ID of the serialised record
|
||||
@param data The record serialisation report data
|
||||
withUIFeedback: True if the UI progress feedback should be updated
|
||||
|
||||
return: True if the serialisation should continue
|
||||
--------------------------------------------------------------------*/
|
||||
bool ConversionReporter::logRecord(const BIMRecordID& recordID, const Data& data, bool withUIFeedback) {
|
||||
//Initialise the progress UI component as required
|
||||
if (withUIFeedback && !m_progress) {
|
||||
if (m_progress = Progress::getInstance(addon()->getLocalString(titleStringLib, conversionProgressID)); m_progress) {
|
||||
m_progress->startStage(addon()->getLocalString(titleStringLib, conversionProgressID), m_projectedRecordCount);
|
||||
//If any records have already failed, mark them as complete in the UI progress display
|
||||
if (m_skippedRecordCount > 0)
|
||||
*m_progress += m_skippedRecordCount;
|
||||
}
|
||||
}
|
||||
//Log the conversion outcome for the record
|
||||
m_log[recordID] = data;
|
||||
//Update the progress UI component
|
||||
if (withUIFeedback && m_progress) {
|
||||
++(*m_progress);
|
||||
return !m_progress->isCancelled();
|
||||
}
|
||||
return true;
|
||||
} //ConversionReporter::logRecord
|
||||
@@ -0,0 +1,108 @@
|
||||
#ifndef SPECKLE_SERIALISE_CONVERSION_REPORTER
|
||||
#define SPECKLE_SERIALISE_CONVERSION_REPORTER
|
||||
|
||||
#include "Active/Serialise/Management/Manager.h"
|
||||
#include "Speckle/Database/Identity/RecordID.h"
|
||||
#include "Speckle/Database/Identity/BIMRecordID.h"
|
||||
|
||||
namespace speckle::interfac {
|
||||
class Progress;
|
||||
}
|
||||
|
||||
namespace speckle::serialise {
|
||||
|
||||
/*!
|
||||
Manager for reporting on the progress of a send conversion/serialisation process
|
||||
*/
|
||||
class ConversionReporter : public virtual active::serialise::Manager {
|
||||
public:
|
||||
|
||||
///Data collected from the conversion of a record
|
||||
struct Data {
|
||||
///Record conversion status
|
||||
enum class Status {
|
||||
success,
|
||||
failure,
|
||||
};
|
||||
|
||||
///The conversion status
|
||||
Status status;
|
||||
///The name of the record type
|
||||
utility::String typeName;
|
||||
///The name of the record type
|
||||
utility::String speckleType;
|
||||
///Optional message from the conversion (particularly relevant when an error occurs)
|
||||
utility::String message;
|
||||
};
|
||||
|
||||
///Reporter log pairing a record ID with the outcome of its conversion
|
||||
using Log = std::unordered_map<database::BIMRecordID, Data>;
|
||||
|
||||
// MARK: Constructors
|
||||
|
||||
/*!
|
||||
constructor
|
||||
@param cardID The conversion model card ID
|
||||
*/
|
||||
ConversionReporter(const database::RecordID& cardID) : m_modelCardID{cardID} {}
|
||||
/*!
|
||||
Destructor
|
||||
*/
|
||||
virtual ~ConversionReporter();
|
||||
|
||||
// MARK: - Functions (const)
|
||||
|
||||
/*!
|
||||
Get the conversion report model card ID
|
||||
@return The model card ID
|
||||
*/
|
||||
const database::RecordID& getModelCardID() const { return m_modelCardID; }
|
||||
/*!
|
||||
Get the conversion log
|
||||
@return The conversion log
|
||||
*/
|
||||
const Log& getLog() const { return m_log; }
|
||||
|
||||
// MARK: - Functions (mutating)
|
||||
|
||||
/*!
|
||||
Set the conversion report model card ID
|
||||
@param cardID The model card ID
|
||||
*/
|
||||
void setModelCardID(const database::RecordID& cardID) { m_modelCardID = cardID; }
|
||||
/*!
|
||||
Increment the number of projected records to be logged
|
||||
*/
|
||||
void incrementProjectedRecords() { ++m_projectedRecordCount; }
|
||||
/*!
|
||||
Increment the number of skipped records (and add to the projected record count)
|
||||
*/
|
||||
void incrementSkippedRecords() {
|
||||
++m_skippedRecordCount;
|
||||
incrementProjectedRecords();
|
||||
}
|
||||
/*!
|
||||
Log the conversion/serialisation of a record
|
||||
@param recordID The ID of the serialised record
|
||||
@param data The record serialisation report data
|
||||
@param withUIFeedback True if the UI progress feedback should be updated
|
||||
@return True if the serialisation should continue
|
||||
*/
|
||||
bool logRecord(const speckle::database::BIMRecordID& recordID, const Data& data = {Data::Status::success}, bool withUIFeedback = true);
|
||||
|
||||
private:
|
||||
///The reporter log
|
||||
Log m_log;
|
||||
///The ID of the conversion model card
|
||||
database::RecordID m_modelCardID;
|
||||
///The conversion progress UI display
|
||||
std::shared_ptr<interfac::Progress> m_progress;
|
||||
///Projected number of records to be logged (used to calculate UI progress components)
|
||||
size_t m_projectedRecordCount = 0;
|
||||
///Number of records skipped (before processing starts - the UI progress feedback will reflect their completion)
|
||||
size_t m_skippedRecordCount = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_SERIALISE_CONVERSION_REPORTER
|
||||
@@ -14,7 +14,7 @@ namespace speckle::serialise {
|
||||
|
||||
Used as a serialisation manager to collect finishes from serialised objects
|
||||
*/
|
||||
class FinishCollector : public active::serialise::Manager {
|
||||
class FinishCollector : public virtual active::serialise::Manager {
|
||||
public:
|
||||
/*!
|
||||
Destructor
|
||||
|
||||
@@ -15,6 +15,7 @@ enum SpeckleStringResource {
|
||||
enum SpeckleTitleString {
|
||||
untitledProjectID = 1,
|
||||
unknownElementTypeID,
|
||||
conversionProgressID,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
namespace speckle::utility {
|
||||
|
||||
/*!
|
||||
Record index class
|
||||
Speckle exception base
|
||||
*/
|
||||
class Exception : public std::runtime_error {
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SPECKLE_UTILITY_USER_CANCEL
|
||||
#define SPECKLE_UTILITY_USER_CANCEL
|
||||
|
||||
#include "Speckle/Database/Identity/RecordID.h"
|
||||
#include "Speckle/Utility/Exception.h"
|
||||
|
||||
namespace speckle::utility {
|
||||
|
||||
/*!
|
||||
Exception thrown to signal the user has cancelled a process
|
||||
*/
|
||||
class UserCancel : public Exception {
|
||||
public:
|
||||
/*!
|
||||
Default constructor
|
||||
*/
|
||||
UserCancel() : Exception{{}} {}
|
||||
/*!
|
||||
Constructor
|
||||
@param modelCardID The model card ID associated with the cancelled process
|
||||
*/
|
||||
UserCancel(const database::RecordID& modelCardID) : Exception{{}}, m_modelCardID{modelCardID} {}
|
||||
|
||||
/*!
|
||||
Get the ID of the model card associated with the cancelled process
|
||||
@return The model card ID (nullopt = process not associated with a model card)
|
||||
*/
|
||||
const database::RecordID::Option getModelCardID() const { return m_modelCardID; }
|
||||
|
||||
private:
|
||||
///The model card ID associated with the cancelled process (nullopt = process not associated with a model card)
|
||||
database::RecordID::Option m_modelCardID;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif //SPECKLE_UTILITY_USER_CANCEL
|
||||
@@ -76,6 +76,11 @@
|
||||
2196F3042CB57E8000450DFC /* Storey.h in Headers */ = {isa = PBXBuildFile; fileRef = 2196F3022CB57E7F00450DFC /* Storey.h */; };
|
||||
2196F3052CB57E8000450DFC /* Storey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2196F3032CB57E7F00450DFC /* Storey.cpp */; };
|
||||
2199881E2BD833830035E5EA /* libArchicad27.a in CopyFiles */ = {isa = PBXBuildFile; fileRef = 21379E082AE47A6400A1584C /* libArchicad27.a */; };
|
||||
2199BB6D2CDBF09900A4BEEC /* ConversionReporter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2199BB6A2CDBF09900A4BEEC /* ConversionReporter.h */; };
|
||||
2199BB6F2CDC2B2500A4BEEC /* ConversionReporter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2199BB6E2CDC2B2500A4BEEC /* ConversionReporter.cpp */; };
|
||||
2199BB732CDCB0D500A4BEEC /* Progress.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2199BB702CDCB0D500A4BEEC /* Progress.cpp */; };
|
||||
2199BB742CDCB0D500A4BEEC /* Progress.h in Headers */ = {isa = PBXBuildFile; fileRef = 2199BB712CDCB0D500A4BEEC /* Progress.h */; };
|
||||
2199BB842CDE508800A4BEEC /* UserCancel.h in Headers */ = {isa = PBXBuildFile; fileRef = 2199BB812CDE508800A4BEEC /* UserCancel.h */; };
|
||||
21A0FBA42CB880690023F24E /* FinishCollector.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A0FB9F2CB880690023F24E /* FinishCollector.h */; };
|
||||
21A0FBB52CBA5E380023F24E /* Str256.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A0FBB42CBA5E380023F24E /* Str256.h */; };
|
||||
21A0FBBC2CBBC04C0023F24E /* ArchicadRGB.h in Headers */ = {isa = PBXBuildFile; fileRef = 21A0FBB92CBBC04C0023F24E /* ArchicadRGB.h */; };
|
||||
@@ -304,6 +309,11 @@
|
||||
2196F3032CB57E7F00450DFC /* Storey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Storey.cpp; sourceTree = "<group>"; };
|
||||
219712682BE7E2D500D9EF7E /* Serialisation.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = Serialisation.md; sourceTree = "<group>"; };
|
||||
2199BB5F2CDB761B00A4BEEC /* ElementStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementStorage.h; sourceTree = "<group>"; };
|
||||
2199BB6A2CDBF09900A4BEEC /* ConversionReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConversionReporter.h; sourceTree = "<group>"; };
|
||||
2199BB6E2CDC2B2500A4BEEC /* ConversionReporter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConversionReporter.cpp; sourceTree = "<group>"; };
|
||||
2199BB702CDCB0D500A4BEEC /* Progress.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Progress.cpp; sourceTree = "<group>"; };
|
||||
2199BB712CDCB0D500A4BEEC /* Progress.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Progress.h; sourceTree = "<group>"; };
|
||||
2199BB812CDE508800A4BEEC /* UserCancel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserCancel.h; sourceTree = "<group>"; };
|
||||
21A0FB9F2CB880690023F24E /* FinishCollector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FinishCollector.h; sourceTree = "<group>"; };
|
||||
21A0FBA92CB9324A0023F24E /* FinishProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FinishProxy.h; sourceTree = "<group>"; };
|
||||
21A0FBB42CBA5E380023F24E /* Str256.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Str256.h; sourceTree = "<group>"; };
|
||||
@@ -664,6 +674,7 @@
|
||||
210CC88D2C81A98500610F58 /* Guid64.h */,
|
||||
219351AE2C62CC1A00E5A69C /* String.cpp */,
|
||||
219351AF2C62CC1A00E5A69C /* String.h */,
|
||||
2199BB812CDE508800A4BEEC /* UserCancel.h */,
|
||||
);
|
||||
path = Utility;
|
||||
sourceTree = "<group>";
|
||||
@@ -717,9 +728,20 @@
|
||||
path = Element;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2199BB722CDCB0D500A4BEEC /* Component */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2199BB702CDCB0D500A4BEEC /* Progress.cpp */,
|
||||
2199BB712CDCB0D500A4BEEC /* Progress.h */,
|
||||
);
|
||||
path = Component;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
21A0FBA02CB880690023F24E /* Collection */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2199BB6E2CDC2B2500A4BEEC /* ConversionReporter.cpp */,
|
||||
2199BB6A2CDBF09900A4BEEC /* ConversionReporter.h */,
|
||||
21A0FB9F2CB880690023F24E /* FinishCollector.h */,
|
||||
21A0FBA92CB9324A0023F24E /* FinishProxy.h */,
|
||||
);
|
||||
@@ -921,6 +943,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
21F69F1A2C6A0FE2008B6A06 /* Browser */,
|
||||
2199BB722CDCB0D500A4BEEC /* Component */,
|
||||
);
|
||||
path = Interface;
|
||||
sourceTree = "<group>";
|
||||
@@ -1034,6 +1057,7 @@
|
||||
21AE19AD2CC8F214004DBCFC /* SegmentedBeam.h in Headers */,
|
||||
21384C1D2CD586D800D4602B /* Morph.h in Headers */,
|
||||
21D0BDE72C943D3F0077E104 /* RecordID.h in Headers */,
|
||||
2199BB742CDCB0D500A4BEEC /* Progress.h in Headers */,
|
||||
21D0BD212C86F0280077E104 /* AccountDatabase.h in Headers */,
|
||||
21A0FBB52CBA5E380023F24E /* Str256.h in Headers */,
|
||||
210CC86F2C7E879700610F58 /* ArgumentBase.h in Headers */,
|
||||
@@ -1061,6 +1085,7 @@
|
||||
21A0FBA42CB880690023F24E /* FinishCollector.h in Headers */,
|
||||
21384C192CD585A600D4602B /* Roof.h in Headers */,
|
||||
21AE19802CC7D265004DBCFC /* PropertiedWrapper.h in Headers */,
|
||||
2199BB842CDE508800A4BEEC /* UserCancel.h in Headers */,
|
||||
21A0FC0B2CBE5E220023F24E /* Segment.h in Headers */,
|
||||
215F088D2CA195EC00CD343B /* ArchicadElementDBaseEngine.h in Headers */,
|
||||
21384BC82CD24ADC00D4602B /* ElementEvent.h in Headers */,
|
||||
@@ -1083,6 +1108,7 @@
|
||||
2196F3042CB57E8000450DFC /* Storey.h in Headers */,
|
||||
21384C042CD57CA500D4602B /* Wall.h in Headers */,
|
||||
21AE196F2CC64D37004DBCFC /* Classified.h in Headers */,
|
||||
2199BB6D2CDBF09900A4BEEC /* ConversionReporter.h in Headers */,
|
||||
21AE19522CC273F1004DBCFC /* Property.h in Headers */,
|
||||
21A0FBF92CBDB9A70023F24E /* BIMMemory.h in Headers */,
|
||||
21AE19AA2CC8F1F8004DBCFC /* BeamSegment.h in Headers */,
|
||||
@@ -1255,6 +1281,7 @@
|
||||
2196F2F82CB51ED400450DFC /* BIMAttributeDatabase.cpp in Sources */,
|
||||
21D0BD4E2C8901A00077E104 /* ServerInfo.cpp in Sources */,
|
||||
21AE19512CC273F1004DBCFC /* Property.cpp in Sources */,
|
||||
2199BB732CDCB0D500A4BEEC /* Progress.cpp in Sources */,
|
||||
21384BED2CD3EBE200D4602B /* Material.cpp in Sources */,
|
||||
21384C252CD59B4100D4602B /* MeshElem.cpp in Sources */,
|
||||
21B67D0E2C7E0E8D00FD64FC /* ErrorReport.cpp in Sources */,
|
||||
@@ -1295,6 +1322,7 @@
|
||||
21F69F512C6CCC25008B6A06 /* BrowserBridge.cpp in Sources */,
|
||||
21A0FC112CBEE5C30023F24E /* Part.cpp in Sources */,
|
||||
21384C212CD5880400D4602B /* Shell.cpp in Sources */,
|
||||
2199BB6F2CDC2B2500A4BEEC /* ConversionReporter.cpp in Sources */,
|
||||
21A890D12CC1B87C0087E732 /* GenericModelElement.cpp in Sources */,
|
||||
21AEF9BC2CA6DF84000B8681 /* DetachmentManager.cpp in Sources */,
|
||||
215F08552C99DA8D00CD343B /* Project.cpp in Sources */,
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<ClInclude Include="Speckle\Interface\Browser\JSPortal.h" />
|
||||
<ClInclude Include="Speckle\Interface\Browser\NamedFunction.h" />
|
||||
<ClInclude Include="Speckle\Interface\Browser\PlatformBinding.h" />
|
||||
<ClInclude Include="Speckle\Interface\Component\Progress.h" />
|
||||
<ClInclude Include="Speckle\Primitive\Mesh\Mesh.h" />
|
||||
<ClInclude Include="Speckle\Record\Attribute\Attribute.h" />
|
||||
<ClInclude Include="Speckle\Record\Attribute\Finish.h" />
|
||||
@@ -115,6 +116,7 @@
|
||||
<ClInclude Include="Speckle\Record\Property\Wrapper\PropertiedWrapper.h" />
|
||||
<ClInclude Include="Speckle\Record\Property\Wrapper\PropertyWrapper.h" />
|
||||
<ClInclude Include="Speckle\Record\Property\Wrapper\PropsAndClassWrapper.h" />
|
||||
<ClInclude Include="Speckle\Serialise\Collection\ConversionReporter.h" />
|
||||
<ClInclude Include="Speckle\Serialise\Collection\FinishCollector.h" />
|
||||
<ClInclude Include="Speckle\Serialise\Collection\FinishProxy.h" />
|
||||
<ClInclude Include="Speckle\Serialise\Detached\DetachedReference.h" />
|
||||
@@ -132,6 +134,7 @@
|
||||
<ClInclude Include="Speckle\Utility\Guid.h" />
|
||||
<ClInclude Include="Speckle\Utility\Guid64.h" />
|
||||
<ClInclude Include="Speckle\Utility\String.h" />
|
||||
<ClInclude Include="Speckle\Utility\UserCancel.h" />
|
||||
<ClInclude Include="Speckle\Version.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -166,6 +169,7 @@
|
||||
<ClCompile Include="Speckle\Interface\Browser\Bridge\Functions\GetBindingsMethodNames.cpp" />
|
||||
<ClCompile Include="Speckle\Interface\Browser\Bridge\Functions\GetCallResult.cpp" />
|
||||
<ClCompile Include="Speckle\Interface\Browser\Bridge\Functions\RunMethod.cpp" />
|
||||
<ClCompile Include="Speckle\Interface\Component\Progress.cpp" />
|
||||
<ClCompile Include="Speckle\Primitive\Mesh\Mesh.cpp" />
|
||||
<ClCompile Include="Speckle\Record\Attribute\Attribute.cpp" />
|
||||
<ClCompile Include="Speckle\Record\Attribute\Finish.cpp" />
|
||||
@@ -210,6 +214,7 @@
|
||||
<ClCompile Include="Speckle\Record\Property\Wrapper\PropertiedWrapper.cpp" />
|
||||
<ClCompile Include="Speckle\Record\Property\Wrapper\PropertyWrapper.cpp" />
|
||||
<ClCompile Include="Speckle\Record\Property\Wrapper\PropsAndClassWrapper.cpp" />
|
||||
<ClCompile Include="Speckle\Serialise\Collection\ConversionReporter.cpp" />
|
||||
<ClCompile Include="Speckle\Serialise\Detached\DetachedReference.cpp" />
|
||||
<ClCompile Include="Speckle\Serialise\Detached\DetachedWrap.cpp" />
|
||||
<ClCompile Include="Speckle\Serialise\Detached\DetachmentManager.cpp" />
|
||||
|
||||
@@ -125,6 +125,9 @@
|
||||
<Filter Include="Speckle\Database\Storage\Element">
|
||||
<UniqueIdentifier>{f4cd84a1-f6c1-449f-98cd-d902cc3d9e8c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Speckle\Interface\Component">
|
||||
<UniqueIdentifier>{ccb4ca39-1960-4590-ad5a-8f9092924778}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Speckle\Environment\Addon.h">
|
||||
@@ -469,6 +472,15 @@
|
||||
<ClInclude Include="Speckle\Database\Storage\Element\ElementStorage.h">
|
||||
<Filter>Speckle\Database\Storage\Element</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Interface\Component\Progress.h">
|
||||
<Filter>Speckle\Interface\Component</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Serialise\Collection\ConversionReporter.h">
|
||||
<Filter>Speckle\Serialise\Collection</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Speckle\Utility\UserCancel.h">
|
||||
<Filter>Speckle\Utility</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Speckle\Environment\Addon.cpp">
|
||||
@@ -723,6 +735,12 @@
|
||||
<ClCompile Include="Speckle\Record\Element\Wall.cpp">
|
||||
<Filter>Speckle\Record\Element</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Speckle\Interface\Component\Progress.cpp">
|
||||
<Filter>Speckle\Interface\Component</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Speckle\Serialise\Collection\ConversionReporter.cpp">
|
||||
<Filter>Speckle\Serialise\Collection</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="Speckle\CMakeLists.txt">
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
$ErrorActionPreference = "Stop";
|
||||
|
||||
dotnet run --project ci-build/build.csproj -- $args
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
dotnet run --project Build/Build.csproj -- "$@"
|
||||
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;Local</Configurations>
|
||||
<ImplicitUsings>true</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Bullseye" Version="5.0.0" />
|
||||
<PackageReference Include="Glob" Version="1.1.9"/>
|
||||
<PackageReference Include="Microsoft.Build" Version="17.10.4"/>
|
||||
<PackageReference Include="SimpleExec" Version="12.0.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,18 @@
|
||||
namespace Build;
|
||||
|
||||
public static class Consts
|
||||
{
|
||||
public static readonly string[] Solutions = ["SpeckleConnector/Connector.sln"];
|
||||
|
||||
public static readonly InstallerProject[] InstallerManifests =
|
||||
{
|
||||
new("archicad", [new("archicad27", "SpeckleConnector/x64/ReleaseAC27", "*.apx")])
|
||||
};
|
||||
}
|
||||
|
||||
public readonly record struct InstallerProject(string HostAppSlug, IReadOnlyList<InstallerAsset> Projects)
|
||||
{
|
||||
public override string ToString() => $"{HostAppSlug}";
|
||||
}
|
||||
|
||||
public readonly record struct InstallerAsset(string ConnectorVersion, string OutputPath, string GlobPattern = "*");
|
||||
@@ -0,0 +1,123 @@
|
||||
using System.IO.Compression;
|
||||
using Build;
|
||||
using GlobExpressions;
|
||||
using static Bullseye.Targets;
|
||||
using static SimpleExec.Command;
|
||||
|
||||
const string CLEAN = "clean";
|
||||
const string BUILD = "build";
|
||||
const string ZIP = "zip";
|
||||
const string RESTORE_TOOLS = "restore-tools";
|
||||
const string BUILD_SERVER_VERSION = "build-server-version";
|
||||
|
||||
//need to pass arguments
|
||||
/*var arguments = new List<string>();
|
||||
if (args.Length > 1)
|
||||
{
|
||||
arguments = args.ToList();
|
||||
args = new[] { arguments.First() };
|
||||
//arguments = arguments.Skip(1).ToList();
|
||||
}*/
|
||||
|
||||
Target(
|
||||
CLEAN,
|
||||
ForEach("**/output"),
|
||||
dir =>
|
||||
{
|
||||
IEnumerable<string> GetDirectories(string d)
|
||||
{
|
||||
return Glob.Directories(".", d);
|
||||
}
|
||||
|
||||
void RemoveDirectory(string d)
|
||||
{
|
||||
if (Directory.Exists(d))
|
||||
{
|
||||
Console.WriteLine(d);
|
||||
Directory.Delete(d, true);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var d in GetDirectories(dir))
|
||||
{
|
||||
RemoveDirectory(d);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
Target(
|
||||
RESTORE_TOOLS,
|
||||
() =>
|
||||
{
|
||||
Run("dotnet", "tool restore");
|
||||
}
|
||||
);
|
||||
|
||||
Target(
|
||||
BUILD_SERVER_VERSION,
|
||||
DependsOn(RESTORE_TOOLS),
|
||||
() =>
|
||||
{
|
||||
Run("dotnet", "tool run dotnet-gitversion /output json /output buildserver");
|
||||
}
|
||||
);
|
||||
|
||||
Target(
|
||||
BUILD,
|
||||
Consts.Solutions,
|
||||
s =>
|
||||
{
|
||||
var version = Environment.GetEnvironmentVariable("GitVersion_FullSemVer") ?? "3.0.0-fakeVersion2";
|
||||
var fileVersion = Environment.GetEnvironmentVariable("GitVersion_AssemblySemFileVer") ?? "3.0.0.1234";
|
||||
Console.WriteLine($"Version: {version} & {fileVersion}");
|
||||
Run("msbuild", $"{s} /p:Configuration=ReleaseAC27 /p:Version={version} /p:FileVersion={fileVersion}");
|
||||
}
|
||||
);
|
||||
|
||||
Target(
|
||||
ZIP,
|
||||
DependsOn(BUILD),
|
||||
Consts.InstallerManifests,
|
||||
x =>
|
||||
{
|
||||
var outputDir = Path.Combine(".", "output");
|
||||
var slugDir = Path.Combine(outputDir, x.HostAppSlug);
|
||||
|
||||
Directory.CreateDirectory(outputDir);
|
||||
Directory.CreateDirectory(slugDir);
|
||||
|
||||
foreach (var asset in x.Projects)
|
||||
{
|
||||
var fullPath = Path.Combine(".", asset.OutputPath);
|
||||
if (!Directory.Exists(fullPath))
|
||||
{
|
||||
throw new InvalidOperationException("Could not find: " + fullPath);
|
||||
}
|
||||
|
||||
var assetName = asset.ConnectorVersion;
|
||||
var connectorDir = Path.Combine(slugDir, assetName);
|
||||
Directory.CreateDirectory(connectorDir);
|
||||
foreach (var directory in Directory.EnumerateDirectories(fullPath, asset.GlobPattern, SearchOption.AllDirectories))
|
||||
{
|
||||
Directory.CreateDirectory(directory.Replace(fullPath, connectorDir));
|
||||
}
|
||||
|
||||
foreach (var file in Directory.EnumerateFiles(fullPath, asset.GlobPattern, SearchOption.AllDirectories))
|
||||
{
|
||||
Console.WriteLine(file);
|
||||
var destFileName = file.Replace(fullPath, connectorDir);
|
||||
File.Copy(file, destFileName, true);
|
||||
}
|
||||
}
|
||||
|
||||
var outputPath = Path.Combine(outputDir, $"{x.HostAppSlug}.zip");
|
||||
File.Delete(outputPath);
|
||||
Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'");
|
||||
ZipFile.CreateFromDirectory(slugDir, outputPath);
|
||||
// Directory.Delete(slugDir, true);
|
||||
}
|
||||
);
|
||||
|
||||
Target("default", DependsOn(ZIP), () => Console.WriteLine("Done!"));
|
||||
|
||||
await RunTargetsAndExitAsync(args).ConfigureAwait(true);
|
||||
Reference in New Issue
Block a user