Coordinates of a WorkAxis

Top  Previous  Next

Once you have the proxy of a work axis you can get details (in centimeters cm) like this


    CComPtr<WorkAxisProxy> pWAProxy  ;

    pTuboOcc->CreateGeometryProxy (pWAxis,(IDispatch**)&pWAProxy) ;


    // Get the geometry of the axis..

    LinePtr pLine = pWAProxy->GetLine() ;

    UnitVectorPtr pDir = pLine->Direction ;


    // You can get hold of the double values like this...

    TRACE ("direction %.3f, %.3f, %.3f,\n",pDir->GetX(),pDir->GetY(),pDir->GetZ())


Here is another example when you have a collection of workaxes...


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

        CComPtr<WorkAxisProxy> pWAProxy;

        pWAProxyCollection->get_Item(i,(IDispatch**)&pWAProxy) ;


        LinePtr pLine = pWAProxy->GetLine() ;

        UnitVectorPtr pProxyDir = pLine->Direction ;

        PointPtr pProxyOrigin = pLine->RootPoint ;


        gLogger.Printf (ekLogMsg,"%2d origin = %.1fcm %.1fcm %.1fcm direction %.3f, %.3f, %.3f,\n",



                           pProxyDir->GetX(),pProxyDir->GetY(),pProxyDir->GetZ()) ;



See also this.

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