#include <cadex/Base_String.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_Instance.hxx>
#include <cadex/ModelData_ModelReader.hxx>
#include <cadex/ModelData_Transformation.hxx>
#include <cadex/ModelData_Vector.hxx>
#include <iostream>
#include <stack>
#include "../../cadex_license.cxx"
using namespace std;
{
public:
InstancesTransformationsVisitor()
{
myTransformationMatrix.push (anIdentity);
}
protected:
{
}
myTransformationMatrix.push (aCumulativeTrsf);
PrintTransformation (theInstance.
Name());
return true;
}
{
myTransformationMatrix.pop();
}
private:
{
theName = "noName";
}
cout << "Instance " << theName << " has transformations: " << endl;
double v00, v01, v02, v10, v11, v12, v20, v21, v22;
myTransformationMatrix.top().RotationPart (v00, v01, v02, v10, v11, v12, v20, v21, v22);
cout << "| " << v00 << " " << v01 << " " << v02 << " " << aTranslation.X() << " |" << endl <<
"| " << v10 << " " << v11 << " " << v12 << " " << aTranslation.Y() << " |" << endl <<
"| " << v20 << " " << v21 << " " << v22 << " " << aTranslation.Z() << " |" << endl;
}
stack<ModelData_Transformation> myTransformationMatrix;
};
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;
}
InstancesTransformationsVisitor aVisitor;
return 0;
}
Defines a Unicode (UTF-16) string wrapping a standard string.
Definition: Base_UTF16String.hxx:34
bool IsEmpty() const
Returns true if the string is empty.
Definition: Base_UTF16String.cxx:233
Base_UTF16String Name() const
Definition: ModelData_BaseObject.cxx:218
Defines an occurrence of assembly or part in a scene graph.
Definition: ModelData_Instance.hxx:34
const ModelData_Transformation & Transformation() const
Returns the transformation matrix.
Definition: ModelData_Instance.cxx:257
bool HasTransformation() const
Returns true if the instance has an explicitly attached transformation matrix.
Definition: ModelData_Instance.cxx:245
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
Defines a 3D vector.
Definition: ModelData_Vector.hxx:442
Defines classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22