top of page

Unhide All Geometry and Tags - SketchUp

This script ensures that all hidden geometry and entities on hidden tags in your SketchUp model are made visible, including nested components and groups.

Unhide All Geometry and Tags - SketchUp

Broken button... I'll fix it eventually...

require 'set'


# Function to unhide all entities recursively, including those in groups and components

def unhide_all_entities(entities, processed = Set.new)

  entities.each do |entity|

    # Skip already processed entities to avoid infinite loops

    next if processed.include?(entity)

    processed.add(entity)


    # Unhide the entity if it has a hidden attribute

    entity.hidden = false if entity.respond_to?(:hidden=)


    # Recursively process groups and components

    if entity.is_a?(Sketchup::Group) || entity.is_a?(Sketchup::ComponentInstance)

      unhide_all_entities(entity.definition.entities, processed)

    end

  end

end


# Main script execution

model = Sketchup.active_model


if model.nil?

  UI.messagebox("No active SketchUp model found. Please open a model and try again.", MB_OK)

else

  # Start operation to improve performance

  model.start_operation("Unhide All Geometry", true)


  # Make all tags visible

  layers = model.layers

  layers.each { |layer| layer.visible = true }


  # Unhide all entities in the model

  unhide_all_entities(model.entities)


  # Commit operation

  model.commit_operation


  # Notify user

  UI.messagebox("All geometry has been successfully unhidden, including geometry in hidden tags!", MB_OK)

end


Description

What This Script Does

  1. Ensures All Tags Are Visible: Before unhiding geometry, the script sets all tags (layers) to visible using layer.visible = true.

  2. Unhides All Geometry: The unhide_all_entities function recursively processes all entities, including those within nested groups and components.

  3. Handles Hidden Geometry in Hidden Tags: Since all tags are made visible, hidden geometry on those tags will also be processed.

Steps to Use

  1. Copy and paste the script into the Ruby Console or save it as a .rb file.

  2. Run the script in your SketchUp model.

  3. After the script completes, all geometry in all tags, including hidden ones, will be visible.

Limitations

  • If some tags should remain hidden for other purposes, you’ll need to manually re-hide them after running the script.

bottom of page