Script for linking materials with keywords?

Started by willchocks7, July 12, 2016, 10:02:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

willchocks7

Hi Everyone,

Is it possible to run a script that will automatically link together some materials?

For example:

Lets say I have two materials (in reality I have hundreds):

Metal frame1 [navy coat]
Metal frame 2 [navy coat]

They are identical materials but their names are different when I import them from my CAD program, and therefore I have to link them before I go about changing any material properties.

I was wondering if there was a way to quickly link them using the common keywords in their name (the keyword being [navy coat]

Is it possible?

And can anyone show me a script that would do undertake this task?

Thanks very much.

Will Gibbons

Scripting is not required to achieve what you want.

First off, when you import your model, KeyShot should link same materials/colors upon import by default unless you're on a much older version.

That said, in your Real-time view, right-click on a part with the material you wish to link, and click 'Select Parts With Material', then right-click on one of the highlighted parts in the scene tree (while all of the parts with that material are highlighted) and select Material>Link Material.

That should do it.

Another way to do this is to look at the in-scene materials tab in the project panel, select all materials you wish to link and right-click and select link materials. See attached images for this below.

willchocks7

Thanks for your reply Will,

Unfortunately Keyshot is treating my seemingly 'identical' materials as 'non-identical' materials. When I click 'select all parts with this material' It only selects two or three parts.

I am using the latest pro version of Keyshot.

Attached is a photo of my materials.

If you take a look you will see that the materials aren't actually the same material applied to multiple parts. (if that makes sense)

My CAD program (Solid Edge) assigns a new material for each part it exports, even if the materials have the exact same values, they are still counted as separate and hence can't be linked through clicking 'select all parts with this material'.

Bit of a frustrating situation as I have many many materials to link and going through by hand and linking them can take quite a long time.

Chad Holton

Hello,

You may be able to use material templates. Here's an older video but it's basically the same process: https://youtu.be/ViVxWFRQV34

Another thought, if material templates don't work the way you need it to, is to use the scene tree to search for the parts and once the parts are highlighted, you can then paste on a linked material. For example, you could search for "Metal frame" or just "Metal" or "Frame" (without quotes) and everything that has that part of the name will be highlighted and can then be linked by material.

Hope this helps.

Chad


Will Gibbons

I'll echo what Chad said and then add that using the search/filter function should help you out. Find the common thread. Looks like your CAD package uses a common keyword for each color ex. 'kiwi' search that, multi-select those, right-click and link.

willchocks7

Material Templates was exactly what I needed. Had no idea it existed!

Thank you very much!

I can now assign all the correct materials with one click and link them easily with very little effort.

fantastic!

Chad Holton