sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Auto naming and replacing materials?

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 169 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