#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES
#endif
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_Body.hxx>
#include <cadex/ModelData_BodyList.hxx>
#include <cadex/ModelAlgo_BRepMesher.hxx>
#include <cadex/ModelAlgo_BRepMesherParameters.hxx>
#include <cadex/ModelData_BRepRepresentation.hxx>
#include <cadex/ModelData_BRepToPolyAssociations.hxx>
#include <cadex/ModelData_Face.hxx>
#include <cadex/ModelData_IndexArray.hxx>
#include <cadex/ModelData_IndexedTriangleSet.hxx>
#include <cadex/ModelData_MeshPatch.hxx>
#include <cadex/ModelData_ModelReader.hxx>
#include <cadex/ModelData_ModelWriter.hxx>
#include <cadex/ModelData_Part.hxx>
#include <cmath>
#include <iostream>
#include "../../cadex_license.cxx"
{
public:
{
if (myFace.IsNull()) {
}
}
{
return myFace;
};
private:
{
const auto& aBodyList = theBRep.
Get();
const auto& aFirstBody = aBodyList.
First();
const auto& aFirstShape = aFaceIt.
Next();
const auto& aFirstFace = ModelData_Face::Cast (aFirstShape);
myFace = aFirstFace;
};
};
{
cout <<
"Face triangulation contains " << aTriangleIndices.
Size() <<
" triangles." << endl;
const size_t aNumberOfTrianglesToPrint = std::min (size_t (4), aTriangleIndices.Size());
for (size_t i = 0; i < aNumberOfTrianglesToPrint; ++i) {
auto aTriangleIndex = aTriangleIndices[i];
cout << "Triangle index " << aTriangleIndex << " with vertices: " << endl;
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 = LicenseKey::Value();
if (!CADExLicense_Activate (aKey)) {
cerr << "Failed to activate CAD Exchanger license." << endl;
return 1;
}
if (argc != 2) {
cerr << "Usage: " << argv[0] << " <input_file>, where:" << endl;
cerr << " <input_file> is a name of the XML 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.Compute (aModel, true );
FirstFaceGetter aVisitor;
auto aBRepToPolyAssociations = aMesher.BRepToPolyAssociations();
PrintFaceToPolyAssociation (aFace, aBRepToPolyAssociations);
if (!aWriter.
Write (aModel,
"VisMesher.xml")) {
cout << "Unable to save the model!" << endl;
return 1;
}
return 0;
}