• Login
sketchucation logo sketchucation
  • Login
πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Ruby Protocol Buffers

Scheduled Pinned Locked Moved Developers' Forum
15 Posts 6 Posters 2.0k Views 6 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 22 Oct 2010, 10:39

    @remus said:

    Certainly sounds interesting.

    Interesting indeed - but I don't understand exactly what it do or what you can do with it.

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

    1 Reply Last reply Reply Quote 0
    • B Offline
      brewsky
      last edited by 31 Aug 2012, 20:37

      I am trying to make an interface from my Sketchup BIM-Tools plugin, to a BIMserver(BIMserver.org) using protocol buffers.

      These Ruby Protocol Buffers are exactly what I need!

      I have been trying to copy parts of the code into my plugin folder, but frankly I have no idea what I'm doing here πŸ˜•

      Is there anyone with some experience in using this "library"?
      Or maybe a few tips on "plugging" external libraries into the sketchup-ruby installation?

      Any help is greatly appreciated!

      Cheers!
      Jan

      Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

      1 Reply Last reply Reply Quote 0
      • T Offline
        thomthom
        last edited by 31 Aug 2012, 21:53

        I would instead make a Ruby C Extension. Bundling along lots of ruby libs opens up for lots of potential clashes. Imagine if another plugin was bundling a slightly different version.

        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
          Dan Rathbun
          last edited by 31 Aug 2012, 22:28

          I took a quick look through the code.

          It requires a full Ruby install as it needs several standard library files. (I also novice some code in there for Ruby v1.9.x compatibility. Don't know if that would cause problems.)

          Generally, from what I read, I do not care for the implementation. It creates modules (and perhaps only toplevel modules. This would heighten the probability of namespace clashes.)

          Why they didn't implement a class and have the Ruby individual protocol buffer be an instance I do not know. It's what I would done.)

          You need to realize that most Ruby Gems are written to run in their own Ruby process, started from the command line. The ruby script does it's task, and then that Ruby process ends.

          SketchUp Embedded Ruby uses a persistent SHARED Ruby process, where we must be careful to run all out code within each of our own toplevel modules (namespaces.)

          This code for example requires the Ruby command line option parser, which means it expects arguments to be in the ARGV array. In SketchUp Embedded Ruby this array is empty. NONE of the command line parameters used to start SketchUp.exe are passed into it's Ruby process.

          Looks to me like WAY too much work to "SketchUpize" this utility.

          What is wrong with class PStore ? .. or JSON string files ?

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • B Offline
            brewsky
            last edited by 1 Sept 2012, 20:19

            Hi Dan,

            Thanks for looking into this!
            Too bad it's not easy to use from SketchUp.

            A single protocol buffers class for ruby does indeed seem much better than all these modules.
            Writing my own class for this seems way over my head(figuring out how the data is "serialized" and all).

            JSON seems to have a similar purpose, and could be a good alternative.

            But there are only a few ways to communicate with the TNO bimserver, from which protocol buffers seems to be the preferred solution.
            Check out this page: http://code.google.com/p/bimserver/wiki/Interfaces
            So in this case I don't think I can use JSON...(and would that be easy to load in SketchUp?)

            (interesting subject though "serialization"(YAML, Marshall, JSON), using this I might be able to store my complete "wall"/"floor" objects in a sketchup attribute. Re-load an object instead of re-creating it!)

            I hope I can find SOME way to communicate with bim-server, would be great if I could make a direct connection!

            Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

            1 Reply Last reply Reply Quote 0
            • D Offline
              Dan Rathbun
              last edited by 1 Sept 2012, 21:44

              [off:g7kpsrm3]( but possibly related )

              Nested Attribute Dictionaries[/off:g7kpsrm3]

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • D Offline
                Dan Rathbun
                last edited by 1 Sept 2012, 22:17

                @brewsky said:

                Check out this page: http://code.google.com/p/bimserver/wiki/Interfaces
                So in this case I don't think I can use JSON...

                Ruby standard library has an extensive [url=http://www.ruby-doc.org/stdlib-1.8.6/libdoc/soap/rdoc/index.html:pxzi4drt]SOAP[/url:pxzi4drt] class, however again a full Ruby install is needed.

                You may be better off trying the [url=http://code.google.com/p/bimserver/wiki/RESTInterface:pxzi4drt]REST[/url:pxzi4drt] interface as it uses HTTP1.1 protocol. See: [url=http://en.wikipedia.org/wiki/REST:pxzi4drt]wikipedia/REST[/url:pxzi4drt]

                πŸ’­

                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • B Offline
                  brewsky
                  last edited by 14 Dec 2012, 22:04

                  @dan rathbun said:

                  What is wrong with class PStore ? .. or JSON string files ?

                  BIMserver.org is implementing a JSON interface!
                  I have absolutely no idea where to start, but lets see if I can somehow make a connection from my BIM-Tools plugin to BIMserver using JSON πŸ˜„

                  Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    Dan Rathbun
                    last edited by 14 Dec 2012, 22:48

                    @brewsky said:

                    @dan rathbun said:

                    ... or JSON string files ?
                    BIMserver.org is implementing a JSON interface!

                    I have absolutely no idea where to start, ...
                    Start here... topic : JSON in Ruby

                    ... read the first few posts where I explain the basics of converting to and from a Ruby Hash into a JSON string.

                    Then... scroll down to the method posts by Aerilius in which he "standardized" the conversions into methods. These can be pasted into your plugin sub-module, or added as a library sub-module, just within your toplevel "author" module, so it can be used by many of your plugins.
                    I show examples of doing this in the post prior to Aerilius' method postings.

                    πŸ’­

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • B Offline
                      brewsky
                      last edited by 14 Dec 2012, 22:55

                      @dan rathbun said:

                      Start here...

                      Thanks Dan!

                      Sketchup BIM-Tools - http://sketchucation.com/forums/viewtopic.php?p=299107

                      1 Reply Last reply Reply Quote 0
                      • D Offline
                        Dan Rathbun
                        last edited by 14 Dec 2012, 23:20

                        ... also an Attribute Dictionary is basically a hash written into the model dB. So they can be converted similarly.

                        πŸ’­

                        I'm not here much anymore.

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

                        Advertisement