Scaling textures
-
Hi, my problem is, that i've got to scale something around 2000 textures to be exactly 0.025 metres x 0.025 metres.
It'd be really annoying to do this all by inserting the numbers. Has sketchup some kind of function for that? Or is there maybe a plugin?
If not, is there a tutorial about ruby scripts anywhere? -
If you mean you have 2000 materials [!] and their texture sizes needs to be reset to be 0.025m square ... then first off, are all of the materials in one model ?
If so, you can iterate the materials and make all of them with textures to that size using Ruby...
Here is an outline of the code needed...require('sketchup.rb') ### Usage; Ruby Console; ### TIG.resize_all_textures width, height ### plain numbers are taken as inches or use 0.025.m etc. ### No numbers revert to 10" sq. ### It will resize ALL textures in the model ! ### See SKMtoolset on how to batch import SKM files, then change textures... ### It is one step undoable. module TIG def self.resize_all_textures(w=10.0, h=10.0) model = Sketchup.active_model mats = model.materials model.start_operation('TIG.resize_all_textures', true) mats.each{|mat| mat.texture.size = [w, h] if mat.texture } model.commit_operation end end
Of course you use your own Module name [Uppercase A-Z at start the A-Za-z0-9_ only].
If they are not all in one model... then swat up on my SKMtools and batch import the materials from their SKM files... before changing the textures... -
thanks, it works perfect. (the textures aren't all in one model, but that doesn't make much difference, shouldn't even take 5 minutes of effort now)
Advertisement