sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Auto make multiple group or component

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    24 Posts 16 Posters 20.2k 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.
    • K Offline
      Kenny
      last edited by

      I've just tried this on SketchUp 2015 and I get the attached error. Does it work on 2015?

      If it's not 2015 compatibility at issue then it could be encoding. I created the file in Notepad, which I've also attached. I chose UTF8 encoding however I couldn't see an option for "without-BOM [Notepad++.exe encoding>convert option]". I'm not familiar with coding so I don't really know what this is.

      Tig, Ideally it would be good to have this as a standard plugin which could be autoinstalled. πŸ˜„


      Auto multiple component error.jpg


      TIG-selected_connected_into_components.rb.txt

      http://www.townscapesolutions.co.uk/

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

        Use Notepad++ to convert the file's encoding to UTF-8_without_BOM and save it.
        It IS a standard encoding format in the list.
        That is the encoding format required in > v2013, it also works in earlier versions.

        Attached is the converted .rb, BUT please check how to do it yourself...TIG-selected_connected_into_components.rb

        To make it easily installable simply ZIP the RB fie, then rename the file-type suffix from .zip to .rbz...
        Again I have attached one, BUT once again, please check how to do it yourself...TIG-selected_connected_into_components.rbz

        TIG

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

          Thanks TIG that's great. The problem was that I was using Microsoft Notepad and not Notepad++ which I had to download.

          Regarding the installable file, does it create a menu item anywhere? I can't see any. It would be good if you could select the geometry, then either right click or click a menu item under Extensions which would make the multiple components, rather than having to paste into the Ruby console each time. It's no big deal however as the fact that I can do it all is a massive time saver, so thanks again for creating it.

          http://www.townscapesolutions.co.uk/

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

            If you read the usage it runs from the Ruby Console with TIG.selected_connected_into_components
            It's easy enough to add a menu item...
            Edit the file using Notepad++ and at near start find module TIG
            Immediately after it, insert these new lines.

            unless file_loaded?(__FILE__)
              UI.menu("Plugins").add_item("TIG.selected_connected_into_components"){self.selected_connected_into_components()}
              file_loaded(__FILE__)
            end
            

            Save it and restart SketchUp to reload...

            TIG

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

              Excellent, thanks again TIG.

              http://www.townscapesolutions.co.uk/

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

                thank you TIG.. but in my case i want to group every face in the model.

                for example: i have 63 face in a sofa model. i want 63 seperate group/component in one click.

                for your ruby script, it only make component touching all faces.

                how can i achieve that?

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

                  @fender

                  Copy+Paste the one-liner below into a Notepad++ file.
                  The reason for that is so you can edit the start part n="???", this sets the name of each group Face#1, Face#2 etc... If you are processing several parts it might be useful to have differing names ? They list in the Outliner in alphanumerical order.

                  Select what you want to separate into groups - only faces are processed so no need to be too careful, just ensure the faces you want to group are included.

                  Copy all of the text.
                  Open the Ruby Console.
                  Paste the text.
                  Press <enter>.

                  Now all selected faces are made into separate groups.
                  It is one step undo-able...

                  n="Face";m=Sketchup.active_model;s=m.selection;fs=s.grep(Sketchup;;Face);s.clear;a=m.active_entities;m.start_operation("~",true);fs.each_with_index{|f,i|g=a.add_group(f);g.name="#{n}##{i+1}"};m.commit_operation
                  

                  TIG

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

                    @TIG

                    it works perfectly!! thank you so much! you save my day

                    1 Reply Last reply Reply Quote 0
                    • ssokolS Offline
                      ssokol
                      last edited by

                      great thanks!!!

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

                        Great plugin!
                        Saved my time for hundreds of separated objects to group/component!
                        Thanks!

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

                          Took me a few goes to get it running but got there! This is just what I needed. Huge thanks, Tig.

                          1 Reply Last reply Reply Quote 0
                          • maxhouserocksM Offline
                            maxhouserocks
                            last edited by

                            this is such a great time saver for tricky situations. thanks!

                            Has this ever been officially made into a plugin for the masses?

                            thanks,
                            bob

                            Robert A. Christman
                            http://rachristman.blogspot.com/

                            1 Reply Last reply Reply Quote 0
                            • O Offline
                              Ozansahin
                              last edited by

                              Hello;

                              I've tried several times but it doesn't work. I don't understand where is my fault 😞.
                              I cannot see any shortcut 😞

                              I use SU 17 thanks for helping

                              1 Reply Last reply Reply Quote 0
                              • jujuJ Offline
                                juju
                                last edited by

                                @ozansahin said:

                                I use SU 17 thanks for helping

                                fix it in your bio (currently showing SU8) then you wouldn't have to remember to type it

                                Save the Earth, it's the only planet with chocolate.

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

                                  It works perfectly. your are god TIG

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

                                    hello,

                                    I am looking to generate Groups instead of Components as output, also sometimes the components generated by the script are pieces of the same whole element, for example a chair is autogenerated in components separately by each leg, arm, rest but all of them must be the same group. It is like a nested components

                                    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