HyperView User's Guide

TclPlugin

TclPlugin

Previous topic Next topic No expanding text in this topic  

TclPlugin

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

TclPlugin - Plug-in support for the Tcl interpreter.

Inputs

ents: an entity table.

src: a value table.

begin: a procedure to be called on the begin event (optional).

onrecord: a procedure to be called on the onrecord event.

end: a procedure to be called on the end event (optional).

opt_str: specify to pass a user-defined argument string (optional).

script: the file that contains the event procedure definitions.

Outputs

answer: a value table.

Notes

The entities in ents must match the binding of the values in src.  For example, if src contains elemental scalars, ents must contain elements from the same pool.
The onrecord procedure is mandatory, begin and end procedures are optional.

Expression Builder

Requires *RegisterResultMathPlugin entry in preference file.  See the Configuration section.

Example

<call name="TclPlugin" ents="ent_tab" src="src_tab"

 begin="begin_proc" onrecord="record_proc"

 end="end_proc"

 script="tcl_script_filepath"

 answer="ans_tab " />

The query and action events that are added to the Tcl interpreter accept string arguments (case insensitive), and are as follows:

Query/Action Function

Description

GetTableInfo

GetTableInfo supports table queries and accepts a single argument:

label – returns the table label.
domain – returns the table domain (“real” or “complex”).

GetTableInfo can be called in the Begin and End events.

GetRecordInfo

GetRecordInfo supports record queries and accepts the following arguments:

id: returns the entity ID attached to the value record.
partid: returns the part ID attached to the element (returns 0 for values not bound to elements).
config: returns the element configuration number.
data: returns the values in the record as a space-separated number.
tensor: valid for tensor value records only and accepts a 2nd parameter to extract invariants:
op1 – major principal
op2 – mid principal
op3 – minor principal
ovon – vonMises
vector: valid for vector values records only and accepts a 2nd parameter to extract invariants:
omag – vector magnitude.

GetRecordInfo can be called in the OnRecord event only.

AddRecord

AddRecord sends values to the destination table and accepts a string with an ID, followed by a space-separated list of values.  For example, when adding a vector value, the call would appear as:

AddRecord “$ent_id $vec_val”

where:

ent_id is a variable that evaluates to the ID.

vec_val is a variable that evaluates to three vector components.

GetOption

GetOption(key)

Returns the string passed in the argument “opt_str” if specified, or the optional argument associated with key.

ThrowException

ThrowException sends a message to the controlling application and terminates execution of the plug-in operation.  The syntax is as follows:

ThrowException $err_string

When a scripted plugin is run from HyperView, the exception string is output in the tk console window.