How to switch a product to design mode using a CATScript macro

Often times when you are dealing with a very large assembly in CATIA the files are setup so that when you open these huge assemblies the parts and products come in as CGR files in visualization mode. To begin working on a part you need to switch the part and products into design mode. This can be accomplished with an easy CATScript macro. In this example, we will check to see if the top level product document is in design mode. If not then we will display a message box asking the user’s permission to automatically switch the product document to design mode.

As usual in CATIA, there are multiple ways to accomplish the same task. Another method could be this:

This code by itself may not be very important to you but it might be a very good idea to add this to the beginning of a more complex macro designed to modify geometry or something else where the product must be in design mode first. As a programmer, you can never assume anything. Don’t assume the parts will already be in design mode. Make sure your code first checks for design mode and then switch to it if needed. This will save you a lot of time later on when other, less experienced users begin running your code and can’t get it to work because of something simple like being in design mode or not. Subscribe to our newsletter for more free CATIA script and macro tips!