CAD Exchanger SDK
Delayed Conversion

Overview

Delayed conversion allows to incrementally convert the model during its life span. This primarily applies in import scenarios when working with large assemblies consisting of multiple parts. Instead of complete one-shot import operation (in Base_Reader::Transfer()) when all model data contents are loaded from external file and converted into target representations much more light-weight structures are created under the cover. Real loading and conversion takes place upon first access to data.

This behavior is controlled by the DelayedConversion(). By default, this parameter is false in order to provide a blocking style behavior (i.e. conversion fully completes upon Base_Reader::Transfer() call exit). To take advantage of delayed conversion this parameter should be set to true in an object of a respective subclass of Base_ReaderParameters (e.g. STEP_ReaderParameters):

#include <cadex/STEP_Reader.hxx>
#include <cadex/STEP_ReaderParameters.hxx>
using namespace cadex;
STEP_Reader aReader;
auto& aParam = aReader.Parameters();
aParam.DelayedConversion() = true;
aReader.ReadFile ("myfile.stp") && aReader.Transfer (aModel);

Benefits

Key benefits of delayed conversion include greater responsiveness of the application (due to shorter import times) and reduced memory footprint. This is especially beneficial when working with large assemblies consisting of multiple sub-assemblies and parts when the user may only intend to import particular sub-assembly or part. In such scenario, delayed conversion allows to quickly import a product structure (assembly/part tree), after what the user would be able to select a sub-tree of interest and only required parts would be loaded.

Taking advantage of delayed conversion CAD Exchanger GUI itself is able to offer greater user experience by gradually loading 3D model and displaying it simultaneously with conversion running in parallel threads.

Supported data and formats

Readers of the following formats support delayed conversion:

  • ACIS;
  • IGES;
  • JT;
  • Parasolid;
  • Rhino;
  • STEP;
  • Native CAD Exchanger format.

The following data segments which are typically the most heavy-weight in the file support delayed conversion:

JT specificity

Due to specificities of the JT format JT reader makes even greater possibility of delayed conversion by deferring parsing JT file data segments (such as XT B-Rep, JT B-Rep, ShapeLOD, Meta Data and PMI data segments). This allows to additionally minimize amount of data to be loaded and parsed when reading JT files.

Potential pitfalls

Taking full advantage of delayed conversion requires its careful use by the application developers willing to integrate it into their application. Naive use can lead to the following potential downsides:

Longer conversion times

If the model is eventually completely loaded into the memory a total wall-clock time of incremental conversions can be greater comparing to immediate (non-delayed) conversion. This can happen if model parts are loaded one by one inside the user application. On the other hand, if immediate conversion were used instead of delayed one, then the model would be imported faster thanks to intensive use of parallel computations inside CAD Exchanger SDK.

To deal with that various pipelining techniques to enable concurrency need to be applied in the user's code.

Imbalanced data access times

As real conversion happens during first data access then the same user's code may take significantly different time whether it is a first or consequent calls. For instance, in the following code

void ProcessBRep (const ModelData_Part& thePart)
{
ModelData_BRepRepresentation aBRep = thePart.BRepRepresentation();
const ModelData_BodyList& aList = aBRep.Get(); //conversion happens inside during first call
//process part bodies...
}

a time of ModelData_BRepRepresentation::Get() execution will be essentially zero if the B-Rep has already been loaded. In the case of delayed conversion this call will take relatively considerable time as real conversion takes place.