Hide menu
Loading...
Searching...
No Matches
Transfer Example

Table of Contents

Converts a file from one CAD format to another.

Overview

The Transfer Example shows how to perform a conversion between different file formats. Unlike the Import Example and the Export Example we will use all-purpose ModelData_ModelReader and ModelData_ModelWriter to handle import and export from and to any supported format.

The workflow is straightforward: we read model data from one format using Reader into ModelData_Model object, then write it to another format using Writer. Thanks to the universal reader and writer the code remains the same for any input and output formats supported by CAD Exchanger.

Main Function

As we did with Importing and Exporting we should complete the following steps:

ModelData_ModelReader aReader;
ModelData_Model aModel;
if (!aReader.Read (aSource, aModel) {
cerr << "Failed to open and convert the file " << aSource << endl;
return 1;
}
ModelData_ModelWriter aWriter;
  • Finally we can convert model data to a chosen format (specified as file extension) and save it:
if (!aWriter.Write (aModel, aDest)) {
cerr << "Failed to convert and write the file to specified format" << aDest << endl;
return 1;
}

Summary

CAD Exchanger SDK provides a lot of packages for model data conversion. It's possible to read, write and transfer almost every existing model data format simply using algorithm described above.

To learn more about conversion possibilities please visit the Converter Details.

Files