#include <cadex/Geom/Direction.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <cadex/Projector_PolyData.hxx>
#include <cadex/Projector_PolyProjector.hxx>
#include <cadex/LicenseManager_LicenseError.hxx>
#include <iostream>
#include "../../mtk_license.cxx"
using namespace std;
class SceneGraphPolyProjector : public ModelData::ModelElementVoidVisitor
{
public:
SceneGraphPolyProjector (Geom::Direction theDirection)
{
myDirection = theDirection;
}
protected:
void operator() (const ModelData::Part& thePart) override
{
Projector_PolyData aData = myProjector.Perform (thePart, myDirection);
std::cout << "Part projection [" << thePart.Name() << "] has:" << endl;
std::cout << " area = " << aData.ProjectionArea() << " mm" << endl << endl;
}
private:
Geom::Direction myDirection;
Projector_PolyProjector myProjector;
};
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 != 2) {
cerr << "Usage: " << argv[0] << " <input_file> <output_folder>, where:" << endl;
cerr << " <input_file> is a name of the file to be read" << endl;
return 1;
}
const char* aSource = argv[1];
ModelData::Model aModel;
ModelData::ModelReader aReader;
if (!aReader.Read (aSource, aModel)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
cout << "Model: " << aModel.Name() << "\n" << endl;
SceneGraphPolyProjector aProjector (Geom::Direction::YDir());
aModel.Accept (aProjector);
return 0;
}
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.