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

Ruby console intruder

Scheduled Pinned Locked Moved Developers' Forum
11 Posts 6 Posters 1.8k Views
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.
  • E Offline
    Edson
    last edited by 18 Jan 2008, 09:43

    i have just downloaded and installed 6.4.120 in one of my machines to see if it runs ok. just at startup it greets me with the ruby console. i know it is telling me there is a problem to be solved but what exactly? and why should be me the one to fix it? see pict attached.

    thanks for any help.


    ruby_console.png

    edson mahfuz, architect| porto alegre • brasil
    http://www.mahfuz.arq.br

    1 Reply Last reply Reply Quote 0
    • G Offline
      Gaieus
      last edited by 18 Jan 2008, 09:51

      This should go to the ruby discussions, Edson, I believe - you'd most probably get an answer quicker. If you think I can move - or as an admin, you can move it yourself...

      Gai...

      1 Reply Last reply Reply Quote 0
      • E Offline
        Edson
        last edited by 18 Jan 2008, 12:34

        yes, sure.

        edson mahfuz, architect| porto alegre • brasil
        http://www.mahfuz.arq.br

        1 Reply Last reply Reply Quote 0
        • T Offline
          todd burch
          last edited by 18 Jan 2008, 13:03

          The author of the script trim_extend.rb, on line #96, used some ruby syntax that generates a warning. It won't affect the operation of the script, per se. That's the first message.

          The rest of the messages are "garbage" debugging messages the author of a script (not necessarily trim_extend, but that's very suspect), left in the source code that should be cleaned up and removed.

          Todd

          1 Reply Last reply Reply Quote 0
          • A Offline
            azuby
            last edited by 18 Jan 2008, 14:06

            ... and be careful with String methods:

            (eval);217; warning; string pattern instead of regexp; metacharacters no longer effective
            

            Would be possible to overwrite the String methods, converting String arguments to Regexp objects. If anyone is interested ...

            Printing out "'garbage" debugging messages' without having $DEBUG enabled shouldn't be done. We all know, that the Ruby console is a time consumer because of it's auto-scrolling.

            azuby

            *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

            Bad English? PM me, correct me. :smile:**

            1 Reply Last reply Reply Quote 0
            • E Offline
              Edson
              last edited by 18 Jan 2008, 14:27

              hi azuby,

              but how do i get rid of the annoying intrusion?

              edson mahfuz, architect| porto alegre • brasil
              http://www.mahfuz.arq.br

              1 Reply Last reply Reply Quote 0
              • A Offline
                azuby
                last edited by 18 Jan 2008, 15:15

                It's just a warning, not an error, so it isn't critical. You can edit line 96 of trim_extend.rb on your own. I think, there you will have a statement formated like this:

                foo bar baz
                

                You need to edit it to

                foo bar(baz)
                

                or

                foo(bar(baz))
                

                . Or just write the line down here and we'll correct it.

                The other garbage ... well it's not easy to find where it comes from if you have lots of Ruby scripts in your Sketchup folders. In "Tools/sandboxtools.rb" you can find some statements, lines 31, 36, 40, 44 beginning with "puts" Behind the statement you can write

                if $DEBUG
                

                The other thing with "dirs=" you can find in "Tools/totd.rb", line 86. Put the same string behind the statement.

                azuby

                *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

                Bad English? PM me, correct me. :smile:**

                1 Reply Last reply Reply Quote 0
                • F Offline
                  fredo6
                  last edited by 18 Jan 2008, 20:57

                  Can someone check if Sketchup changed the version of the Ruby Interpreter (normally 1.8), because these messages maybe a sign of an evolution on the Ruby side.

                  1 Reply Last reply Reply Quote 0
                  • E Offline
                    Edson
                    last edited by 19 Jan 2008, 12:36

                    thanks, azuby. i'll try it and let you know what happened.

                    just to make sure i get it right (being english not my native language): when you say behind the statement are you saying before it?

                    regards.

                    edson mahfuz, architect| porto alegre • brasil
                    http://www.mahfuz.arq.br

                    1 Reply Last reply Reply Quote 0
                    • T Offline
                      TIG Moderator
                      last edited by 19 Jan 2008, 12:39

                      This error occurs on lines 47, 48, 95 and 96. It's because there's a method that has a variable sent to it and there's a white-space gap between them, thus [I've put a ' ^ ' where the gap is as a single space isn't too clear in the text used for 'code' here...]:

                      do_something ^ (with_this)
                      

                      rather than the faultless:

                      do_something(with_this)
                      

                      The lines read:

                      
                      47  d1=(pt1.position.distance (ext1[0])).to_f if ext1 != nil
                      48  d2=(pt2.position.distance (ext2[0])).to_f if ext2 != nil
                      95  d1=(pt1.position.distance (ext1[0])).to_f if ext1 != nil
                      96  d2=(pt2.position.distance (ext2[0])).to_f if ext2 != nil
                      
                      

                      The lines should read:

                      
                      47  d1=(pt1.position.distance(ext1[0])).to_f if ext1 != nil
                      48  d2=(pt2.position.distance(ext2[0])).to_f if ext2 != nil
                      95  d1=(pt1.position.distance(ext1[0])).to_f if ext1 != nil
                      96  d2=(pt2.position.distance(ext2[0])).to_f if ext2 != nil
                      
                      

                      It relatively easy to change them using Notepad.exe to edit the text... Make each of the four 'distance (' into 'distance('

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        azuby
                        last edited by 19 Jan 2008, 14:23

                        "Behind": Change

                        puts "foo"
                        

                        to

                        puts "foo" if $DEBUG
                        

                        The other way would be:

                        if $DEBUG
                          puts "foo"
                        end
                        

                        This also would be possible 💚 :

                        puts "foo" unless !$DEBUG
                        

                        @Fredo6
                        They still have Ruby 1.8.0 implemented since ... don't know - maybe Sketchup 4?

                        azuby

                        *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SU²CATT

                        Bad English? PM me, correct me. :smile:**

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        1 / 1
                        • First post
                          3/11
                          Last post
                        Buy SketchPlus
                        Buy SUbD
                        Buy WrapR
                        Buy eBook
                        Buy Modelur
                        Buy Vertex Tools
                        Buy SketchCuisine
                        Buy FormFonts

                        Advertisement