Skip to content

IfcPlusPlus is an open source C++ class model, as well as a reader and writer for IFC files in STEP format. Features: Easy and efficient memory management using smart pointers. Parallel reader for very fast parsing on multi-core CPU's. Additionally, there's a simple IFC viewer application, using Qt and OpenSceneGraph. It can be used as starting …

License

Notifications You must be signed in to change notification settings

ifcquery/ifcplusplus

Repository files navigation

ABOUT IFC++

IFC++ is an open source IFC implementation for C++. It is very fast, but it has not the lowest possible memory footprint, because it has a complete class model.

Benefits of the complete class model are (among others):

  • you can easily instantiate objects and access member variables, for example:
  shared_ptr<IfcCartesianPoint> ifcPoint = make_shared<IfcCartesianPoint>();
  shared_ptr<IfcPolyLoop> polyLoop = make_shared<IfcPolyLoop>()
  polyLoop->m_Polygon.push_back(ifcPoint);
  • you can navigate the model easily by accessing member variables directly, including inverse attributes:
shared_ptr<IfcBuildingStorey> currentBuildingStorey = ...;
for (auto it : currentBuildingStorey->m_IsDecomposedBy_inverse)
{
   shared_ptr<IfcRelAggregates> relAggregates(it);

   for (auto it2 : relAggregates->m_RelatedObjects)
   {
      shared_ptr<IfcObjectDefinition> child_obj = (it2);
      shared_ptr<IfcWallStandardCase> wall = dynamic_pointer_cast<IfcWallStandardCase>(child_obj);
      if(wall)
      {
         // do something with wall
      }
    }
 }

Inverse attribute pointers are automatically generated by IFC++ for all object references in the model.

  • casting is possible for all types:
 shared_ptr<IfcPropertySet> pset = dynamic_pointer_cast<IfcPropertySet>(relatingPropertyDefinition);
  • Professional support is available for bug fixing or custom implementations on www.ifcquery.com.

Web-ifc as alternative to IFC++

IFC++ has an object oriented approach, which is convenient for navigating the model, accessing attributes, casting for certain types etc. But it comes with considerable memory overhead.

As an alternative, there is a great new project called web-ifc (https://github.com/ThatOpen/engine_web-ifc). It does not have an object oriented approach for IFC entities, instead it has a tape reader, so the STEP file content is kept as-is, just with tokens inserted before each attribute, which allows positioning the read cursor to read all entities and attributes. Web-ifc is so light weight, it can be directly compiled into a C++ console or GUI application, or linked as a library on Windows or Linux. It even compiles and runs efficiently as WebAssembly.

If you want to benefit from my experience how to implement web-ifc in various applications, please contact fabian.gerold at gmail.com

About

IfcPlusPlus is an open source C++ class model, as well as a reader and writer for IFC files in STEP format. Features: Easy and efficient memory management using smart pointers. Parallel reader for very fast parsing on multi-core CPU's. Additionally, there's a simple IFC viewer application, using Qt and OpenSceneGraph. It can be used as starting …

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 23

Languages