---
title: Openings and fillings
summary: The void and fill relationships — hasOpenings and fillings from an element, hasFillings and voidsElement from an opening, fills and fillsVoid from a door or window.
order: 210
terms: [opening, filling]
see-also: [reference/bql/sub-features, reference/bql/get]
---

# Openings and fillings

An [[term:opening|opening]] (`IfcOpeningElement`) voids a wall or slab (`IfcRelVoidsElement`); a [[term:filling|filling]] — a door, a window — fills the opening (`IfcRelFillsElement`). Six relations walk these links in every direction; all are `GET` relations, usable in the dot and parenthesised forms of [[bql:sub-features]].

## From the voided element {#element}

| Relation | Target |
|---|---|
| `hasOpenings` | The openings cut into this element. |
| `fillings` | The doors and windows that fill those openings, without the opening in between. |

```bql {#has-openings}
GET qid, attribute.Name, hasOpenings(qid, attribute.Name), fillings(qid, niceType, attribute.Name) WHERE type = IFCWALL
```

## From the opening {#opening}

| Relation | Target |
|---|---|
| `voidsElement` | The element this opening voids (single). |
| `hasFillings` | The elements that fill this opening. |

```bql {#opening}
GET qid, voidsElement.attribute.Name, hasFillings.niceType WHERE type = IFCOPENINGELEMENT
```

From the wall, `hasOpenings.hasFillings` reaches the same doors and windows as `fillings`, opening by opening.

## From the filling {#filling}

| Relation | Target |
|---|---|
| `fillsVoid` | The opening this element fills (single). |
| `fills` | The element whose opening this element fills — the host wall — as a set. |

```bql {#filling}
GET qid, attribute.Name, fillsVoid.qid, fillsVoid.voidsElement.attribute.Name AS HostWall, fills.attribute.Name WHERE type = IFCDOOR
```

## Counting {#counting}

Openings and fillings are not `children` of the wall in the spatial tree, so they are not counted by `COUNT(children)`. Count them over the relation instead, one number per wall:

```bql {#count-per-wall}
GET qid, attribute.Name, fillings(COUNT(qid) WHERE type IN (IFCDOOR, IFCWINDOW)) AS Fillings WHERE type = IFCWALL
```

Or query the fillings and group them by the element they fill:

```bql {#count-fillings}
GET fillsVoid.voidsElement.attribute.Name AS Host, COUNT(qid) WHERE type IN (IFCDOOR, IFCWINDOW) GROUP BY fillsVoid.voidsElement.attribute.Name
```

## Used in {#used-in}

- [[page:tutorials/bql/relations]] — the host wall of each door.
