#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);
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;
}
Provides MTK data model.
Definition Model.hxx:39
Reads supported formats, see Import section.
Definition ModelReader.hxx:32
Defines color background style.
Definition BackgroundStyle.hxx:37
Writes an image file with graphical content of a model.
Definition ImageWriter.hxx:43
Defines parameters of the ImageWriter.
Definition ImageWriterParameters.hxx:32
Defines an exception thrown by a license manager when a valid license could not be acquired.
Definition LicenseError.hxx:37
const char * what() const noexcept override
Returns an error string.
Definition LicenseError.cxx:50
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseError.hxx:27