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

    [Plugin] Select component instances on right click

    Scheduled Pinned Locked Moved Plugins
    28 Posts 16 Posters 33.9k 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.
    • C Offline
      confitex architure
      last edited by confitex architure

      Hi there,

      You'll find a short .rb files that select component instances on the fly.
      You just have to select one or more different components one your model, right click and choose "Select Instances" on the drop down menu.
      I tought it would be faster to attach this plugin on this drop down menu.
      Rather than to go on your "Component window" with this bunch of compo, and hunt for the one you need to select in the entire model, this plugin should simplify.

      NEW Version 2:
      This new version includes a new function that is "Select Families" on right click.
      A family would be a bunch of components that were created by making a parent compo unique.
      Every component name that begins with the same name before the '#' will be considered as part of the family. Capisci? 😎

      So just create a component, copy it a couple of time, make one of the instance unique, select any of the created component and right click "Select families".

      Enjoy!


      select_instancev2.rb

      1 Reply Last reply Reply Quote 0
      • K Offline
        kwistenbiebel
        last edited by

        That is really handy!

        Thank you very much.

        1 Reply Last reply Reply Quote 0
        • Didier BurD Offline
          Didier Bur
          last edited by

          Hi,

          Very handy. May I suggest to change last line of the script

          file_loaded "fr_cleanup.rb"
          

          to

          file_loaded "select_instance.rb"
          

          and it would be nice to have the option in the context menu ONLY if selection is not empty AND all objects selected are components.

          For instance, the following function should do it:

          
          def compos_valid_selection
          s=Sketchup.active_model.selection
          return false if s.empty?
          types=[]
          s.each { |e| types.push(e.typename) }
          types.uniq!
          return false if types.length != 1
          return false if types[0]!= "ComponentInstance"
          return true if types[0]== "ComponentInstance"
          end
          
          

          Then in the menu definition:

          
          UI.add_context_menu_handler do |menu|
            if compos_valid_selection
            menu.add_separator
            menu.add_item("Select Instances") { select_component_instance }
            end
          end
          
          

          Regards,

          DB

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

            The new version (v2) has been posted!
            See above.

            1 Reply Last reply Reply Quote 0
            • boofredlayB Offline
              boofredlay
              last edited by

              Thank you very much.

              http://www.coroflot.com/boofredlay

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

                I have just tried with simple component. Copied it couple of times and make one unique. Went into component and changed colour of the group (also made unique). In the context menu I have "select instances" but not "select families". I have installed the version 2 from the top of this tread.
                Thanks

                1 Reply Last reply Reply Quote 0
                • R Offline
                  RickW
                  last edited by

                  Wow, I need to do more marketing! Instances has been available at Smustard for a couple of years, now. 😄

                  You've added some nice additional functionality.

                  RickW
                  [www.smustard.com](http://www.smustard.com)

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

                    @rickw said:

                    Wow, I need to do more marketing! Instances has been available at Smustard for a couple of years, now. 😄

                    You've added some nice additional functionality.

                    Oops, I wish I could know this a couple of years ago 😕
                    Thanks Rick!

                    1 Reply Last reply Reply Quote 0
                    • W Offline
                      watkins
                      last edited by

                      Dear Rick,

                      I have been using your script for quite a while now, and find it very useful. Particularly for making arrays of holes. I draw the first circle on the surface and then make it a component - say Hole_1. I then use move and copy to array the component on the surface. Then I select one of the hole components and go to "select instances". I then explode the components which makes all the circles sink nicely into the surface (no need to trace over circles). This is followed by the push/pull tool to drive the holes through the component (double click if uniform thickness).

                      Thanks once again.

                      Regards,
                      Bob

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

                        OK found the culprit. Did not remove old selectinstance.rb. Now have the select families and it works like charm.... Thanks for very useful script.

                        Coen 😄 did not get your comment.

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

                          Would it be possible to change the script so that it don't select instances that are hidden, or instances that are on a hidden layer ?

                          Just an idea, don't know if others have this need 😄

                          Thanks
                          Jorgensen

                          sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

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

                            @jorgensen said:

                            Would it be possible to change the script so that it don't select instances that are hidden, or instances that are on a hidden layer ?

                            Yes it is. It's even far better. The link on the first post has been refreshed

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

                              @sepo said:

                              I have installed the version 2 from the top of this tread.
                              Thanks

                              Hi sepo, What are the name of your instances? select instances only works when components are selected, no groups allowed in the selection set.
                              Are you sure you've deleted the first version of the plugin?

                              1 Reply Last reply Reply Quote 0
                              • M Offline
                                Morpeth
                                last edited by

                                very impressed.

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

                                  Doesn't work for me for the Families.

                                  If I select either a unique component version or the original component, right-click, choose Families from the menu the result is that the geometry is DESELECTED.

                                  I copied the script at the top of the posting 31 May 08 (a.m.).

                                  Also, note that the there are two .rb's listed in the script, one with "v2", the other without.

                                  John | Illustrator | Beaverton, Oregon

                                  1 Reply Last reply Reply Quote 0
                                  • 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
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement