Getting Parameters

Actions and Conditions with Two or Fewer Parameters

For these, it's best to use the two parameters of the function: long param1 and long param2.
- Getting a Number: Just use the parameters as they are.
- Getting a Float: Use float Value = CNC_GetFloatValue(rdPtr, number) where number is either 0 or 1 depending on which parameter the float is and then use this conversion: float Num = *(float *)&Value;
- Getting a String: You need to type-cast the parameter to a LPSTR. Ex: char * String = (LPSTR)param1;

Actions and Conditions with Three or More Parameters

For these, you need to type-cast the return of CNC_GetParameter(rdPtr) function (PARAM_EXPRESSION does not use this function):
- Getting a Number: Use this function instead: long Value = CNC_GetIntParameter(rdPtr);
- Getting a Float: Use this function instead: long Value = CNC_GetFloatParameter(rdPtr) and then use this conversion: float Num = *(float *)&Value;
- Getting a String: You need to type-cast the return of the CNC_GetParameter(rdPtr) function to a LPSTR. Ex: char * String = (LPSTR)CNC_GetParameter(rdPtr);

Expressions

For these, you need to use the CNC_GetFirstExpressionParameter(rdPtr, param1, Type) or CNC_GetNextExpressionParameter(rdPtr, param1, Type).
- Getting an Integer: Just call the function normally. Ex: long Value = CNC_GetNextExpressionParameter(rdPtr, param1, TYPE_INT);
- Getting a Float: Just call the function normally and then use the conversion as exemplified. Ex: long Temp = CNC_GetNextExpressionParameter(rdPtr, param1, TYPE_FLOAT); float Value = *(float *)&Temp;
- Getting a String: You need to type-cast the return of the function. Ex: char * String = (LPSTR)CNC_GetNextExpressionParameter(rdPtr, param1, TYPE_STRING);

Back to Main Page