Script to apply materials to objects by name

Script to apply materials to objects by name

danZL2KU
Participant Participant
2,118 Views
23 Replies
Message 1 of 24

Script to apply materials to objects by name

danZL2KU
Participant
Participant

Hi

 

We currently link our models into 3ds max from Revit by material name. For example:

-Plywood Face Natural
-Plywood Edge Natural

 

We then select each of these, one by one and apply a material to them from our library.

I have set up the materials with the exact same name.

 

It is quite simple but it takes time to apply as we can have 20 or 30 objects/materials.

 

Is there a script which I can run to do this:

It would be something like this.

1. Select all objects.

2. Apply materials from a library which have a name match.

 

Thanks

 

Dan

www.madeinply.co.uk

 

 

 

0 Likes
Accepted solutions (1)
2,119 Views
23 Replies
Replies (23)
Message 21 of 24

denisT.MaxDoctor
Advisor
Advisor

@danZL2KU wrote:

Any idea why that is?


because you do something wrong... there is only one possible reason.

name don't match exactly, not all materials in the library, path is wrong... do everything right and it will work.

 

0 Likes
Message 22 of 24

denisT.MaxDoctor
Advisor
Advisor

@danZL2KU wrote:

Figured it out. I have to select the objects and then run the script


you have the option to do it for all objects in the scene... 

 

But you should have minimal knowledge of how maxscript works. So, try learning MaxScript if you're going to use it in the future. Good luck!

0 Likes
Message 23 of 24

danZL2KU
Participant
Participant
Accepted solution

Not to worry I have figured it out. Thank you so much for your help. This works so well. 

0 Likes
Message 24 of 24

denisT.MaxDoctor
Advisor
Advisor

 Solved by danZL2KUGo to Solution.

 

Haha... You forgot to 'Like' yourself 😉

0 Likes