sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Auto naming and replacing materials?

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 189 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.
    • D Offline
      DasMatze
      last edited by

      Hello!

      I'm looking for plugins which allow me to

      • replace certain textures with other ones (like replacing "Black_Center.png","Black_Side.png" and "Black_Corner.png" with "Red_Center.png", "Red_Side.png" and "Red_Corner.png")
      • name all materials after the filename of the texture (if it uses a texture)

      The second function is more important. I cannot code but if you can give me a line of code that does that, I could try to wrap it up as a plugin.

      Thank you in advance!

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

        The method texturepath = material.texture.filename returns the path/name of the material's texture's image-file. Use something like imagename = nil; imagename = File.basename(material.texture.filename) if material.texture...
        To change a material's texture you use a new path material.texture="C:/.../mytetxure.png".
        To get a material's name use matname = material.name.
        To rename a material use material.name="newname" OR material.name=imagename if imagename - note that the renaming method is unavailable in older versions of Sketchup...

        TIG

        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