Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

SM3_Basic.IAxisRef.GetAxisRefPointer not working?

void
2021-12-28
2021-12-28
  • void - 2021-12-28

    Hi, running "CODESYS V3.5 SP16" here, does anyone have the same problem with the method in the title?

    PROGRAM PLC_PRG
    VAR
        itfAxisRef : SM3_Basic.IAxisRef;
        pAxisRefSm3 : POINTER TO SM3_Basic.AXIS_REF_SM3;
    END_VAR
    
    pAxisRefSm3 := itfAxisRef.GetAxisRefPointer;
    

    Trying to compile the above throws the following error

    C0032:  Cannot convert type 'GETAXISREFPOINTER(sm3_basic, 4.10.0.0 (3s - smart software solutions gmbh))' to type 'POINTER TO SM3_Basic.AXIS_REF_SM3'
    

    which has me really confused because I've never seen the type GETAXISREFPOINTER before and the documentation for .GetAxisRefPointer states that it returns POINTER TO AXIS_REF_SM3

    https://help.codesys.com/webapp/3dvrBKsuKjYfmeP1KzrJnylfstc%2FGetAxisRefPointer;product=SM3_Basic;version=4.9.0.0

    As for why I'm trying to use this method, I'm trying to loop through the array of axes in SM3_Robotics.AXIS_GROUP_REF_SM3 and pass them to SM3_Basic.MC_ReadStatus in order to get their individual SM3_Basic.SMC_AXIS_STATE (not only the SM3_Robotics.SMC_AXIS_GROUP_STATE) for debugging

    Is there a better way to achieve the above without using the axes array?

     

    Last edit: void 2021-12-28
  • dwpessoa - 2021-12-28

    Hi void,
    GetAxisRefPointer is a method, try add "()" in the end:

    pAxisRefSm3 := itfAxisRef.GetAxisRefPointer();
    
     
    πŸ‘
    1

Log in to post a comment.