sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Mass material importer

    Scheduled Pinned Locked Moved Developers' Forum
    14 Posts 10 Posters 9.6k Views 10 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      Since I tweaked this so it worked originally, here goes...

      You pick 'Import Materials' off the Plugins menu.
      You'll get a dialog open up.
      Navigate to the folder that contains all of your image files (jpg etc).
      Select one of the files and click OK - the instructions on the dialog's top-bar tell you to do this...
      Because there is no 'get directory' method in SketchUp Ruby the work around is that you select one file and the script works out that file's directory... Then it takes all of the images in that directory and these are added as materials in the Model - open the 'model-tab' in the Materials browser to see them...
      You might need to scale the materials individually...
      You can then 'save_as' pop-out to export these as separate .skm files outside of the one model if you have multiple models needing some of these materials.

      Still works for me...

      .

      TIG

      1 Reply Last reply Reply Quote 0
      • E Offline
        ericschimel
        last edited by

        Is there a way that you can set the default texture size? I see that when you import them, they all come in at 10" x 10".....

        Other then that, sweet plugin!

        -Eric
        http://plugin.sketchthis.net
        Sketchup Kitchen Design Plugin
        Custom Models

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

          You can read the image size and set the materials texture to suit...

          ### material == mat in the script...
          image_width_in_pixels = mat.texture.image_width
          image_height_in_pixels = mat.texture.image_height
          my_factor = 0.3333333 ### how do we decide this ?***
          image_height_in_inches = image_height_in_pixels * my_factor
          mat.texture.size = image_height_in_inches ### auto-keeping aspect ratio
          ### OR perhaps mat.texture.size = [image_width_in_inches, image_height_in_inches] ### ???
          
          

          *** Unfortunately there seems to be no direct relationship between the original image size in pixels and imported image or the texture size it produces. We could find
          path_to_image=mat.texture.filename
          then use Ruby to find its size - as its file-size might come into the equation with it w/h pixel size ?
          file_size=File.size(path_to_image)
          Not sure how though ??? my_factor would then be calculated based on the file_size and image_height in pixels, to return it as inches ?
          To show this weirdness manually you can import two images of different pixel sizes and double-click to place them with no scaling - and an image of 225x225px might become a SUp image of 75x75" when exploded, whilst one 512x512px might become 69x69" - the height:width ratio is kept but the image-size varies - probably depending on the image's complexity, I find that low-res monochrome images import as very large in w/h inches ?

          It's an enhancement I've yet to implement - if you want to add it then it's not so hard - except for working out what the size should be ??? ... πŸ€“

          TIG

          1 Reply Last reply Reply Quote 0
          • GaieusG Offline
            Gaieus
            last edited by

            Also there is no direct relationship between an image size in pixels and how many virtualinches/sms it should cover in SU (just think of brick sizes -how would the plugin know how many bricks are in the image and how big they are supposed to be each?).

            It seems that some manual tweaking and rescaling the images cannot be spared in SU.

            Gai...

            1 Reply Last reply Reply Quote 0
            • 3D Modeler3 Offline
              3D Modeler
              last edited by

              BTW - WOW ... this is an EXCELLENT Plugin.
              I wish I had known about this a long time ago but better late than never.
              This plugin will save me (and others) a HUGE amount of time.

              I have hundreds of hi-res repeating photo textures that would take hours or even days to import and save one-by-one.
              With this Plugin/Ruby, I was able to save many in just a few clicks.
              It's going to get lots of use over the next day or two ... any for hereinafter.

              1 Reply Last reply Reply Quote 0
              • T Offline
                tomot
                last edited by

                @3d modeler said:

                BTW - WOW ... this is an EXCELLENT Plugin.
                I wish I had known about this a long time ago but better late than never.
                This plugin will save me (and others) a HUGE amount of time.

                I agree, I have a large collection, which I'm willing to share, is it possible to
                setup a sharing of Materials Repository for .skm files at this Forum?

                [my plugins](http://thingsvirtual.blogspot.ca/)
                tomot

                1 Reply Last reply Reply Quote 0
                • KrisidiousK Offline
                  Krisidious
                  last edited by

                  Tomot... I don't know but let me know. I'd love to see what you have.

                  I still use the importer and it works somewhat well. I do have issues with it after using it 3 times in a row or using it on folders with over 50 textures it imports them in a black hue or a light gray hue. So I try to keep the folders small.

                  then of course the standard 10" I would at least like it to be 1'x 1'.

                  By: Kristoff Rand
                  Home DesignerUnique House Plans

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    tomot
                    last edited by

                    @krisidious said:

                    Tomot... I don't know but let me know. I'd love to see what you have.

                    I don't want to be accused of stealing this thread, ....sorry!
                    Come to think of it this might not be feasible in this forum.
                    Therefore I would suggest Google Drive as an alternative. It offers 5GB free and its easy to email download links to friends that are interested in cross sharing.

                    My current customized material files are not small?


                    material.jpg

                    [my plugins](http://thingsvirtual.blogspot.ca/)
                    tomot

                    1 Reply Last reply Reply Quote 0
                    • KrisidiousK Offline
                      Krisidious
                      last edited by

                      I know what you mean...

                      the smaller folder being my .skm's the larger all the originals and stuff I might not have used or converted yet.

                      I would really love and would pay (hint hint) to be able to convert all the files to skms... and keep the folder structure in tact.

                      materials.JPG

                      By: Kristoff Rand
                      Home DesignerUnique House Plans

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tomot
                        last edited by

                        @krisidious said:

                        I know what you mean...

                        the smaller folder being my .skm's the larger all the originals and stuff I might not have used or converted yet.

                        I would really love and would pay (hint hint) to be able to convert all the files to skms... and keep the folder structure in tact.

                        [attachment=0:4l1rf0fq]<!-- ia0 -->materials.JPG<!-- ia0 -->[/attachment:4l1rf0fq]

                        It does not take long to make the conversion, all it takes is time πŸ˜„ Hint: I keep my textures in separate prefixed folders, while keeping the original texture file folder names unchanged. This way I can always copy my texture folders to any new install of SU. Using this procedure your new prefixed folders can be added to my folders under the common Materials folder, or vice versa.

                        [my plugins](http://thingsvirtual.blogspot.ca/)
                        tomot

                        1 Reply Last reply Reply Quote 0
                        • C Offline
                          charlezzz
                          last edited by

                          Thanks a lot guys for the tips ! the script work fine.

                          But really no one have any idea how to batch-adjust the tiling of the material ? Other ways it will take me days to manually adjust each one of them πŸ˜• (I have like 500 skm tu adjust)

                          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