Constraints CATIA macro

Constraints CATIA macro

While searching the web I found one very interesting macro for me. So I decided to write code for constraints CATIA macro.

powercopy and macro

In the video above you can see a lot of different CATIA macros. All of these macros are based on good ground models and templates. Therefore if you want to have good optimization you must have good templates and basic models. Hence in this post, we want to recreate macro from 0:50-1:00 min of the video. So what this constraint CATIA macro does? It creates constraints for all points inside sketch and round them with the chosen number. I do this operation all the time but manually. Grid for screws is very important, consequently, you can have a problem in production. Certainly with this macro you can easily maintain that problem. With a little bit different code from this you can also check your constraints if they are divided with 10, 5, etc.   This is Visual Basic application but we can make it also with CATScript. 

Recording macro

Best way to start making these constraints CATIA macro is to record one. You need to make two constraints for the point inside the sketch.  

constraints CATIA macro

Certainly, this recorded macro can help a lot. We just need to change that names, insert some sort of selection and for a loop.

Editing recorded macro

This is our final code hence just copy and paste it. So if you want to use this macro make a sketch and few points inside. From the sketch environment run these constraints CATIA macro like in the video below.

You can copy-paste this macro code and use it.

If you have any issues feel free to contact me.

2 thoughts on “Constraints CATIA macro

Leave a Reply

Your email address will not be published. Required fields are marked *