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

    p_hennessey

    @p_hennessey

    10
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    p_hennessey Unfollow Follow
    registered-users

    Latest posts made by p_hennessey

    • RE: Batch replace all textures in model with in one script?

      @tig said:

      When you make a new material and then give it a texture, the method mat.texture.filename return that texture's file-path, or in the case of an 'orphaned texture' - just its 'image-name' - e.g. from the SKM library where no path is applicable...

      You are muddling materials and textures.

      Just process a few materials and list if they have textures and then the texture's filename...

      Sorry...I don't mean texture as in bump map. I mean literally a JPG image, brought into a model and applied to a surface. What would that be called?

      posted in Extensions & Applications Discussions
      P
      p_hennessey
    • RE: Batch replace all textures in model with in one script?

      @tig said:

      Let's assume the model.materials are 'inspected' and only those with associated textures are put into a 'list' - let's call that - mats
      and now we process that...
      Next. in turn look at each material and get its texture, and its path
      textu = mat.texture filen = textu.filename
      Check the path given in filen against a list of possible jpg names...
      Assemble that list from the contents of some subfolder you've set up and defined...
      There are Ruby tools to compare just the file-names [File.basename etc] and also to allow for non-matching cases etc...
      Assuming that you now have a match, then you have the new file path - filenew
      So use
      mat.texture = filenew
      That material now is assigned the replacement textu[tr] ??

      I thought the textures were embedded in the SKP file itself. When textures are placed, they don't appear to live at any particular filepath. That's the part that confuses me about how SketchUp works.

      posted in Extensions & Applications Discussions
      P
      p_hennessey
    • Batch replace all textures in model with in one script?

      I'm hoping one of you fine folks is able or willing to advise me on a SketchUp script that I am convinced would be extremely helpful in lots of people's workflows.

      Let's say I have applied a series of unique artworks to a model. Let's say I have 20 unique JPG artworks with 20 unique filenames placed in my model. That would amount to a list of files (artwork1.jpg, artwork2.jpg, artwork3.jpg...etc).

      Now... let's say that I have updated JPGs -- the same exact list, but the artwork has been modified in some way, and I need to update my model with each of them.

      Currently, the only way to do this is to painstakingly replace each and every texture instance one by one in the material editor.

      SURELY THERE IS A BETTER WAY??

      https://forums.sketchup.com/t/batch-create-materials-from-directory-of-files/114300

      Looks like this person was on to something. Is there anyone here who could help me rewrite this Ruby script (I'm new to Ruby, so bear with me) in such a way that we could batch replace every texture in the model with its corresponding JPG? In other words, a single script that would look in a specific folder, and replace any texture in my material library with the JPG in the folder whose name matches that texture?

      I refuse to believe this is impossible. Can anyone help?

      posted in Extensions & Applications Discussions extensions
      P
      p_hennessey