.. _import-cae-page:

############################
Use the Import CAE Component
############################

The ImportCae component adds easy loading of simulation results from commercial CAE formats. It provides a data source 
for the UnstructGrid Component that can read files from commercial FEA and CFD simulation software systems.
With a few lines of code you can import your model from most commercial FEA and CFD file formats.


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

**Import a CAE Model**

|FamilyName| contains readers for numerous commercial FEA and CFD file formats. These
are imported using the :class:`DataSourceCae <cee::imp::cae::DataSourceCae>` data source.

Add the following code to import and show a supported file:

.. code-block:: cpp

    cee::imp::cae::DataSourceCae* source = new cee::imp::cae::DataSourceCae(datasourceId);
    cee::ug::Error error;
    if (source->open(filename, &error))
    {
        m_unstructModel = new cee::ug::UnstructGridModel();
        m_unstructModel->setDataSource(source);

        m_viewerWidget->view()->addModel(m_unstructModel.get());

        m_unstructModel->updateVisualization();
    }

The :class:`DataSourceCae <cee::imp::cae::DataSourceCae>` behaves in the same way as the other data source interfaces. 
In addition to the :func:`open() <cee::imp::cae::DataSourceCae::open>` function it also has an 
:func:`openSecondary() <cee::imp::cae::DataSourceCae::openSecondary>` for interfaces where the data is divided into 
multiple files.

To get a list of all supported readers and their associated file endings programmatically, get 
:func:`DataSourceCae::supportedFormats() <cee::imp::cae::DataSourceCae::supportedFormats>`.


Supported formats are listed under the :any:`CAE Import Component <cee::imp::cae>`.


**Special Requirements for Abaqus ODB Files**

The Abaqus ODB reader depends on an external set of libraries provided by a third party vendor. These libraries are 
found under **ThirdParty/Abaqus**> in the distribution.

.. note::
    The Abaqus ODB reader can only read files from the latest version of Abaqus. If you try to open an old file, the 
    file will be converted into a file with the name filename_upg.odb and this file will be opened. See 
    :func:`cee::imp::cae::DataSourceCae::open()` for more information.