#include <cadex/LicenseManager/LicenseError.hxx>
#include <cadex/LicenseManager/LicenseManager.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/View/ImageWriter.hxx>
#include <cadex/View/ImageWriterParameters.hxx>
#include <cadex/Materials/Color.hxx>
#include <iostream>
#include "../../helpers/LicenseHelper.hxx"
#include "../../mtk_license.cxx"
using namespace std;
int main (int argc, char* argv[])
{
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;
}
auto aKey = MTKLicenseKey::Value();
if (!LicenseHelper::SetupRuntimeKey()) {
return 1;
}
try {
mtk::LicenseManager::Activate (aKey);
} catch (const mtk::LicenseError& theException) {
mtk::LicenseManager::Deactivate();
std::cerr <<
"Failed to activate Manufacturing Toolkit license: " << theException.
what() << std::endl;
return 1;
}
const char* aSource = argv[1];
const char* aDest = argv[2];
cerr << "Failed to read the file " << aSource << endl;
mtk::LicenseManager::Deactivate();
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;
mtk::LicenseManager::Deactivate();
return 1;
}
cout << "Thumbnail successfully generated: " << aDest << endl;
mtk::LicenseManager::Deactivate();
return 0;
}
Defines an RGBA color (with alpha channel).
Definition Color.cs:19
Provides MTK data model.
Definition Model.cs:31
Reads supported formats, see Import section.
Definition ModelReader.cs:17
Defines color background style.
Definition ColorBackgroundStyle.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