#include <cadex/Base_String.hxx>
#include <cadex/Base_UTF16String.hxx>
#include <cadex/LicenseManager_Activate.h>
#include <cadex/ModelData_BIMBeam.hxx>
#include <cadex/ModelData_BIMBuilding.hxx>
#include <cadex/ModelData_BIMColumn.hxx>
#include <cadex/ModelData_BIMCustomGeometryElement.hxx>
#include <cadex/ModelData_BIMCompositeElement.hxx>
#include <cadex/ModelData_BIMConstructionElement.hxx>
#include <cadex/ModelData_BIMDoor.hxx>
#include <cadex/ModelData_BIMElement.hxx>
#include <cadex/ModelData_BIMFurniture.hxx>
#include <cadex/ModelData_BIMHost.hxx>
#include <cadex/ModelData_BIMMaterial.hxx>
#include <cadex/ModelData_BIMModel.hxx>
#include <cadex/ModelData_BIMPlate.hxx>
#include <cadex/ModelData_BIMPropertyLibrary.hxx>
#include <cadex/ModelData_BIMRailing.hxx>
#include <cadex/ModelData_BIMRoof.hxx>
#include <cadex/ModelData_BIMSite.hxx>
#include <cadex/ModelData_BIMSlab.hxx>
#include <cadex/ModelData_BIMStair.hxx>
#include <cadex/ModelData_BIMStorey.hxx>
#include <cadex/ModelData_BIMVisitor.hxx>
#include <cadex/ModelData_BIMWall.hxx>
#include <cadex/ModelData_BIMWindow.hxx>
#include <cadex/ModelData_ModelReader.hxx>
#include <iomanip>
#include <iostream>
#include <unordered_map>
#include "../../cadex_license.cxx"
using namespace std;
{
public:
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Beam"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Column"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["CustomGeometryElement"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Door"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Furniture"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Plate"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Railing"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Roof"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Slab"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Stair"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Wall"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myCounts["Window"] += 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myNestingLevel += 1;
myCounts["Building"] += 1;
return true;
}
{
myNestingLevel -= 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;;
myNestingLevel += 1;
myCounts["Site"] += 1;
return true;
}
{
myNestingLevel -= 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;;
myNestingLevel += 1;
myCounts["CompositeElement"] += 1;
return true;
}
{
myNestingLevel -= 1;
}
{
cout << GetFiller() << theElement.
Name() << endl;
myNestingLevel += 1;
myCounts["Storey"] += 1;
return true;
}
{
myNestingLevel -= 1;
}
void PrintCounts ()
{
cout << "Element Types:" << endl;
for (const auto& aType : myCounts) {
cout << aType.first << ": " << aType.second << endl;
}
}
private:
string GetFiller() const
{
return string(4 * myNestingLevel, '-') + " ";
}
size_t myNestingLevel = 0;
unordered_map<string, size_t> myCounts;
};
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 file to be read" << endl;
return 1;
}
const char* aSource = argv[1];
cout << aSource << endl;
if (!aReader.
Read (aSource, aModel)) {
cerr << "Failed to read the file: " << aSource << endl;
return 1;
}
BimStructureVisitor aStructureVisitor;
aModel.
Accept (aStructureVisitor);
cout << endl;
aStructureVisitor.PrintCounts();
return 0;
}
const Base_UTF16String & Name() const
Returns an element name.
Definition: ModelData_BIMBaseObject.cxx:62
Beam represents a structural element that resists bending or lateraly loads.
Definition: ModelData_BIMBeam.hxx:30
Building is an element of spatial structure hierarchy (together with site, storey,...
Definition: ModelData_BIMBuilding.hxx:33
Column represents structural or architectural vertical element, that can transmit loads from top elem...
Definition: ModelData_BIMColumn.hxx:30
Composite Element represents the complex BIM Element, consisting of several other BIM Elements....
Definition: ModelData_BIMCompositeElement.hxx:30
CustomGeometryElement represents general bim element with geometry for defining elements that have no...
Definition: ModelData_BIMCustomGeometryElement.hxx:30
Door element can be used for represent standard entrance or internal doors, gates,...
Definition: ModelData_BIMDoor.hxx:30
Furniture represents element for defining furnishings such as a table, chair, cabinet,...
Definition: ModelData_BIMFurniture.hxx:30
Provides CAD Exchanger BIM data model.
Definition: ModelData_BIMModel.hxx:37
void Accept(ModelData_BIMVisitor &theVisitor) const
Accepts a visitor.
Definition: ModelData_BIMModel.cxx:510
Plate represents planar element, that is often add-on part for wall, roof or slab.
Definition: ModelData_BIMPlate.hxx:30
Railing represents a frame assembly for physical support, fall prevention and also decorating.
Definition: ModelData_BIMRailing.hxx:30
Roof represents covering element of the top part of a building.
Definition: ModelData_BIMRoof.hxx:30
Site represents the area of land, on which the building construction is to be. Often,...
Definition: ModelData_BIMSite.hxx:32
Slab represents an element that encloses a building space vertically. The slab may provide the floor ...
Definition: ModelData_BIMSlab.hxx:30
Stair represents a passageway allowing persons to step from one level to another level at a different...
Definition: ModelData_BIMStair.hxx:30
Storey represents a horizontal aggregation of building spaces that are vertically bound and are all a...
Definition: ModelData_BIMStorey.hxx:32
Defines a BIM elements visitor.
Definition: ModelData_BIMVisitor.hxx:42
Wall represents an element that bounds or subdivides building spaces. Wall are usually vertical,...
Definition: ModelData_BIMWall.hxx:30
Window element can represent vertical, sloped or horizontal window in the wall or roof,...
Definition: ModelData_BIMWindow.hxx:30
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 classes, types, and global functions related to CAD Exchanger.
Definition: A3DSTestLib.hxx:22