> ## 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.

# OPBaseProject

> OPBaseProject places many custom elements as one assembly.

Use it for furniture layouts and equipment groups that repeat the same asset.

## Import

```typescript theme={null}
import { OPBaseProject, loadOPBaseAssetSources } from '@opengeometry/floorkit';
```

## Example

```typescript theme={null}
import { OPBaseProject, ElementType, Floorkit } from '@opengeometry/floorkit';

async function example(wasmURL: string): Promise<void> {
  await new Floorkit().setupOpenGeometry(wasmURL);
  const project = new OPBaseProject({
    id: 'equipment-layout',
    name: 'Equipment layout',
    assets: {
      equipment: {
        id: 'equipment',
        kind: 'embedded-op',
        definition: {
          version: 1,
          id: 'equipment',
          labelName: 'Equipment',
          type: ElementType.FURNITURE,
          dimensions: { width: 1, depth: 0.6, height: 0.9 },
        },
      },
    },
    nodes: {
      first: {
        id: 'first',
        assetRef: 'equipment',
        placement: { position: [1, 0, 2], rotation: [0, 0, 0], scale: [1, 1, 1] },
      },
    },
    roots: ['first'],
  });
  try {
    project.setNodePlacement('first', {
      position: [2, 0, 3],
      rotation: [0, 0, 0],
      scale: [1, 1, 1],
    });
    console.log(project.getNode('first')?.worldPlacement);
    console.log(project.getOPBaseBuffer());
  } finally {
    project.dispose();
  }
}
```

## Notes

* Each node has a parent, a placement and an asset.
* `setNodePlacement` moves a node and rebuilds the assembly. Get the elements again after a rebuild.
* `getOPBaseBuffer` returns the assembly as text.
* Give the definitions of external assets yourself. The class does not download them.
* An assembly is not a building. For storeys, walls, views and sheets, use a [building model](/floorkit/concepts/building-model).
* Start the geometry kernel before you create this object. See [`Floorkit`](/floorkit/api/runtime/floorkit).

**Inheritance:** `extends THREE.Group`

## Constructor

```typescript theme={null}
constructor(config?: OPBaseInput);
```

## Properties

<ResponseField name="ogid" type="string" />

<ResponseField name="propertySet" type="OPBaseConfig" />

## Methods

### parseBuffer

```typescript theme={null}
static parseBuffer(buffer: string): OPBaseDocument;
```

### normalizeDocument

```typescript theme={null}
static normalizeDocument(document: unknown): OPBaseDocument;
```

### getOPBaseBuffer

```typescript theme={null}
getOPBaseBuffer(): string;
```

### getOPBaseConfig

```typescript theme={null}
getOPBaseConfig(): OPBaseConfig;
```

### setOPBaseConfig

```typescript theme={null}
setOPBaseConfig(config: OPBaseInput): void;
```

### setNodePlacement

```typescript theme={null}
setNodePlacement(nodeId: string, placement: Placement): void;
```

### getAsset

```typescript theme={null}
getAsset(id: string): OPBaseResolvedAsset | undefined;
```

### getNode

```typescript theme={null}
getNode(id: string): OPBaseResolvedNode | undefined;
```

### getRelation

```typescript theme={null}
getRelation(id: string): OPBaseRelation | undefined;
```

### getExportElements

```typescript theme={null}
getExportElements(): OpenElement[];
```

### resolveProject

```typescript theme={null}
resolveProject(): OPBaseResolvedDocument;
```

### generateExportDocument

```typescript theme={null}
generateExportDocument(): OPBaseResolvedDocument;
```

### dispose

```typescript theme={null}
dispose(): void;
```

## loadOPBaseAssetSources

```typescript theme={null}
function loadOPBaseAssetSources(
  document: OPBaseDocument,
  assetBaseUrl?: string,
): Promise<Record<string, string>>;
```

## Types

### OPBaseConfig

```typescript theme={null}
interface OPBaseConfig extends OPBaseDocument {
  ogid?: string;
}
```

### OPBaseInput

```typescript theme={null}
type OPBaseInput = string | OPBaseDocument | OPBaseOptions;
```

