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

    Rename the names of the materials

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 285 Views 3 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.
    • bagateloB Offline
      bagatelo
      last edited by

      I wonder if it is possible to create a function to rename the names of the materials in the whole scene based on the file name or some other string that we can provide. Thanks.

      While the cat's away, the mice will play

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        Check the Code index in this forum, or the Plugins index in the Plugins forum, and look under author TIG.

        Sounds like something he would have already written.

        If not you can get ideas from his code.

        I'm not here much anymore.

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

          I wrote a material.name="newname" extension to the Material class [ http://forums.sketchucation.com/viewtopic.php?p=293701#p293701 ]... BUT from v8M1 it is now a built-in method.
          So to change all materials' names you simply need something like this...
          model=Sketchup.active_model prefix=model.title+"-" ### or any other text you'd like model.materials.each{|mat|mat.name=prefix+mat.display_name}

          TIG

          1 Reply Last reply Reply Quote 0
          • bagateloB Offline
            bagatelo
            last edited by

            TIG I'm so grateful for your help.
            But if I like to complete clean old names, and serialize by numbers?

            Thanks again. This is great to me.

            While the cat's away, the mice will play

            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