Updated: Apr 16, 2020
In this tutorial, we're writing a SketchUp script that will automatically create scenes with the names of every layer in your model. The best part is that entities that belong to a specific layer will only be visible in the scene that matches that layer's name.
The instructions on how to run the script with the Ruby Code Editor Plugin is in my first tutorial.
But, If you like LayerScene and want to install it as a SketchUp Extension/Plugin which includes a toolbar button, then you can buy it for a small fee in the link below.
Before explaining what each line of code does, let me recommend the following book so you can better understand the Ruby syntax.
Click the link and get a copy of this book, it will give you the knowledge to start coding with Ruby which is the language that SketchUp uses to create Extensions/Plugins.
When you're starting to prototype ideas it is best to start small and at this point, 14 lines of code were all we needed to prove our concept. The following is a breakdown of the logic behind each line of code and the API calls used in the script...Enjoy!
API: Layers #each