Tcl Support

This topic describes the versions of Tcl used by ENOVIA Live Collaboration.

Related Topics
Overview
Configuring Windows Systems for Tcl

The Tcl 8.5.7 Library

The Tcl 8.5.7 library is installed and configured as the default version of Tcl with installation of the desktop applications.

To use Tcl on a Windows system, you must modify the system path environment variable.

The Tcl 8.0 and 8.3.3 Libraries

The Tcl/Tk 8.0 and 8.3.3 libraries are also included for cases where an implementation requires the older version. If you have used Tcl 8.0 (the default before version 10.x) and use locale specific tcl commands, such as those dealing with number formats, the default ENOVIA Live Collaboration setup will behave differently. For example, inthe tcl mode of MQL, if you enter the following on a machine set up with a European locale such as de_DE:

format "%f" 3,45

With tcl 8.0, the returned value is:

3,450000

But with tcl 8.3.3, the value is:

3,45

You may need to rewrite code that depends on the 8.0 format. Until you have the time to rewrite all applicable code, you can reconfigure ENOVIA Live Collaboration to use Tcl 8.0 as described below. The configuration is done via .ini files, so older version software will not run with new .ini files, unless updates are made.

The MX_TCL_SHLIB variable sets the path to the TCL library you want to use, and defaults to the 8.5.7 directory structure, so you'll need to add this setting in order to use the version 8.0 files. You must also reset the default TCL_LIBRARY and TK_LIBRARY settings to the paths of the initialization files. Make these changes in the .ini files for Windows, Studio Modeling Platform startup files for UNIX desktop, and mxEnv.sh for the ENOVIA Live Collaboration Server on UNIX.

Note: If implementations rely on TCL_LIBRARY or TK_LIBRARY settings to find files under that directory, you will need to move those files to the Tcl 8.5.7 directory structure. For example, the Solutions Library depends on these entries being set in the environment to find files under a sub-directory called mxTclDev.

Floating Point Calculations

The out-of-the-box Tcl 8.5.7 performs floating point calculations at a higher precision than the previously incorporated Tcl 8.3.3, which defaulted to precision=12. This can affect some floating point calculations using 'expr'. For example:

% expr 1.23 + 4.56
5.789999999999999

If this is a problem, the workaround is to add the following line to <installdir>/tcl85/lib/tcl8.5/init.tcl:

set tcl_precision 12

Adding this line gives you the same results as in Tcl 8.3.3:

% expr 1.23 + 4.56
5.79

Default Clock Command Output

When using Tcl 8.5.7 or Tcl 8.3.3, the millis subcommand should be used with the clock command. The clicks subcommand is unreliable and should not be used.

Incorrect Syntax in the Catch Command

Be aware that in Tcl versions before Tcl 8.5.7, Tcl was more lenient with the syntax used in the catch command. The correct syntax is catch BLOCK1 BLOCK2, where BLOCK1 and BLOCK2 are bracketed with curly braces { } and not square brackets [ ]. The [ ] brackets force evaluation prior to entering the catch command, which makes the command useless. Tcl 8.5.7 enforces the use of { }.