Hide menu
No Matches
BIM Model Exploring Example

Reads and translates an external IFC file into a BIM model. Explores BIM elements and counts BIM types occurrence.


The BIM Exploring Example shows how to import data from IFC file into a BIM Model and explore its elements via ModelData_BIMElementVisitor.

In this example we define a BimStructureVisitor class for traversing and processing BIM model elements. Then we use IFC_Reader which allows us to read and transfer IFC file data into ModelData_BIMModel content. Next, we apply BimStructureVisitor object to model data for processing its content.

BimStructureVisitor class

Firstly, for traversing BIM model structure and processing elements we define BimStructureVisitor class which inherits ModelData_BIMElementVisitor and implement set of Visit, VisitEnter and VisitLeave functions:

class BimStructureVisitor : public ModelData_BIMElementVisitor
void Visit (const ModelData_BIMBeam& theElement) override
cout << GetFiller() << theElement.Name() << endl;
myCounts["Beam"] += 1;
bool VisitEnter (const ModelData_BIMBuilding& theElement) override
cout << GetFiller() << theElement.Name() << endl;
myNestingLevel += 1;
myCounts["Building"] += 1;
return true;
void VisitLeave (const ModelData_BIMBuilding&) override
myNestingLevel -= 1;

Main Function

The main function have the following structure:

ModelData_BIMModel aModel;
ModelData_ModelReader aReader;
if (!aReader.Read (aSource, aModel)) {
cerr << "Failed to read the file: " << aSource << endl;
return 1;
  • As a result now we have an access to a ModelData_BIMModel content which we can use in further processing with BimStructureVisitor object:
BimStructureVisitor aStructureVisitor;
aModel.Accept (aStructureVisitor);


You can try this example with the following model:

./examples/models/FZK Haus.ifc