I wanted to build a WPF 3D application, that will present models. I didn't want to include code that loads different formats and creates WPF models at runtime, and I wanted an easy-to-use, free modeler.
Blender is free, but I find it very cumbersome. Google SketchUp is very easy to use, but was lacking a way to export to XAML.
Fortunately, SketchUp has a very easy-to-use Ruby API that I could use to build an exporter.
It currently exports the meshes separated by materials, and grouped together in geometry groups according to the same hierarchy structure of the model. Materials include front faces only (i.e. no BackMaterials) and support solid color and textures. If no material is given, a solid white material is used.
While it's not perfect, it does a pretty good job. Feel free to use and please send feedback,
http://cid-8fbcae0caa96d592.skydrive.live.com/self.aspx/.Public/xamlExporter.rb
UPDATE:
I updated the plugin. Check out the follow-up post: XAML exporter for Sketchup - Round 2.
Hi!
ReplyDeleteI also have a problem- how to export sketchip model to XAML? I downloaded: http://cid-8fbcae0caa96d592.skydrive.live.com/self.aspx/.Public/xamlExporter.rb- but do not understand, how can I use it???
Can you tell me?
Best regards,
Diana
Just copy the .rb file to the Skethup plugins folder
ReplyDelete(C:\Program Files\Google\Google SketchUp 7\Plugins, or something similar)
You will see a new menu - plugins, under which there will be a sub menu 'XAML', under which you will see "Export to XAML..."
Select a file name and press Save.
That's it :-)
oh my god! it works! Thank you! You don't know how many people are looking for this :)
ReplyDeleteHey Itai. Do you plan to update this .rb script? It handles simple models well but when the geometry becomes complicated it starts to get messy. Have you tested it with complicated models?
ReplyDeleteJubei,
ReplyDeleteThanks for your interest in XamlExporter.
I have only tested it on rather simple models that I needed for an application I was writing.
I'd be glad to improve the script given more complex models.
Please send such a model to my email (itaibh at gmail dot com), and I'll see what I can do.
Itai.
I'm new to XAML and Expression Blend
ReplyDeleteI try to import the XAML into Expression Blend and the tags are not recognised. Do I need to add a specific reference?
Hello Gareth. Thank you for trying Skethup Xaml Exporter.
ReplyDeleteThe exported XAML files contain a 3DGroup element, which must be placed inside a 3DViewPort.
You need to create a 3DViewPort in your XAML application, and place the content of the exported file there. You may also try to link to it, but this is more advanced topic and I suggest you look it up on Google or Bing.
That would be a ViewPort3D of course...
ReplyDeleteWhen I export a sketchup model of a building it doesn't export the flat (textured) roofs and floor. I'm not a sketchup expert, so maybe I'm doing something wrong ? I'm using version 8.
ReplyDelete3d modellen, please send me the model you are trying to convert and I'll take a look.
ReplyDeleteHi
ReplyDeleteI would like to export "Piano Keys" model (by jasontran) in the Google 3d Warehouse.
The link is
http://sketchup.google.com/3dwarehouse/details?mid=3e5310bae7e04f58c124f92750a205ca&prevstart=0
I am using Sketchup version 8.
The "export model" command writes the Model3DGroup tags to the file, but no actual content.
Is there any chance that you could take a look at this?
Phil
Hi Phil.
ReplyDeleteSeems like there is a problem with grouped elements. I tried "exploding" the model, then "exploding" a key sub-model and then that key showed up in the XAML.
I'll take a look why that problem happens, but it might take a while. In the mean time try to use the workaround I written above.
Itai.
Hi
ReplyDeleteThanks Itai, that helps.
Phil
Hi,
ReplyDeleteThanks for the posting. I'm using Sketchup 2015 and i copied to the plugins folder. But unfortunately the plugin menu is not coming. Any thing am i missing here. Please help
Thanks
Ramesh