#include <cadex/Base/ProgressScope.hxx>
#include <cadex/Base/ProgressStatus.hxx>
#include <cadex/LicenseManager/LicenseError.hxx>
#include <cadex/LicenseManager/LicenseManager.hxx>
#include <cadex/ModelAlgo/MeshGenerator.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <iostream>
#include "../../helpers/LicenseHelper.hxx"
#include "../../mtk_license.cxx"
using namespace std;
class ProgressBarObserver : public ProgressStatus::Observer
{
public:
{
cout << theInfo.
Value() <<
"%" << endl;
}
{
cout << theInfo.
Value() <<
"%: complete!" << endl;
}
};
int main (int argc, char* argv[])
{
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <input_file>, where:" << endl;
cerr << " <input_file> is a name of the file to be read" << 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];
ProgressBarObserver anObserver;
anObserver.SetAllNotifyingThreads();
{
aReader.
SetProgressStatus (aStatus);
aReader.
Read (aSource, aModel);
}
aMesher.
SetProgressStatus (aStatus);
}
mtk::LicenseManager::Deactivate();
return 0;
}
Computes a bounding box for theShape, takes its maximum dimension and multiplies by thePrec.
Definition MeshGenerator.cs:36
void Generate(cadex.ModelData.Model theModel, bool theEnforceGeneration)
Generates a mesh for the model.
Definition MeshGenerator.cs:94
Provides MTK data model.
Definition Model.cs:31
bool IsEmpty()
Returns true if the model has no roots, i.e.
Definition Model.cs:100
Reads supported formats, see Import section.
Definition ModelReader.cs:17
bool Read(cadex.UTF16String theFilePath, cadex.ModelData.Model theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cs:82
Represents a node in a hierarchy of progress scopes.
Definition ProgressScope.cs:50
Provides progress status and notification mechanism.
Definition ProgressStatus.cs:64
void Register(ProgressStatus.Observer theObserver, float theValueThreshold, uint theTimeThreshold)
The life span of theObserver must be greater than one of this status object.
Definition ProgressStatus.cs:136
double Value()
Beware of internal rounding errors.
Definition ProgressStatus.cs:429
bool WasCanceled()
The operation can be canceled either by explicit call to Cancel() or when a cancelation checker set w...
Definition ProgressStatus.cs:492
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition BaseObject.cs:12