Thursday, October 2, 2025

BIM-Legal 2D notorial drawings directly from IFC


BIM-Legal is a project here in the Netherlands where various organisations (TU Delft, Kadaster, Sopra Steria, Building Bits, BIM-Connected, myself) work towards enabling notaries to document legal property ownership boundaries in IFC building models.

As part of this project a utility is built using IfcOpenShell to extract 2D condominium/subdivision plans from the 3D model. The requirements for such a drawing are that they provide a clear delimitation of private units with unambiguous, closed boundary lines, and index numbers; and an indication of common areas.

A wonderful visual web-based tool has been built as part of the project, but the algorithmic basis is available in open source IfcOpenShell. In this Blog post I quickly outline the possibilities of generating such drawings using IfcOpenShell/Bonsai. These drawings are similar to those from the official platform, but north arrows and references to parent indices are some of the items that are missing.

Model preparation


The Duplex_A model is manually enriched in Bonsai with IfcZones.

  • APT_A
    • Spaces: A101 A102 A103 A104 A105 A201 A202 A203 A204 A205
    • Pset: BIM-Legal PSET
      • gemeenschappelijkeruimte: False
      • level: 1
      • number: 1
  • APT_B
    • Spaces: B101 B104 B105 B201 B202 B203 B204 B205
    • Pset: BIM-Legal PSET
      • gemeenschappelijkeruimte: False
      • level: 1
      • number: 2
  • COMMON
    • Spaces: B102 B103 
    • Pset: BIM-Legal PSET
      • gemeenschappelijkeruimte: True
      • level: 1

gemeenschappelijkeruimte (Dutch for common area) represents whether the space is public or not, level is the subdivision level and number is the index number to be used in the drawing

Drawing generation

The functionality is currently only available in the command line ifcopenshell.draw utility. And invocated in the following way:

python -m ifcopenshell.draw
  duplex_bimlegal_zones.ifc duplex_level1.svg
  --space-names --arrange-zones
  --include-entities IfcSpace
  --storey-filter 'Level 1'
  --zone-filter '/.+/.level=1'
  --zone-label '/.+/.number'
  --css '@bimlegal.css' 

These represent:

  • input and output filename
  • the flags to enable the functionality to create 2d arrangement based on assignment to zones
  • the filter to draw only the spaces
  • the filter to include only a specific IfcBuildingStorey by name
  • a fragment of ifcopenshell.util.selector to syntax to include only those zones that relate to subdivision level 1
  • a fragment of ifcopenshell.util.selector to annotate the constructed zones with the number from the property set
  • a reference to a file on disk to provide styling using a Cascading Style Sheet.

Contents of bimlegal.css

.IfcSpace {
    display: none
}

path {
    stroke-width: 1;
    stroke: black;
    fill: none;
}

.gemeenschappelijkeruimte path {
    stroke-width: 0.1;
}
 

These three CSS statements:

  • causes the input spaces not to be displayed at all
  • a thick black stroke around all path for the zones
  • for those paths that represent a public space a much thinner line is to be used.

The output, presented below, is very simple, but a crucial aspect is that there is no rest-space in between of the IfcSpaces. The 3D space geometries in the IFC input model have gaps because of the walls between them. Those gaps have been eliminated to provide a schematic 2D representation of the property boundaries in accordance with Dutch law.

Implementation 

Algorithmically this is implemented in the C++ code in IfcOpenShell as part of the pre-existing svgfill module, making extensive use of CGAL::Arrangement_2 and Polygon_2 for the various steps of the algorithm to form a planar graph. In short, the gaps in between of neighbouring spaces is triangulated; the midpoints of edges of these triangles are connected where they span two distinct input polygons; the areas that originate from these corridors is merged with their neighbouring input polygons. After the precise center line has been found in C++ CGAL, the polygons that are assigned to the same zone are unioned to remove intermediate lines. This is done in Python using shapely.

 

Other use cases

There are many other use cases that benefit from the depiction of IfcZones (that do not have a visual representation in themselves; they only constitute a grouping) in 2D drawings. Examples include fire safety zones. The ability to style the line work using CSS based on semantics from the model is both flexible and powerful.





No comments:

Post a Comment