{"id":174,"date":"2008-09-06T23:08:33","date_gmt":"2008-09-06T23:08:33","guid":{"rendered":"http:\/\/www.goneabitbursar.com\/?p=174"},"modified":"2008-09-09T13:56:18","modified_gmt":"2008-09-09T13:56:18","slug":"ruby","status":"publish","type":"post","link":"http:\/\/www.goneabitbursar.com\/?p=174","title":{"rendered":"Ruby"},"content":{"rendered":"<p>In the course of assisting someone on the <a href=\"http:\/\/www.flightgear.org\/forums\/index.php\">FlightGear forums<\/a> with a problem, I sort of volunteered to write a custom exporter for <a href=\"http:\/\/sketchup.google.com\/\">SketchUp<\/a> &#8211; using its <a href=\"http:\/\/www.ruby-lang.org\/en\/\">Ruby<\/a> API. Writing a 3D exporter isn&#8217;t quite the typical first project in a language, but it&#8217;s not exactly unfamiliar territory for me either.\u00c2\u00a0<\/p>\n<p>Overall, Ruby is what I expected &#8211; very similar to Python, with some\u00c2\u00a0syntactic\u00c2\u00a0niceties and some oddities, and of course without the scoping-via-indentation that causes such ire. The standard library has some odd gaps (or perhaps I overlooked the classes I was supposed to use) but manipulating maps and arrays of mesh data is easy and tidy. There&#8217;s also a nice syntax for expanding variables in strings, which makes writing out text files pretty clean.<\/p>\n<p>The SketchUp API itself is pretty reasonable, though there&#8217;s some weak points in the documentation. Fortunately other people have figured out the hidden secrets, making my life easier. Best thing so far &#8211; one call which\u00c2\u00a0supposedly\u00c2\u00a0takes zero args, actually takes a magic integer argument (in reality a bit-field I think) which controls which data is produced. This shows up as &#8216;7&#8217; or &#8216;5&#8217; in the .X and OGRE exporters I was learning from.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the course of assisting someone on the FlightGear forums with a problem, I sort of volunteered to write a custom exporter for SketchUp &#8211; using its Ruby API. Writing a 3D exporter isn&#8217;t quite the typical first project in a language, but it&#8217;s not exactly unfamiliar territory for me either.\u00c2\u00a0 Overall, Ruby is what [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,23],"tags":[137,135,136],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-3d","category-code-geek","tag-flightgear","tag-ruby","tag-sketchup"],"_links":{"self":[{"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=\/wp\/v2\/posts\/174","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=174"}],"version-history":[{"count":2,"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":178,"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=\/wp\/v2\/posts\/174\/revisions\/178"}],"wp:attachment":[{"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.goneabitbursar.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}