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

    D/Code - smells like IRB spirit (1.0 RC1)

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 5 Posters 3.0k 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.
    • Didier BurD Offline
      Didier Bur
      last edited by

      Sounds promising !
      I use RDE but it is a pain to test bits of code with the ruby console window.
      BTW, what is the "Export HTML" button for ? And "Encoded", "Decoded" ?

      DB

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

        you must disable the load button until you finish the eval of the code as SU Ruby is not reentrant

        export html I think is for exporting the code highlighting and encode/decode for script encryption

        I also did something similar for SU5, before WebDialogs, with tab completion and aliases. if you want I can share the source as I dont have time to finish it 😎

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

        1 Reply Last reply Reply Quote 0
        • A Offline
          azuby
          last edited by

          @unknownuser said:

          you must disable the load button until you finish the eval of the code as SU Ruby is not reentrant

          export html I think is for exporting the code highlighting and encode/decode for script encryption

          I also did something similar for SU5, before WebDialogs, with tab completion and aliases. if you want I can share the source as I dont have time to finish it 😎
          I don't think there is a need to disable the Load button, because there is less Javascript. So I build the page every time the user loads a file, changes the view or sends/executes his code. I know what will happen, if the user enters a infinite loop (or maybe a time consuming one) 😄 but still haven't tried it.

          It's a simple action that causes the error:

          • Run Sketchup
          • Call the d/Code console (click the Button or menu entry)
          • Click the Load button -> BOOM!
            That means, everything is done in the window when I can click the Load button. But maybe Sketchup is a bit slower and hasn't registered the callbacks. Really don't know.

          Export HTML is for exporting the current view without buttons and input field. If you have the "decoded" view and the output field, both will get exported.

          Encode/decode is simple. You know. 😄 For a bit more comfort.

          I'm interested in your code, if it is Ruby 😉 (I guess it's not)

          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
          • A Offline
            azuby
            last edited by

            OK, here we go again. I've uploaded d/Code 1.0 RC1 to my server.

            Download it from http://www.errorinitus.de/ > Software > d/Code

            Features

            • Load and show file
            • Syntax beautifying for Ruby files
            • Syntax highlighting for Ruby, C, YAML, RHTML, HTML, XHTML, XML files
            • Views for encoded, decoded, beautifyed and raw code
            • Encryption if Sketchup Ruby Scrambler is availble
            • Export current view as HTML file
            • Open current file with system preferences
            • Write current code to source file
            • Write current code to new file
            • Reset code field
            • Clear complete view
            • Select all code in input field
            • Select all code in output field
            • Encode current Ruby code
            • Decode current Ruby code
            • Step-by-step evaluate current (Ruby) code
            • Mulitlanguage support (English and German at the moment)
            • Toolbar icon for fast access
            • Menu position configurable
            • Separate shortcut definition files for each language
            • Resizable window
            • Set window back to defined position and size
            • Toggling on and off via Sketchup "Windows > Preferences" possible

            There also are help files included in the download, but you also can reach them directly:

            d/Code help file (English)
            d/Code-Hilfe-Datei (German)

            There now is one more button to encrypt files if you have access to the Sketchup Ruby Scrambler.

            Hope it runs on Windows and Mac. Should ... but only have tried it on Windows XP pro.

            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
            • T Offline
              tomasz
              last edited by

              Thank you, Azuby! Step by step..! testing ❗

              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

              1 Reply Last reply Reply Quote 0
              • A Offline
                azuby
                last edited by

                It's not a step-by-step like a Debugger! One short example:

                class Foo
                  def bar
                    puts "baz"
                  end
                end
                # First step finished.
                Foo.new.bar
                # Second step finished
                

                So it's not line by line like in IRB:

                irb(main);001;0> class Foo
                irb(main);002;1>   def bar
                irb(main);003;2>     puts "baz"
                irb(main);004;2>   end
                irb(main);005;1> end
                => nil
                irb(main);006;0> Foo.new.bar
                baz
                => nil
                

                Maybe I can do the "debuggish" way a bit later.

                edit: So you can't write a piece of a class without closing the class. This will result in a SyntaxError.

                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
                • T Offline
                  tomasz
                  last edited by

                  Ok. Understood.
                  My first thought was that it is a sort of debugger 😄 First thing I have done - I have loaded 'real' script too check how it goes 😄

                  I am testing it and it is excellent for learning Ruby 👍
                  and testing some small procedures.

                  1st bug - when I press 'Select all' beside Input browser displays Page Cannot be dispayed.
                  Firefox, SU6
                  Tomasz

                  Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    azuby
                    last edited by

                    Firefox in Sketchup? 😲 I thought they integrated only Internet Explorer. How have you done this?

                    Thanks for the bug report.

                    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
                    • T Offline
                      tomasz
                      last edited by

                      @azuby said:

                      Firefox in Sketchup? 😲

                      It is my default browser.. but you are right - message comes from IE. 😒

                      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                      1 Reply Last reply Reply Quote 0
                      • T Offline
                        tomasz
                        last edited by

                        2nd 'bug': when thread.new has been initiated in following manner

                        	Thread.new do
                        		system(`program arg`)
                        	end
                        

                        then d/Code will wait with displaying its window till the program closed.
                        btw. Thread works well with passing arguments to exe. Thanks again.
                        Tomasz

                        Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

                          First of all - it is fantastic to be able to test scripts direct inside Sketchup 😄

                          Would it be possible to have the input(Select all) window in the top and Code (Raw) window
                          windows at the bottom - for me it is difficult to se long lines 😞

                          Does one have to have two windows ?

                          Could Code(RAW) do it ?

                          Sorry, if my questions are noob - byt i'm a noob 😉

                          Jorgensen

                          sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

                          1 Reply Last reply Reply Quote 0
                          • A Offline
                            azuby
                            last edited by

                            @unknownuser said:

                            2nd 'bug': when thread.new has been initiated in following manner

                            	Thread.new do
                            > 		system(`program arg`)
                            > 	end
                            

                            then d/Code will wait with displaying its window till the program closed.
                            btw. Thread works well with passing arguments to exe. Thanks again.
                            Tomasz
                            OK, have to write this again, because I kicked my posting 😞

                            I've tried it with threads and

                            • Windows Calculator - system "calc"
                            • Ruby interpreter - system "ruby -ne 'gets'"
                              and it immediately came back to the Plugin while the called executables were still running. Maybe it depends on the executable? Don't know.

                            @Jorgensen
                            This also was possible with the built-in Ruby Console, but it was a pain writing all code in one line 😉

                            Changing the layout is possible. At the moment there is no HTML template to edit, it's hard-coded. Also a two-window version could be made, yes. Because I'm not that wise in writing modern HTML and JavaScript code, I have to dive deeper into the possibilities.

                            This one I do not understand:
                            @unknownuser said:

                            Could Code(RAW) do it ?
                            Do "what"?

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

                              Hi azuby

                              The problem is, that I have so sidescroll the window to see long lines.

                              It might be just me (noob), but to me a "code window" and "a output" would be fine - does there have to be three ?

                              Jorgensen

                              sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

                              1 Reply Last reply Reply Quote 0
                              • A Offline
                                azuby
                                last edited by

                                A I see, Kinder Surprise 😄 - three wishes at once. Yes, you are right, long lines seem to be a bit complicated. Also three windows would be possible - not at the moment (just want to listen for bugs), but for the future. I add it to the todo list.

                                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
                                • tbdT Offline
                                  tbd
                                  last edited by

                                  hmm, cannot access the site - gives me 212.162.44.242 reports: Destination protocol unreachable on traceroute. in Firefox it just timeouts 😞

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

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    azuby
                                    last edited by

                                    That's not cool, but it's not the server my website is hosted:

                                    tracert errorinitus.de
                                    
                                    Routenverfolgung zu errorinitus.de [62.67.235.128]  über maximal 30 Abschnitte;
                                    
                                      1    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                                      2     *        *        *     Zeitüberschreitung der Anforderung.
                                      3     6 ms     6 ms     6 ms  217.0.82.86
                                      4     6 ms     6 ms     6 ms  217.5.72.138
                                      5    22 ms    21 ms    20 ms  62.156.138.178
                                      6    22 ms    21 ms    21 ms  ae-0-56.mp2.Berlin1.Level3.net [4.68.108.162]
                                      7    13 ms    12 ms    12 ms  so-1-0-0.mp1.Hamburg1.Level3.net [4.68.128.37]
                                      8    12 ms    13 ms    13 ms  ge-4-1.hsa1.Hamburg1.Level3.net [195.122.140.163]
                                      9    13 ms    13 ms    13 ms  212.162.44.242
                                     10    13 ms    15 ms    15 ms  s28.evanzo-server.de [62.67.235.128]
                                    

                                    Hope, this helps. For now, try this one.

                                    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
                                    • tbdT Offline
                                      tbd
                                      last edited by

                                      tried from two providers - still not working 😞
                                      later edit: finally made it work via proxy

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

                                      1 Reply Last reply Reply Quote 0
                                      • A Offline
                                        azuby
                                        last edited by

                                        OK, next try with proxy: http://www.behidden.com/ - you have to enable JavaScript checkbox on this website where to put the url.

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

                                          Hi azuby

                                          Any news on the development ? 😄

                                          sketchup pro 2016 16.1.1449 64 bit | windows 10 pro | i7-3770k @3.5 GHz | 16gb ram | gtx 780 ti / gtx 980 ti | nvidia driver 368.39

                                          1 Reply Last reply Reply Quote 0
                                          • A Offline
                                            azuby
                                            last edited by

                                            Not at the moment. Unfortunately I'm a bit too busy with German law 😞

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

                                            Advertisement