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

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.
  • T Offline
    thomthom
    last edited by 23 Mar 2010, 15:13

    @chris fullmer said:

    I have to admit that I do not understand what an IDE does over just using Notepad++ to write scripts? What is all this extra functionality that we keep talking about?

    Chris

    IDE usually allow you to hook a debugger to your code, so you can set breakpoints and step through code, evaluate variable values live and profile your code to find where the choking points are.
    They also usually keep track of your methods and classes which will appear in lists - and the better ones extract your documentation comments so when you start typing the name of a method you defined the auto-complete will suggest your own methods (not just the standard ruby ones) and also display your own documentation comments.
    And lots more in terms of keeping track of your files etc. Usually more useful for larger projects - but I have some plugins where I'd really like an intelligent IDE instead of just simple syntax colouring.

    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 23 Mar 2010, 15:51

      @chris fullmer said:

      just using Notepad++ to write scripts?
      Chris

      my recent endeavors to find the mysterious Mac 'bug' that appears to affect some scripts and not others and some Macs and not others, led me to a number of blogs about MS'Dos' debris causing issues, when I cleaned and reformatted using Unix Line Delimiters as suggested (as apposed to PC or Mac specific) some of the script worked without additional work, while there seemingly identical originals still didn't...

      So I started looking for a powerful cross platform alternative to what I was using and free, open-source seemed sensible.

      the problem lays in setting them up so they are as easy to use as the less complex ones when starting out, but are readily expanded as you pick up, mix in other languages etc...

      This appears to meet my criteria, but maybe I should have an easy start list at the top of the thread that can be added to over time??

      Give it a go, my first tip is Download Studio first, then let it download Rad Rails, which also contains RUBY, then set ruby prefs from there.

      @Martin-is this what you mean?http://www.vimeo.com/6885985

      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
        Dan Rathbun
        last edited by 23 Mar 2010, 22:35

        @driven said:

        ... when I cleaned and reformatted using Unix Line Delimiters as suggested (as apposed to PC or Mac specific) some of the script worked without additional work, while there seemingly identical originals still didn't...

        So Notepad++ has 3 options for EOL (which is apparentley auto set on install for the platform the user is on.) On my PC, it was set to 'Windows'.

        The other options are 'Mac' and 'UNIX'.

        IF UNIX EOLs work on Mac, how does it work for Ruby on a PC??

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by 23 Mar 2010, 23:13

          @dan rathbun said:

                  IF UNIX EOLs work on Mac, how does it work for Ruby on a PC??
          

          That I don't know, I was attempting to modify PC rubies to work on the Mac.... although I did send a couple back to one developer who then ran them on his PC... be handy if they do, I suppose one way to check is if you switch coding on something known to work on your PC and see if it still does... I'm by no means saying that notepad causes all problems, or that changing encode is a miracle cure, but it seems that it is capable of producing errors, and is probably a good place to start when debugging , it's easy.....

          Have you had a look at this editor/IDE?

          john

          PS, I've also set up SU on XP pro SP3 on one mac, but as it unix under the skin it may not be the best test bed...

          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
            Dan Rathbun
            last edited by 24 Mar 2010, 00:17

            Well being a Mac guy.. be careful here:

            Notepad is a crappy plain jane text editor that comes with Windows; and is even known to screw up files made for windows.

            Notepad++ is a full featured code editor based on the Scintilla core (which is cross-platform.) I just don't know anyone's ever compiled a Mac version.

            Haven't had time to look at that editor, I'm happy with Notepad++ as an editor, that can be expanded with plugins. (such as a console, debugger interface etc.)

            The problem is not a lack of editors or IDEs, or even those that work with Ruby,.. it's that Sketchup does NOT use standard Ruby. The answer is to get both Sketchup and an IDE to be using (or acceesing,) the same instance of Ruby. We don't have a choice NOW, because it's Sketchup that loads the Ruby instance, and into that instance is where Sketchup loads it's API extensions.

            I WISH for the future, that the Google Team can be convinced to let us have more control over Ruby.

            • A configure setting where WE tell Sketchup the location and name of the Ruby Interpreter binary (so it can be pointed to the standard Ruby bin directory of whatever version we want to run or test.)* The option to load the SU API extensions into a Ruby Process that is already running, and started by the user, or the IDE, rather than Sketchup. (Hoping here that when SU crashes, it doesn't take Ruby down with it.)

            I'm not here much anymore.

            1 Reply Last reply Reply Quote 0
            • M Offline
              MartinRinehart
              last edited by 24 Mar 2010, 14:33

              @dan rathbun said:

              I'm happy with Notepad++ as an editor,

              It's really strong with HTML and JavaScript, but pretty weak on Ruby. Minimal coloring, only a faint try at matching begin/end constructs, ...

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • M Offline
                MartinRinehart
                last edited by 24 Mar 2010, 14:51

                @chris fullmer said:

                I have to admit that I do not understand what an IDE does over just using Notepad++ ...

                In the [not so] good old days, we had an editor, compiler, linker, debugger, etc. For reference, we had treeware. An IDE gathers them all in one place.

                In the [not so] good old days, your cycle was edit, compile, link, run. With today's tools, compiling and linking happen in milliseconds (used to be minutes). An IDE has a single-key compile/link/run command. You probably click your console, up-arrow and Enter. Not quite as nice as one key, but really no big deal.

                What we lack is a proper debugger. Additional IDE tools include screen painters for menus, input forms and so on. Also, complete help systems. Modern IDEs do so much that they also feature serious learning curves, so they are not appropriate tools for those who don't earn their daily bread by coding.

                Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by 24 Mar 2010, 15:50

                  @martinrinehart said:

                  What we lack is a proper debugger.

                  I think that's goes without saying

                  @martinrinehart said:

                  Additional IDE tools include screen painters for menus, input forms and so on.

                  visual aids are a great help when learning anything

                  @martinrinehart said:

                  Also, complete help systems.

                  what could be better

                  @martinrinehart said:

                  Modern IDEs do so much that they also feature serious learning curves

                  unless guidance, and support are available, like Google provides for Gears, O3D, Android Development, or Apple for iPhone, or the open source community for newcomers.

                  @martinrinehart said:

                  so they are not appropriate tools for those who don't earn their daily bread by coding.

                  sorry, I think you just contradicted yourself here, these tools are designed to avoid your [not so] good old days learning curve,

                  I didn't think that YOU (the author of one of the most comprehensive "hey guy's SU codings NOT hard" books proscribed to the FOFO school of teaching and learning

                  I hadn't grasped that your, "hey guys, no need to look under the hood" API was devised to slow peoples own programing knowledge.

                  I must say I'm rather disappointed in your attitude.

                  A request for assistance in avoiding badly coded 'amateur' and efforts to understand what makes a cross-platform 'professional' scripts would find your support.

                  these scripts are often targeted at an extremely niche market, and a 'DIY' solution is often the only commercially viable option for those on both sides of the equation.

                  An idea I'm pursuing out of curiosity may help you in your 'professional' activities and I for one am to old to re-live your years of pain.

                  I do have 6 Acorn computers in my workshop, should I concentrate on learning programing on those...

                  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
                  • M Offline
                    mattscar
                    last edited by 24 Mar 2010, 18:39

                    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
                    • T Offline
                      thomthom
                      last edited by 24 Mar 2010, 18:58

                      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 24 Mar 2010, 19:31

                        @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 24 Mar 2010, 19:34

                          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 24 Mar 2010, 19:39

                            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 24 Mar 2010, 21:31

                              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 24 Mar 2010, 22:00

                                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 24 Mar 2010, 22:19

                                  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
                                  • D Offline
                                    Dan Rathbun
                                    last edited by 25 Mar 2010, 04:17

                                    @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 25 Mar 2010, 04:43

                                      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 25 Mar 2010, 05:01

                                        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 25 Mar 2010, 05:08

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

                                          Advertisement