> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/bim/api.md).

# WebViewer BIM Client APIs

Enhance your BIM applications with WebViewer BIM Client APIs. Access 3D viewer initialization, server connection, and model loading functions effortlessly. Optimize your BIM experience on web. The Apr

{% hint style="info" %}
New licenses for WebViewer BIM are no longer offered.
{% endhint %}

#### `initializeBimViewer`

Construct initialized 3D viewer.

**Parameters**

| Name        | Type   | Description                                                                                                                                                                                                                  |
| ----------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `instance`  | object | WebViewer instance that is available after initializing.                                                                                                                                                                     |
| `serverURL` | string | URL of WebViewer BIM server.                                                                                                                                                                                                 |
| `options`   | object | An options object to configure the WebViewer BIM application. The following are possible arguments: — `license` - The WebViewer BIM license key. — `dataSchema` - An object that defines the schema of the properties panel. |

**Returns**

A promise that resolves to an object containing the functions necessary for loading models in WebViewer.

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
import  WebViewer  from  '@pdftron/webviewer';
import { initializeBimViewer } from '@pdftron/webviewer-bim-client'
WebViewer({
  path: '/webviewer/lib',
}, document.getElementById('viewer')).then(instance  => {
  const  license = `---- Insert commercial license key here after purchase ----`;
  const  serverURL = `---- Insert server URL after setup ----`;
  const  options = {
    license: license,
    dataSchema: {
      headerName: 'Name',
      defaultValues: {
        Description: 'Description',
        GlobalID: 'GlobalId',
        Handle: 'handle',
        EmptyRow1: 'EmptyRow1',
      },
      groups: {
        Dimensions: {
          Length: 'Length',
          Width: 'Width',
          Height: 'Height',
          EmptyRow2: 'EmptyRow2',
          GrossFootprintArea: 'GrossFootprintArea',
          GrossSideArea: 'GrossSideArea',
          GrossVolume: 'GrossVolume',
        }
        EmptyGroupTest: {
            ObjectType: 'Lions',
            EmptyRow3: 'Tigers',
            ObjectPlacement: 'Bears',
        },
      },
      groupOrder: ['EmptyGroupTest', 'Dimensions'],
      removeEmptyRows: true,
      removeEmptyGroups: true,
      createRawValueGroup: true,
    }
  };
  const WebViewerBIM = await initializeBimViewer(instance, serverURL, options);
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `load3dAsset`

Loads a 3D model.

**Parameters**

| Name          | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `pathToAsset` | string | URL or path to 3D model.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `options`     | object | An optional object that modifies the 3D loading process. — `loadProperties`, determines whether the server should extract and load 3D property data or not. — `withCredentials`, determines whether to set the credentials property to 'include' on the Fetch request. This is used when the BIM Server has `allow_credentials` enabled. — `headers`, carries additional information to be sent to the BIM server. — `headers.extension`, use this option to exclusively specify the file extension. |

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
const loadOptions = {
  loadProperties: true,
  withCredentials: true,
  headers: {
    extension: '.ifc',
  },
};
webviewerBIM.File.load3dAsset('Add URL to your 3D asset here', loadOptions);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `preload3dAsset`

Preloads a 3D model for future loading, allowing for the conversion of model data before loading.

**Parameters**

| Name             | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `serverURL`      | string | URL to your BIM server instance.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `pathToAsset`    | string | URL or path to 3D model.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `preloadOptions` | object | Optional options object to modify preload behavior. — `loadProperties`, determines whether the server should extract and load 3D property data or not. — `withCredentials`, determines whether to set the credentials property to 'include' on the Fetch request. This is used when the BIM Server has `allow_credentials` enabled. — `headers`, carries additional information to be sent to the BIM server. For instance, the `extension` attribute can be included in the header to exclusively specify the file extension. |

**Returns**

`Promise<object>` - An object containing IDs for model and, optionally, properties data. If `enable_auth` is enabled on your BIM server, it will return an `authorization` token for both the model and properties data.

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
// Sample return value.
assetObject = {
  modelData: {
    id: '7bdb6aeab27191a882b9d3ed1e48afd4b490d755',
    authorization: 'be36e17d84d9eac35f41aef4cd9dc6e894f9f452b96175b2075308725338c3fe',
  },
  propertiesData: {
    id: 'b204f18fb2168dc547d5056721c50ceb5bb3c62b',
    authorization: 'fa34e17d84g3awe35f41aef4cd9dc6e894f9f452b96175b2075308725338c3fe',
  },
};
```

{% endcode %}
{% endtab %}
{% endtabs %}

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const preloadOptions = {
  loadProperties: true,
  withCredentials: true,
  headers: {
   extension: '.ifc', 
  },
};
const assetObject = await preload3dAsset(<serverURL>, <pathToAsset>, preloadOptions);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `loadCached3dAsset`

Loads a cached 3D asset from the BIM server.

**Parameters**

| Name                | Type   | Description                                                                                                                                                                                                                                                                                                                                                       |
| ------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `loadCachedOptions` | object | Options object containing credential options, model data IDs, and optional properties data. Authorization tokens are only required if enable\_auth is set to true on the BIM Server. — `withCredentials`, determines whether to set the credentials property to 'include' on the Fetch request. This is used when the BIM Server has `allow_credentials` enabled. |

**Returns**

Promise\<void>

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const loadCachedOptions = {
  withCredentials: true,
  modelData: {
    id: '7bdb6aeab27191a882b9d3ed1e48afd4b490d755',
    authorization: 'be36e17d84d9eac35f41aef4cd9dc6e894f9f452b96175b2075308725338c3fe',
  },
  propertiesData: {
    id: 'b204f18fb2168dc547d5056721c50ceb5bb3c62b',
    authorization: 'fa34e17d84g3awe35f41aef4cd9dc6e894f9f452b96175b2075308725338c3fe',
  },
};
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
await webviewerBIM.File.loadCached3dAsset(loadCachedOptions);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `checkAssetConversionProgress`

Checks the status on asset conversion, returning `true` when an asset is ready to load.

**Parameters**

| Name            | Type   | Description                                                                                                                                                                                                                                                                                                                                                       |
| --------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `optionsObject` | object | Options object containing credential options, model data IDs, and optional properties data. Authorization tokens are only required if enable\_auth is set to true on the BIM Server. — `withCredentials`, determines whether to set the credentials property to 'include' on the Fetch request. This is used when the BIM Server has `allow_credentials` enabled. |

**Returns**

`Promise<boolean>` - A promise that resolves to `true` if the conversion has been completed successfully. `false` otherwise.

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
import { initializeBimViewer, preload3dAsset } from '@pdftron/webviewer-bim-client';
const webviewerBIM = await initializeBimViewer(<instance>, <serverURL>, <options>);
const asset = await preload3dAsset(<serverURL>, <assetURL>, {});
// Rudimentary polling against the BIM server to know when the asset is ready.
while (true) {
  const status = await webviewerBIM.File.checkAssetConversionProgress({
    ...asset,
    withCredentials: true
  });
  if (status === true) {
    break;
  }
  await new Promise((r) => setTimeout(r, 200));
}
await webviewerBIM.File.loadCached3dAsset(asset);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `unmountBimViewer`

Unmounts the BIM Viewer. Calling this will close the document and delete all annotations of the current session.

**Parameters**

| Name       | Type   | Description                                              |
| ---------- | ------ | -------------------------------------------------------- |
| `instance` | object | WebViewer instance that is available after initializing. |

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
import  Webviewer  from  '@pdftron/webviewer';
import { initializeBimViewer, unmountBimViewer } from '@pdftron/webviewer-bim-client'
Webviewer({
  path: '/webviewer/lib',
}, document.getElementById('viewer')).then(instance  => {
  const  license = `---- Insert commercial license key here after purchase ----`;
  const  serverURL = `---- Insert server URL after setup ----`;
  const  options = {
    license: license,
  }
  const WebViewerBIM = await initializeBimViewer(instance, serverURL, options);
  webviewerBIM.File.load3dAsset("Add URL to your 3D asset here");
  unmountBimViewer(instance);
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Viewer APIs

#### `enableSSAO`

Enable screen-space ambient occlusion for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.enableSSAO();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `disableSSAO`

Disable screen-space ambient occlusion for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.disableSSAO();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `setSSAOOptions`

Adjust screen-space ambient occlusion for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.setSSAOOptions({
  // example parameters：
  isDynamicRadius: true,
  radius: 1,
  loops: 64,
  blurRadius: 2,
  power: 1.4,
});
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `enableAntiAliasing`

Enable anti-aliasing for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.enableAntiAliasing();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `disableAntiAliasing`

Disable anti-aliasing for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.disableAntiAliasing();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `enableShadows`

Enable ground shadows for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.enableShadows();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `disableShadows`

Disable ground shadows for the viewer.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.disableShadows();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `getWalkMode`

Gets the current Walk Mode for the `First Person Mode`.

**Returns**

String - Returns either `WalkThrough` or `FlyThrough`.

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.FirstPersonMode.getWalkMode();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `setWalkMode`

Sets the current Walk Mode for the `First Person Mode`, either `WalkThrough` or `FlyThrough`. `WalkThrough` simulates `walking` where going forward for example is always in reference to the ground plane. When set to `FlyThrough` directional movement is relative to the `camera` orientation.

**Parameters**

| Name       | Type   | Description                                                                      |
| ---------- | ------ | -------------------------------------------------------------------------------- |
| `walkMode` | string | `String` containing the desired walk mode, either `WalkThrough` or `FlyThrough`. |

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.Viewer.FirstPersonMode.setWalkMode('WalkThrough');
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Orbit & Pan Tools APIs

#### `setCameraSensitivity`

Sets the sensitivity for Orbit/Pan tool.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const cameraTools = {
  orbit: 'Orbit3D',
  pan: 'Pan3D',
  walk: 'Walk',
};
const panTool = instance.Core.DocumentViewer.getTool(cameraTools.pan);
panTool.setCameraSensitivity(10);
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `getCameraSensitivity`

Gets the Orbit/Pan tool's sensitivity.

**Returns**

Number

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const cameraTools = {
  orbit: 'Orbit3D',
  pan: 'Pan3D',
  walk: 'Walk',
};
const orbitTool = instance.Core.DocumentViewer.getTool(cameraTools.orbit);
orbitTool.getCameraSensitivity();
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Properties Panel APIs

#### `setPanelSchema`

Sets a new Properties Panel configuration based on a passed in Schema.

**Parameters**

| Name     | Type   | Description                                  |
| -------- | ------ | -------------------------------------------- |
| `schema` | object | Object containing the desired configuration. |

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const sampleSchema =  {
      headerName: 'Name',
      defaultValues: {
        Description: 'Description',
        GlobalID: 'GlobalId',
        Handle: 'handle',
        EmptyRow1: 'EmptyRow1',
      },
      groups: {
        Dimensions: {
          Length: 'Length',
          Width: 'Width',
          Height: 'Height',
          EmptyRow2: 'EmptyRow2',
          GrossFootprintArea: 'GrossFootprintArea',
          GrossSideArea: 'GrossSideArea',
          GrossVolume: 'GrossVolume',
        }
        EmptyGroupTest: {
            ObjectType: 'Lions',
            EmptyRow3: 'Tigers',
            ObjectPlacement: 'Bears',
        },
      },
      groupOrder: ['EmptyGroupTest', 'Dimensions'],
      removeEmptyRows: true,
      removeEmptyGroups: true,
      createRawValueGroup: true,
    }
    const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
    webviewerBIM.PropertiesPanel.setSchema(sampleSchema);
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `toggleShowDefaultGroup`

Toggles showing the `Default` group. This group contains all of the key/value pairs on a selected `element` without any adjustments.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.PropertiesPanel.toggleShowDefaultGroup();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `toggleShowEmptyGroups`

Toggles showing empty `Groups` on the properties panel. Empty `Groups` are defined as groups where every `Row` has an empty `String`.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.PropertiesPanel.toggleShowEmptyGroups();
```

{% endcode %}
{% endtab %}
{% endtabs %}

#### `toggleShowEmptyRows`

Toggles showing empty `Rows` on the properties panel. An empty `Row` is defined as a row where the value is an empty `String`.

**Returns**

void

**Example**

{% tabs %}
{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```js
const webviewerBIM = await initializeBimViewer(instance, serverURL, options);
webviewerBIM.PropertiesPanel.toggleShowEmptyRows();
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/bim/api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
