Material change script

I was just wondering if there’s any script that could change the material for a selected object. I have 7 different materials.I want to create 7 different button to assign each material.Is there macro script that does that? or VBrhino script?

Can’t help you.

Just wanted to comment: looks like a rhinoscript function that returns the names of all present materials would be useful. The way rs.LayerNames() returns all present layers.
After that, another rhinoscript function, that will apply a certain material (by its name) to a certain object.

From what I saw, for now this appliance could only be done for material’s source (by layer, by object…). But not specifically for a certain material within material from object. Which would exactly be what junkim is looking for.

@andy, can you look into this?

There is a page on scripting the RDK here:

The function ContentList(“material”) will list the materials in the document. You can then query the names from there.

This is not possible at the moment without some very involved scripting. I will get this fixed in the next SR of Rhino.

Thanks Andy,

This is a C++ SDK functionality?
There’s isn’t something similar for RhinoCommon?

It seems like you could assign material by layer instead of by object and do it with a button.

Most of what I do is material by layer and I’ve made macros to change the material on layers. I also use buttons to assign objects to layers, creating the layer if it doesn’t exist. You’d just have to combine the two bits into one button.


No - this RhinoScript.

There is RhinoCommon functionality for this in SR7 of Rhino 5.

  • Andy