How to apply materials by Tag?

I'm afraid you will have some difficulties...

You can not retrieve material via Ruby API. You only have the #color method to retrieve the color of the layer. (with the limitation that the alpha channel can not be read properly)
See also e.g. here:
How can set the material of layer by RUBY API? - #2 by dezmo

Perhaps using C API, but I’m not familiar with it…
C API : Get and Set Material Color for a `SULayerRef` · Issue #418 · SketchUp/api-issue-tracker · GitHub

1 Like