#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_Body.hxx>
#include <cadex/ModelData_BodyList.hxx>
#include <cadex/ModelData_BRepRepresentation.hxx>
#include <cadex/ModelData_IndexedTriangleSet.hxx>
#include <cadex/ModelData_ModelReader.hxx>
#include <cadex/ModelData_PolyRepresentation.hxx>
#include <cadex/ModelData_PolyShapeList.hxx>
#include <cadex/ModelData_PolyVertexSet.hxx>
#include <cadex/ModelData_SceneGraphElementUniqueVisitor.hxx>
#include <cadex/ModelData_Solid.hxx>
#include <cadex/WallThickness_Data.hxx>
#include <cadex/WallThickness_Analyzer.hxx>
#include <iostream>
#include "../../../cadex_license.cxx"
#include "../../../mtk_license.cxx"
using namespace std;
{
public:
{
const auto& aBodyList = aBRep.Get();
for (size_t i = 0, n = aBodyList.Size(); i < n; ++i) {
const auto& aBody = aBodyList[i];
while (aShapeIt.
HasNext()) {
const auto& aShape = aShapeIt.
Next();
if (aShape.Type() == ModelData_ST_Solid) {
cout << "Part #" << myPartIndex << " [\"" << aPartName << "\"] - solid #" << std::to_string (i) << " has:" << endl;
ProcessSolid (ModelData_Solid::Cast (aShape));
}
}
}
const auto& aPolyList = aPolyRep.Get();
for (size_t i = 0; i < aPolyList.Size(); ++i) {
const auto& aPVS = aPolyList[i];
cout << "Part #" << myPartIndex << " [\"" << aPartName << "\"] - mesh #" << std::to_string (i) << " has:" << endl;
}
}
}
++myPartIndex;
}
{
auto aWTData = myAnalyzer.Perform (theSolid, myResolution);
PrintWTData (aWTData);
}
{
auto aWTData = myAnalyzer.Perform (theMesh, 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";
}
}
__CADEX_DEFINE_INITIALIZED_PRIMITIVE_PROPERTY (size_t, Resolution, 1000)
private:
size_t myPartIndex = 0;
};
int main (int argc, char* argv[])
{
auto aKey = LicenseKey::Value();
auto anMTKKey = MTKLicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
if (!CADExLicense_Activate (anMTKKey)) {
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.Resolution() = aResolution;
return 0;
}
bool IsEmpty() const
Returns true if the string is empty.
Definition: Base_UTF16String.cxx:233
Base_UTF16String Name() const
Definition: ModelData_BaseObject.cxx:218
Defines a polygonal shape consisting of triangles.
Definition: ModelData_IndexedTriangleSet.hxx:35
Element visitor with empty implementation.
Definition: ModelData_Model.hxx:113
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
const Base_UTF16String & Name() const
Returns a model name.
Definition: ModelData_Model.cxx:358
void Accept(ElementVisitor &theVisitor) const
Accepts a visitor.
Definition: ModelData_Model.cxx:882
Reads any format that CAD Exchanger can import.
Definition: ModelData_ModelReader.hxx:33
bool Read(const Base_UTF16String &theFilePath, ModelData_Model &theModel)
Reads the file at the specified path into the specified model.
Definition: ModelData_ModelReader.cxx:182
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_BRepRepresentation BRepRepresentation() const
Definition: ModelData_Part.cxx:360
ModelData_PolyRepresentation PolyRepresentation(ModelData_RepresentationMask theRepresentationMask) const
Definition: ModelData_Part.cxx:371
Defines a visitor that visits each unique element only once.
Definition: ModelData_SceneGraphElementUniqueVisitor.hxx:33
Iterates over subshapes in a shape.
Definition: ModelData_Shape.hxx:41
Defines a topological solid.
Definition: ModelData_Solid.hxx:31
The wall thickness analyzing tool.
Definition: WallThickness_Analyzer.hxx:42
Contains information about minimum and maximum wall thicknesses.
Definition: WallThickness_Data.hxx:39
double MaxThickness() const
Returns the maximum wall thickness in mm.
Definition: WallThickness_Data.cxx:69
bool IsEmpty() const
Returns true if WallThickness_Data is empty.
Definition: WallThickness_Data.cxx:97
double MinThickness() const
Returns the minimum wall thickness in mm.
Definition: WallThickness_Data.cxx:63
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22