From 536941bee49a962df8495f4f250548d3b6a04792 Mon Sep 17 00:00:00 2001 From: Ralph Wessel <150629054+r-wessel@users.noreply.github.com> Date: Wed, 24 Jul 2024 17:31:46 +0100 Subject: [PATCH] Fix: Corrects serialised data from Archicad (macOS) (#3587) GS::ObjectState::Add interprets C string as char array rather than string in Xcode - explicit string conversion is applied to prevent this --- .../AddOn/Sources/AddOn/Commands/GetDataCommand.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ConnectorArchicad/AddOn/Sources/AddOn/Commands/GetDataCommand.cpp b/ConnectorArchicad/AddOn/Sources/AddOn/Commands/GetDataCommand.cpp index ed6d040642..41242b887f 100644 --- a/ConnectorArchicad/AddOn/Sources/AddOn/Commands/GetDataCommand.cpp +++ b/ConnectorArchicad/AddOn/Sources/AddOn/Commands/GetDataCommand.cpp @@ -344,10 +344,10 @@ namespace { API_Attribute attribute{}; attribute.header.index = materialIndex; attribute.header.typeID = API_BuildingMaterialID; - auto error = ACAPI_Attribute_Get (&attribute); + auto error = ACAPI_Attribute_Get(&attribute); if (error != NoError) return error; - serialiser.Add(FieldNames::Material::Name, attribute.header.name); + serialiser.Add(FieldNames::Material::Name, GS::UniString{attribute.header.name}); return NoError; } //exportMaterial @@ -366,13 +366,13 @@ namespace { const auto& serialMaterialQuants = serialiser.AddList (FieldNames::ElementBase::MaterialQuantities); for (auto& quantity : materialQuants) { GS::ObjectState serialMaterialQuant, serialMaterial; - auto error = exportMaterial (quantity.materialIndex, serialMaterial); + auto error = exportMaterial(quantity.materialIndex, serialMaterial); if (error != NoError) return error; serialMaterialQuant.Add(FieldNames::ElementBase::Quantity::Material, serialMaterial); serialMaterialQuant.Add(FieldNames::ElementBase::Quantity::Volume, quantity.volume); serialMaterialQuant.Add(FieldNames::ElementBase::Quantity::Area, quantity.surfaceArea); - serialMaterialQuant.Add(FieldNames::ElementBase::Quantity::Units, "m"); + serialMaterialQuant.Add(FieldNames::ElementBase::Quantity::Units, GS::UniString{"m"}); serialMaterialQuants(serialMaterialQuant); } return NoError; @@ -733,7 +733,7 @@ GS::ObjectState GetDataCommand::Execute (const GS::ObjectState& parameters, err = SerializeElementType (element, memo, os); if (err != NoError) continue; - + listAdder (os); }