sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [Plugin] Select component instances on right click

    Scheduled Pinned Locked Moved Plugins
    28 Posts 16 Posters 34.3k Views 16 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.
    • JClementsJ Offline
      JClements
      last edited by

      This is a copy of part of the script's code. See the reference to the .rb in the 1st and last line:

      @unknownuser said:

      if (not file_loaded?("select_instance.rb") )
      UI.add_context_menu_handler do |menu|
      if compos_valid_selection
      menu.add_separator
      menu.add_item("Select Instances") { select_component_instance }
      menu.add_item("Select Families") { select_component_made_unique }
      end
      end
      end

      file_loaded "select_instancev2.rb"

      Attached is a test file. Now when I run the script, choosing Select Families recogizes a family component and selects one family instance.

      Try right-clicking on each component instant and the choose Select Families; for me the resulting selection always changes to Object B. Is the script intended to work or is it supposed to select all family instances at once?


      Instances.skp

      John | Illustrator | Beaverton, Oregon

      1 Reply Last reply Reply Quote 0
      • C Offline
        confitex architure
        last edited by

        Hi John,
        I don't understand what's wrong with the list. Do you mean in your plugins folder? You should erase the former version, the one without the "v2", from this folder.
        I tried again and again and everything is ok on my side. What are the name of your components ?

        1 Reply Last reply Reply Quote 0
        • C Offline
          confitex architure
          last edited by

          Hi John,

          @unknownuser said:

          Is the script intended to work or is it supposed to select all family instances at once?
          ❗

          it has been fixed (DL on the first post)

          1 Reply Last reply Reply Quote 0
          • JClementsJ Offline
            JClements
            last edited by

            Thank you.

            John | Illustrator | Beaverton, Oregon

            1 Reply Last reply Reply Quote 0
            • A Offline
              Abdullah
              last edited by

              Hi,
              I want to select multiple components with similar definition names (like "compo" and "comp#1") in the entire Model. It means, it means not only those inside the selected object, but also the others ones which are inside other objects.

              I have the following plugins:
              [] "Selection Toys", which selects components from everywhere, but only those with same name.
              [
              ] "Select Instances", which selects component families with similar names (like "compo" and "comp#1"), but only inside the selected object and not everywhere.

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                Take care making selection sets that span different contexts - you can Bugsplat it you try to manipulate them !
                To select instances of similar named definitions this will work

                n="match";m=Sketchup.active_model;s=m.selection;s.clear;m.definitions.each{|d|s.add d.instances if d.name=~/#{n}/}
                

                Change the string 'match' within the "" to the pattern match you want - I suggest that you read-up of pattern-matching - e.g. n="[Cc]at" finds all definitions like 'Cat', 'cat1', 'tomcat', whereas anchoring the pattern to the start/end like this n="^[Cc]at" only matches 'Cat and 'cat1', or n="m[Cc]at$" to only matches '#tomcat' and 'TomCat'...

                TIG

                1 Reply Last reply Reply Quote 0
                • A Offline
                  Abdullah
                  last edited by

                  It didn't work first, because there was a "$" in the string (it looked like "abc$match"), so took only the part after "$" (and it looked like "match")and it work well. Thank you very much.

                  By the way, are there any "good" Sketchup Ruby Tutorials/Books for Beginners? I would really like to learn it.

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    @abdullah said:

                    It didn't work first, because there was a "$" in the string (it looked like "abc$match"), so took only the part after "$" (and it looked like "match")and it work well. Thank you very much.
                    By the way, are there any "good" Sketchup Ruby Tutorials/Books for Beginners? I would really like to learn it.
                    Look for Automatic Sketchup - as a pdf or a to-buy hard-copy.
                    There are also several other links in the "developers' forum"...
                    If you place a $ at the very end it says the pattern ends there.
                    If you want to search for a '$' inside the text escape it '$'; same with the '^' which marks the very beginning.
                    Here's a short guide to pattern matching... http://www.tutorialspoint.com/ruby/ruby_regular_expressions.htm

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      John_C
                      last edited by

                      That's great, thanks ... πŸ˜„

                      1 Reply Last reply Reply Quote 0
                      • F Offline
                        fullyfledgeded
                        last edited by

                        Hi, Is there any way of selecting component families even if they are in groups or nested within other components? The only way i can get it to work with this plugin is if i explode until all desired components are no longer grouped or component nested.

                        1 Reply Last reply Reply Quote 0
                        • F Offline
                          fullyfledgeded
                          last edited by

                          Thanks TIG and Abdullah for sorting out a that code πŸŽ‰ I was frantically, searching the forum for a solution that i missed this code.

                          Alot of my component instances, have annoyingly renamed, with #1, #2 etc added to them, ultimately creating new component definitions, increasing file size 😠

                          now that i can select multiple instances at once, I can replace them with one component definition.

                          However I still don't why this is happening, other people have this problem too:

                          http://sketchucation.com/forums/viewtopic.php?f=15&t=22523

                          might start a new post to see if there is any more info

                          cheers

                          1 Reply Last reply Reply Quote 0
                          • S Offline
                            smicha
                            last edited by

                            Great plugin. Thanks

                            1 Reply Last reply Reply Quote 0
                            • S Offline
                              Sir
                              last edited by

                              fantastic plugin. extremely useful.

                              thanks

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

                              Advertisement