Script for changing material assignment from "per layer" to "per object"

Hi all,

can anyone help me with a script/macro/command that does the following:

  • identify all object in a file that have a material assigned per layer
  • assign these materials per object to the respective objects.

Background:
Upon merging several files in a larger project, we learned that we have a mixture of per object and per layer material assignment. And that per layer will cause trouble down the road :-/

Any help much appreciated!

TIA,
Frank

_-RunScript (Rhino.ObjectMaterialSource (Rhino.ObjectsByMaterialSource (0), 1))

or

'_SelAll -_properties _material _o _enter _enter _enter

Thanks a ton, Javier!

The macro seems to work for me.

For the sake of easy copy/pasting, I fixed a typo in the last “enter” here:

'SelAll -properties _material _o _enter _enter _enter