We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-12-13 06:21 AM - last edited on 2024-09-17 01:18 PM by Doreena Deng
I'm studying the previous code, but I can't put a constant in the index. What should I do?
for (UInt32 i = 2; i <= count; i++) //I starts from 2 because 1 is Archicad layer
{
BNZeroMemory(&attrib, sizeof(API_Attribute));
attrib.header.typeID = API_LayerID;
attrib.header.index = i;
err = ACAPI_Attribute_Get(&attrib);
API hide all layers - Graphisoft Community
Q2. Looking at this code, it seems strange.
Count and index are not the same thing, but it looks as if the index is set in count order.
I don't think you can do full Hidden with this code.
Is full Hidden possible?
Where can I study?
err = ACAPI_Attribute_GetNum(API_LayerID, count);
if (err) {
WriteReport_Err("ACAPI_Attribute_GetNum", err);
return;
}
ACAPI_WriteReport("name: = %d", true, count);
for (UInt32 i = 2; i <= count; i++) //I starts from 2 because 1 is Archicad layer
{
BNZeroMemory(&attrib, sizeof(API_Attribute));
attrib.header.typeID = API_LayerID;
attrib.header.index = i;
err = ACAPI_Attribute_Get(&attrib);
if (!err && attrib.layer.head.flags != APILay_Hidden)
{
attrib.layer.head.flags |= APILay_Hidden; // you should add ‘|’ because flags has another bit of information (APILay_Locked)
err = ACAPI_Attribute_Modify(&attrib, nullptr);
if (err != NoError) {
WriteReport_Err("Unable to modify the layer", err);
return;
}
}
}
Solved! Go to Solution.
2023-12-13 09:25 AM
What version of Archcade are you using? In version 27, the implementation of API_AttributeIndex has changed.
Try attrib.header.index = ACAPI_CreateAttributeIndex (i);
https://graphisoft.github.io/archicad-api-devkit/class_a_p_i___attribute_index.html
Structural engineer, developer of free addon for sync GDL param and properties
2023-12-13 09:25 AM
What version of Archcade are you using? In version 27, the implementation of API_AttributeIndex has changed.
Try attrib.header.index = ACAPI_CreateAttributeIndex (i);
https://graphisoft.github.io/archicad-api-devkit/class_a_p_i___attribute_index.html
Structural engineer, developer of free addon for sync GDL param and properties
2023-12-13 09:44 AM - edited 2023-12-13 09:45 AM
All layers are not turned off like in q2.
What do I need to study to learn the code to turn off an entire layer?
thank you ^^