TC‑Python Miscellaneous Examples
See CSV Files for the location.

Run this script when troubleshooting TC-Python:
File name: diagnostics.py
Run this script EXACTLY the same way as you run your TC-Python script. i.e. In the same IDE, same project, same Python environment, same Jupyter notebook etc.

This example shows how to read a time-temperature profile from a CSV file and running a precipitation calculation with it. The easiest CSV file is simply a comma-separated text-file as shown in the present example.
File name: pyex_M_01_Input_from_file.py

This example shows how to create a property (step) diagram using TC-Python.
The alloy system Fe-Ni is used as an example.
The result is then saved in different file formats:
- JSON
- XML
- CSV
- TXT
- HDF5
File name: pyex_M_02_Output_to_file.py

This example shows how you create a single equilibrium calculation from a ternary system, loop it\n", while changing Al and Cr concentration, then calculate the density and plot the result as a 3D surface.
File name: pyex_M_03_jupyter_lab_best_practices.ipynb

The TC-Python license is a separate license from the Thermo-Calc software license. You need to activate the TC‑Python license once on your computer after, or in addition to, activating the Thermo-Calc license.
It is recommended to run the included example to perform the activation and deactivation. By default an online activation is performed, but you can choose other methods, which are both included in the example and described in the API documentation.
- Open and run the example
pyex_M_04_license.py
, which is located in the Miscellaneous folder. - The license activation is completed with the methods in the class
tc_python.license.LicenseManager
. - Depending on the type of license other methods are available, for example for online and offline activation plus the use of proxy settings are described.
Once the license is activated, either by using online or offline activation methods, you can view the license status and information in Thermo-Calc. Select Help → Show License Info from the menu.
To use the license on a different computer, the license must first be deactivated on the original computer. This is for both online and offline activations.
This example shows a variety of ways to manage licenses that are activated or deactivated with user credentials. Described are the online and offline methods plus the use of proxy settings.
The general details cover these topics.
- Printing information about the currently activated license.
- For any activation type, i.e. online, offline, or proxy settings.
- Online license activation for computers with Internet access using user credentials.
- This requires a valid username and password that is provided by email and originates from a Thermo-Calc representative.
- Offline license activations for computers without Internet access. Learn how to:
- Create an offline activation file in the supplied directory.
- Activate an offline license using the offline activation file. See
create_offline_activation_file()
in the API documentation.
- Proxy settings. Learn how to use proxy settings for the LicenseManager.
- This function shows the
proxy_settings_set
method to configure proxy settings when working with the license.
- This function shows the
- Update the current license to its latest state. This is only available for online activations.
- This task is used to refresh the license information and ensure it is up-to-date.
- Deactivate an active license.
- Typically done when a license is no longer needed on a specific computer or you want to activate it on a different computer.
- For offline licenses it creates an offline deactivation file, which is then used to deactivate the license on a computer that does not have Internet access.