sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Mass Material Importer

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    6 Posts 5 Posters 2.4k Views 5 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.
    • D Offline
      dillow
      last edited by

      My old computer (the one with all my materials libraries on them) took a dump. I now need to recreate the materials folders. I seem to be having trouble getting the old Mass Material Importer plug-in to work. It loads and asks for a file location, I enter that, and then nothing.

      Is there a way to batch do this outside of the old plug-in? It is way too tedious doing this one at a time. I find it hard to believe there's nothing in the warehouse that accomplishes this. It's got to be one of the most basic plug-ins.

      Thanks!

      1 Reply Last reply Reply Quote 0
      • Rich O BrienR Offline
        Rich O Brien Moderator
        last edited by

        Do you need to add .skm files back to SketchUp as collections?

        If you have your original .skm files then is is relatively quick to setup new collection in SketchUp.

        PS...
        What concerns me more is that your old PC took a dump. 😲

        Download the free D'oh Book for SketchUp πŸ“–

        1 Reply Last reply Reply Quote 0
        • D Offline
          dillow
          last edited by

          I do not have the skm collections. I do have old Sketchup files with materials in them but I thought it'd be just easier to download the jpgs (mostly from manufacturer tileable images). But converting hundreds of jpgs to skms isn't fun.

          1 Reply Last reply Reply Quote 0
          • sdmitchS Offline
            sdmitch
            last edited by

            @dillow said:

            I do not have the skm collections. I do have old Sketchup files with materials in them but I thought it'd be just easier to download the jpgs (mostly from manufacturer tileable images). But converting hundreds of jpgs to skis isn't fun.

            Here is a version of the method I use to load materials into a model.

            module DILLOW
            		def self.materials_from_file
            			@mod = Sketchup.active_model
            			@textures_from_file = []; @images = []; @image_path ||= File.dirname(__FILE__)+"/*.*"
            			@image_path = UI.openpanel("Texture Files",@image_path)
            			unless @image_path==nil
            				image_folder = File.dirname(@image_path.gsub('\\','/'));
            				@images = Dir[image_folder+"/*.{jpg,png,tif,bmp,gif,tga,epx}"]
            				@images.each{|i| @textures_from_file<<File.basename(i,'.*')};
            				if @textures_from_file[0]
            					@textures_from_file.each_with_index{|name,i|
            						unless @mod.materials[name]
            							mat = @mod.materials.add(name)
            							mat.texture = @images[i]
            						end
            					}
            				end
            			end
            		end
            end
            DILLOW.materials_from_file
            

            Copy and paste into Ruby Console and press Enter to execute. Select any image file and click Open.

            Nothing is worthless, it can always be used as a bad example.

            http://sdmitch.blogspot.com/

            1 Reply Last reply Reply Quote 0
            • R Offline
              ronaldoluidi
              last edited by

              sdmitch your code is awesome, thank you!

              1 Reply Last reply Reply Quote 0
              • A Offline
                asterios_polyp
                last edited by

                SDMITCH! After searching for hours, I finally found your script and it does 90% of what I was looking for. Thank you so much!!! This is the closest thing I have found to a batch material import for 2019. I still have to save the skms back to the folder i want and then upload the collection, but bringing the images in into sketchup is the real timesuck.

                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