Hide menu
Loading...
Searching...
No Matches
Import and Export

Import

When reading a file, the result is converted into a common data model that provides format-neutral data representation and access API.

Supported Formats

Manufacturing Toolkit can import STEP (.stp/.step) and native MTK (.mtk) format models.

See also:

Reading files

ModelData::ModelReader is the primary class for reading files. The usage is simple: one just has to call a single function with the path to the file that should be read and the target ModelData::Model instance.

The data model object will be populated with the contents imported from the file being read. The model is not cleaned up before conversion, therefore multiple files can be accumulated in the same model.

#include <cadex/ModelData/ModelReader.hxx>
using namespace cadex;
if (!aReader.Read ("myfile.stp", aModel)) {
//error during reading the file
}
Provides MTK data model.
Definition Model.hxx:40
Reads STEP and native format.
Definition ModelReader.hxx:31
bool Read(const UTF16String &theFilePath, ModelData::Model &theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cxx:248
Defines classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30

Parameters

Reader parameters are controlled by ModelData::ModelReaderParameters class and can be set using ModelData::ModelReader::SetParameters() method.

Parameter Default value
ModelData::ModelReaderParameters::ReadPMI() false
ModelData::ModelReaderParameters::ReadDrawing() false

Export

To export a model, use the Save() method provided by the ModelData::Model class. This method writes the contents of the model to a file in the specified format. Supported formats are defined in the ModelData::Model::FileFormatType enum.

Supported Export Formats:

  • .mtk
  • .mtkweb

    using namespace cadex;
    // Populate the model...
    if (!aModel.Save("output_model.mtk", ModelData::Model::FileFormatType::MTK)) {
    std::cerr << std::endl << "ERROR: Failed to export " << std::endl;
    }