Graphisoft®

API Development KitVersion: 18

ACAPI_Element_GetComponents

요소의 구성요소들을 리턴합니다.

    GSErrCode  ACAPI_Element_GetComponents (
        const API_Elem_Head*        elemHead,
        API_ComponentRefType***     compRefs,
        Int32*                      nComp
    );

 

파라미터

elemHead
[in] 얻고 싶은 구성요소들을 가진 요소입니다.
compRefs
[out] 구성요소들의 리스트입니다.
nComp
[out] 구성요소들의 개수입니다.

 

리턴 값

APIERR_BADPARS
compRefs가 NULL이거나 nComp가 NULL입니다.
APIERR_BADID
올바르지 않은 elemHead를 지정하였습니다.
APIERR_MEMFULL
구성요소들을 가져오기에는 메모리가 부족합니다.

다른 공통 API 오류들에 대해서는 API 오류 문서를 보십시오.

 

설명

이 함수는 하나의 요소의 모든 구성요소에 대한 정보를 가져오는 데 사용합니다. 이 구성요소들은 요소의 프로퍼티 객체들 안에 있습니다. 이것은 모든 건설 요소들에게 적용됩니다.

 

예제

void GetComponents (const API_Guid& guid)
{
    API_Elem_Head         elemHead;
    API_ComponentRefType  **compRefs;
    API_ListData          listdata;
    Int32                 nComp, i;
    char                  s[256];
    GSErrCode             err;

    BNZeroMemory (&elemHead, sizeof (API_Elem_Head));
    elemHead.guid = guid;

    err = ACAPI_Element_GetComponents (&elemHead, &compRefs, &nComp);
    if (err == NoError) {
        for (i = 0; i < nComp; i++) {
            if ((*compRefs)[i].status != APIDBRef_Deleted) {
                BNZeroMemory (&listdata, sizeof (API_ListData));
                listdata.header.typeID   = API_ComponentID;
                listdata.header.index    = (*compRefs)[i].index;
                listdata.header.setIndex = (*compRefs)[i].setIndex;
                switch ((*compRefs)[i].status) {
                    case APIDBRef_Normal:
                        err = ACAPI_ListData_Get (&listdata);
                        break;
                    case APIDBRef_Local:
                        err = ACAPI_ListData_GetLocal ((*compRefs)[i].libIndex, &listdata);
                        break;
                }
                if (err != NoError)
                    break;
                sprintf (s, "Keycode/code: \"%s\"/\"%s\" quantity: %.2f", listdata.component.keycode,
                    listdata.component.code, (*compRefs)[i].quantity);
                ACAPI_WriteReport (s, false);
            }
        }
        BMKillHandle ((GSHandle *) &compRefs);
    }
}

 

요구사항

버전: API 2.1 또는 이후
헤더: ACAPinc.h

참고사항

API_ElemTypeID, API_ComponentRefType,
요소 관리자, 리스팅 관리자, API 함수