CATIA V5 automation was originally designed for VB6, VBA, and VBScript. Microsoft no longer officially supports VB6 as it has been replaced by VB.net, which is supported by CATIA V5 R16 and onwards. VB6 is more complex but more powerful than VBA, as is VBA over VBScript and CATScript. CATIA Macro languages supported by CATIA and discussed in this text are VBScript, CATScript, and VBA, all derivatives of Visual Basic used in scripting.visual basic

CATScript is Dassault Systèmes’ portable version of VBScript and is very similar to it. CATScript macros CAN run on UNIX systems. It is a sequential programming language and non-GUI oriented. Regular text editors (like Notepad) can be used for coding. Advantages of writing CATScript macros include free to use, macro recording, personal time saving operations, and rapid deployment. The disadvantages of CATScript are limited flexibility and difficult to debug.The file extension is .CATScript.

VBScript is a subset of the Visual Basic Programming language (VBA). All elements of VBScript are present in VBA, but some VBA elements are not implemented in VBScript. The result of the slimming down process is a very small language that is easy to use. VBScript (officially, “Microsoft Visual Basic Scripting Edition”) was originally designed to run in Web applications such as Internet Explorer. One of the advantages of VBScript (in common with other scripting languages) is that it’s written in plain, ordinary ASCII text. That means that your ‘development environment’ can be something as simple as Notepad.CATIA objects can be called but no type is used as the system tries to dynamically call methods and properties of objects.It can be used on both Windows and UNIX versions of CATIA. The disadvantage of VBScript is it’s slow, is limited for interface development, and has the least functionality.The file extension is .catvbs.

Visual Basic (VB or VB6) is the full and complete version. Derived from BASIC, VB6 programs can generate independent programs, can create ActiveX and servers, and can be compiled. VB programs run in their own memory space.

VBA (Visual Basic for Applications) is another subset of Visual Basic and is hosted in applications such as CATIA (after V5R8), Microsoft Word, Excel, etc. VBA provides a complete programming environment with an editor, debugger, and help object viewer. Declaring the object library used is allowed.In CATIA, VBA has the full VB6 syntax and IDE, which is similar to VBA in Excel. It is event driven; GUI oriented, and has full IDE yet cannot run a program WITHOUT the host application running (meaning it runs as a DLL in the same memory space as the host application). The advantages of using CATvba macros include using the GUI, building forms, and the debugging ability of the macro editor. The disadvantage is VBA programs cannot be compiled into executables or DLLs and they do not run in their own memory space.The extension is .catvba.

Visual Basic.NET(VB.net) is Microsoft’s designated successor to VB6 and has been supported by Dassault Systèmes since V5R16.  VB.net is event driven, has IDE, and is used for building GUI but is not COM (though it can call COM objects). The syntax is different from VB6. Code can be compiled into .exe or .asp files. There are many issues encountered when switching from VB6 to VB.net, such as new syntax, new IDE, new GUI controls, and a new Install Shield, therefore fully automatic conversions are near impossible.Compiled languages like VB.net aren’t completely necessary because most automation can be done in VBA.VB.net will not be discussed in this text.

To further the development of your Visual Basic programming skills I recommend checking out Microsoft Visual Basic 2010 Step by Step by Michael Halvorson.

Go back to CATIA macro terms and definitions.

Continue to CATIA macro syntax.