Search code examples
codesysstructured-text

SM3_Basic.IAxisRef.GetAxisRefPointer not working as expected


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?


Solution

  • GetAxisRefPointer is a Method, try:

    pAxisRefSm3 := itfAxisRef.GetAxisRefPointer();