Create an xml file using sketchup ruby API
-
hello Sketchup developers,
I'm working on a project which is creating a Sketchup extension that collects data and generates it as an XML file, need to create an XML file that contains data (area,
volume ...) from a sketchup house model, using sketchup Ruby API.I found methods like Nokogiri, REXML and Builder but do they work even for the Sketchup Ruby API ? if so how ?
Does anyone have any idea or examples ?
thank you !
-
Your profile says you are using the obsolete v8.
This has very limited access to additional external Ruby methods.However, the newer version of Ruby, which ships with the newer SketchUp versions, allows you to access all of the additional Ruby's methods.
Luckily there are XML ones...
You just need to 'require' them in your code - because, although they ship with the newer SketchUp, they don't auto-load...
You need to do some Ruby API learning, above-and-beyond the SketchUp API...You can even load/require additional 'gems' - i.e. those which are not shipped with SketchUp... but in this case, I don't think you'll need to do that
-
Yeah i do need to do some Ruby API learning it's just that i want is it possible to export data in an xml file.
and i did find something about the "require" part but do i need to add some files from Nokogiri, REXML or Builder to the sketchup folder ?i'm using sketchup Make 2014
-
Please adjust your profile details...
C:\Program Files (x86)\SketchUp\SketchUp 2014\Tools\RubyStdLib\xmlrpc
is a collection of XML tools...
Read up and see if they'll do what you want.
There are many Ruby utilities in that file,
You can use additional Ruby files [like Nokogiri], but it's just another layer of complication you could perhaps sidestep...
Do add things to the SketchUp Ruby folder - do it in another way...
There is specific AppData location for 'gems'... -
Thank you for your answer i did adjust my profile, and it's my first time using sketchup and sketchup ruby api and i'm supposed to deliver a projet using those two and i searched so much randomly as i didn't know the exact methode to search about
Advertisement