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 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 constraints CATIA macro does? It creates constraints for all points inside sketch and round them with chosen number. I do this operation all the time but manually. Grid for screws is very important, consequently you can have problem in production. Certainly with this macro you can easily maintain that problem. With little bit different code from this you can also check your constraints if they be 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 this constraints CATIA macro is to record one. You need to make two constraints for the point inside 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 loop.

Editing recorded macro

This is our final code hence just copy and paste it. So if you want to use this macro make sketch and few points inside. From sketch environment run this constraints CATIA macro like in 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 *