I already knew that script. But the one that I need was something like that:
Imagine you to create a component with several subgroups. For each one of those subgroups you put in a different Layer. You create other components. And each one of those components has several subgroups, each one of them in different layers, but they are layers in common with other components. Each one of those objects is totally without material. Then now, you want to put several materials in several layers. The plugin render Vray have that capacity, but doesn't work with subojects, this work just with objects that are in the root of the outliner.
Thanks for your answer.