Is there a plugin to batch rename scenes?

Is there a plugin to batch rename scenes?

Postby db11 » Thu Nov 24, 2016 3:13 pm

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
0

db11 
 

Re: Is there a plugin to batch rename scenes?

Postby TIG » Thu Nov 24, 2016 5:01 pm

Code: Select all
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'...
1
TIG
User avatar
TIG 
Global Moderator
 

Re: Is there a plugin to batch rename scenes?

Postby function » Fri Nov 25, 2016 10:09 am

Thanks again TIG :mrgreen:
2016-11-25-956.png
0

function 
 

Re: Is there a plugin to batch rename scenes?

Postby db11 » Fri Nov 25, 2016 3:39 pm

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?
0

db11 
 

Re: Is there a plugin to batch rename scenes?

Postby Ludolff » Mon Jun 11, 2018 8:51 pm

TIG wrote:
Code: Select all
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
0

Ludolff 
Premium Member
Premium Member
 

Re: Is there a plugin to batch rename scenes?

Postby TIG » Mon Jun 11, 2018 9:16 pm

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...
Code: Select all
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' !
0
TIG
User avatar
TIG 
Global Moderator
 

Re: Is there a plugin to batch rename scenes?

Postby StarSketch » Sun May 10, 2020 11:49 pm

Thank you a lot TIG, you save my day !!! :thumb: :thumb:
0

StarSketch 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: No registered users and 9 guests

Visit our sponsors: