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

Sorting of objects by their properties in VBA


Sorting in VBA is a quite tricky task because VBA itself has no support for sorting values. You have to use an algorithm like QuickSort. But what if you want to sort objects? It is even worse and harder, algorithms become more complex and less clear. Luckily, you can again make use of mscorlib.dll library and with the help of ArrayList and IComparer interface, you can implement your own object sorting method.


Read More

Sort values in VBA without an algorithm


Sorting of values is a quite common programming task. VBA has no native sorting method. You can use algorithms like QuickSort to sort the array in place. However, there is another, maybe easier way how to sort your data without using algorithms.


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

Graph Tree Reordering in VBA


One of the most annoying CATIA features, especially when you work with large assemblies is reordering of specification tree in Products. Even as a programmer there is almost nothing you can do about it, because there is no direct way of reordering components in specification tree. Such a function has not been exposed to CATIA API yet. There are a few tools available on the internet and maybe you already use some of them. You may have even thought how the hell they work. So stop wondering, today I am going to show you how they (might) works :).


Read More