CAD Exchanger SDK
Delayed External File Parsing

Overview

Delayed external file parsing allows to incrementally load elements of the model stored in external files. Instead of parsing the main file and the referenced external files all at once only the contents of the main file (specified as parameter for the ReadFile()) are loaded. Data from external files is loaded on demand by calling FlushProvider() on a respective scene graph element (e.g. ModelData_Assembly or ModelData_Part) as shown below:

using namespace cadex;
void Load (const ModelData_Assembly& theAssembly)
{
if (!theAssembly.IsNull() && theAssembly.HasProvider()) {
theAssembly.FlushProvider();
}
}

This behavior is controlled by the DelayedExternalFileParsing() flag. By default, this parameter is set to false in order to provide a blocking style behavior (i.e. parsing is fully complete upon the exit from ReadFile()). To take advantage of delayed external file parsing this parameter should be set to true:

#include <cadex/JT_Reader.hxx>
#include <cadex/JT_ReaderParameters.hxx>
using namespace cadex;
JT_Reader aReader;
auto& aParam = aReader.Parameters();
aReader.ReadFile ("myfile.jt") && aReader.Transfer (aModel);

This option could be used in combination with DelayedConversion().

Benefits

Key benefits of delayed external file parsing include reduced memory footprint and ability to only load specific model elements. This is especially beneficial when working with large assemblies consisting of multiple sub-assemblies and parts stored in external files when the user may only intend to import a particular sub-assembly or part.

Supported data and formats

Currently, only JT format supports delayed external file parsing.