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.cs:30
Reads supported formats, see Import section.
Definition ModelReader.cs:17
Defines color background style.
Definition ColorBackgroundStyle.cs:17
Defines an RGBA color.
Definition Color.cs:17
Writes an image file with graphical content of a model.
Definition ImageWriter.cs:17
Defines parameters of the ImageWriter.
Definition ImageWriterParameters.cs:17
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition BaseObject.cs:12