.. _dataprovider-exchange-page:

####################################
HOOPS Exchange Plugin 
####################################

********
Overview
********

HOOPS Exchange is the leading CAD import library. It can import over 30 CAD file formats into your application with the 
HOOPS Exchange SDK for CAD data translation including CATIA®, SOLIDWORKS®, Inventor™, Revit™, Creo®, NX™, Solid Edge®.

The HOOPS Exchange plugin utilizes the full HOOPS Exchange SDK and provides tessellated model data from the supported 
CAD files. See the list of supported formats at:
https://docs.techsoft3d.com/exchange/latest/start/supported-formats.html

.. image:: ../../../images/exchange_file_formats.png

The plugin will provide

-   Tessellated parts
-   Edges
-   Part colors
-   Part transparency
-   Part names


To use the HOOPS Exchange data provider plugin, you need your own version of the HOOPS Exchange libraries and a 
HOOPS license key with Exchange support. The license key and HOOPS Exchange library path must be set before opening a CAD file.
For both EnvisionWeb and EnvisionDesktop, you can specify the **CEW_TECH_SOFT_LICENSE_CODE** and **HOOPS_LIBRARY_PATH** environment variables for this purpose.

Alternatively, for EnvisionDesktop, use the :func:`cee::imp::cae::ReaderSettings::addDataProviderSettings()` to specify these options 
before opening a file. 

.. note::
    The HOOPS Exchange plugin is built using **HOOPS Exchange 2023 SP1**. You must use a binary 
    compatible version! 


HOOPS Exchange Data Provider Plugin has been developed using :ref:`data-provider-framework-page`.

********************************************************
Use in |ProductName|
********************************************************

Load the HOOPS Exchange data provider plugin using 
:func:`loadDataProviderPlugin() <cee::imp::cae::DataSourceCae::loadDataProviderPlugin()>` or load multiple 
plugins at once using 
:func:`loadDataProviderPluginsFromWildcard() <cee::imp::cae::DataSourceCae::loadDataProviderPluginsFromWildcard()>`.

Use the :func:`ReaderSettings::addDataProviderSettings() <cee::imp::cae::ReaderSettings::addDataProviderSettings()>` 
to specify the necessary options before opening a file. 

The following options are supported by the HOOPS Exchange Data Provider:

+--------------------------+----------+--------------------------------------------------------------------------------+
| **Name**                 | **Type** | **Description**                                                                |
+--------------------------+----------+--------------------------------------------------------------------------------+
| HOOPS_LICENSE            | string   | HOOPS Exchange license key string                                              |
+--------------------------+----------+--------------------------------------------------------------------------------+
| HOOPS_LIBRARY_PATH       | string   | Path to folder containing HOOPS Exchange libraries (A3DLIBS.[dll|so]). If |br| |
|                          |          | left empty, the data provider plugin will look for the HOOPS Exchange |br|     | 
|                          |          | libraries in the executable folder and in the PATH.                            |
+--------------------------+----------+--------------------------------------------------------------------------------+

Example:

.. code-block:: cpp

    for (size_t i = 0; i < cee::imp::cae::DataSourceCae::readerSettings().dataProviderSettingsCount(); ++i)
    {
        cee::imp::cae::ReaderSettingsDataProvider& settings = cee::imp::cae::DataSourceCae::readerSettings().dataProviderSettings(i);

        if (settings.providerIdString() == "ExchangeProvider")
        {
            settings.setStringValue("HOOPS_LIBRARY_PATH", "C:\\HOOPS_Exchange_Publish_2023_U1\\bin\\win64_v142");
            settings.setStringValue("HOOPS_LICENSE", "MyLicenseString");
        }
    }
    

*****************************************************************
Use in Envision Demo Analyzer Desktop
*****************************************************************

To use your data provider with HOOPS Demo Analyzer Desktop. When installed, the data provider plugins are in the 
**DataProviders** folder below the Analyzer executable. You can change this location by defining the environment 
variable **CEE_DATA_PROVIDERS_FOLDER** to point to the folder where your cdp_ExchangePlugin is located.
Envision Demo Analyzer will load the data providers from the specified folder.

Envision Demo Analyzer expects the HOOPS Exchange binaries to be in the PATH or in the same folder as the Analyzer
executable. To specify another location, set the environment variable **CEE_HOOPS_EXCHANGE_FOLDER** and specify the
folder path to the HOOPS Exchange libraries (A3DLIBS.[dll|so]).


******************************************************
Use in |WebProductName|
******************************************************

Data providers can be used with the RemoteModel server (UgServer). To load your data provider, set the 
**CEW_UG_DATA_PROVIDER_FOLDER** environment variable to point to the folder with your data provider. The UgServer will 
load all data providers in the specified folder. The data provider needs to comply to the following naming scheme:

    cdp_ExchangePlugin.[dll|so|dylib]

Example:

    cdp_ExchangePlugin.dll (Windows), cdp_ExchangePlugin.so (Linux)

The server will list the registered HOOPS Exchange data provider plugin when a file is opened.

Lastly, use the **CEW_TECH_SOFT_LICENSE_CODE** and **HOOPS_LIBRARY_PATH** environment variables for your UgServer to 
specify the license string and the path to a folder containing HOOPS Exchange libraries.
An alternative to the **CEW_TECH_SOFT_LICENSE_CODE** variable is to specify a **CEW_TECH_SOFT_LICENSE_FILE** environment 
variable which points to a file containing the license string.
