Auto naming and replacing materials?
- 
Hello!
I'm looking for plugins which allow me to
- replace certain textures with other ones (like replacing "Black_Center.png","Black_Side.png" and "Black_Corner.png" with "Red_Center.png", "Red_Side.png" and "Red_Corner.png")
 - name all materials after the filename of the texture (if it uses a texture)
 
The second function is more important. I cannot code but if you can give me a line of code that does that, I could try to wrap it up as a plugin.
Thank you in advance!
 - 
The method
texturepath = material.texture.filenamereturns the path/name of the material's texture's image-file. Use something likeimagename = nil; imagename = File.basename(material.texture.filename) if material.texture...
To change a material's texture you use a new pathmaterial.texture="C:/.../mytetxure.png".
To get a material's name usematname = material.name.
To rename a material usematerial.name="newname"ORmaterial.name=imagename if imagename- note that the renaming method is unavailable in older versions of Sketchup... 
Advertisement