Play Snake in CATIA V5 product


A CATIA V5 remake of the well-known arcade game. Many of us used to play it on our cellphones. Your goal is to move the snake and eat as many "food" segments as possible while the snake grows in length. The game was developed in a pure VBA with some help from WinAPI.


Read More

Play Tetris in CATIA V5 drawing


CATIA V5 as a gaming platform? Well, nothing is impossible. Thanks to the powerful VBA language, you can create simple games even in CATIA V5. But which game to choose? Good old Tetris is probably the best choice. Simple and addictive game is an excellent candidate to test CATIA as a game engine. And CATIA, as usual, did a great job.


Read More

Get point on a curve in CATIA V5 VBA


To create a point on a curve in CATIA V5 is a pretty simple task. Things get complicated if we need to repeat it in VBA. Although most of the information you need you can find also in CATIA V5 documentation, the lack of examples is a real problem. I would like to try to fill this gap and show you some of the functions you can use when you work with CATIA curves. And because I like when things are moving, we create an animation :).


Read More

Clock animation in CATIA V5 drawing with VBA


If you want to create an animation in CATIA, most of the time you use a DMU Kinematics workbench. However, simple animations can be performed without any dedicated CATIA module, just with a plain VBA code. Moreover, you can use VBA across workbenches and Drafting workbench is not an exception. I am going to show you, how you can create a simple animation in a CATIA V5 drawing.


Read More

Circular text in CATIA V5 drawings


Circular text in a drawing cannot be done easily using standard CATIA V5 commands. You can maybe put a letter into the required position, use a Rotate command to copy it along a circle and then edit letter text one by one. Or you can utilize the power of VBA.

A code below creates a circular text in a matter of milliseconds. All you have to do is to set some initial properties and let your computer do his job.


Read More

Lock/Unlock drawing views in VBA


Locking and unlocking of drawing views is a common task in CATIA V5. To save a time you can automate this operation with VBA macro. Following procedure checks the lock status of the first view in a CATIA V5 drawing and then sets all views to the opposite.


Read More

Export a product structure to Excel in VBA


To loop through the content of an assembly you can use programming technique called recursion. Recursion is a powerful concept where a procedure calls itself. Although it is not the most effective way how to write a code, there are cases when advantages of this technique overweight its drawbacks like higher memory usage or lower efficiency. Also, it is very important to design your recursive procedure to terminate the recursion properly otherwise you end up stuck in an infinite loop and Out of stack space error.


Read More

Export a CATIA table to Excel with VBA


This simple script copies the content of CATIA table into an Excel worksheet. Before launching it, please ensure that:

  • Active document is a CATIA drawing.
  • Active view contains a CATIA table.
  • If there are more tables in the active view only first one is going to be exported.


Read More

SelectionSets object in CATIA VBA


Selection sets are nice CATIA feature to group and store selected elements of any type. They are pretty well described in V5Automation reference. The purpose of the methods of a SelectionSets object like CreateSelectionSet, DeleteSelectionSet or RenameSelectionSet is quite obvious, other methods like AddCSOIntoSelectionSet or PutSelectionSetIntoCSO are a bit less obvious, but at the first glance, we have enough to start with. However, there is no real-world example or use case which could help us at the beginning.


Read More