How to apply material to a CATPart using a macro

Typically, material is applied to a CATPart by click on the “Apply Material” icon then browsing the material cataloghow to apply material to a catpart macro until you find the material you’re looking for. But what if you need to apply the material to hundreds of parts? Apply individually by hand will take forever. This is an example where an automated process like a macro comes in handy. The key to applying material to a CATPart via a macro is to use the ApplyMaterialOnBody command.

The code to apply the material is shown below. This is only for a single CATPart. You could add to this code to cycle through a product tree and apply material to a part then loop through to the next part, etc.

 

 

 

3 Comments

Add a Comment

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