#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData/Body.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/Solid.hxx>
#include <cadex/WallThickness_Data.hxx>
#include <cadex/WallThickness_Analyzer.hxx>
#include <iostream>
#include "../../helpers/shape_processor.hxx"
#include "../../mtk_license.cxx"
using namespace std;
class PartProcessor : public SolidProcessor
{
public:
{
auto aWTData = myAnalyzer.Perform (theSolid, myResolution);
PrintWTData (aWTData);
}
{
cout <<
" Min thickness = " << theData.
MinThickness() <<
" mm" << endl;
cout <<
" Max thickness = " << theData.
MaxThickness() <<
" mm\n" << endl;
} else {
cerr << " Failed to analyze the wall thickness of this entity.\n";
}
}
size_t myResolution = 1000;
private:
};
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 || argc > 3) {
cerr << "Usage: " << argv[0] << " <input_file> <input_resolution>, where:" << endl;
cerr << " <input_file> is a name of the file to be read" << endl;
cerr << " <input_resolution> is an optional argument that determine accuracy"
<< " of wall thickness calculation."
<< " The larger the value, the higher the accuracy of the calculations,"
<< " but greatly increase computation time and memory usage."
<< " Should be at least 100." << endl;
return 1;
}
const char* aSource = argv[1];
size_t aResolution = 1000;
if (argc == 3) {
aResolution = std::atoi (argv[2]);
}
if (aResolution < 100) {
cout << "WARNING: Input resolution \"" << aResolution << "\" < 100. Will be used default resolution." << "\n" << endl;
aResolution = 1000;
}
if (!aReader.
Read (aSource, aModel)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
cout <<
"Model: " << aModel.
Name() <<
"\n" << endl;
PartProcessor aPartProcessor;
aPartProcessor.myResolution = aResolution;
return 0;
}
Defines a visitor that visits each unique element only once.
Definition ModelElementVisitor.hxx:87
Provides MTK data model.
Definition Model.hxx:40
UTF16String Name() const
Returns a model name.
Definition Model.cxx:250
void Accept(ModelElementVisitor &theVisitor) const
Accepts a visitor.
Definition Model.cxx:270
Reads STEP and native format.
Definition ModelReader.hxx:29
bool Read(const UTF16String &theFilePath, ModelData::Model &theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cxx:227
Defines a topological solid.
Definition Solid.hxx:32
The wall thickness analyzing tool.
Definition WallThickness_Analyzer.hxx:40
Contains information about minimum and maximum wall thicknesses.
Definition WallThickness_Data.hxx:41
double MaxThickness() const
Returns the maximum wall thickness in mm.
Definition WallThickness_Data.cxx:148
bool IsEmpty() const
Returns true if WallThickness_Data is empty.
Definition WallThickness_Data.cxx:207
double MinThickness() const
Returns the minimum wall thickness in mm.
Definition WallThickness_Data.cxx:142
Defines classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30