Refer to the mtk_thumbnail_generation_example_page.
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData/ModelReader.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/View/ImageWriter.hxx>
#include <cadex/View/ImageWriterParameters.hxx>
#include <cadex/View/Color.hxx>
#include <iostream>
#include "../../mtk_license.cxx"
using namespace std;
int main(int argc, char *argv[])
{
auto aKey = MTKLicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate Manufacturing Toolkit license." << endl;
return 1;
}
if (argc != 3) {
cerr << "Usage: " << argv[0] << " <input_file> <output_file>, where:" << endl;
cerr << " <input_file> is a name of the model file to be read" << endl;
cerr << " <output_file> is a name of the image file to be write" << endl;
return 1;
}
const char* aSource = argv[1];
const char* aDest = argv[2];
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
aWriterParameters.
SetImageWidth (750);
aWriterParameters.
SetImageHeight (500);
aWriterParameters.
SetViewIsFitAll (
true);
aWriterParameters.
SetViewBackground (aBackground);
aWriter.
SetParameters (aWriterParameters);
if (!aWriter.
WriteFile (aModel, aDest)) {
cerr << "Failed to write the image file " << aDest << endl;
return 1;
}
cout << "Thumbnail successfully generated: " << aDest << endl;
return 0;
}
Provides MTK data model.
Definition Model.hxx:40
Reads STEP and native format.
Definition ModelReader.hxx:33
Defines color background style.
Definition BackgroundStyle.hxx:45
Defines an RGBA color.
Definition Color.hxx:32
Writes an image file with graphical content of a model.
Definition ImageWriter.hxx:41
Defines parameters of the ImageWriter.
Definition ImageWriterParameters.hxx:34
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30