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!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    [Ruby] Help - Sometimes a group, sometimes not.

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 5 Posters 902 Views 5 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.
    • thomthomT
      thomthom
      last edited by

      Have you asked them to keep the Ruby Console open and report back any messages that might appear?

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

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

        The problem for me was line 40, grp_ents = group.definition.entities. Components have definitions but groups do not even though they may appear in the definitions list. Changing the statement to grp_ents = group.entities allowed the plugin to run.

        Also Ruby doesn't like spaces in from of '(' so all of the Geom::Point3d.new (...) should have the space removed.

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

        http://sdmitch.blogspot.com/

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

          group.definition.entities the API doesn't provide group.definition. However, some plugins have added this shortcut method - which is why it works.

          There are ways to get the group definition - but you don't need that.

          Replace group.definition.entities with group.entities.

          There would be errors pointing out that group.definition was not a valid method if the users had the Ruby Console open.

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

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

            @sdmitch said:

            Components have definitions but groups do not even though they may appear in the definitions list.

            Groups do have definitions - but they lack the method to obtain it in the same way as component instances.

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

            1 Reply Last reply
            Reply Quote 0
            • T
              Trogluddite
              last edited by

              @thomthom said:

              have you asked them to keep the Ruby Console open and report back any messages that might appear?

              [FacePalm] 😳
              Thanks for the prod, ThomThom - why is it always the most obvious things that I forget?! More caffeine required, I think!

              And many thanks to you and sdmitch 😄
              I still can't believe how fast those "reply to your post" e-mails go 'ping, ping, ping', I barely had time to make a coffee!

              Indeed, now that I look at the API docs again, I see my schoolboy error. I started out using a component, and then decided to change to a group to avoid browser clutter - lazy bones using find/replace instead of RTFM!!

              "Check the console, check the console, check the console, check...... " 😉

              1 Reply Last reply
              Reply Quote 0
              • BoxB
                Box
                last edited by

                I don't understand anything anyone has written in this thread so I can't tell if you solved it but this is the error I get if you want it.

                @unknownuser said:

                Error: #<NoMethodError: undefined method definition' for #<Sketchup::Group:0x91d8c20>> C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/Tile Grid.rb:40:in add_tile_grid'
                C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/Tile Grid.rb:80
                C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/Tile Grid.rb:40:in `call'
                C:/Program Files (x86)/Google/Google SketchUp 8/Plugins/Tile Grid.rb:40

                1 Reply Last reply
                Reply Quote 0
                • T
                  Trogluddite
                  last edited by

                  PS) And thanks to Dan Rathburn too - I was just reading his excellent advice on catching errors inside an undo commit operation when those replies came in. So now I can make invalid input values behave more robustly too!
                  Oh, what a grand place this is! 🎉

                  1 Reply Last reply
                  Reply Quote 0
                  • T
                    Trogluddite
                    last edited by

                    @box said:

                    this is the error I get if you want it

                    Thanks - yes, that would have told me just what I needed to know, if only I had had the good sense enough to ask!
                    Fixed version now popped backed into the original thread, with thankyou's all round!

                    1 Reply Last reply
                    Reply Quote 0
                    • Dan RathbunD
                      Dan Rathbun
                      last edited by

                      @trogluddite said:

                      ... So now I can make invalid input values behave more robustly too! ...

                      Look at the global inputbox() method in "Tools/sketchup.rb"

                      It is an [simple] example of using Ruby's retry keyword to force valid input.

                      (Although it really should not have been made a global method, .. but that's an old peeve. It would be better to copy it into your own module namespace.)

                      I'm not here much anymore.

                      1 Reply Last reply
                      Reply Quote 0
                      • T
                        Trogluddite
                        last edited by

                        Thanks Dan, I'll go check that out.

                        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