-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
David/cnx 930 create a getelementproperties converter (#7)
* sending properties * GetElementMaterialQuantities * ArchicadObject * GetElementClassifications * cherry pick element properties by guid * added element type quantity getters * getting more quantities * RootObjectBuilder refactor * opacity bugfix * opacity bugfix * removed duplicate properties * user defined props under groups * do not return null prop values * wall quantities restructure * working units, override material names and surfaces * workingunits fix * GetElementProperties refactor, moved all property collection logic to converter from RootObjectBuilder * do not send empty dictionaries
- Loading branch information
1 parent
36fc9cf
commit f490ec8
Showing
17 changed files
with
962 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
AddOns/Speckle/Sources/AddOn/Converter/HostToSpeckle/GetElementClassification.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include "HostToSpeckleConverter.h" | ||
#include "ConverterUtils.h" | ||
|
||
#include "APIEnvir.h" | ||
#include "ACAPinc.h" | ||
#include "CheckError.h" | ||
|
||
namespace | ||
{ | ||
std::string GetClassifictaionName(const API_Guid& classificationId) | ||
{ | ||
API_ClassificationItem classification{}; | ||
classification.guid = classificationId; | ||
ACAPI_Classification_GetClassificationItem(classification); | ||
std::string classificationName = classification.id.ToCStr().Get(); | ||
|
||
return classificationName; | ||
} | ||
|
||
std::string GetClassifictaionSystemName(const API_Guid& classificationSystemId) | ||
{ | ||
API_ClassificationSystem system{}; | ||
system.guid = classificationSystemId; | ||
ACAPI_Classification_GetClassificationSystem(system); | ||
std::string systemName = system.name.ToCStr().Get(); | ||
std::string systemEdition = system.editionVersion.ToCStr().Get(); | ||
|
||
return systemName + " - " + systemEdition; | ||
} | ||
} | ||
|
||
std::map<std::string, std::string> HostToSpeckleConverter::GetElementClassifications(const std::string& elemId) | ||
{ | ||
std::map<std::string, std::string> classifications; | ||
|
||
auto apiGuid = APIGuidFromString(elemId.c_str()); | ||
|
||
GS::Array<GS::Pair<API_Guid, API_Guid>> classificationItems; | ||
ACAPI_Element_GetClassificationItems(apiGuid, classificationItems); | ||
|
||
for (const auto& item : classificationItems) | ||
{ | ||
auto classificationSystemName = GetClassifictaionSystemName(item.first); | ||
auto classificationName = GetClassifictaionName(item.second); | ||
classifications[classificationSystemName] = classificationName; | ||
} | ||
|
||
return classifications; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.