#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelAlgo_BRepMesher.hxx>
#include <cadex/ModelData_IndexedTriangleSet.hxx>
#include <cadex/ModelData_ModelReader.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"
using namespace std;
{
cout << "PolyPoint set contains " << n << " vertices" << endl;
for (int i = 0; i < n; ++i) {
cout << "Point " << i << ":" << endl;
cout << " Node coordinates:" << endl;
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;
cout << " (" << aV.X() << ", " << aV.Y() << ", " << aV.Z() << ")" << endl;
}
}
}
{
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;
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;
}
}
{
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 (!aReader.
Read (aSource, aModel)) {
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
aMesher.Compute (aModel);
PartPolyVisitor aVisitor;
return 0;
}
Computes a polygonal representation from a B-Rep one.
Definition: ModelAlgo_BRepMesher.hxx:48
bool IsOfType() const
Returns true if the object has a type T.
Definition: ModelData_BaseObject.hxx:57
Defines an RGBA color (with alpha channel).
Definition: ModelData_Color.hxx:34
float A() const
Returns alpha-channel.
Definition: ModelData_Color.hxx:76
Defines a polygonal shape consisting of triangles.
Definition: ModelData_IndexedTriangleSet.hxx:35
const CoordType & Coordinate(IndexType theFace, IndexType theVertexSlot) const
Returns a vertex coordinate.
Definition: ModelData_IndexedTriangleSet.cxx:210
bool HasNormals() const
Returns true if the triangle set has explicitly defined normals.
Definition: ModelData_IndexedTriangleSet.cxx:228
bool HasUVCoordinates() const
Returns true if the triangle set has UV coordinates associated with vertices.
Definition: ModelData_IndexedTriangleSet.cxx:289
const NormalType & VertexNormal(IndexType theFace, IndexType theVertexSlot) const
Returns a normal at a vertex in a face.
Definition: ModelData_IndexedTriangleSet.cxx:246
const ModelData_Point2d & UVCoordinate(IndexType theFace, IndexType theVertexSlot) const
Returns a UV coordinate associated with a vertex.
Definition: ModelData_IndexedTriangleSet.cxx:299
const ColorType & VertexColor(IndexType theFace, IndexType theVertexSlot) const
Returns a color at a vertex in a face.
Definition: ModelData_IndexedTriangleSet.cxx:271
IndexType NumberOfFaces() const
Returns a number of faces (triangles).
Definition: ModelData_IndexedTriangleSet.cxx:179
ModelData_Vectorf NormalType
Defines a type of the normal vector.
Definition: ModelData_IndexedTriangleSet.hxx:42
Element visitor with empty implementation.
Definition: ModelData_Model.hxx:113
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
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_PolyRepresentation PolyRepresentation(ModelData_RepresentationMask theRepresentationMask) const
Definition: ModelData_Part.cxx:371
Defines a 2D point.
Definition: ModelData_Point2d.hxx:193
Defines a 3D point.
Definition: ModelData_Point.hxx:295
Defines a polygonal shape consisting of polylines.
Definition: ModelData_PolyLineSet.hxx:31
const CoordType & Coordinate(IndexType thePolyline, IndexType theVertexSlot) const
Returns a vertex coordinate.
Definition: ModelData_PolyLineSet.cxx:99
IndexType NumberOfPolyLines() const
Returns a number of polylines.
Definition: ModelData_PolyLineSet.cxx:89
IndexType NumberOfVertices(IndexType thePolyline) const
Returns a number of vertices in a polyline.
Definition: ModelData_PolyLineSet.cxx:80
Defines a polygonal shape consisting of individual points.
Definition: ModelData_PolyPointSet.hxx:31
Defines polygonal (faceted or tessellated) representation of part.
Definition: ModelData_PolyRepresentation.hxx:39
const ModelData_PolyShapeList & Get() const
Returns poly shapes comprising the representation.
Definition: ModelData_PolyRepresentation.cxx:408
List of vertex sets contained in polygonal representation.
Definition: ModelData_PolyShapeList.hxx:33
Base class for particular vertex sets - triangle sets, polyline sets, point sets.
Definition: ModelData_PolyVertexSet.hxx:31
int IndexType
Type of indices.
Definition: ModelData_PolyVertexSet.hxx:35
const CoordType & Coordinate(IndexType theVertexIndex) const
Returns a vertex coordinate.
Definition: ModelData_PolyVertexSet.cxx:81
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22