• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Request Section Management Panel

Scheduled Pinned Locked Moved Developers' Forum
6 Posts 2 Posters 43 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    alexpacio2013
    last edited by 25 Jul 2024, 08:39

    Hi, I’m asking you why Sketchup has never created a panel for managing sections, like tags, to be able to activate, deactivate, rename, delete them and if possible match them to scenes. I think this function is essential because I often find myself with many sections inside objects and components and managing them becomes complicated. There is the possibility of acting also with the structure panel but it is difficult to disentangle oneself within the subgroups. I think this is a fundamental function for sketchup and I don’t understand why no one has ever thought of it. Often to manage the activation of the sections I go through the vray panel. When a function like this

    Who is available to develop a Plugin that solves this problem?

    R 1 Reply Last reply 25 Jul 2024, 11:06 Reply Quote 0
    • R Online
      Rich O Brien Moderator @alexpacio2013
      last edited by 25 Jul 2024, 11:06

      @alexpacio2013 said in Request Section Management Panel:

      asking you why Sketchup has never created a panel for managing sections

      Probably because they have the Ruby API that allows people to extend SketchUp to suits their needs

      Download the free D'oh Book for SketchUp 📖

      A 2 Replies Last reply 26 Jul 2024, 09:36 Reply Quote 0
      • A Offline
        alexpacio2013 @Rich O Brien
        last edited by 26 Jul 2024, 09:36

        @Rich-O-Brien I consider this function a basic function of the program I do not have an option to have those who develop plugins in Ruby create. A panel to manage sessions is essential as it is to manage levels to manage scenes to manage materials to manage components in practice it is a function in my opinion fundamental However if there is someone who wants to develop a plugin of this kind I am available to give my suggestions to implement the necessary functions

        1 Reply Last reply Reply Quote 0
        • A Offline
          alexpacio2013 @Rich O Brien
          last edited by Rich O Brien 26 Jul 2024, 10:01

          @Rich-O-Brien I'll start by saying that I'm not a programmer. I created this script with cloud 3 5 AI to disable or activate the sections in the project. The plug-in correctly creates the list of sections but even though I created the activate and deactivate buttons, they don't work. I tried it on sketchup 2024. Is there anyone who can give me that suggestion?

          require 'sketchup.rb'
          
          module SectionManager
            def self.show_dialog
              dialog = UI::WebDialog.new("Gestione Sezioni", false, "SectionManager", 400, 500, 100, 100, true)
              dialog.set_size(400, 500)
          
              dialog.add_action_callback("toggleSection") do |_, section_id|
                model = Sketchup.active_model
                section = find_section_by_id(model, section_id.to_i)
                if section
                  model.start_operation('Toggle Section', true)
                  section.active = !section.active
                  model.commit_operation
                  puts "Sezione #{section_id} #{section.active? ? 'attivata' : 'disattivata'}"
                else
                  puts "Sezione #{section_id} non trovata"
                end
                update_dialog_content(dialog)
              end
          
              dialog.add_action_callback("activateSection") do |_, section_id|
                model = Sketchup.active_model
                section = find_section_by_id(model, section_id.to_i)
                if section
                  model.start_operation('Activate Section', true)
                  section.active = true
                  model.commit_operation
                  puts "Sezione #{section_id} attivata"
                else
                  puts "Sezione #{section_id} non trovata"
                end
                update_dialog_content(dialog)
              end
          
              dialog.add_action_callback("refreshList") do |_|
                puts "Aggiornamento lista richiesto"
                update_dialog_content(dialog)
              end
          
              update_dialog_content(dialog)
              dialog.show
            end
          
            def self.find_all_sections(entities)
              sections = []
              entities.each do |entity|
                if entity.is_a?(Sketchup::SectionPlane)
                  sections << entity
                elsif entity.is_a?(Sketchup::Group) || entity.is_a?(Sketchup::ComponentInstance)
                  sections += find_all_sections(entity.definition.entities)
                end
              end
              sections
            end
          
            def self.find_section_by_id(model, section_id)
              find_all_sections(model.active_entities).find { |s| s.entityID == section_id }
            end
          
            def self.update_dialog_content(dialog)
              model = Sketchup.active_model
              sections = find_all_sections(model.active_entities)
              puts "Numero totale di sezioni trovate (incluse quelle nidificate): #{sections.length}"
          
              html = <<-HTML
                <html>
                <head>
                  <style>
                    body { font-family: Arial, sans-serif; }
                    .section { margin: 10px 0; }
                    button { margin-left: 5px; }
                  </style>
                </head>
                <body>
                  <h2>Tutte le Sezioni</h2>
                  <div id="sectionList">
                    #{
                      if sections.empty?
                        "<p>Nessuna sezione trovata nel modello.</p>"
                      else
                        sections.map { |section|
                          "<div class='section'>
                            #{section.name || 'Sezione senza nome'} (ID: #{section.entityID})
                            <button onclick='toggleSection(#{section.entityID})'>
                              #{section.active? ? 'Disattiva' : 'Attiva'}
                            </button>
                            <button onclick='activateSection(#{section.entityID})'>
                              Attiva
                            </button>
                          </div>"
                        }.join
                      end
                    }
                  </div>
                  <button onclick='refreshList()'>Aggiorna Lista</button>
                  <script>
                    function toggleSection(sectionId) {
                      window.location = 'skp:toggleSection@' + sectionId;
                    }
                    function activateSection(sectionId) {
                      window.location = 'skp:activateSection@' + sectionId;
                    }
                    function refreshList() {
                      window.location = 'skp:refreshList@';
                    }
                  </script>
                </body>
                </html>
              HTML
          
              dialog.set_html(html)
            end
          end
          
          # Aggiungi una voce di menu per avviare lo script
          UI.menu("Plugins").add_item("Gestione Sezioni (Versione Aggiornata)") {
            SectionManager.show_dialog
          }
          

          puts "Script di gestione sezioni (versione aggiornata) caricato"

          R 1 Reply Last reply 26 Jul 2024, 11:46 Reply Quote 0
          • R Online
            Rich O Brien Moderator @alexpacio2013
            last edited by 26 Jul 2024, 11:46

            @alexpacio2013 SketchUp vanilla does allow you the activate and deactivate sections using Outliner. Mix that with the Entity Info panel to assign sections to tags you have the functionality you need.....mostly.

            Only missing element would be assigning sections to scenes.

            In relation to your AI script failing I would open the console and see what errors are output to give you some hints where it failing.

            But SketchUp does alot of what you are asking out of the box it just uses existing panels that are multipurpose.

            For instance, you can double click a section in the Outliner to activate/deactivate quickly. You can right click it in the Outliner to rename the section or symbol.

            Outliner and Entity info are very powerful tools to select, organise and manage objects in SketchUp.

            Download the free D'oh Book for SketchUp 📖

            A 1 Reply Last reply 26 Jul 2024, 15:36 Reply Quote 0
            • A Offline
              alexpacio2013 @Rich O Brien
              last edited by 26 Jul 2024, 15:36

              @Rich-O-Brien I know many other solutions but They are tricks to get around the problem but the problem remains it is not possible to manage sections scenes in a simple way. It would need a panel to manage the sections anyway thanks for the suggestion.

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              1 / 1
              • First post
                5/6
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement