HOOPS Exchange to StreamCache Mapping (Beta)
Please note, this functionality is only available on Windows and is not publicly exposed in the Exchange API -- please contact us if you are interested in using this feature.
While the Stream Cache (SC) format used in HC is very rich and retains a lot of the data that is associated with a typical CAD model, it is sometimes desirable to have even deeper access to the precise B-rep and attribute data as well as perform calculations that HC does not support directly. Connecting an HC viewing session to Exchange on the server is one way to accomplish this. We currently offer a beta version of the bidirectional StreamCache-Exchange mapping functionality that facilitates these types of workflows.
The following steps are currently required for this feature to work:
- When converting the original CAD model to the SC format via Converter, the --add_exchange_ids command line options has to be set to true. This step will generate Exchange ID's for every node in the model which can be queried in the WebViewer with a call to model.getNodeExchangeId().
- On the server, the PRC file associated with the SC model being viewed should be loaded into Exchange via the function A3DPrcIdMapCreate(). The resulting map can then be used to find the Exchange entity associated with the Exchange ID that the viewer has passed to the server.
Matching Conversion Parameters
When loading a CAD file into Exchange on the server, it's important to ensure that the parameters of your Exchange loader match the corresponding parameters from the conversion process in Converter (referred to in Step 1 above). If you change your command-line options in Converter, then be sure to alter your Exchange CAD conversion accordingly.
The following code snippet for loading a file in Exchange corresponds with the default parameters from Converter:
Once the CAD file has been loaded, you can call A3DPrcIdMapFindId() to retrieve the corresponding A3DEntity from your Exchange model. For example:
The process of parsing an Exchange entity to retrieve data is beyond the scope of this document and will largely depend on your file conversion configuration and the type of data you'd like to extract.
Relationships Between Entity Types
Exchange product occurrences directly correspond to product occurrences in HC.
To avoid storing the same geometry structure multiple times, Exchange uses the concept of prototypes. When we parse the tree we generate a unique exchangeId for all traversed entities, so instances of the same prototype representation items will have different, unique exchangeID's.
Selecting a Server Framework for HOOPS Exchange
Since most users integrate their applications with Exchange in C++, it's probably most expedient to find a web server framework that can call directly into C++ code. Restbed is one example.