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

    HELP setting up a SU code editor

    Scheduled Pinned Locked Moved Developers' Forum
    97 Posts 11 Posters 6.4k Views 11 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.
    • M Offline
      mattscar
      last edited by

      I agree that a SketchUp IDE would be helpful, even for newcomers, so long as it provides an intuitive UI. I usually use Notepad++, but I wrote an article that presents a simplistic Eclipse plugin that accesses SketchUp.

      The plugin provides syntax coloring and single-click script execution through the SketchUp bridge, but that's about it. If this interests you guys, I'd be happy to add features. The debugger is tough, but it's not impossible.

      Matt

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

        That's an interesting article.

        @unknownuser said:

        You can download Aptana Studio and RadRails, but the installation process is long and complicated. Besides, if you just want a Ruby editor, downloading a 30-day evaluation version of the gigantic Aptana Studio isn't worth it.

        Complicated installation process? And the thing is free. http://www.aptana.org/

        Anyway - are you able to set breakpoints etc in SU plugin scripts and run them from Eclipse?

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

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

          @mattscar said:

          The plugin provides syntax coloring and single-click script execution through the SketchUp bridge, but that's about it. If this interests you guys, I'd be happy to add features. The debugger is tough, but it's not impossible.
          Matt

          Hi matt,

          should I just turn this into a wish list then....

          number 1 for me is Mac compatibility which the now ported, now free Aptana gives me, it also has a quite straight forward, simple ruby editor hidden in there, so can the plug added to it or is it completely separate issue?

          I installed XP Pro sp3 on the Mac last week so I'll have a play with this there before asking to many naive questions, I'm sure requests

          welcome aboard

          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
          • J Offline
            Jim
            last edited by

            Well, the bridge that Matt is using is a Windows-only thing - you'd need to ask TBD about the possibility of porting.

            Hi

            1 Reply Last reply Reply Quote 0
            • tbdT Offline
              tbd
              last edited by

              I am already looking into porting SketchUp Bridge to Mac, but it will take some time as I need to learn the internals of OSX.

              SketchUp Ruby Consultant | Podium 1.x developer
              http://plugins.ro

              1 Reply Last reply Reply Quote 0
              • M Offline
                mattscar
                last edited by

                I could have sworn SketchUp had a socket interface somewhere. If we could send commands reliably over a socket, then the Java interface becomes trivial. And you can use the IDE to access SketchUp on a remote computer.

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

                  Hi all,

                  as your online Matt (and any one else) I'm just trying to combine two rubies to print out a full xml list of my local SU ruby api.

                  I've taken the exporter from tomatoes_export.rb and I'm trying capture the puts from su_api.rb as it loops thru all the rubies on my local SU

                  I haven't got any of it working yet, I only just thought of it ...

                  will it work

                  I guess step 1 is get su_api.rb to loop the list it gathers to ruby console and copy paste the results into excel....

                  I want to add the list to resources template.

                  or is there an easy way to have an introspective, local, platform aware list....

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

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

                    and then I found a test code to try
                    <a class=@Matt is this what you mean?" title="@Matt is this what you mean?" class=" img-fluid img-markdown" />

                    I have no idea what it means, but you probably do...

                    
                    # begin code
                    def socket_listener(v)
                       puts "r;#{v.inspect}"
                       if v == "Connection closed"
                          p SKSocket.disconnect
                       end
                    end
                    
                    puts "Connecting..."
                    p SKSocket.connect "google.com", 80
                    puts "Done."
                    
                    puts "adding listener..."
                    p SKSocket.add_socket_listener { |e| socket_listener(e) }
                    puts "Done."
                    
                    puts "Writing..."
                    p SKSocket.write("HEAD / HTTP/1.1\n\n")
                    
                    # end code
                    

                    thank you goes to Dr. YSG (ygut...@gmail.com)

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

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

                      @driven said:

                      or is there an easy way to have an introspective, local, platform aware list....

                      Of all the .rb/.rbs files in the Tools/Plugins file heirarchy ?

                      .. or the objects they create, ie: Classes / Modules / Methods, etc. ??

                      I'm not here much anymore.

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

                        like this

                        this is what my mac can find [in open SU], I went through manually, there's a few I don't recognise, and aren't on API Doc

                        what does #arity mean??

                        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
                        • J Offline
                          Jim
                          last edited by

                          arity is the number of arguments a method accepts

                          def my_method(a, b) has arity of 2.

                          Introspection is possible. I built these charts using the same idea:
                          http://sketchuptips.blogspot.com/2008/08/sketchup-ruby-api-class-diagrams.html

                          But the introspection sometimes gives you bad information - look at the MaterialsObserver methods from your own list, and compare them to the names in the API docs. Maybe it's just exposing a buggy API. At any rate, the MatsObs is the only one I know for sure is returning bogus method names.

                          I believe that socket code snippet is mine. I used it to get Lego inventories from sites like peeron.com, and build a Component inventory. It is not officially supported and so there's no guarantee it will be around in the next version. But it's fun to play with.

                          Hi

                          1 Reply Last reply Reply Quote 0
                          • chrisglasierC Offline
                            chrisglasier
                            last edited by

                            @driven said:

                            what does #arity mean??

                            disappointingly - the number of arguments - but I don't know what the -1's mean on your list.

                            With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

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

                              hi Jim,
                              thanks for the clear answer
                              the SLSocket doesn't show up at all on XP [on the same Mac] and I haven't gone through the methods on it yet,

                              I really need to mod the script to generate the full list automatically, so I can compare with 3 other Macs with different versions of Ruby etc and with and without scripts,

                              I thought I recognised at least one of TIG's, but there's other at last ones that aren't on the API as well.

                              I take a look at your list in the morning...

                              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
                              • Dan RathbunD Offline
                                Dan Rathbun
                                last edited by

                                An old post on SkSocket at over at GG.
                                http://groups.google.com/group/sketchupruby/browse_frm/thread/0b81977cc5d795ba#

                                I'm not here much anymore.

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

                                  cheers Dan,

                                  I found that earlier and followed the links to the test script I ran.

                                  I posted the results because I don't how to interrupt the output, although it did show me a potentially 'protected' name, that's used in a script that just won't run on OSX on my Mac, but will on XP [same mac]

                                  SKSocket doesn't show up under XP....

                                  john

                                  @ Jim, had a look at the charts, very nice

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

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

                                    @driven said:

                                    @ Jim, had a look at the charts, very nice

                                    @ JIM .. dittos from me. I'd like some that we're left right hierachry, tho.

                                    I'm not here much anymore.

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

                                      @chrisglasier said:

                                      @driven said:

                                      what does #arity mean??

                                      disappointingly - the number of arguments - but I don't know what the -1's mean on your list.

                                      "For methods written in C, returns -1 if the call takes a variable number of arguments."
                                      http://www.ruby-doc.org/docs/ProgrammingRuby/html/ref_c_method.html#Method.arity

                                      I'm not here much anymore.

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

                                        @driven said:

                                        SKSocket doesn't show up under XP....

                                        Nor does:
                                        class Sketchup::Geodesic

                                        I have module Precision, but not the 3 methods your list shows.

                                        I cant find (mix-in) module Smoothable (is this a plugin?)

                                        None of the DC classes or modules are on your list.

                                        The following classes, don't have prototypes defined (BUT SHOULD!):
                                        UI::InputPoint [*no-proto]
                                        UI::Menu [*no-proto]
                                        UI::PickHelper [*no-proto]
                                        UI::Tool [*no-proto]

                                        Sketchup::FrameChangeObserver [*no-proto]

                                        And then the standard extensions:
                                        LanguageHandler ( should be moved to -> UI::LanguageHandler )
                                        SketchupExtension (should be moved to -> Sketchup::Extension)

                                        P.S. - I accidently opened your list in ol' plain Notepad and it of course could not handle the EOLs.
                                        But when I opened it in Notepad++ no problem, and the app automatically switched to UNIX EOLs for that 1 file tab.

                                        I'm not here much anymore.

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

                                          I write my plugins in ASCII - since Ruby 1.8 only deals with ASCII. Despite the data from SU comes in as UTF-8.
                                          I tried with UTF-8 at one point and got errors...

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

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

                                            @dan rathbun said:

                                            @driven said:

                                            SKSocket doesn't show up under XP....

                                            Nor does:
                                            class Sketchup::Geodesic
                                            only if you don't have Geodesic.rb instaled BEFORE loading suapi.rb

                                            I have module Precision, but not the 3 methods your list shows.
                                            that one may be a Mac thing, I need to automate my process, you'll see why...

                                            I cant find (mix-in) module Smoothable (is this a plugin?)
                                            [balso, only if you don't have Geodesic.rb instaled BEFORE loading suapi.rb[/b]]

                                            None of the DC classes or modules are on your list.
                                            I don't have Pro installed

                                            The following classes, don't have prototypes defined (BUT SHOULD!): why???
                                            UI::InputPoint [*no-proto]
                                            UI::Menu [*no-proto]
                                            UI::PickHelper [*no-proto]
                                            UI::Tool [*no-proto]
                                            Not sure what you mean here, but it may come to me if they suddenly turn up

                                            Sketchup::FrameChangeObserver [*no-proto]
                                            Is this a Pro thing?

                                            And then the standard extensions:
                                            LanguageHandler ( should be moved to -> UI::LanguageHandler )
                                            SketchupExtension (should be moved to -> Sketchup::Extension)
                                            possibly Mac thing, but are you see the pattern emerging?

                                            P.S. - I accidently opened your list in ol' plain Notepad and it of course could not handle the EOLs.
                                            But when I opened it in Notepad++ no problem, and the app automatically switched to UNIX EOLs for that 1 file tab.
                                            all the at last and google rubies are (UTF8),but sometimes other plugins arn't

                                            Basically, it seems suapi.rb could be the basis for a de-bugger,
                                            if it's loaded without any plugins you will get a snapshot of YOUR setup's usable content,
                                            if you than add the atLast/Google 'advanced' rubies
                                            if you than add 'PRO' you will get an 'advanced' 'PRO' snapshot of YOUR 'advanced PRO' setup.

                                            Then, if we all collate our reports, we would have a three stage baseline of what actually is installed on Mac's,PC,Linux,Chrome.....

                                            and this could be used as the library in the editor for targeting ruby's to 'levels of set-up' or at least a 'Basic SetUp' requirement comment on a script...

                                            I know there other factors, but we can test against installed version of Ruby as well as other

                                            this would certainly help de-bugging, wouldn't it?

                                            I've got a folder with a basic set of rubies I found make a difference, and a manual process to go with it, anyone want meto post it?

                                            Not for the faint hearted, but shouldn't do any damage?

                                            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
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 1 / 5
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement