cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Archicad C++ API
About Archicad add-on development using the C++ API.

Unable to Retrieve Stair Tread Depth via API_Element (Value Always 1)

Jin T
Participant

I would like to retrieve the stair tread depth using the Archicad API. I tried accessing stair.treadDepth from API_Element, but the returned value is always 1.

 

May I ask what might be causing this issue? Or is the tread depth not supposed to be obtained from this field?

 

Below are a test screenshot and the source code used for retrieving the stair tread depth.

 API_Neig neig;
 API_ElemType elemtype = API_StairID;
 if (ClickAnElem("click a stair", API_StairID, &neig)) {
 API_Element elem;
 elem.header.guid = neig.guid;
 GSErrCode err = ACAPI_Element_Get(&elem);
 if (err == NoError) {
 GS::UniString msg = "treadDepth = ";
 msg += GS::ValueToUniString(elem.stair.treadDepth);
 ACAPI_WriteReport(msg, true);
 };
 }

 

JinT_1-1767751200716.png

 

JinT_0-1767751059924.png

2 REPLIES 2

Hi Jin,

 

I've tried your code and get the same result: For stairs with fixed goings, the treadDepth is always "1.0".

Maybe the actual tread depth needs to be calculated from other values or retrieved from every single tread via the element memo.
I've tried changing the 'treadDepth' to '2.0' and use 'ACAPI_Element_Change', but nothing happens (also no error).

 

Best regards,
Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

Thank you for your reply, Bernd.

Retrieving from element memo seems to be a good way to try. Thank you for your advise!