---
title: Interacting with IFC GUIDs
slug: viewer-3d/interacting-with-ifc-guids
docTags: 
createdAt: 2024-03-01T14:08:11.718Z
---

To interact with the viewer you will need to use **objectIds**. When the model is processed objects are given unique objectIds. These objectIds are guaranteed to be unique within the model and across revisions. This is done because IFC GUIDs are unique to each object which may exist in multiple models and/or revisions.

However, you may find you need to interact with the viewer using IFC GUIDs. For this you will need to translate between IFC GUIDs and objectIds.

## Translate IFC GUIDs to objectIds

### 1. Invoke the `query` method

Provide the IFC GUIDs you want to get the objectIds for.

```javascript
const query = {
  "attributes.GlobalId": {
    $in: ["ifc-guid-1", "ifc-guid-2"]
  },
};

const objectIds = viewer3d.query(query);
```

### 2. Use the returned objectIds

The `query` method returns an array of objectIds that match the specified IFC GUIDs. You can then use these objectIds to interact with the viewer.

## Translate objectIds to IFC GUIDs

### 1. Invoke the `getProducts` method

Provide the objectIds of the objects you want to get the IFC GUIDs for.

```javascript
const objectIds = ["object-id-1", "object-id-2"];

const products = viewer3d.getProducts(objectIds);
```

### 2. Extract the IFC GUIDs from the returned products

The IFC GUID is the value of the `GlobalId` attribute for each object.

```javascript
[
  {
    ifcType: "IfcWall",
    modelId: "model-id",
    objectId: "object-id-1",
    attributes: {
      GlobalId: {
        ifcType: "IfcGloballyUniqueId",
        type: "string",
        value: "2_TmT90tD0x9tJSTsyTb1J"
      }
    }
  },
  {
    ifcType: "IfcDoor",
    modelId: "model-id",
    objectId: "object-id-2",
    attributes: {
      GlobalId: {
        ifcType: "IfcGloballyUniqueId",
        type: "string",
        value: "2_LeT78tF0x5tDSRsyHt5K"
      }
    }
  }
];
```

