Reference: String
Model ElementReference_String defines a user defined text string in MotionSolve. The string may be of any length. It must contain only printable ASCII characters.
Description
Reference_String is primarily used within user defined subroutines. They are commonly used to pass filenames, messages, block names and DLL names to user defined subroutines.
Within a user defined subroutine, the MotionSolve utility subroutine GTSTRG is used to access the Reference_String. The ID of the Reference_String itself may be passed as a parameter to the user defined subroutine.
Format
<Reference_String
id = "ID Number"
label = "Name of the string"
{
string = "The string itself" >
|
usrsub_dll_name = valid_path_name
usrsub_param_string = "USER([[par_1[,...][,par_n]])
"
usrsub_fnc_name = "custom_fnc_name" >
|
script_name = valid_path_name
interpreter = "PYTHON" | "MATLAB"
usrsub_param_string = "USER([[par_1[,...][,par_n]])
usrsub_fnc_name = "custom_fnc_name" >
}
/>
Attributes
- id
- Element identification number (integer>0). This number is unique among all Reference_String elements.
- label
- The name of the Reference_String element.
- string
- Specifies the character string to be stored.
- usrsub_dll_name
- Specifies the path and name of the DLL or shared library containing a user subroutine. MotionSolve uses this information to load the user subroutine in the DLL at run time.
- usrsub_param_string
- The list of parameters that are passed from the data file to the user defined subroutine, String_Read. This attribute is common to all types of user subroutines and scripts.
- usrsub_fnc_name
- Specifies an alternative name for the user subroutine String_Read.
- script_name
- Specifies the path and name of the user written script that contains the routine specified by usrsub_fnc_name.
- interpreter
- Specifies the interpreted language that the user script is written in. Valid choices are MATLAB or PYTHON.
Example
The example below demonstrates how a Reference_String can be used to define a filename that can be passed to a VARSUB. Notice how the ID of the Reference_String is passed as a parameter to the user defined VARSUB. This generalizes the implementation of the VARSUB.
<Reference_String
id = "1101"
label = "Name of string"
string = "/staff/gates/test/tire_data.xml" >
/>
Comments
Reference_Strings may be used in any user defined subroutine.