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:

  1. 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().
  2. 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:

A3DRWParamsLoadData loadData;
A3D_INITIALIZE_DATA(A3DRWParamsLoadData, loadData);
loadData.m_sGeneral.m_bReadSolids = true;
loadData.m_sGeneral.m_bReadSurfaces = true;
loadData.m_sGeneral.m_bReadWireframes = true;
loadData.m_sGeneral.m_bReadPmis = true;
loadData.m_sGeneral.m_bReadAttributes = false;
loadData.m_sGeneral.m_bReadHiddenObjects = false;
loadData.m_sGeneral.m_bReadConstructionAndReferences = false;
loadData.m_sGeneral.m_bReadActiveFilter = true;
loadData.m_sGeneral.m_eReadGeomTessMode = kA3DReadGeomAndTess;
loadData.m_sGeneral.m_eDefaultUnit = kA3DUnitUnknown;
loadData.m_sPmi.m_bAlwaysSubstituteFont = false;
loadData.m_sAssembly.m_bUseRootDirectory = true;
loadData.m_sTessellation.m_eTessellationLevelOfDetail = kA3DTessLODMedium;
loadData.m_sMultiEntries.m_bLoadDefault = true;
loadData.m_sAssembly.m_bRootDirRecursive = false;
A3DStatus status = A3DAsmModelFileLoadFromFile((A3DUTF8Char*)path.c_str(), &loadData, &model_file);
status = A3DPrcIdMapCreate(model_file, &entity_map);
// this call to A3DSimplifyModelFileWithAnalytics corresponds with Converter's handling of CAD data
const double measurement_tolerance = 1e-2;
A3DEEntityType rtypes[] = { kA3DTypeSurfCone, kA3DTypeSurfCylinder,
kA3DTypeSurfPlane, kA3DTypeCrvLine, kA3DTypeCrvCircle };
status = A3DSimplifyModelFileWithAnalytics(model_file, measurement_tolerance, 5, rtypes);

Once the CAD file has been loaded, you can call A3DPrcIdMapFindId() to retrieve the corresponding A3DEntity from your Exchange model. For example:

A3DEntity *exchange_entity = nullptr, *exchange_entity_father = nullptr;
A3DPrcIdMapFindId(sc_exchange_id.c_str(), model_file_->entity_map,
&exchange_entity, &exchange_entity_father);

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

Product Occurrences

Exchange product occurrences directly correspond to product occurrences in HC.

Representation Items

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

Currently, HOOPS Communicator provides no functionality to directly communicate with Exchange or to pass ID's to the server. This should be handled by your WebApp directly – e.g., via httprequests or websocket connections originating from your Javascript client application, passed via REST or some other method to a server running 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.

top_level:2 prog_guide:1 data_import:0 cad_conversion:0 external_data:0