• Login
sketchucation logo sketchucation
  • Login
🔌 Quick Selection | Try Didier Bur's reworked classic extension that supercharges selections in SketchUp Download

Automatic Materials Library Installer

Scheduled Pinned Locked Moved SketchUp Components, Materials & Styles
sketchup
6 Posts 2 Posters 8.4k 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.
  • A Offline
    ashscott
    last edited by 10 Aug 2015, 16:43

    Am trying to make an installer that will install a materials library to the right location on the user's computer. Here is an example but it doesn't seem able to deal with different windows/sketchup versions.

    It would need to be able to handle

    • 32 bit and 64 bit configurations
    • Windows XP, Vista, 7, 8 and hopefully 10
    • Back to Sketchup 6

    There are a number of options but many are inadequate.

    • zip installer seems to have no ability to deal with different folder locations
    • This may be useful but seems to have a learning curve and a price tag: http://www.advancedinstaller.com/
    • This doesn't appear to have the ability to deal with different folder locations: http://www.wikihow.com/Create-a-Self-Extracting-.Exe

    Does anyone have experience with this? I can't imagine it is very complicated with the right tools.

    Thanks in advance

    Just some stuff I do with Sketchup.

    1 Reply Last reply Reply Quote 0
    • D Offline
      driven
      last edited by 10 Aug 2015, 19:16

      use ruby...
      Sketchup knows where the material folder lives on all versions, and can move file using rename...

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • A Offline
        ashscott
        last edited by 11 Aug 2015, 03:05

        Thanks John,

        Can you give me any directive on where to start with this?

        For user friendliness it basically needs to be a package that can be downloaded and run once and everything is complete - I'm not confident that a plugin is easily usable by elementary Sketchup users.

        Just some stuff I do with Sketchup.

        1 Reply Last reply Reply Quote 0
        • A Offline
          ashscott
          last edited by 11 Aug 2015, 06:01

          In case anyone else wants to achieve something like this:

          This can kinda be done with WINRAR but you'll need to make a separate installer for each sketchup version.

          • Once WinRAR is installed, select and right click the texture files you want to use.
          • Click "Add To Archive"
            [*[Under the "general" tab check "Create SFX archive" - this will make the file .exe
          • Under "Advanced" tab click SFX Options and on the general tab enter the path to the sketchup materials folder
          • Click "OK"
          • Under the "Files" tab change "File Paths" to "Do Not Store Paths"
          • Hit "Ok"

          Now your installer will place the files you originally selected in the sketchup materials folder on the user's computer but you will have to make a separate installer for each version of sketchup as the path to the materials folder changes

          If you want to have separated folders within the sketchup materials folder (to organize your new library nicely on the user's computer then you will have to organize everything into folders before you add to archive at the beginning.

          Super simple but makes things a lot easier for your users.

          If only I could find a way to detect the latest version of SU on the user's computer and install accordingly in the appropriate folder.

          Just some stuff I do with Sketchup.

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by 11 Aug 2015, 11:59

            sorry for late reply, we're on different timezones...

            Your Materials should be going into the 'Users' Materials directory...

            Any installer will need to check if that one exists, and create it if it doesn't...

            As PC users can specify anywhere for this User directory, it would require a search for the folder Name and a check for its sub-content containing .skm files...

            IMHO, installing a Plugin is a well documented procedure for all SU versions...
            the plugins Ruby can be used to check for a user library...
            it can create one if it doesn't already exist...
            and it can move a 'self contained' folder of materials into the user directory, and then delete itself...

            on next restart of SU, you have the Materials and the Plugin is gone...

            john

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by 11 Aug 2015, 19:24

              here's some code I tested on my mac...

              module JcB
                module Add_Skm
                  def self.skm_loader
                    # current best practice puts any added content in the User space
                    # so first we get a handle for that [is this cross platform?]...
                    user= ENV["HOME"].dup
                    # then we look for SU's default folder...
                    materials_path = Sketchup.find_support_file("Materials")
                    # and the plugins folder
                    plugins_path = File.dirname(__FILE__)
                    # because the rbz will instal in Plugins, so will our skm's
                    new_mats = File.join(plugins_path, "move_mats")
                    # check if the user has ever made a material...
                    usr_mats = materials_path.include? user
                    # check if Plugins are in user land...
                    usr_plugins = plugins_path.include? user
              
                    # using the true/false returns from those
                    if usr_plugins and not usr_mats
                      # if we have a User plugins folder. but no User materials folder, we can just change our folder name to 'move' all it's contents...
                      File.rename(new_mats,(new_mats.sub("Plugins/move_mats", "Materials")))
                      # then delete this script...
                      File.delete(__FILE__)
                    else
                      # if we don't have a user plugins folder or we do a user materials folder, we need to rename individual skms
                      Dir.glob("#{new_mats}/*").each do|f|
                      File.rename(f, f.sub("Plugins/move_mats", "Materials"))
                      end
                      # but that leave an empty folder, so we remove it...
                      Dir;;rmdir(new_mats)
                      # then delete this script...
                      File.delete(__FILE__)
                    end
                  end
                end
              end
              # this is a hack to make it run the same on all versions I tested v8+
               result = UI.messagebox("ready to load new skm's?", MB_YESNO)
               if result == IDYES
                 JcB;;Add_Skm.skm_loader
                 UI.messagebox("Skm's have been added to \n#{Sketchup.find_support_file('Materials')}")
               end
              # I'm surprised it runs when it does, but it works for me and the skms are available from the materials Browser without a restart...
              
              

              and a test rbz to see if it runs on you PC...just adds one of the xtra skm folder from your example...
              it could be extended to add a help menu item Add Skm Collection, or similar...
              I think it's easier to modify then worrying about all the different versions of Windows and SU an installer would need.

              I can't even run SU v6 or v7 on any of my machines so I don't cater for them [although this may work on them]...

              For this to add a set of subfolder in a parent folder, it would need a PC conditional, as that won't work on a mac...

              john

              learn from the mistakes of others, you may not live long enough to make them all yourself...

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

              Advertisement