Procedures for Tool Members
Tool members are important to save data that needs to be stored with every execution. They are set individually for each tool and are identified by their name. Therefore, it is important to follow the naming convention and make sure the name contains no typos.
The following interface procedures can be used to get a specific tool member or to set a specific tool members to a predefined content.
Procedures
This procedure can be used to get the tool member (object) that is registered under the name given for the parameter "Name" and initializes the output parameter "Object" with the returned value.
Me_get_tool_member_object ( : Object : ToolHandle, Name : )
Parameters
The procedure contains the following input parameters:
|
Input parameter |
Description |
|---|---|
|
ToolHandle |
The ID of the tool. |
|
Name |
The name of the tool member object to be queried. |
The procedure contains the following output parameter:
|
Output parameter |
Description |
|---|---|
|
Object |
The tool member object. |
This procedure can be used to get the tool member (tuple) that is registered under the name given for the parameter "Name".
Me_get_tool_member_tuple ( : : ToolHandle, Name : Tuple)
Parameters
The procedure contains the following input parameters:
|
Input parameter |
Description |
|---|---|
|
ToolHandle |
The ID of the tool. |
|
Name |
The name of the tool member tuple to be queried. |
The procedure contains the following output parameter:
|
Output parameter |
Description |
|---|---|
|
Object |
The tool member tuple. |
This procedure can be used to register the content of a tool member (object) with the entry given in the parameter "Name".
Me_set_tool_member_object ( InstanceObject : : ToolHandle, Name : )
Parameters
The procedure contains the following input parameters:
|
Input parameter |
Description |
|---|---|
|
InstanceObject |
The tool member object to be set. |
|
ToolHandle |
The ID of the tool. |
|
Name |
The name of the tool member object to be set. |
This procedure can be used to register the content of a tool member (tuple) with the entry given in the parameter "Name".
Me_set_tool_member_tuple ( : : ToolHandle, Name, InstanceTuple: )
Parameters
The procedure contains the following input parameters:
|
Input parameter |
Description |
|---|---|
|
ToolHandle |
The ID of the tool. |
|
Name |
The name of the tool member tuple to be set. |
|
InstanceObject |
The tool member tuple to be set. |
Example
The following code block shows an example how you can use a tool member to store values of multiple execution cycles.
Me_get_tool_member_tuple (ToolHandle, 'History_HistoryData', History_HistoryData)
History_HistoryData := [History_HistoryData, NewData]
Length := |History_HistoryData|
if (Length > MaxBufferSize)
History_HistoryData := History_HistoryData [Length-MaxBufferSize:Length-1]
endif
Me_set_tool_member_tuple (ToolHandle, 'History_HistoryData', History_HistoryData)
This code block is executed each time the execute procedure of the custom tool is executed. First, the current tuple in the parameter "History_HistoryData" is queried with Me_get_tool_member_tuple. Then, a new value is added to the tuple. In the next step, the length of the tuple is checked and limited to the maximum buffer size. In the last step, the tuple with the new value is then saved again with Me_set_tool_member_tuple.