AB4D Forum

Full Version: Saving 3d drawing to file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Do you have a sample of saving the contents of a Viewport3d to a file? I have a 3d drawing I created in a WPF project, and I'd like to be able to view it in a web browser. Thanks!
You probably want to save the 3D scene from Viewport3D.

This can be done with Assimp exporter - see the "Assimp exporter" sample in the Assimp section of the samples that come with Ab3d.PowerToys.

You can export to collada (.dae), obj, ply and stl file formats.

As it is written in the comments in the sample, there are some limitations on what can be exported:

- stl and ply files do not support materials,
- obj, stl and ply files do not support object hierarchies,
- Cameras and lights are not exported - Collada(.dae) file support cameras and lights but this is not supported by Assimp exporter,
- BackMaterial or some other form of two-sided materials is not supported by any file format

Exporting 3D lines:
3D lines in Ab3d.PowerToys are created with triangles that are updated to always face the camera. When the 3D scene with 3D lines is exported, the current MeshGeometry3D objects of the 3D lines is also exported. But this means that because after exporting the MeshGeometry3D for the 3D line is fixed, it will not look good under some other camera angle. Therefore it is recommended to use TubeLineVisual3D or TubePathVisual3D objects instead of 3D lines.Those two objects are correctly exported to files.



If you only want to export 2D bitmap, then you can use RenderToBitmap method on the camera object - see Utilities / RenderToBitmapSample.