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

    [Plugin] Center of Gravity

    Scheduled Pinned Locked Moved Plugins
    183 Posts 41 Posters 297.6k Views 41 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.
    • Dave RD Offline
      Dave R
      last edited by

      I just installed it on my MacBook and tried running it. It worked fine for me. Thank you TIG.

      Etaoin Shrdlu

      %

      (THERE'S NO PLACE LIKE)

      G28 X0.0 Y0.0 Z0.0

      M30

      %

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

        @driven said:

        Error: #<NoMethodError: undefined method db' for CofGravity:Class> /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb:153:in calculate'
        /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb:813

        Have you got deBabelizer.rb in the Plugins Folder ?
        This file is for translation and is used by many of my tools and it ships with each of them - although it's always the same file...
        It should come with the zip and is installed into the same folder as CofGravity.rb ?
        The error is because 'db' which is the local def of deBableizer in the class is failing to get defined...
        πŸ˜•

        TIG

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by

          @tig said:

          Have you got deBabelizer.rb in the Plugins Folder ? :?

          Hi Tig,

          I only installed it to send you a report from another Mac, and am sure I used all of the correct instal procedures.

          your other tools are still working (EEby.., Manifold, Vol..2) , after the CofG_1.2 instal (including deBalelizer.rb)

          after the first (_1.2) Error, I replaced both files with the _1.1 files and had the same error.

          I then tested all in the same drawing
          EEby Rail--worked
          Volume2 --worked
          Manifold --worked
          CofG --same error report (-1.2 re-installed from zip)

          john

          learn from the mistakes of others, you may not live long enough to make them all yourself...

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

            driven

            A mystery... πŸ˜• πŸ˜’

            
            def CofGravity;;calculate ### LINE 129 ==start of class/def that is reporting the error...
            
            def db(string)
              dir=File.dirname(__FILE__)+"/TIGtools"
              toolname="CofGravity" 
              locale=Sketchup.get_locale.upcase
              path=dir+"/"+toolname+locale+".lingvo"
              if not File.exist?(path)
                return string
              else
                deBabelizer(string,path)
              end 
            end#db
            
            if (Sketchup.version.split(".")[0].to_i<5)
                 UI.messagebox(db("C of G; Sorry, this is Version >= 6 Tool !"))
                 return nil
            end#if
            
            model=Sketchup.active_model
            entities=model.active_entities
            
            ############
            if Sketchup.version[0,1].to_i > 6
              model.start_operation((db("C of G")),true)### LINE 153 GIVES ERROR !!!
            
            

            Can you look at the script's contents and see if it looks like this ?
            Works fine on a PC for me - can't see where a Mac might trip up ?
            ❓ ❓ ❓

            TIG

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

              Need to require 'dBabelizer' before you use it.

              Hi

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

                Jim

                That's it ! Thanks.

                Other tools requiring it were masking the fact I missed it out of the initial 'require'... πŸ˜’

                Update on it's way !!!

                TIG

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by

                  that appears exactly the same,
                  the only thing that seems at odds is the syntax colouring for calculate shows it as a variable??
                  I don't know enough to know why, or where to look next

                  this is odd...

                  I'll send this even if the missing "require" is at fault, because I don't understand why one and not the other would be a variable....

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                    Here's v1.3...
                    http://forums.sketchucation.com/viewtopic.php?p=229404#p229404
                    The initial 'require' of deBabelizer was accidentally missed out, but its absence was masked by some other tools loading it anyway so most times it worked anyway...
                    Now it is explicitly called for in the tool... πŸ˜’
                    Sorry for the confusion...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      driven
                      last edited by

                      Same error code, same syntax colouring for line 813

                      seems to have something to do with it...

                      learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                        driven

                        Have you got the recent v1.3, with the require 'deBabelizer.rb' added ?
                        This should fix it ?

                        TIG

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

                          If calculate is a reserved term in Mac Ruby versus PC I'm surprised...
                          You can edit the file and change every ' calculate' to say ' do_calculation' and see if that helps - if so let me know asap πŸ˜• πŸ˜• πŸ˜•

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • D Offline
                            driven
                            last edited by

                            Yes it's v1.3

                            changed to tig_calculate (lines 131, 815)

                            Error; #<NoMethodError; undefined method `db' for CofGravity;Class>
                            /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;155;in `calculate'
                            /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;815
                            

                            but the colour changed

                            learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                              @driven said:

                              Yes it's v1.3
                              changed to tig_calculate (lines 131, 815)

                              Error; #<NoMethodError; undefined method `db' for CofGravity;Class>
                              > /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;155;in `calculate'
                              > /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;815
                              

                              You mustn't have changed them all as it's still calling 'calculate' ?
                              I've redone the original and v1.4 with full 'do_calculation' will be there asap...

                              TIG

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

                                Here's v1.4 http://forums.sketchucation.com/viewtopic.php?p=229401#p229401 with 'calculate' replaced with 'do_calculation' to see if that fixes it - if not I have exhausted all ideas so far !!!

                                TIG

                                1 Reply Last reply Reply Quote 0
                                • D Offline
                                  driven
                                  last edited by

                                  Ok, v1.4

                                  Error; #<NoMethodError; undefined method `db' for CofGravity;Class>
                                  /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;156;in `do_calculation'
                                  /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;816
                                  
                                  

                                  sorry

                                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                                  1 Reply Last reply Reply Quote 0
                                  • GaieusG Offline
                                    Gaieus
                                    last edited by

                                    @tig said:

                                    ...Any more ideas welcome... πŸ˜•

                                    Not yet, TIG - at least not anything that would be clear. I was just thinking aloud and combining my ideas. Maybe when I have already used the plugin for such things.

                                    Thanks anyway!
                                    πŸ˜‰

                                    Gai...

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

                                      Aaaarrrgh... πŸ˜’
                                      BUT as we can all see it is defining db as a method inside the particular class::def and then using it - the way it's used loads of times in other tools too... It works fine on PC so what is so special about a Mac ?
                                      Puzzled... Any Mac scripters have any ideas ??? ❓ ❓ ❓

                                      TIG

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        driven
                                        last edited by

                                        it is in the db method,

                                        I just ran composite on to groups and got this

                                        Error; #<NoMethodError; undefined method `db' for CofGravity;Class>
                                        /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;604;in `composite'
                                        /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb;817
                                        
                                        

                                        learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                                          TIG,

                                          Sorry for the earlier abbreviated message - I got called away from the computer.

                                          I get the following when trying CofG (Version 1.4 here).

                                          QUOTE

                                          Error: #<NoMethodError: undefined method db' for CofGravity:Class> /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb:156:in do_calculation'
                                          /Library/Application Support/Google SketchUp 7/SketchUp/Plugins/CofGravity.rb:816

                                          UNQUOTE

                                          Chris

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

                                            Possibly something to do with the version of Ruby? Macs running Snow Leopard come with a pre-packaged version 1.8.7 of Ruby.

                                            Chris

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

                                            Advertisement