How to Determine what Scene uses a Particular Section?

Is there a way to determine what scene/scenes a Section Plane is Active in? without going through each scene? The Model has a lot of Scenes.

Did you build the model?
If not, no, you’ll have to go through each scene, turn on section cuts, see which one is active, etc.
Next time name the section cuts with a notation that relates to your scenes…

And don’t forget to update each scene that you are satisfied with concerning the active section plane(s (*)).

(*) Multiple active section planes are possible at a time although only one per level.
So nested components can have their own active section plane.

It is not not our model. 60+ Scenes and Sections with a lot of those being working scenes. Thanks for confirming what we thought bmike

We name our Section Cuts with the Orientation and Subject. (EX.: Section N2 Back of Banquette_SECT BAR) with N2 as the Section Symbol, and the Scene as (N2 Back of Banquette_SECT BAR) The Capital SECT indicates that it is used as a Section Detail and should not be moved. We also Keep the Word Section in the Name so it is easy to find in the Outliner. Although this time It would have been Handy to be able Purge any unused (UnActive) Section Planes the work of going through scenes is not that bad, just thought there should be a another way.

Wo3Dan We don’t use Multiple Active Nested Section Planes in our current workflow but look forward to that Ball of Complexity.

1 Like

This can be achieved by writing a SketchUp Ruby Script.

Solution #1

For example, the Ruby script below looks through all the section planes in an active model and changes their name with the name of the scene they are active on.

With the Entity Info window tray opened, you can select a section plane and match its name with the name of the scene it is active in.

module I3D
  module SceneSectionNamer
    def self.name_section_planes
      model = Sketchup.active_model
      entities = model.active_entities
      model.pages.each do |page|
        model.pages.selected_page = page

        entities.each do |entity|
          if entity.is_a?(Sketchup::SectionPlane) && entity.active?
            entity.name = page.name
          end
        end
      end
    end
  end
end

I3D::SceneSectionNamer.name_section_planes

Solution #2 (I prefer this solution over the first one.)

There are other methods we can use to know what scene a section is active on.
Another idea is to write a Ruby script that takes a selected section plane and will automatically select the scene it is active on

module I3D
  module MatchSceneSection
    def self.match_scene_section
      model = Sketchup.active_model
      selection = model.selection

      selected_section = selection.grep(Sketchup::SectionPlane)[0]

      model.pages.each do |page|
        model.pages.selected_page = page
        break if selected_section.active?
      end
    end
  end
end

I3D::MatchSceneSection.match_scene_section

I can create an extension that can be installed and has a toolbar button you can activate. But, before I do that I would like to know if this solves your initial problem>

Note: You can test the code I wrote if you copy & paste it on the Ruby Console: Keep in mind that for the second code example to work you need to select a section.

One may have more than one scene with the same active section plane, for instance looking at your model from different angles. Thus more scene names and the same section plane to be named.

Which scene will be selected if there are more than one scenes to pick from? (also see case mentioned above)

1 Like

Hi, thank you for mentioning a scenario where multiple scenes have the selected section activated.

The code below creates a dialog box with a drop-down menu of all the scenes the selected section is active on.

In the video example, you can see me first selecting a section plane that is active in three scenes. Then I select “Scene 4” from the dropdown list and click ok to activate that scene. After that, I select another section where it is only active in “Scene 2”.

module I3D
  module MatchSceneSection
    def self.match_scene_section
      model = Sketchup.active_model
      selection = model.selection
      pages = model.pages
      current_scene = pages.selected_page
      scenes = []

      selected_section = selection.grep(Sketchup::SectionPlane)[0]

      model.pages.each do |page|
        model.pages.selected_page = page
        scenes << page if selected_section.active?
      end

      title = "Section is active in the following scenes"
      prompts = ["Scenes:"]
      defaults = [scenes[0].name]
      list = [scenes.map(&:name).join("|")]
      input = UI.inputbox(prompts, defaults, list, title)

      unless input == false
        model.pages.each do |page|
          model.pages.selected_page = page
          break if page.name == input.first
        end
      else
        model.pages.selected_page = current_scene
      end
    end
  end
end

I3D::MatchSceneSection.match_scene_section

1 Like

Thank for this code.

1 Like

I will soon create a plugin with a toolbar button so people can easily run the code.

Hi,

Here is an RBZ file you can install from SketchUp:

i3d_active_section_in_scene_finder.rbz (9.1 KB)

Here is the Toolbar Button Icon:

icon

SketchUp Extension: Active Section in Scene Finder

Now you can quickly locate one or more scenes where the selected section plane is active with the press of a button. :grinning:

I have improved the code significantly… Let me know if you run into any bugs.

Cheers!

2 Likes

Perhaps you already are aware of this…

Outliner also will show which section(s) are active if you look at/watch the section plane icons as you toggle through scenes.
Also, you can activate/deactivate sections via outliner too.

1 Like

Thanks indie3d. It Woks. Interestingly, when you are in scene and select the active Section Plane and run the Plug-In it Returns all scenes that don’t have ‘Active Section Planes Properties’ saved because those scenes would be using the current active plane. Didn’t see that coming but makes sense because the active section plan stays active until its unactivated or changed by the next scene. Thank you very much.

1 Like