> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ploterr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# bindManagedSceneEditor

> bindManagedSceneEditor connects a GUIEditor to a BuildingSession.

The user then edits the building in the 3D view, and each edit goes into the session.

## Import

```typescript theme={null}
import { bindManagedSceneEditor } from '@opengeometry/floorkit';
```

## Example

```typescript theme={null}
import {
  bindManagedSceneEditor,
  type GUIEditor,
  type BuildingSession,
} from '@opengeometry/floorkit';

export function connectScene(editor: GUIEditor, session: BuildingSession): void {
  bindManagedSceneEditor(editor, session, {
    hostedOpeningDetachTolerance: 0.35,
    onError: (error) => console.error('Scene edit rejected', error),
  });
}
```

## Notes

* Add `session.root` to your scene one time.
* `hostedOpeningDetachTolerance` is a distance in metres. When the user moves a door or a window farther than this from its wall, it leaves the wall.
* Set `onError` to show an edit that Floorkit rejected.
* Dispose the editor before the session.

## Signature

```typescript theme={null}
function bindManagedSceneEditor(
  editor: GUIEditor,
  session: BuildingSession,
  options?: ManagedSceneBindingOptions,
): void;
```

## Parameters

<ParamField path="editor" type="GUIEditor" required />

<ParamField path="session" type="BuildingSession" required />

<ParamField path="options" type="ManagedSceneBindingOptions">
  Default: `&#123;&#125;`.
</ParamField>

## Returns

```typescript theme={null}
void
```

## Types

### ManagedSceneBindingOptions

```typescript theme={null}
interface ManagedSceneBindingOptions {
  onError?: (error: unknown) => void;
  hostedOpeningDetachTolerance?: number;
  history?: ManagedEditHistory;
}
```

<ResponseField name="onError" type="(error: unknown) => void" />

<ResponseField name="hostedOpeningDetachTolerance" type="number">
  Metres from every wall beyond which a dragged door or window leaves its wall; default 0.35.
</ResponseField>

<ResponseField name="history" type="ManagedEditHistory">
  Undo and redo through another history, such as a project manager; default is the session.
</ResponseField>

## Related

* [`BuildingSession`](/floorkit/api/editor/building-session)
* [`GUIEditor`](/floorkit/api/editor/gui-editor)
* [`ManagedEditHistory`](/floorkit/api/editor/managed-plan-editor#managededithistory)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.