Files
speckle-cpp-connectors/SpeckleLib/Speckle/Environment/Project.cpp
T
Ralph Wessel b5447b263e NB: Interim commit - new code is untested at this point
Information sent to Speckle is now presented in hiearchical collections:
- Root level contains material proxies
- Second level is project storeys
- Third level is element type
Added database and record definitions for attributes including:
- Finishes (surface rendering material)
- Storeys
Element getters for storey and type name
Aligned some speckle_type names to Revit (where possible)
2024-10-10 08:52:18 +01:00

69 lines
2.3 KiB
C++

#include "Speckle/Environment/Project.h"
#include "Speckle/Database/BIMAttributeDatabase.h"
#include "Speckle/Database/BIMElementDatabase.h"
#include "Speckle/Environment/Addon.h"
#include "Speckle/SpeckleResource.h"
#ifdef ARCHICAD
#include <ACAPinc.h>
#endif
using namespace speckle::database;
using namespace speckle::environment;
using namespace speckle::utility;
namespace {
}
/*--------------------------------------------------------------------
Constructor (NB: this object is assumed to be the active instance)
identity: Optional name/ID for the subscriber
--------------------------------------------------------------------*/
Project::Project() {
m_element = std::make_unique<BIMElementDatabase>();
m_attribute = std::make_unique<BIMAttributeDatabase>();
} //Project::Project
/*--------------------------------------------------------------------
Destructor
--------------------------------------------------------------------*/
Project::~Project() {
} //Project::~Project
/*--------------------------------------------------------------------
Get information about the project
return: Project information
--------------------------------------------------------------------*/
Project::Info Project::getInfo() const {
//Start with an untitled project - this will be replaced if a saved project is active
Info result{addon()->getLocalString(titleStringLib, untitledProjectID)};
#ifdef ARCHICAD
API_ProjectInfo projectInfo;
if (ACAPI_ProjectOperation_Project(&projectInfo) == NoError) {
if ((projectInfo.projectName != nullptr) && !projectInfo.projectName->IsEmpty())
result.name = *projectInfo.projectName;
result.isShared = projectInfo.teamwork;
if ((projectInfo.projectPath != nullptr) && !projectInfo.projectPath->IsEmpty())
result.path = String{*projectInfo.projectPath};
else if (projectInfo.teamwork) {
if (projectInfo.location_team != nullptr) {
GS::UniString path;
if (projectInfo.location_team->ToPath(&path) == NoError)
result.path = String{path};
}
} else if (projectInfo.location != nullptr) {
GS::UniString path;
if (projectInfo.location->ToPath(&path) == NoError)
result.path = String{path};
}
}
#endif
return result;
} //Project::getInfo