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!
    Mac User? | Join the Rayscaper Beta for Mac Learn More

    How to locate specific group# in model? [Solution Provided]

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    8 Posts 6 Posters 754 Views 6 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.
    • N
      nickdk
      last edited by

      It might be very simple but I don't know how to find a specific group in my model, I have problems cutting group #94 as it freezes but I don't know which group it is, is it possible to locate the #94 in some clever way? πŸ˜„

      1 Reply Last reply
      Reply Quote 0
      • Dave RD
        Dave R
        last edited by

        It's a shame you weren't using components. You wouldn't have this problem.

        Perhaps one of the Ruby gurus would have a way to determine the group by its number via a bit of code in the Console but it doesn't appear there's any way to identify it from the Outliner or Entity Info.

        Etaoin Shrdlu

        %

        (THERE'S NO PLACE LIKE)

        G28 X0.0 Y0.0 Z0.0

        M30

        %

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

          You can of course manually give your 'unnamed' Groups individual names using 'Entity Info', but the Groups' definitions' names always stay as 'Group#1', 'Group#2' etc.
          If Groups don't have names this "one-liner" will change their names to match their definition-name - then you can use the Outliner to select 'by name'.

          m=Sketchup.active_model;m.start_operation("ReN");m.definitions.each{|d|next unless d.group?;d.instances.each{|g|g.name=d.instances[0].definition.name if g.name.empty?}};m.commit_operation
          

          Copy/Paste all of the code + <enter> into the Ruby Console and then use the Outliner to see/highlight the Group[s] by name.
          It is one-step undo-able in case you mess up...
          IF you want EVERY Group to be renamed [perhaps dangerous?] then remove the text ' if g.name.empty?' from the one-liner, and then all Groups get named after their definition-name - 'Group#1', 'Group#2' etc overwriting any earlier names you might have added manually using 'Entity Info'...
          πŸ€“

          TIG

          1 Reply Last reply
          Reply Quote 0
          • J
            Jim
            last edited by

            You can select the Group in the Outliner window. On Windows, you can limit the visible entities by entering text in the Outliner's filter box.

            Hi

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

              The problem is that unnamed Group all display as 'Group' in the Outliner, so if you get an error referring to a specific Group definition name you have no way of finding it... My snippet changes unnamed Groups names to match their definition so you can then find them in the Outliner because then name==defn.name...

              TIG

              1 Reply Last reply
              Reply Quote 0
              • sdmitchS
                sdmitch
                last edited by

                When I used this code-

                m=Sketchup.active_model;m.start_operation("ReN");m.definitions.each{|d|next unless d.group?;d.instances.each{|g|g.name=d.instances[0].definition.name if g.name.empty?}};m.commit_operation
                

                I got this error-
                Error: #<NoMethodError: undefined method `definition' for #Sketchup::Group:0x834ce04>

                removing the .definition removed the error but did not result in the naming of the groups.

                removing the .instances[0] seemed to work as expected. The final code string was

                m=Sketchup.active_model;m.start_operation("ReN");m.definitions.each{|d|next unless d.group?;d.instances.each{|g|g.name=d.name if g.name.empty?}};m.commit_operation
                

                As an alternative, selecting the offending group will make it easier to find.

                m=Sketchup.active_model;s=m.selection;m.start_operation("sel grp");s.clear;m.definitions.each{|d|  next unless d.group?;if d.name == "Group#94";d.entities.each{|e| s.add e};end;};m.commit_operation
                

                Nothing is worthless, it can always be used as a bad example.

                http://sdmitch.blogspot.com/

                1 Reply Last reply
                Reply Quote 0
                • N
                  nickdk
                  last edited by

                  Thank you very much TIG, I'll test it soon πŸ˜„

                  1 Reply Last reply
                  Reply Quote 0
                  • thomthomT
                    thomthom
                    last edited by

                    d.instances[0].definition.name
                    This line makes little sense. The definition uses an instance of itself to get its definition...

                    It's equal to d.name. And d.name will avoid the error because Group doesn't have .definition.

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply
                    Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better πŸ’—

                    Register Login
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement