Looking for Plugin
-
Question:
Is there a plugin that will make scenes for each layer? So if I have 5 layer, run the plugin, the plugin will create 5 scenes with the name of the layer. Seems I have seen a plugin that did this, however, I can not find it, or I am using the wrong search text.
Thank you in advance
Ken
-
Copy+Paste this code into a file called
layer2scene.rbin the Plugins foldermodule TIG def self.layer2scene() model.start_operation('layer2scene') layers=[];model.layers.each{|layer|layers<<layer.name} layers.sort.each{|name|model.pages.add(name)} end endRestart Sketchup.
TypeTIG.layer2scenein the Ruby Console to make a set of Scene tabs named after every Layer name... Making new scene tabs is not 'undo-able'... so save first and use with care!EDIT: use the corrected code in the post three on - this one has a typo

-
TIG
Thank you for your quick reply. I added the line as indicated below as it did not work with the code you provided. So, I get two for the price of one. Some code that I will try to add to a toolbar and a learning exercise in Ruby. It is a good day when you have corrected TIG's code.
module TIG
def self.layer2scene()
model=Sketchup.active_model # Added by Ken
model.start_operation('layer2scene')
layers=[];model.layers.each{|layer|layers<<layer.name}
layers.sort.each{|name|model.pages.add(name)}
end
endThanks
Ken
-
@unknownuser said:
It is a good day when you have corrected TIG's code
At times I wonder if he does this intentionally?
-
Of course I did !
The correct code ismodule TIG def self.layer2scene() model=Sketchup.active_model layers=[];model.layers.each{|layer|layers<<layer.name} layers.sort.each{|name|model.pages.add(name)} end endThere is no point in adding a start/commit block as adding scenes is not undo-able! I edit the code at the last minute when I realized that BUT removed the wrong line... I was rushing because my dinner was ready
even I have to eat 
Sorry for the balls-up - congrats on fixing it yourself...
-
What?! You eat?!?

-
I eat and drink... like mere mortals

-
But you don't sleep

-
is it possible to hide the other layer excepte the one that hade the scene name? so you will have every layer in separate scene.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement