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
    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.
    • D Offline
      d12dozr
      last edited by

      I just came across these open source Ruby Protocol Buffers from Mozy.com - I have no clue how to use them, but figured I'd share them with developers here...hopefully they are useful!

      3D Printing with SketchUp Book
      http://goo.gl/f7ooYh

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

        hm... wonder what it does....

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

        1 Reply Last reply Reply Quote 0
        • R Offline
          remus
          last edited by

          @unknownuser said:

          Protocol Buffers are a way of encoding structured data in an efficient yet
          extensible format. Google uses Protocol Buffers for almost all of its internal
          RPC protocols and file formats.

          This library has two components: a compiler to turn <tt>.proto</tt> definitions
          into Ruby modules (extension <tt>.pb.rb</tt>), and a runtime to use protocol
          buffers defined by these modules. The compiler relies on Google's C++ based
          compiler (+protoc+) for much of the heavy lifting -- this has huge advantages in
          ensuring compatibility and correctness.

          This library is heavily optimized for encoding and decoding speed. There is a
          small C extension available in the ext/ dir that will improve performance even
          further, but it is currently disabled to avoid rubygems having to compile a
          native extension. TODO: anybody know if we can make this optional?

          Because this is a tool for generating code, the RDoc documentation is a bit
          unusual. See the text in the ProtocolBuffers::Message class for details on what
          code is generated.

          Certainly sounds interesting.

          http://remusrendering.wordpress.com/

          1 Reply Last reply Reply Quote 0
          • N Offline
            notareal
            last edited by

            Protocol Buffers are a serialization format. Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be "resurrected" later in the same or another computer environment. (wikipedia)
            I can imagine that with Protocol Buffers one can build a efficient way for communication between ruby and some program... even over network. Sounds interesting.

            Welcome to try [Thea Render](http://www.thearender.com/), Thea support | [kerkythea.net](http://www.kerkythea.net/) -team member

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

              @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
              • brewskyB Offline
                brewsky
                last edited by

                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
                • thomthomT Offline
                  thomthom
                  last edited by

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

                    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
                    • brewskyB Offline
                      brewsky
                      last edited by

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

                        [off:g7kpsrm3]( but possibly related )

                        Nested Attribute Dictionaries[/off:g7kpsrm3]

                        I'm not here much anymore.

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

                          @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
                          • brewskyB Offline
                            brewsky
                            last edited by

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

                              @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
                              • brewskyB Offline
                                brewsky
                                last edited by

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

                                  ... 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