#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelAlgo/MeshGenerator.hxx>
#include <cadex/ModelData/Body.hxx>
#include <cadex/ModelData/Face.hxx>
#include <cadex/ModelData/Model.hxx>
#include <cadex/ModelData/ModelReader.hxx>
#include <cadex/ModelData/Part.hxx>
#include <cadex/ModelData/ShapeIterator.hxx>
#include <cmath>
#include <iostream>
#include "../../mtk_license.cxx"
using namespace std;
{
public:
{
if (myFace.IsNull()) {
ExploreBRep (thePart.
Bodies());
}
}
{
return myFace;
};
private:
void ExploreBRep (const std::vector<ModelData::Body>& theBodies)
{
for (const auto& aBody : theBodies) {
const auto& aFirstShape = aFaceIt.
Next();
const auto& aFirstFace = ModelData::Face::Cast (aFirstShape);
myFace = aFirstFace;
break;
}
}
};
};
{
cout <<
"Face triangulation contains " << anITS.
NumberOfTriangles() <<
" triangles." << endl;
const size_t aNumberOfTrianglesToPrint = std::min (
size_t (4), anITS.
NumberOfTriangles());
for (size_t i = 0; i < aNumberOfTrianglesToPrint; ++i) {
cout << "Triangle index " << i << " with vertices: " << endl;
for (size_t j = 0; j < 3; ++j) {
cout << " Vertex index " << aVertexIndex << " with coords (";
cout <<
"X: " << aPoint.
X() <<
", ";
cout << "Y: " << aPoint.Y() << ", ";
cout << "Z: " << aPoint.Z() << ")" << endl;
}
}
}
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>, where:" << endl;
cerr << " <input_file> is a name of the file to be read" << endl;
return 1;
}
const char* aSource = argv[1];
if (!aReader.
Read (aSource, aModel)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
aMesher.Generate (aModel);
FirstFaceGetter aVisitor;
PrintFaceTriangulationInfo (aFace);
return 0;
}
Generates a polygonal mesh for a B-Rep body.
Definition MeshGenerator.hxx:39
Defines parameters used by the mesh generator.
Definition MeshGeneratorParameters.hxx:29
void SetChordalDeflection(double theValue)
Sets chordal deflection.
Definition MeshGeneratorParameters.cxx:195
void SetAngularDeflection(double theValue)
Sets angular deflection.
Definition MeshGeneratorParameters.cxx:293
Defines a topological face.
Definition Face.hxx:33
IndexedTriangleSet Triangulation() const
Returns triangulation of the face.
Definition Face.cxx:343
Defines a polygonal shape consisting of triangles.
Definition IndexedTriangleSet.hxx:33
size_t NumberOfTriangles() const
Returns a number of triangles.
Definition IndexedTriangleSet.cxx:326
const VertexType & TriangleVertex(size_t theTriangleIndex, size_t theVertexSlot) const
Returns a vertex of a triangle.
Definition IndexedTriangleSet.cxx:241
int TriangleVertexIndex(size_t theTriangleIndex, size_t theVertexSlot) const
Returns a vertex index in a triangle.
Definition IndexedTriangleSet.cxx:254
Element visitor with empty implementation.
Definition ModelElementVisitor.hxx:64
Provides MTK data model.
Definition Model.hxx:40
void Accept(ModelElementVisitor &theVisitor) const
Accepts a visitor.
Definition Model.cxx:274
Reads STEP and native format.
Definition ModelReader.hxx:33
bool Read(const UTF16String &theFilePath, ModelData::Model &theModel)
Reads the file at the specified path into the specified model.
Definition ModelReader.cxx:276
Defines a leaf node in the scene graph hiearchy.
Definition Part.hxx:34
Iterates over subshapes in a shape.
Definition ShapeIterator.hxx:32
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition LicenseManager_LicenseError.hxx:30