#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.cs:36
Defines parameters used by the mesh generator.
Definition MeshGeneratorParameters.cs:52
void SetAngularDeflection(double theValue)
Sets angular deflection.
Definition MeshGeneratorParameters.cs:189
void SetChordalDeflection(double theValue)
Sets chordal deflection.
Definition MeshGeneratorParameters.cs:148
Defines a topological face.
Definition Face.cs:120
cadex.ModelData.IndexedTriangleSet Triangulation()
Returns triangulation of the face.
Definition Face.cs:237
Defines a polygonal shape consisting of triangles.
Definition IndexedTriangleSet.cs:76
cadex.Geom.Point TriangleVertex(uint theTriangleIndex, uint theVertexSlot)
Returns a vertex of a triangle.
Definition IndexedTriangleSet.cs:188
int TriangleVertexIndex(uint theTriangleIndex, uint theVertexSlot)
Returns a vertex index in a triangle.
Definition IndexedTriangleSet.cs:202
uint NumberOfTriangles()
Returns a number of triangles.
Definition IndexedTriangleSet.cs:245
Element visitor with empty implementation.
Definition ModelElementVoidVisitor.cs:20
Provides MTK data model.
Definition Model.cs:30
void Accept(cadex.ModelData.ModelElementVisitor theVisitor)
Accepts a visitor.
Definition Model.cs:179
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:86
Defines a leaf node in the scene graph hierarchy.
Definition Part.cs:23
Iterates over subshapes in a shape.
Definition ShapeIterator.cs:58
Contains classes, namespaces, enums, types, and global functions related to Manufacturing Toolkit.
Definition BaseObject.cs:12