sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Scaling textures

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    3 Posts 2 Posters 174 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      Kazeshin
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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...

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          Kazeshin
          last edited by

          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)

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement