sketchucation logo sketchucation
    • Login
    1. Home
    2. nick9111
    3. Topics
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    N
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 10
    • Groups 1

    Topics

    • N

      Followme with distance

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      8
      0 Votes
      8 Posts
      312 Views
      N
      Thanks to all who tried to help me. I'm just new to ruby and Sketchup API, but digging some deeper into it I solved this problem by myself now.
    • N

      Rename texture image file inside *.skp

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      7
      0 Votes
      7 Posts
      2k Views
      N
      So there is a ruby plugin I've done (based on TIG's post). It renames all texture files in model with a template. module VNV def VNV.rename_textures UI.messagebox("All texture file names will be changed with a template - mat000") model = Sketchup.active_model model.start_operation('Rename texture files', true) tw = Sketchup.create_texture_writer temp_path = File.expand_path( ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] ) temp_folder = File.join( temp_path, 'Sketchup_tmp_mtl' ) unless File.exist?( temp_folder ) Dir.mkdir( temp_folder ) end group = model.active_entities.add_group() Sketchup.active_model.materials.each_with_index{ |m,i| if m.texture then group.material = m tw.load(group) path_to_png = File.join(temp_folder, "mat#{'%03d' % i}"+".png") tw.write(group, path_to_png) w = m.texture.width h = m.texture.height m.texture = path_to_png m.texture.size = [w, h] File.delete(path_to_png) end } group.erase! model.commit_operation end # def end # module if (!file_loaded?(__FILE__)) menu = UI.menu("Plugins") menu.add_item("Rename texture files") { VNV;;rename_textures } # Let Ruby know we have loaded this file file_loaded(__FILE__) end RenameTextures.rb
    • 1 / 1