About Macros

This section provides background information about macros.

If you perform a task repeatedly, you can take advantage of a macro to automate it. A macro is a series of functions, written in a scripting language, that you group in a single command to perform the requested task automatically.

You can create a macro by editing a file to insert the functions you wish. You can also edit an existing macro to best fit your needs.

This page discusses:

Definitions

The following definitions are provided to help you better understand the terminology related to macros.

Macro
Program written in a simple script language to allow customization and automation of repetitive user tasks. Macros are stored in the database as objects.
Macro library
Container for macro programs, stored in the database as a representation. From an external standpoint, macro library, macro container and macro project are synonyms which stand for the same concept.
VSTA add-in
Term used by Microsoft, corresponding to the Dassault Systèmes notion of VSTA macro. A macro, as such, adds functionality in the host application (in CATIA, for example).
IDE
Integrated development environment, also known as DTE: design-time environment.

Script Development Tools and Languages

This section describes script development tools and languages.

You can use the following scripting tools and languages:

CATScript
These macros are written in Basic Script, stored in directories, and can be run on both Windows and Linux.
Visual Basic Script (VBScript)
At minimum level 5.0 which is part of the operating system. Although CATScript macros written in previous releases continue to work, we recommend that you prefer VB Script to CATScript.
Visual Basic for Applications (VBA) Version 7
Programming language developer by Microsoft. This product is installed with the software. Macros written using VBA can only be run on Windows. Among the advantages of using VBA are:
  • VBA's IntelliSense features can display a list of the available properties, methods and constants to facilitate editing.
  • VBA contains a debugger.
  • You can use VBA for graphic user interface development, which is not possible using CATScript or VBScript macros.
Note: VBA must have a CATMain method in order to be launched outside the editor.
Microsoft VSTA
Visual Studio Tools for Applications. Scripting technology based on the .NET framework and the Visual Studio IDE. VSTA adds support for C Sharp (C#).
VSTA is available side-by-side with VBA v7 and VBScript. This means you can still edit and run VBA and VBScript macros, while also creating new VSTA macro libraries and edit or run VSTA macros in the same fashion.

Macro Storage

Macros are stored in a macro library or in a document.

Macros are stored as objects:

  • In a macro library: the macro will be stored in a directory (or a VBA project if it exists).
  • In a document: the macro will be stored in the current document.

What macro types you can store and where you can store them are summarized in the following table:

Macro TypesWhere Stored
Language UsedEditorFile extensionIn DocumentIn DirectoryIn VBA Project
C#Visual Studio
CATScriptInternal editor.CATScript YesYesNo
MS VBAVisual Basic Editor.catvbaNoNoYes
MS VB Script Internal editor.catvbs YesYesNo
VB.NetVisual Studio

Limitations

This section describes limitations.

Limitation 1: Editability Mode Switch

Because the PLM entity for storing macros is a macro library, you can switch only macro libraries, but not single macros, to edition mode or to read-only mode. For example, it is not possible to have a macro in read-only mode inside a macro library in edition mode.

Limitation 2: Macro Modifications

Concurrent modifications of a macro library in the database are not supported.

Limitation 3: Synchronous and In-process Macro Support

Only synchronous macros are supported. If you find a defect, please retry inside a synchronous a macro.

Only in-process macros are supported. If you find a defect when calling a COM exposed API from a third-party app, for example Excel, reproduce the defect inside a macro running in a 3DEXPERIENCE platform app.

Limitation 4: PLM Integration

The PLM integration aspect is achieved by persisting projects in the database.

This may have a performance impact if the network suffers latency, or a collaborative impact if other users are trying to manipulate the same project at the same time.