Listing the names of axes in a part

Top  Previous  Next

Here's an example of how to do it:

 

 

    for (int i = 1 ; i <= pPartCompDef->WorkAxes->Count ; i++) {

        CComPtr<WorkAxis> pWorkAxis  ;

        HRESULT hRes = pPartCompDef->WorkAxes->get_Item (CComVariant(i),&pWorkAxis) ;

        if (FAILED(hRes)) {

            gLogger.Printf (ekLogMsg,L"Could not get axis number %d\n",i);

        } else {

            gLogger.Printf (ekLogMsg,L"Got axis %d, name = <%s> ",i,LPCWSTR(pWorkAxis->Name)) ;

        }

    }

 

 

Note the LPCWSTR cast.

 

 

Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)