We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

Stair Creation in ArchiCAD 25 / CPP code

roni
Booster

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

 

 

 

 

 

 

Stair rendering.png

0 REPLIES 0

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!