HWC and Tcl

HWC Wrapper

You can use HWC commands in the Tcl Console. The hwc wrapper is on the same root level as the hwi parent handle. The wrapper allows you to execute the HWC commands inside of Tcl by using hwc as a prefix for this command:
hwc <HWC Command>
The HWC command to hide all components which contain the string “door” in their label:
hide component *door*
can be executed in Tcl as follows:
hwc hide component *door*
Multiple commands can also be executed in one line:
hwc hide all | show component *door*
The advantage is that no handle needs to be created; the wrapper class always exists. The command can also be used as-is, no change required.
Important: Recorded commands which contain name=value pairs are recorded with a blank space between the equal sign, “=” and the value when these variables are of a type which can contain backslashes. If multiple entities are selected typing a comma “,” HWC inserts spaces between these entities and the “’,” This blank space is required for the Tcl parser to work.
Important: Please do not remove the blank spaces that HWC automatically inserts.
The blank space between text= and "Value is required for the command to work:
hwc annotation note "Note 4" display text= "Value \"Force\" = {entity.id}"

All HWC commands from the command history can be copied in the Tcl syntax to the clipboard using the Copy to Tcl option in the context menu of the HWC console:

Figure 1.

HWC Class Tcl API

In addition to the wrapper, the HWC class Tcl API runs HWC commands and executes HWC command files:
<sessionHandle> GetHWCHandle <hwc_handle>
<hwc_handle> LoadHWCFile <hwc_file>
<hwc_handle> EvalHWC <hwc_commands>

The <hwc_command> can consists of one or multiple commands separated by the pipe symbol, "|". If you copy multiple commands in the command line, the pipe symbol, "|", is automatically inserted.

For example:
hwc EvalHWC "section create planar Demo_Section"
hwc EvalHWC "section create planar Demo_Section | section Demo_Section grid=false"

Figure 2. Run HWC Commands from Tcl