We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2023-11-16 11:22 AM - last edited on 2024-09-16 02:38 PM by Doreena Deng
Hi All,
I was trying to create a dog-legged stair with a mid-land after 10 steps in archiCad using CPP code.
I was able to render the stair, but in the mid-land section a step was rendered. I have attached the screenshot of what I expected (right image) and what got rendered (left image).
Like in ArchiCAD UI, Can we specify the stair flight and mid-landing positions in CPP api's?
Below code was used
NB: ArchiCAD Version 25
API_GetPolyType polyInfo = {};
polyInfo.nCoords = 4;
polyInfo.nArcs = 0;
polyInfo.coords = (API_Coord**)BMhAllClear((polyInfo.nCoords + 1) * sizeof(API_Coord));
(*polyInfo.coords)[1] = { convertFeetToM(0), convertFeetToM(0) };
(*polyInfo.coords)[2] = { convertFeetToM(0), convertFeetToM(-12.3194) };
(*polyInfo.coords)[3] = { convertFeetToM(-3.0020), convertFeetToM(-12.3194)};
(*polyInfo.coords)[4] = { convertFeetToM(-3.0020), convertFeetToM(0) };
API_Element element;
API_ElementMemo memo;
BNClear (element);
BNClear (memo);
element.header.typeID = API_StairID;
err = ACAPI_Element_GetDefaults (&element, &memo);
// element.stair.inputDirection = APISD_Upward;
if (err != NoError) {
ACAPI_WriteReport ("ACAPI_Element_GetDefaults (Stair) has failed with error code %ld!", true, err);
ACAPI_DisposeElemMemoHdls (&memo);
return err;
}
element.stair.totalHeight = convertFeetToM(height);
element.stair.flightWidth = convertFeetToM(width);
element.stair.riserHeight = convertFeetToM(riserHeight);
element.stair.stepNum = steps;
element.stair.baselinePosition = APILP_Center;
memo.stairBaseLine.coords = polyInfo.coords;
memo.stairBaseLine.parcs = polyInfo.parcs;
memo.stairBaseLine.polygon.nCoords = polyInfo.nCoords;
memo.stairBaseLine.polygon.nArcs = polyInfo.nArcs;
err = ACAPI_Element_Create (&element, &memo);