Transitioning Macros from CATIA V5 to the 3DEXPERIENCE- Part 1: Framework

December 14, 2023 Iouri Apanovitch

Say you’ve got a bunch of sleek macros and scripts for CATIA V5, but now your company is switching to the 3DEXPERIENCE (or, for short, 3DX) platform, and you want to convert all your V5 macros to 3DX. How do you do that? Where do you begin?

In this series of blog posts, I will try to shed some light on that. This is the first post in the series, in which we will talk about the coding framework.

For reference, here are all of the blogs in this series:
Part 1: Framework
Part 2: Creating, Opening, and Saving Files
Part 3: Services
Part 4: Product Modeler
Part 5: Part Modeling and Drafting
Part 6: Selections
Part 7: Deployment
---------------------------------------------------------

Documentation

I will not try to explain every single nook and cranny, that would be impossible. You will have to do some digging on your own. And this is where you find the official 3DX Automation documentation.

On your computer with the 3DX software installed, go to C:\Program Files\Dassault Systemes\<install_folder>\win_b64\code\bin, where <install_folder> is the installation folder for your version of 3DX, and locate the file named DSYAutomation.chm. This is a so-called Microsoft Compiled HTML file, containing the official 3DX automation documentation. Double-click the file, it should open as shown in Figure 1. The documentation contains object diagrams, object property and method descriptions, articles, etc. All in all, the documentation is organized quite similarly to the one provided with the V5 software.

Figure 1

Macro Tools Icons

First things first. If you intend to work with 3DX macros a lot, it might be a good idea to add the macro tools icons to the 3DX user interface.

To add the icons across all 3DX apps, 1st make sure you have no documents in session, i.e., 3DX displays no tabs or windows, just the gray screen with the DS logo on it. Now, right-click the blue bar at the top of the 3DX window and select Display > Customize.


Figure 2


Select the Action Bar section you want to add the icons to (typically, the Tools section) and click Add commands.


Figure 3


Multi-select the following commands in the list and hit OK:

  • Macros
  • Start Recording
  • Stop Recording
  • Visual Basic Editor (if you intend to use VBA)


Figure 4

Optionally, you can add the macro commands to the Action Pad too, by selecting the appropriate tab in the Customize dialog box. Now the macro tools icons will appear in the Tools section of the Action Bar.


Figure 5

Instead of the icons, you can also use the following shortcuts:

  • <Alt>+F8: To start the Macros dialog box
  • <Alt>+F11: To start the Visual Basic Editor

Programming Languages

The coding framework is similar to V5 – you can use VBScript, CATScript, or VBA as your programming language.

The first difference from V5 is that you can also use VB.NET or C# as the programming language of your choice. To author C# or VB.NET scripts, you’d need to have the MS Visual Studio installed. However, no MS VS is necessary to run those macros.

Macro Libraries

The second difference is that now your macro libraries are stored in the PLM database (DB). To create or retrieve a macro library, either select the   (Macros) icon, or press <Alt>+F8 keys to open the Macros dialog box, then select Macro libraries.

Figure 6

To create a new library, select the library type and click Create new library.



Figure 7

Enter the title for your library and click OK. A new macro library is created, as well as registered as the current library in your 3DX session.



Figure 8

To retrieve and register an existing library in your session, select Add existing library and search for it in the DB. The Macro dialog box now displays the list of the macros in the library.



Figure 9

You can also create a new library from V5 macro files by selecting Create new library from files in the Macro libraries dialog box. Note, however, that your V5 macros will not run in 3DX as-is, though importing existing macros might save you a bit on typing the code in.

Macro Recording

Recording a macro is similar to V5. To start a recording, select  (Start Recording) icon. Enter the name for the macro and click Start.


Figure 10

To finish the recording, select (Stop Recording).

VBA Editor

Finally, if you use VBA, to pop-up the VBA editor, either select the (Visual Basic Editor) icon, or press <Alt>+F11.

Figure 11

That is all for now, but stay tuned. In my next post, I will explain how to create, open, and save 3D models in the 3DEXPERIENCE.

About the Author

Iouri Apanovitch

Senior Technical Training Engineer<br><br>As a senior member of the Rand 3D team with a doctorate degree in Finite Element Analysis (FEA) and over 35 years of experience, Iouri provides design, consulting, and training services to those in the aerospace, automotive, electronics, and consumer goods industries. Iouri is a seasoned pro in 3D parametric design and prototyping using knowledge-based engineering methods, and has worked on a wide range of projects including BOM automation, CMM points generation, automated 3D annotation creation, and die tooling automation design. He is also a sought-after instructor and holds the designations of both CATIA Certified Professional (Expert level) and CATIA Certified Instructor.

Follow on Linkedin Visit Website More Content by Iouri Apanovitch
Previous Article
3DEXPERIENCE: How to Figure Out PLM Attributes
3DEXPERIENCE: How to Figure Out PLM Attributes

Learn two methods for obtaining the names and values of all the PLM attributes.

Next Article
Transitioning Macros Part 2: Creating, Opening, and Saving Files
Transitioning Macros Part 2: Creating, Opening, and Saving Files

Learn about creating, opening, and saving files when transitioning macros from CATIA V5 to the 3DEXPERIENCE...