• Technical Overview
  • Release Notes
  • Reference Manual
  • HOOPS Visualize
TechSoft3d

HOOPS Exchange Integration

1.0 Using the HOOPS Exchange HIO Component

2.0 Supported Data

3.0 Mapping Between HOOPS/3DGS and Exchange Entities

4.0 Platform Support

5.0 Required Libraries


1.0 Using the HOOPS Exchange HIO Component

The HOOPS Exchange HIO component (HIO Exchange) supports both import and export capabilities. For import, it utilizes the capabilities of HOOPS Exchange to access assembly, visualization (tesselation) and PMI info from many MCAD formats and bring it into the HOOPS/3DGS scene-graph. A full list of the supported Exchange formats is detailed here. Before reviewing the specifics of this component, developers should become familiar with the general HIO architecture and capabilties, covered in Section 4.0 of the HOOPS/MVO Programming Guide.

For export, the component supports exporting the HOOPS/3DGS scene graph information to IGES, STEP, Parasolid and STL. (The scene-graph can also be exported to the PRC format, which is the native 3D representation used within PDF. Exporting to a 3D-PDF requires a license to the HOOPS Publish product.)

The HIO Exchange component is delivered in the form of a .hio file, which gets dynamically loaded/accessed by HOOPS/MVO file import logic. To ensure your application can access the hio_exchange component, perform the following:

Windows Platform:

  • Create a hio_plugins directory in your application's working directory.
  • Copy the hioexchange <version>.hio file found in <hoops>/bin/<platform>/hio_plugins/hio_exchange to the hio_plugins directory created in the previous step.

Linux Platform:

  • Copy the hioexchange <version> .hio file found in <hoops> /bin/ <platform>into your application's working directory.

During start-up, when HOOPS/MVO finds the HIO Exchange component and HOOPS Exchange .dlls, it will perform the following steps:

  1. Create the appropriate input and output handler.
  2. Register the handler and its associated file extensions with the HIOManager.

Once the hio_exchange component is successfully loaded, your application will be able to import any of the files supported by HOOPS Exchange. To utilize the extensive HOOPS Exchange API services, you must compile against HOOPS Exchange directly.

1.1 Importing Example

Reading a file involves setting up the HInputHandlerOptions structure with a valid HOOPS Exchange license key and HBaseView object, and then loading the model into the desired HOOPS Visualize scene-graph segment by calling HBaseModel::Read. The following shows how you would import a CATIA file:

#include "HIOManager.h"
    
HFileInputResult result = InputOK;
HInputHandlerOptions input_options;

// setup the input options with a HOOPS Exchange license key and an HBaseView object
input_options.m_license = const char* licensekey = "<license_key_string>"; 
input_options.m_pHBaseView = my_view;

// open up the desired HOOPS/MVO model segment and read the file
HC_Open_Segment_By_Key(<my model key>);
    result = HBaseModel::Read("c:\\temp\\myFile.CATProduct", view, true, &input_options);
HC_Close_Segment();

/*
After reading, a handle to the PRC data is accessible via the HInputHandlerOptions structure, and you can directly query assembly, topology and PMI information using the HOOPS Exchange API. This PRC data handle would also be used to export to a 3D-PDF if there is an active license for HOOPS Publish. Refer to the HOOPS Publish HIO connector docs for more information.
*/

m_pPRCAsmModelFile = input_options.m_pPRCAsmModelFile;

1.2 Obtaining and Selecting Configurations

Several of the CAD file formats supported by HOOPS Exchange have a concept of multiple model 'configurations' which can be stored in the file. (Each configuration may have a list of 'views', described down below in Section 2.1) HOOPS Exchange is able to access the list of configurations at load time, and this info can in turn be accessed in HIO Exchange by defining a load-time callback using HInputHandlerOptions::m_pPRCMultiModelSelectionCallback. This method will provide your callback with the number of configurations, and let you pass back the configuration that you've selected for loading. (You would typically provide the list of configurations in a GUI pulldown dialog, and use the configuration selected by the user as the 'out_config_selection').

The callback is specified in the HInputHandlerOptions used to control file input:

  input_options.m_pPRCMultiModelSelectionCallback = MultiModelSelectionCallback;

 

1.3 Controlling Import of Hidden Objects

If HInputHandlerOptions::m_bPRCImportHiddenObjects is set to true, representation items marked as 'hidden' will be imported but have their visibility turned off. If set to false, representation items marked as hidden will be skipped and not imported

1.2 Exporting Example

You can write files in formats supported by HOOPS 3D Exchange from your HOOPS 3DF-based application using code similar to this:

#include "HIOManager.h"
    
HFileOutputResult result = OutputFail;
HOutputHandlerOptions output_options;

/* Let's assume that m_pPRCAsmModelFile is a pointer to a PRC model that was either constructed by your application code, or returned from HOOPS Exchange. We pass in the handle to the PRC data via the 
HOutputHandlerOptions::m_pExtendedData attribute.*/
output_options.m_pExtendedData = m_pPRCAsmModelFile;

result = pSolidModel->WriteWithOptions("c:\\temp\\myFile.iges", my_view, &output_options);

 

2.0 Supported Data

