---
title: getBuildings
slug: viewer-2d/methods/getBuildings
docTags: 
createdAt: 2024-02-21T14:33:53.989Z
---

Returns the list of buildings.

## Example

::codepen{url="https://codepen.io/Catenda/embed/ZEdXPOK"}

## Usage

```javascript
const buildings = viewer2d.getBuildings();
```

## Return Value

The list of buildings.

| **Type**         |
| ---------------- |
| Array\[Building] |

**Building**

| **Name**    | **Type** | **Description**                       |
| ----------- | -------- | ------------------------------------- |
| `guid`      | String   | Guid of the building                  |
| `id`        | String   | Id of the building                    |
| `name`      | String   | Name of the building                  |
| `modelName` | String   | Name of the model building belongs to |
| `modelId`   | String   | Id of the model building belongs to   |

### Example

```javascript
[
  {
    id: "0.yv0ntfpcrbs",
    guid: "3eM8WbY_56HH6TDWry5aRU",
    modelId: "my-model-id",
    modelName: "My model",
    name: "Building 1"
  }
];
```

