#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelAlgo_BRepMesher.hxx>
#include <cadex/ModelData_IndexedTriangleSet.hxx>
#include <cadex/ModelData_Model.hxx>
#include <cadex/ModelData_Part.hxx>
#include <cadex/ModelData_Point2d.hxx>
#include <cadex/ModelData_PolyLineSet.hxx>
#include <cadex/ModelData_PolyPointSet.hxx>
#include <cadex/ModelData_PolyRepresentation.hxx>
#include <cadex/ModelData_PolyShapeList.hxx>
#include <iostream>
#include "../../cadex_license.cxx"
{
ModelData_PolyPointSet::IndexType n = thePS.
NumberOfVertices();
cout << "PolyPoint set contains " << n << " vertices" << endl;
for (int i = 0; i < n; ++i) {
cout << "Point " << i << ":" << endl;
cout << " Node coordinates:" << endl;
const ModelData_PolyPointSet::CoordType& aP = thePS.
Coordinate (i);
cout << " (" << aP.X() << ", " << aP.Y() << ", " << aP.Z() << ")" << endl;
}
}
{
cout << "PolyLine set contains " << n << " PolyLines" << endl;
for (int i = 0; i < n; ++i) {
cout << "PolyLine " << i << ":" << endl;
cout << " Node coordinates:" << endl;
const ModelData_PolyLineSet::CoordType& aV = thePLS.
Coordinate (i, j);
cout << " (" << aV.X() << ", " << aV.Y() << ", " << aV.Z() << ")" << endl;
}
}
}
{
ModelData_IndexedTriangleSet::IndexType n = theTS.
NumberOfFaces();
cout << "Triangle set contains " << n << " Triangles" << endl;
for (int i = 0; i < n; ++i) {
cout << "Triangle " << i << ":" << endl;
for (int j = 0; j < 3; ++j) {
cout << " Node " << j << ":" << endl;
const ModelData_IndexedTriangleSet::CoordType& aV = theTS.
Coordinate (i, j);
cout << " Coordinates: (" <<
aV.X() << ", " << aV.Y() << ", " << aV.Z() << ")" << endl;
cout << " UV coordinates: (" <<
aUV.X() << ", " << aUV.Y() << ")" << endl;
}
cout << " Normal vector: (" <<
aN.X() << ", " << aN.Y() << ", " << aN.Z() << ")" << endl;
}
cout << " Color (RGBA): (" <<
aColor.
R() <<
", " << aColor.
G() <<
", " << aColor.
B() <<
", " << aColor.
A() <<
")" << endl;
}
}
}
}
{
cout << "IndexedTriangleSet type." << endl;
DumpTriangleSet (anITS);
cout << "PolyLineSet type" << endl;
DumpPolyLineSet (aPLS);
cout << "PolyPointSet type" << endl;
DumpPolyPointSet (aPPS);
} else {
cout << "Undefined type" << endl;
}
}
{
const ModelData_PolyShapeList& aList = thePoly.
Get();
for (ModelData_PolyShapeList::SizeType i = 0; i < aList.Size(); ++i) {
cout << "PolyShape " << i << ":" << endl;
PrintPVSInfo (aPVS);
}
}
{
protected:
{
if (aPolyRep) {
ExplorePoly (aPolyRep);
}
}
};
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 (!aModel.
Open (aSource)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
PartPolyVisitor aVisitor;
return 0;
}