BIM Coordinator Program (INT) April 22, 2024

Find the next step in your career as a Graphisoft Certified BIM Coordinator!

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

attrib.header.index = i; is error.

LeeJaeYoung
Virtuoso

I'm studying the previous code, but I can't put a constant in the index. What should I do?

 

LeeJaeYoung_0-1702444725165.png

 

 

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);

 

 

LeeJaeYoung_2-1702444840055.png

 

 

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;
}
}
}

 

 
AC27 on window 11
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
kuvbur
Enthusiast

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

View solution in original post

2 REPLIES 2
Solution
kuvbur
Enthusiast

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

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 ^^

 

LeeJaeYoung_0-1702457096695.png

LeeJaeYoung_1-1702457109758.png

 

 

AC27 on window 11
Learn and get certified!