Reading (importing) and writing (exporting) files are the mainstream scenarios when using CAD Exchanger SDK. This can be the simplest way to integrate support of a new format into your application if it can already parse some format. For instance, if your application can parse STL files and you consider adding support of the IGES format then you can read IGES files and convert them to temporary STL files with the help of CAD Exchanger, and then parse those STL files using your existing code.
Each format is designated by a corresponding prefix, for instance JT_, ACIS_, IGES_, etc - refer to General Conventions for naming conventions.
Refer to Supported Formats for details on the supported scope for each format.
All reader classes subclass Base_Reader.
Reading a file consists of two steps:
Depending on a file format, Base_Reader::ReadFile() can accept a file name defined as Base_UTF16String or as a C++ stream std::istream.
Base_Reader::Transfer() accepts a ModelData_Model object which is populated with the contents imported from the file being read. The model is not cleaned up before converting, therefore a few files can be accumulated in the same model.
The following example demonstrates a typical reading workflow:
All writer classes subclass Base_Writer.
Symmetrically to reading a file, writing a file consists of two steps:
Base_Writer::Transfer() accepts a ModelData_Model object and uses its contents to convert to a target file.
Depending on a file format, Base_Writer::WriteFile() can accept a file name defined as Base_UTF16String or as a C++ stream std::ostream.
The following example demonstrates a typical writing workflow:
Readers and writers support progress status update. The example below demonstrates how to add observers to an internal progress status object:
For details refer to Progress Status Support and Progress Status Example.
Refer to General Example, Progress Status Example.