HOOPS Exchange first maps all incoming CAD data to the neutral 'PRC' format, which in turn is then mapped to the HOOPS/3DGS scene-graph. Here are some key notes on supported graphical primitives and attributes:

  • All analytics (Polycylinders, NURBS Surfaces, Spheres, Ellipses, Circles) will be turned into shells via Compute_Shell_From_Geometry. Furthermore, all curves will be turned into polylines.
  • Color interpolation is supported via textures. However, color interpolation will always be turned on with such models.
  • Images and simple diffuse textures are supported. However, any texture that has an automatic texture map will appear untextured. Environment maps are supported but secondary diffuse textures and bump maps are not.
  • Subwindows are not currently supported.
  • Heuristics and Rendering Options are not currently supported. This means that "mask transform" and "screen range" settings are ignored.

It is important to note that the hio_exchange component ignores b-rep data and asks HOOPS Exchange to provide all data in tesselated form.

2.1 Views

A view consists of a group of information in the original CAD file, and displays a particular state of the model. This typically includes a camera, set of cutting planes, lights, PMI, background color, and 'linked items' which are references to model objects along with specific visibility and position information.

The HIO_Exchange module provides support for querying the view information from the PRC data, and mapping it to HOOPS/MVO MarkupManager layers. Each view is associated with a markup 'layer'. Refer to the Markup Manager Programming Guide for more details on how to query the list of MarkupManager 'layers' and open (activate) a layer.

The view information stored in the MarkupManager layers should not be edited, as it is quite specific to the particular CAD-View. If you wish to have additional markups, they should be added to newly created MarkupManager layers.

3.0 Mapping Between HOOPS/3DGS and HOOPS Exchange Entities

It is important for developers to be able to map between objects within their HOOPS/3DGS database and the corresponding entities within HOOPS Exchange. Recall that HOOPS Exchange maps CAD data to the PRC data format.

The HIOConnector supports this data mapping functionality. When you call HIOConnector::GetKernelEntity and pass a HOOPS key, the HIOConnector will return a pointer to the corresponding PRC entity. Similarly, if you provide a pointer to a PRC entity when calling HIOConnector::GetHoopsEntity, the HIOConnector will return the key(s) of object(s) within the HOOPS/3DGS database which are used to represent the PRC entity.

Here is some sample code which sets up and utilizes the HIOConnector capabilities. Note that we create a new HIOConnector object and pass its handle into the HInputHandlerOptions class. After input is complete, the HIOConnector class will encapsulate the mapping information.

    #include "HIOManager.h"
    
    HFileInputResult result = InputOK;
    HInputHandlerOptions input_options;
    HIOConnector *connector = new HIOConnector;

    // setup the input options with a HOOPS Exchange license key and an HBaseView object
    input_options.m_license = const char* licensekey = "<license_key_string>"; 
    input_options.m_pHBaseView = my_view;
    input_options.m_pConnector = connector;

    // open up the desired HOOPS/MVO model segment and read the file
    HC_Open_Segment_By_Key(<my model key>);
        result = HBaseModel::Read("c:\\temp\\myFile.CATProduct", view, true, &input_options);
    HC_Close_Segment();

    my_view->FitSegment(modelkey);
    my_view->Update();

    HC_Open_Segment_By_Key(<my model key>);
    HC_Begin_Contents_Search("...", "shells");
    char temp[256];
    HC_KEY key;
    while (HC_Find_Contents(temp, &key))
    {
        void *prc_entity = connector->GetKernelEntity(key);
        HC_KEY newkey = connector->GetHoopsEntity(prc_entity);

        if (newkey == key)
            AfxMessageBox(_T("Same Roundtripped Key"));
    }
    HC_End_Contents_Search();
    HC_Close_Segment();

Once a PRC entity is obtained via the HIOConnector::GetKernelEntity method, we can use various HOOPS Exchange methods to further query the PRC data, including traversing up the PRC topology:

// Get PRC topology entity from the HOOPS key via HIO_Connector:
A3DEntity* pEntity = (A3DEntity *)connector->GetKernelEntity(hoops_key);

// Get "OwnersManager" for PRC entity
A3DTopoItemOwnersManagerGet(pEntity, m_pTopologyOwnersManager));

// Use OwnersManager to retrieve the item's "owner"
A3DTopoItemOwner* pTopoItemEdgeOwner = NULL;
A3DTopoItemOwnersGet(m_pTopologyOwnersManager, pEntity, pTopoItemEdgeOwner);

4.0 Platform Support

For Release 19.14, the HOOPS Exchange HIO component is supported under Windows 32-bit/64-bit for Microsoft Visual Studio 2008/2010, and 32-bit/64-bit Linux (Ubuntu 10.04 LTS gcc/g++ 4.4.3).

For Release 19.1, the HOOPS Exchange HIO component is supported under Windows 32-bit/64-bit for Microsoft Visual Studio 2008 and 2010.

5.0 Required Libraries

For Release 19.34+, the HOOPS Exchange HIO component requires HOOPS Exchange 6.0.

For Release 19.28, the HOOPS Exchange HIO component requires HOOPS Exchange 5.3.

For Release 19.16, the HOOPS Exchange HIO component supports HOOPS Exchange 5.0.

For Release 19.14, the HOOPS Exchange HIO component supports HOOPS Exchange 4.2.

For Release 19.1, the HOOPS Exchange HIO component supports HOOPS Exchange 4.1.