# VTK Plugin

## Overview

The VTK Data Provider Plugin has been developed using Data Provider Framework.

The provider can be plugged into applications based on HOOPS Envision for Desktop. This includes HOOPS Envision Demo Analyzer and the RemoteModel server (UgServer) in HOOPS Envision for Web. The same plugin can be used both on web and desktop.

The cdp_Vtk plugin provides the following data based on a given ModelKey:

- Meta data about the given model: Number of states (time increments), geometries (multiple domains + boundaries), results
- CAE model with elements and nodes
- Results: Scalar, Vector, Displacements and Tensors
- Element sets

The VTK data provider plugin will then be used to open all your .vtu, .pvtu, .pvd and .vtm files.

If the built-in VTK reader should be used, just delete the cdp_VtkPlugin plugin from this path.

## Available Options

The following options are supported by the VTK Data Provider:

Name | Type | Default | Description
--- | --- | --- | ---
PVD_WELD_INTERFACE_NODES | bool | true | Weld interface nodes for pvd files.
PVTU_WELD_INTERFACE_NODES | bool | true | Weld interface nodes for parallel vtu files.
PVTU_PARTID_FIELD_NAME | string | PartID | Field name for Parts in PVTU files.
VTU_PARTID_FIELD_NAME | string | PartID | Field name for Parts in VTU files.
READ_VECTOR_AS_DISPLACEMENT | boolean | false | Read Vector as Displacements.
USE_CEETRON_ACCESS_COMPATIBILITY | boolean | true | HOOPS Access compatibility: i.e Use 6 components as SymTensor. Use 3 components as vector. Use Results Nature.
RESULTS_NAMES_MAPPING | string |  | U=VELOCITY;displacement=DISPLACEMENT;strain=STRAIN;strain_energy_density=STRAIN_ENERGY_DENSITY;stress=STRESS;pd=PRESSURE;T=TEMPERATURE;points=POSITION;origId=IDENTIFIER;rho=DENSITY;gamma=FLUID_PHASE;positions=POSITION;cellID=IDENTIFIER;scalars=SCALARS

For Envision Web, use the `RemoteModel.setReaderOptions()` to specify these options before opening a file. For Envision Desktop, use the `ReaderSettings::addDataProviderSettings()` to specify these options before opening a file.

## Use in HOOPS Envision for Desktop

Load the VTK data provider plugin using `loadDataProviderPlugin()` or load multiple plugins at once using `loadDataProviderPluginsFromWildcard()`.

Use the `ReaderSettings::addDataProviderSettings()` to specify these options before opening a file.

See the list of available options for the VTK data provider in the list above.

Example:

    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() == "VTKProvider")
        {
            settings.setBoolValue("PVTU_WELD_INTERFACE_NODES", true);
            settings.setBoolValue("PVTU_PARTID_FIELD_NAME", "MyPartID");
        }
    }

## Use in Envision Demo Analyzer Desktop

You can use your data provider with Envision 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_VtkPlugin is located. Envision Demo Analyzer will load the data providers from the specified folder.

In the Settings dialog under the Data Provider panel, all the reader options for the VTK data provider are shown and can be edited. See the list of available options for the VTK data provider in the list above.

Once any of this settings edited, please reopen your model to account for this modification.

## Use in HOOPS Envision for Web

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_VtkPlugin.[dll|so|dylib]

Example:

> cdp_VtkPlugin.dll (Windows), cdp_VtkPlugin.so (Linux)

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

A data provider plugin can have a set of reader settings. For Envision Web, use the `RemoteModel.setReaderOptions()` to specify these options before opening a file. See the list of available options for the VTK data provider in the list above.

Example:

    this.m_model.setReaderOptions("VTKProvider", {
        "PVTU_WELD_INTERFACE_NODES": true,
        "PVTU_PARTID_FIELD_NAME": "MyPartID"
    });

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...