14 Apr, 2019

Automation APIs For CATIA

CATIA exposes some of its engine’s functionality to 3rd party developers via APIs– Application Programming Interfaces. It does that by providing what is known as:
– Packages for EKL, KML, and CATRules.
– DLLs (dynamically loaded libraries) for VBA, VSTA(C-Sharp), and CATScript.
– Header files for C++, along with additionals DLLs.

xGenerative Design

xGenerative Design (XGD) is a visual programming app for building functional graphs (akin to functional programming). Here, the API is present in the form of nodes that take inputs and produce outputs. XGD provides a text-scripting nodes that permits writing EKL code. That said, while the syntax is similar, the API’s are slightly different.


The Enterprise Knowledge Language is part of CATIA’s Knowledge-ware. Running EKL code requires no license. Users can make use of Knowledge-ware object and rule-based templates regardless of the roles they are licensed to use. However, authoring EKL code and rule-based templates requires a KDI or a KPO license. EKL code is resolved by CATIA’s propagation graph, making it synchronous with the engines update cycle. For more on EKL, check out these posts that provide an introduction to EKL, and an explanation of what differentiates it from other languages.

EKL runs within the context of the active Virtual Product Model in the current Editor– the currently active tab in CATIA session. For some background on EKL, take a look at this post where I interviewed Thomas Videqoc. EKL is also used as the programming language for building KAC apps. KAC is a license that permits building richer UIs than those currently available to EKL (namely Bubble-Notification, Message Boxes, and Yes/No Questions). This post provides more information on KAC.


The Knowledge Modeling Language is rooted in the field of Knowledge Based Engineering, an area pioneered by ICAD. Put simply, KML is an object oriented version of EKL: Classes are Concepts, and methods/functions are behaviors. Concepts have input and output attributes; facilitating a functional style of programming/system engineering. The power of KML is found in the engine that triggers concepts as needed based on the context. I’ll provide a more detailed post on KML in the very near future.

VBA, VBScript, VSTA (C-Sharp)

Users can write macros using VBA (Visual Basic for Applications), and VSTA (Visual Studio for Application with C-Sharp). Developing macros does not require additional licenses. Macros live within a CATIA session. Hence, one can have multiple CATIA sessions each with its own VBA or VSTA macros, which is similar to EKL. However, VBA and VSTA macros differ in that they are not synchronized with CATIA’s update cycle. This requires that macro developers limit the scope of their code to avoid asynchronous code executions. A simple solution is to have users trigger multiple macros sequentially. One of the VBA and VSTA macro advantages is the ability to create User Interfaces using Windows Forms(VBA and C-Shape) or Windows Presentation Foundation (C-Shape only). Things like drop down menus, check boxes, text areas can help provide a rich user interaction experience that is not available in the regular KDI and KPO licenses of EKL. VBA and VSTA macros are stored on CATIA’s server/cloud as documents. Thus, it is not possible to use version control tools to manage them. VBScripts are less sophisticated than VBA: they don’t support user selection APIs, and are stored as features inside Representations. It is possible to develop Windows C-Sharp applications that run independently from CATIA; and store them on disk. Thus, they can be version-controlled by tools such as Git.That said, such applications can only target one CATIA session. This session is the first on the list of running CATIA sessions.

The API’s provided for VBA and VSTA are accessed by referencing the DLLs that come with the CATIA instillation on disk. These APIs give more granular control and cover a larger area in comparison to EKL. However, they lack the its simplicity and safety.


Component Application Architecture is a license that enables 3rd party developers to write C++ CATIA apps that run aside those provided by Dassault within CATIA. This is akin to plugin development in other applications. The CAA license gives developers with C++ header files which come with more powerful API’s than those made available to VBA and VSTA. However, developing C++ applications requires a greater deal of debugging and testing when compared to VBA and C-Sharp.


CATScripts are used in some areas in CATIA to manage settings and offer tool customizations within predefined CATIA frameworks. It is a less sophisticated version of VBScript and uses the same VBA/C# APIs. Examples that make use of CATScript is the Drawing Layout tool to generate frame and title blocks.


These rules are used to manage some business logic of CATIA assemblies in addition to other components such as the BI essentials tool customization. CATRules are written in EKL syntax and stored with the *.CATRule extension on disk.


About : Maher Elkhaldi

Maher Elkhaldi is a senior applications engineer at Tesla Motors. He founded the 3DXAutomation blog to help make knowledge of programming CATIA easier to find, and contribute to the open-source community.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.