### OPBaseDocument

```typescript theme={null}
interface OPBaseDocument {
  version: 1;
  id: string;
  name: string;
  units: 'meters';
  assets: Record<string, OPBaseAsset>;
  nodes: Record<string, OPBaseNode>;
  roots: string[];
  relations?: Record<string, OPBaseRelation>;
  metadata?: Record<string, string>;
}
```

### OPBaseResolvedAsset

```typescript theme={null}
interface OPBaseResolvedAsset {
  id: string;
  kind: OPBaseAsset['kind'];
  definition: OpenElementDefinition;
  sourceUri?: string;
}
```

### OPBaseResolvedNode

```typescript theme={null}
interface OPBaseResolvedNode {
  id: string;
  assetRef: string;
  parentId?: string;
  visible: boolean;
  locked: boolean;
  localPlacement: Placement;
  worldPlacement: Placement;
  childIds: string[];
  relationIds: string[];
  container: THREE.Group;
  element: OpenElement;
  overrides?: OPBaseNodeOverrides;
}
```

### OPBaseRelation

```typescript theme={null}
interface OPBaseRelation {
  id: string;
  kind: 'attachedTo' | 'hostedBy' | 'insertedInto' | 'dependsOn' | 'groupMember';
  from: string;
  to: string;
  attachment?: AttachmentSpec;
  metadata?: Record<string, string>;
}
```

### OPBaseResolvedDocument

```typescript theme={null}
interface OPBaseResolvedDocument {
  id: string;
  name: string;
  units: 'meters';
  metadata?: Record<string, string>;
  assets: Record<string, OPBaseResolvedAsset>;
  nodes: Record<string, OPBaseResolvedNode>;
  roots: string[];
  relations: Record<string, OPBaseRelation>;
  elements: OpenElement[];
}
```

### OPBaseOptions

```typescript theme={null}
interface OPBaseOptions extends Partial<
  Omit<OPBaseConfig, 'version' | 'assets' | 'nodes' | 'roots'>
> {
  version?: 1;
  assets?: Record<string, OPBaseAsset>;
  nodes?: Record<string, OPBaseNode>;
  roots?: string[];
  relations?: Record<string, OPBaseRelation>;
  source?: string | OPBaseDocument;
  assetBaseUrl?: string;
  assetSources?: Record<string, string | OpenElementDefinition>;
}
```

### OPBaseAsset

```typescript theme={null}
type OPBaseAsset = OPBaseExternalAsset | OPBaseEmbeddedAsset;
```

### OPBaseNode

```typescript theme={null}
interface OPBaseNode {
  id: string;
  assetRef: string;
  parentId?: string;
  placement: Placement;
  visible?: boolean;
  locked?: boolean;
  overrides?: OPBaseNodeOverrides;
}
```

### OPBaseNodeOverrides

```typescript theme={null}
interface OPBaseNodeOverrides {
  labelName?: string;
  metadata?: Record<string, string>;
  dimensions?: OpenElementDimensions;
}
```

### AttachmentSpec

```typescript theme={null}
interface AttachmentSpec {
  hostAnchorId?: string;
  childAnchorId?: string;
  offset?: Placement;
  alignment?: 'match' | 'flipX' | 'flipY' | 'flipZ';
  face?: string;
  slot?: string;
}
```

### OPBaseExternalAsset

```typescript theme={null}
interface OPBaseExternalAsset {
  id: string;
  kind: 'external-op';
  uri: string;
}
```

### OPBaseEmbeddedAsset

```typescript theme={null}
interface OPBaseEmbeddedAsset {
  id: string;
  kind: 'embedded-op';
  definition: OpenElementDefinition;
}
```

## Related

* [`OpenElement`](/floorkit/api/architecture/open-element)
* [`OpenElementDefinition`](/floorkit/api/architecture/open-element#openelementdefinition)
* [`OpenElementDimensions`](/floorkit/api/architecture/open-element#openelementdimensions)
* [`Placement`](/floorkit/api/shapes/cuboid-shape#placement)


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