---
title: Show building storeys
summary: List the storeys of one or more models as one set of floors, show a floor on its own and fit the view to it, toggle floors with checkboxes, and show or hide the objects that are in no storey.
order: 37
languages: [javascript]
terms: [building-storey, object-state-manager, model-manager, qid]
see-also: [how-to/viewer3d/show-a-floor-plan, how-to/viewer3d/hide-and-isolate, reference/bql/building-storeys]
---

# Show building storeys

A [[term:building-storey|storey]] picker is the first control many viewer pages get. BIM.works lists the storeys of the models you load as one set of floors, merged across the models, and the [[term:object-state-manager|ObjectStateManager]] shows and hides them.

## Live demo

```demo
name: building-storeys
title: Storeys of two models as one list
models: s1, s1-electrical
height: 520
notes: |
  The architectural and the electrical model of S1 are loaded together; each floor is one row with the storey objects of both models (the **Models** column). Click a name to show that floor alone and fit the view to it; untick boxes to hide floors. The last row holds the objects that are in no storey. **Show all** restores everything.
```

## Before you start

You have a viewer with one or more models loaded ([[page:how-to/viewer3d/embed-the-viewer]]) and their [[term:vid|Vids]]. The credential needs `query:run`.

## Steps

```example
name: viewer-storeys
code: javascript/viewer-storeys.js
notes: A checkbox per storey; a double click on a name shows that storey alone.
highlight: 3,21,23,30-31
```

1. **List the storeys.** `client.bim.listBuildingStoreys(versionUuids)` answers `{buildingStoreys: [...]}`, one entry per floor over all the models you pass. Storeys of different models are the same floor when their GlobalId, their name or their elevation match; the entry then joins their names with a comma.

   | Field | What |
   |---|---|
   | `name` | The storey's name, or the joined names. |
   | `elevation` | The `Elevation` attribute, in the length unit of the model. |
   | `floor` | The floor number BIM.works computed by elevation: 0 for the ground floor, negative below it. |
   | `buildingStoreys` | `[{qid, oid}]`: the storey object in each model that has this floor. |
   | `description`, `longname` | The storey's attributes. |

   An entry named `[No BS]` with no `buildingStoreys` collects the objects that are contained in no storey.

2. **Show one floor.** `setBuildingStoreysVisibleExclusive(storeyQids)` shows the objects of those storeys and nothing else; the second argument, `true` by default, leaves the openings out. `modelManager.getObjectQidsForBuildingStoreyQids(storeyQids, false)` gives the floor's objects to fit the view to.
3. **Toggle floors.** `setBuildingStoreysVisibility(storeyQids, visible)` shows or hides floors and leaves the rest as it is; `setNoBuildingStoreysVisibility(visible)` does the same for the objects in no storey.
4. **Show everything again** with `objectStateManager.resetAll()` ([[page:how-to/viewer3d/hide-and-isolate]]).

In BQL the storey of an object is `buildingStorey`, so `GET qid WHERE buildingStorey.attribute.Name = "Erdgeschoss"` selects a floor's objects in a query ([[page:reference/bql/building-storeys]]).

## Check

The list has one row per floor, also with two models loaded, and the floor you click is the only one left in the viewer.
