Application Programming Interface (API)

The Autodesk® CFD Application Programming Interface (API) provides ways to work with Autodesk® CFD functionality that are not readily available in the user interface.

The API is a platform for customization, and can significantly benefit your design process. It is very flexible, and can be used for a wide variety of tasks. Here are a few examples of potential applications:

While the scope of API applications is very wide, it is not as well suited for automating graphically-interactive actions (such as dragging a results plane).

The API is based on the Python scripting language. Python has been widely accepted, and is both easy to use and flexible. Python has built-in connections with other technologies, including Microsoft® Office tools such as Excel, that make it an ideal "glue language." Autodesk® CFD is distributed with Python version 2.7.

Two script editors are available for creating, editing, and running scripts. Use the editor in the UI for interacting with an open design study. Use the stand-alone utility for running existing scripts, mainly for running scripts as a batch process.

Click here for more details about the script editors.

Two Scripting Languages: Python scripting and QT Scripting

Python scripting and QT Scripting work in tandem for Autodesk® CFD . The choice of scripting language is based on the features you wish to automate.

Note that going forward, all new functionality will be developed using Python scripting as QT scripting is phased out.

Programming References

The API language reference is available for download by clicking here. After downloading and extracting the files, double click on index.html to view the reference.

For detailed information about how to use the API Programming Reference, click here.

The Examples Library in the API Programming Reference contains multiple example scripts. Use these as a reference and starting point for your own scripts.

The Python Programming Language Official Web site contains a good introduction to the Python programming language and syntax and several useful tutorials.

Customizing the User Interface with a Startup Script

The API can be used to add menu items or to customize the user interface. To automatically run a script every time Autodesk® CFD is started, perform the following steps:

  1. Create the script, and name it: "UserStartupScript.py"
  2. Save it to the account*\AppData\Local\Autodesk\Simulation CFD 2015 folder. (Note: *account is the name of the user account in which the startup script will run automatically.)

The example script called ribbon.py describes how to add a menu to the user interface.

MS Office Tools

Because Python has connects to MS Office tools, it is relatively easy to output data in standard formats for presentation or reuse in other software tools. The Autodesk® CFD API uses the COM protocol to make calls to the MS Office API.

For more information about using the API with Excel, search for "csv" on the Python Programming Language .Official Web site.