Begin your Archicad journey with our free learning path - perfect for newcomers and experienced users looking to strenghten their skills.
4 weeks ago
Hi Everyone!
I'm experimenting with the ACAPI_Attribute_GetAttributesFromProject function. And I'm getting strange results, I want to ask you what am I doing wrong?
Here's the code I'm trying to run:
GSErrCode err = NoError;
for (GS::USize i = 0; i < fileLocs.GetSize(); i++)
{
for (GS::USize j = 0; j < attrTypes.GetSize(); j++)
{
GS::Array<GS::Pair<API_Attribute, API_AttributeDefExt>> resultArray;
err = ACAPI_Attribute_GetAttributesFromProject(fileLocs[i], attrTypes[j], &resultArray);
if (err == NoError)
{
ACAPI_WriteReport("Found " + GS::ValueToUniString(resultArray.GetSize()) + " " + AttrTypeToString(attrTypes[j]) + " attrubites in external file", true);
}
else
{
ACAPI_WriteReport("Error: " + GS::ValueToUniString(err), true);
}
}
}
I'm building it with the API Development Kit 26.3000. The function returns with err == NoError.
My first attempt was to see if the function works to check the size of resultArray, which I assume should be equal to the number of attributes belonging to each type.
My problem is that resultArray reports size = 0 with some attribute types (Pen, Layer, Material, Font, DimStandards, ModelViewOptions, MEPSystem, BuildingMaterial) although there are many attributes of each type in the file.
With the other attribute types the size of resultArray is as expected.
What am I doing wrong? Does this function not work with all attribute types?
Any help is appreciated!
3 weeks ago
Checked with Dev Kit 28 too.
Very similar result.
The resultArray reports size = 0 with attributes: Layer, Material, MEPSystem and BuildingMaterial attribute types.