We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-12-20 01:28 AM - last edited on 2024-09-16 02:40 PM by Doreena Deng
Hello fellow ArchiCAD developers,
I'm currently developing an add-on for ArchiCAD and have encountered an issue that I'm struggling to resolve. The add-on's purpose is to process building elements, specifically to report the properties of walls, including any embedded doors. However, I'm facing a problem where the add-on is incorrectly reporting multiple embedded doors for a single wall, even when there's only one door embedded.
Here's a brief overview of what the add-on does:
Issue:
// Handling Wall elements
if (elemType == API_WallID) {
API_ElementMemo memo;
BNZeroMemory(&memo, sizeof(API_ElementMemo));
if (ACAPI_Element_GetMemo(elementGuid, &memo) == NoError) {
std::string doorsStr;
if (memo.wallDoors != nullptr) {
for (int i = 0; memo.wallDoors[i] != APINULLGuid; ++i) {
if (!doorsStr.empty()) doorsStr += ", ";
doorsStr += APIGuidToString(memo.wallDoors[i]).ToCStr().Get();
}
}
if (!doorsStr.empty()) {
sprintf(reportStr + strlen(reportStr), " Embedded Doors: [%s]", doorsStr.c_str());
}
}
ACAPI_DisposeElemMemoHdls(&memo);
}
Any advice, insights, or suggestions on how to properly extract and report only the actual embedded doors for each wall would be greatly appreciated.
This is how my output looks like.
Best regards,
Solved! Go to Solution.
2023-12-20 06:44 AM
Use this code to get the correct number of guids in a memo array:
GSSize doorCount = BMGetPtrSize (reinterpret_cast<GSPtr> (memo->wallDoors)) / sizeof (API_Guid);
for (GSSize i = 0; i < doorCount; i++) {
const API_Guid& doorGuid = memo->wallDoors[i];
// do something with the door
}
2023-12-20 06:44 AM
Use this code to get the correct number of guids in a memo array:
GSSize doorCount = BMGetPtrSize (reinterpret_cast<GSPtr> (memo->wallDoors)) / sizeof (API_Guid);
for (GSSize i = 0; i < doorCount; i++) {
const API_Guid& doorGuid = memo->wallDoors[i];
// do something with the door
}
2023-12-20 11:47 PM
@Viktor Kovacs Thank you very much for the feedback. That was very helpful.