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

how do i get grid name and position in model?

Yeojin Hwang
Participant

Hi. 

I want to get Grid Name and Position Information. 

i use ACAPI_LibraryPart_GetActParameters, but it show only "AC_MarkerText_1"'s default value.  (Example X1)

I would appreciate any help you can give me.          

 

I use Archicad 27 API

 

            API_GetParamsType getParams;
            BNZeroMemory(&getParams, sizeof(API_GetParamsType));
            err = ACAPI_LibraryPart_GetActParameters(&getParams);
            if (err == NoError) {
                for (Int32 i = 0; i < BMGetHandleSize((GSHandle)getParams.params) / sizeof(API_AddParType); ++i) {
                    const API_AddParType& param = (*getParams.params)[i];
                    if (strcmp(param.name, "AC_MarkerText_1") == 0) {
                        //info.markerText = reinterpret_cast<const char*>(param.value.uStr);
                        info.markerText = GS::UniString(param.value.uStr).ToCStr().Get();
                        DBPrintf("Marker Text: %s\n", info.markerText.c_str());
                        break;
                    }
                }
            }

 

 

YeojinHwang_1-1736828231415.png

 

1 REPLY 1
LChen
Graphisoft
Graphisoft

Hi, I'd suggest you to use ACAPI_Element_GetMemo() to get "AC_MarkerText_1" and "AC_Length" values from memo.params in this case.

I think the position information would be element.object.pos and the end node of

x = element.object.pos.x + (value of "AC_Length") * cos(element.object.angle)
y = element.object.pos.y + (value of "AC_Length") * sin(element.object.angle)
HTH.