#include <cadex/Base_String.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_Assembly.hxx>
#include <cadex/ModelData_Body.hxx>
#include <cadex/ModelData_BodyList.hxx>
#include <cadex/ModelData_BRepRepresentation.hxx>
#include <cadex/ModelData_Instance.hxx>
#include <cadex/ModelData_ModelReader.hxx>
#include <cadex/ModelData_Part.hxx>
#include <cadex/ModelData_PropertyTable.hxx>
#include <cadex/ModelData_Shape.hxx>
#include <iostream>
#include <vector>
#include "../../cadex_license.cxx"
using namespace std;
class PropertyVisitor : public ModelData_PropertyTable::VoidVisitor
{
public:
PropertyVisitor()
{
cout << "\nProperty table: " << endl;
}
void operator() (PropertyNameConstReference theName,
I32 theValue)
override
{
OutputData (theName, theValue);
}
void operator() (PropertyNameConstReference theName, double theValue) override
{
OutputData (theName, theValue);
}
void operator() (PropertyNameConstReference theName,
const Base_UTF16String& theValue)
override
{
OutputData (theName, theValue);
}
protected:
template <typename T>
void OutputData (PropertyNameConstReference& theName, T theValue)
{
cout << theName << ": " << theValue << endl;
}
};
{
PropertyVisitor aPropVisitor;
}
class SubshapePropertiesVisitor : public ModelData_BRepRepresentation::SubshapeVisitor
{
public:
vector<ModelData_PropertyTable> PropertyTables()
{
return myPTVector;
}
protected:
{
myPTVector.push_back (aPT);
}
private:
vector<ModelData_PropertyTable> myPTVector;
};
{
protected:
{
ExplorePropertyTable (aPT);
if (aBRep) {
SubshapePropertiesVisitor aVisitor (aBRep);
vector<ModelData_PropertyTable> aPTVector = aVisitor.PropertyTables();
for (size_t i = 0; i < aPTVector.size(); ++i) {
ExplorePropertyTable (aPTVector[i]);
}
}
}
{
ExplorePropertyTable (aPT);
return true;
}
};
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];
cerr << "Failed to read the file " << aSource << endl;
return 1;
}
PropertiesVisitor aVisitor;
return 0;
}
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition: Base_UTF16String.hxx:34
Defines precise Boundary Representation of part.
Definition: ModelData_BRepRepresentation.hxx:39
void Accept(SubshapeVisitor &theVisitor) const
Applies the visitor to visit the subshapes.
Definition: ModelData_BRepRepresentation.cxx:993
Provides combined methods VisitEnter() and VisitLeave() to visit all elements.
Definition: ModelData_Model.hxx:123
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
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_BRepRepresentation BRepRepresentation() const
Definition: ModelData_Part.cxx:360
Defines a collection of properties.
Definition: ModelData_PropertyTable.hxx:40
void Accept(Visitor &theVisitor) const
Accepts the visitor.
Definition: ModelData_PropertyTable.cxx:496
Base class for part, instance and assembly.
Definition: ModelData_SceneGraphElement.hxx:39
ModelData_PropertyTable Properties() const
Returns a property table.
Definition: ModelData_SceneGraphElement.cxx:338
Base class of topological shapes.
Definition: ModelData_Shape.hxx:37
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22
int I32
Defines a signed 32-bit integer.
Definition: Base_TypeDef.hxx:50