Best way to recreate the model database?
-
Hi, all. I'm working on a script that has to recreate the sketchup model database outside of sketchup (ruby console app on a remote server). I am struggling with the best way to do it for best performance/flexibility. one constraint is that I can only communicate with the external app through Strings. Also, I am not using the import/export SDK because this is for real-time communication so I am using observers to notice changes and update the external model several times a second. The external model is for many things e.g. versioning/history records, multiple users, complex visibility controls, browser viewer with webgl, and a few others.
how would you do it?
-
Hash: The way I'm doing it right now is with nested hashes. a single message might look like this {time.now =>{"edge" => {id_number => {start_pt, end_pt}}}}. I pass it back and forth with .inspect and eval() to make it a string. I then take the new message and use it to .update a mega hash overwriting old info or adding new info. it works but the hashes are several levels deep and I don't know if there are going to be performance issues.
-
JSON: this would be the same as a hash just modifying the string to be JSON. The benefit of this might be using it with existing webGL libraries or anything web related but i don't really know.
-
MySQL or some other database: with a real database I could organize the information better in tables but I don't know if queries would be faster or slower than looking up in a hash. Also, it's just one more layer of technology to use/learn.
-
XML: I could write changes out to some XML format like collada or IFC. not sure how I would update the xml but maybe it's possible. Also, worried about quick look-ups with XML.
-
Something I haven't thought of.
Thanks,
-Mike -
-
(I know, old post.)
How's the project coming along?
I'm not sure there would be much of a performance difference between the mentioned formats. If history is important, a proper database seems like a good choice for persistent storage and support of transactions. Instead of "real-time", maybe sending the messages as some kind of "Transaction" after each operation completes would work better.
The other thought I had was that creating a set of simplified drawing tools that generate the Transaction messages as they complete might be easier than trying to use Observers to capture all the activity generated by SketchUp as it happens.
-
@jim said:
How's the project coming along?
Unfortunately, it's not coming along very much at all. just been too busy to code (which is my hobby, not my job). The initial goal was to make a server-base sketchup environment so that multiple people could work on a model at the same time. However, my eyes got bigger than my abilities and I started dreaming of a completely new way to collaborate, document, and communicate 3-dimensional information. I got a little overwhelmed when I starting looking into webGL and thought that it would be amazing if there would be a way to put sketchup modelings into a browser webGL viewer similar to google's body browser:http://bodybrowser.googlelabs.com/body.html#. Since then I am cooling the programming jets to write a white paper on the future of architectural documentation and what the technology required for an all-digital design/build environment might look like.
Thanks for the advice on my previous post. I will be getting this project going again hopefully very soon.
-Mike
Advertisement