# mount

Once created, the BIMDataViewer must be mounted to a DOM (opens new window) element in order to be displayed to the user.

bimdataViewer.mount("#viewerId"); // 'viewerId' must be the id of an existing element.

The mount method take an optional second argument: the layout. The layout is the configuration of the windows displayed at startup. The default value is "3d", which is the name of a window registered by default. The "3d" window includes many BIMData plugins like "viewer3d", "section", "projection", "structure-properties"...

The layout object passed to the bimdataviewer.mount method can be either a string or an object.

  • If string, it must be the name of a registered window.
  • If object, the layout represents a window or a recursive object representing a container of window names.

# Window

A window is represented by a string with its name or the following Object:

Name Type Description
windowName string The name of the window to load.
windowState { modelIds: number, viewpoint: Object, storey: string } The state to load. (the storey string is the storey key)

# Container

Name Type Description
ratios number[] Required. The amount of space (in %) taken by respective children.
children string[] | object[] Required. An array of window names as string or other containers as object.
direction string "column" or "row" (default). The direction of the container.

Here is an example of a complex layout:

const layout = {
  ratios: [40, 60],
  children: [
    "window-1",
    {
      direction: "column",
      ratios: [40, 60],
      children: [
        "window-2",
        {
          windowName: "window-3",
          windowState: {
            modelIds: [4717],
          },
        },
      ],
    },
  ],
};

The result is the following UI layout:

Viewer complex mount layouts.