How to create a new geometrical set within a CATPart

If you’re going to create new geometry with a CATScript macro in CATIA V5, it is often a good idea to create a brand new geometrical set to place this new geometry. This can be accomplished as a “first step” within your macro code. First, we’ll use On Error Resume Next as our error handling vehicle to insure that the active document is a part document. If not, a message box will display and the macro will quit running. If there are no errors (error=0) then we’ll continue on with the rest of our script. A geometrical set in a CATScript code is a hybrid body. Use the Add() function to insert the new hybrid body and then the Name function to rename it whatever you like. Then, we’ll set that as the in work object (the object with the line under it) this way any additional geometry will be created within this geometrical set. See the complete CATScript below and please note the comments contained within.

Learn other VBA macros for CATIA.