.. _vtfx-page:

#####################################################
Share Everywhere with VTFx Files and Envision Viewers
#####################################################

The Export component adds easy sharing of simulation results using the :ref:`Envision VTFx format <vtfx-format-page>`. 
With a few lines of code, you can export exactly what you have on the screen to a compact file that can be shown on 
almost any platform. You can upload the VTFx file to Ceetron Cloud and share and view it directly in the web browser on 
any device. You can analyze it further using HOOPS Envision Analyzer Desktop or HOOPS Envision Analyzer Cloud. 


.. note::
    Currently the Export component only works with the UnstructGrid component.

**License note:** The Export Component requires a license with this feature enabled. Please see 
:ref:`license-system-page` for more info.


**Export to VTFx**

Add the following code to export exactly what you have on the screen to a compact VTFx.

.. code-block:: cpp

    cee::exp::ExportVTFx exporter(cee::exp::ExportVTFx::DISPLAY_MODEL_ONLY, model);

    // Add properties from the view and the model
    {
        cee::PtrRef<cee::PropertySetCollection> propColl = new cee::PropertySetCollection;
        cee::PtrRef<cee::ImageResources> resources = new cee::ImageResources;
        cee::exp::PropertyBuilderVTFx propBuilder(propColl.get(), resources.get());
        propBuilder.addFromModel(*model);
        propBuilder.addFromView(*view);
        exporter.addProperties(*propColl);
        exporter.addResources(*resources);
    }

    // Optionally, add a thumbnail image
    {
        PtrRef<cee::vis::Image> thumbNailImg = new cee::Image;
        view->renderToImage(640, 480, thumbNailImg.get());
        exporter.setSnapshotImage(thumbNailImg.get());
    }

    exporter.setVendorNameAndApplication("MyCompany", "MyApp");

    exporter.saveCase(myFilename);


.. image:: ../../images/export_demoapp.png
    :height: 500
    :align: left


.. image:: ../../images/export_3dviewer.png
    :width: 45%

.. image:: ../../images/export_powerpoint.png
    :width: 45%


