sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Is there a plugin to batch rename scenes?

    Scheduled Pinned Locked Moved Plugins
    9 Posts 6 Posters 4.3k Views 6 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
      db11
      last edited by

      I have a SU model with dozens of scenes that I'd like to batch rename, in this case by replacing the "Scene" prefix (with a one or two letter appellation) and adding a sequential suffix from the current order.

      Is anyone aware of a plugin with that function β€” maybe one of Renderiza's?

      If not, would it be difficult/possible to write one?

      Thanks,

      Doug

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

        n=inputbox(["Prefix; "],["N"],"Scene_Rename");Sketchup.active_model.pages.each_with_index{|p,i|p.name="#{n[0]} #{i+1}"}if n;puts
        

        Copy+paste+enter this Ruby one-liner into the Ruby Console - it renames all scene-tabs in order with the 'Prefix' - e.g. 'N 1', 'N 2' etc...
        The dialog lets you type in any desired 'Prefix'...

        TIG

        1 Reply Last reply Reply Quote 0
        • F Offline
          function
          last edited by

          Thanks again TIG πŸ’š
          2016-11-25-956.png

          1 Reply Last reply Reply Quote 0
          • D Offline
            db11
            last edited by

            Thanks TIG.

            When I had time last night I went back to look at Rederiza's ReScene and it does have a rename function.
            It's very slow to load though (at least on a Mac), so your one-liner will be useful.

            Is there a (simple) way to modify it to rename only selected scenes?

            1 Reply Last reply Reply Quote 0
            • L Offline
              Ludolff
              last edited by

              @tig said:

              n=inputbox(["Prefix; "],["N"],"Scene_Rename");Sketchup.active_model.pages.each_with_index{|p,i|p.name="#{n[0]} #{i+1}"}if n;puts
              

              Copy+paste+enter this Ruby one-liner into the Ruby Console - it renames all scene-tabs in order with the 'Prefix' - e.g. 'N 1', 'N 2' etc...
              The dialog lets you type in any desired 'Prefix'...

              Hi TIG, Many thanks for this code. Is there anyway of adding some code to this that will allow you to select the scenes to rename?

              Ludolff

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

                You can only select scenes that have names matching a pattern...
                Let's say you want to rename only prefixed scenes containing the text 'Plan', you need to enter an extra option...

                n = inputbox( ["Prefix; ", "Pattern; "], ["N", "Plan"], "Scene_Rename" ); Sketchup.active_model.pages.each_with_index{|p, i| (p.name = "#{n[0]} #{i+1}") if p.name =~ /#{n[1]}/ } if n; puts
                

                BUT you need to decide on the 'pattern' !

                TIG

                1 Reply Last reply Reply Quote 0
                • S Offline
                  StarSketch
                  last edited by

                  Thank you a lot TIG, you save my day !!! πŸ‘ πŸ‘

                  1 Reply Last reply Reply Quote 0
                  • onzkiO Offline
                    onzki
                    last edited by

                    Thank you TIG! Is there a way to rename using filter/ conditions? Example I have time scene names, like Scene 1 10:00am, Scene 2 1:00pm, Scene 3 6:00pm, (etc.. lots of it)
                    I want to rename all time to use 24-hour military time convention. Is it possible? So all with "10:00am" becomes-> 1000. Same goes with others.

                    Thanks!


                    [/hr]Dell Alienware Area-51. SKU 2021 Pro. AutoCAD 2023. Landscape design firm

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

                      You need to add some extra code, e.g.

                      read the scene name
                      then split it at the space etc etc

                      
                      name="Scene 2 1;00pm"
                      splitname=name.split(" ") ###>>> ["Scene", "2", "1;00pm"]
                      timestring = splitname[2] ###>>> "1;00pm"
                      ###delete the ; 
                      timestring.gsub!(/[;]/, "") ###>>> "100pm"
                      ###now check if pm
                      if timestring=~/pm$/
                        timestring.gsub!(/pm$/, "")
                        time_num=timestring.to_i + 1200 ###>>> 100 >>> 1300
                        timestring=time_num.to_s
                        ###
                      elsif timestring=~/am$/
                        timestring.gsub!(/am$/, "") ###>>> 100
                      end
                      name=splitname[0]+" "+splitname[1]+" "+timestring ### modify name >>> "Scene 2 1300"
                      ###
                      ### now rename that scene with the modified name etc...
                      ###
                      
                      

                      To strip off the entire 'Scene N ' part just use:

                      name=timestring ### modify name >>> "Scene 2 1;00pm" >>> "1300"
                      

                      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