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

# Space

> Space is a room or a zone.

It has a name, a number, an area and a perimeter. Use it for room labels and area lists.

## Import

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

## Example

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

async function example(wasmURL: string): Promise<void> {
  await new Floorkit().setupOpenGeometry(wasmURL);
  const room = new Space({
    name: 'Studio',
    number: '101',
    elevation: 0,
    showLabel: false,
    show3D: true,
    height: 3,
    profile: {
      outerRing: [
        [0, 0],
        [6, 0],
        [6, 4],
        [0, 4],
      ],
      holes: [
        [
          [2, 1],
          [3, 1],
          [3, 2],
          [2, 2],
        ],
      ],
    },
  });
  try {
    room.setOPConfig({ name: 'Workshop' });
    console.log(room.area, room.perimeter, room.toDrawing('top'));
  } finally {
    room.dispose();
  }
}
```

## Notes

* Profile points are `[x, z]` in metres. `area` is in square metres.
* Holes are subtracted from the area. `perimeter` measures the outer boundary.
* You give the boundary. Floorkit does not find rooms from walls.
* For a text label, call `setGlyphScene(scene, camera)` before you create the space.
* `show3D` shows the room as a translucent volume.
* Start the geometry kernel before you create this object. See [`Floorkit`](/floorkit/api/runtime/floorkit).
* This object is live geometry. To save a building, write it in a [building model](/floorkit/concepts/building-model).

**Inheritance:** `extends OPElement implements IShape, IPlaceable, PlanVectorExportable`

## Constructor

```typescript theme={null}
constructor(config?: Partial<SpaceOptions>);
```

<ParamField path="config.ogid" type="string" />

<ParamField path="config.labelName" type="string" />

<ParamField path="config.type" type="ElementType.SPACECONTAINER" />

<ParamField path="config.name" type="string">
  Room name shown as the first label line (e.g. "Kitchen").
</ParamField>

<ParamField path="config.number" type="string">
  Room number shown on the second label line (e.g. "101").
</ParamField>

<ParamField path="config.profile" type="PolygonProfile">
  Room boundary in the world XZ plane. `outerRing` is auto-closed and normalized to CW (the
  convention `opengeometry.Polygon` expects). Holes are auto-closed and normalized to CCW and are
  excluded from `area`.
</ParamField>

<ParamField path="config.elevation" type="number">
  World Y of the room's floor plane.
</ParamField>

<ParamField path="config.height" type="number">
  Height of the optional 3D volume (profile × height).
</ParamField>

<ParamField path="config.show3D" type="boolean">
  Show the translucent 3D volume in model view. Default off — a Space is primarily a plan-view
  element.
</ParamField>

<ParamField path="config.showLabel" type="boolean">
  Show the centroid name/number label in plan view.
</ParamField>

<ParamField path="config.fontSize" type="number">
  Label text height in world meters.
</ParamField>

<ParamField path="config.color" type="number" />

<ParamField path="config.propertySets" type="PropertySets" />

## Properties

<ResponseField name="ogType" type="ElementType" />

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

<ResponseField name="subElements2D" type="Map<string, OPGeometry>" />

<ResponseField name="subElements3D" type="Map<string, OPGeometry>" />

<ResponseField name="selected" type="boolean" />

<ResponseField name="edit" type="boolean" />

<ResponseField name="locked" type="boolean" />

<ResponseField name="onSpaceUpdated" type="Event<null>" />

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

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

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

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

<ResponseField name="profile" type="SpaceProfile" />

<ResponseField name="elevation" type="number" />

<ResponseField name="spaceHeight" type="number" />

<ResponseField name="extrudeHeight" type="number">
  Push/pull alias for the GUIEditor — the extrude dimension is the height.
</ResponseField>

<ResponseField name="show3D" type="boolean" />

<ResponseField name="showLabel" type="boolean" />

<ResponseField name="spaceColor" type="number" />

<ResponseField name="area" type="number">
  Read-only. Net floor area in m² — outer ring minus holes. Computed, read-only.
</ResponseField>

<ResponseField name="perimeter" type="number">
  Read-only. Outer-boundary length in m. Computed, read-only.
</ResponseField>

<ResponseField name="outline" type="boolean" />

<ResponseField name="profileView" type="boolean" />

<ResponseField name="modelView" type="boolean" />

## Methods

### editableSchema

```typescript theme={null}
static editableSchema(): OPEditableSchema;
```

Self-describing editable surface; a host inspector renders this generically.

### move

```typescript theme={null}
move(delta: Vec3): void;
```

Translate this element by `delta` (world-space, meters).

### rotate

```typescript theme={null}
rotate(angleDeg: number, axis?: Vec3, anchor?: Vec3): void;
```

Rotate this element by `angleDeg` around `axis` (default Y-up), pivoted at `anchor` (default the element's own centroid).

### setOPGeometry

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

### getExportRoots

```typescript theme={null}
getExportRoots(view: PlanExportView): THREE.Object3D[];
```

Vector-export roots (RFC §7).

### toDrawing

```typescript theme={null}
toDrawing(view: PlanExportView): DrawingPrimitive[];
```

Plan footprint region plus the name/number·area texts at the centroid.

### setOPMaterial

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

### getOPConfig

```typescript theme={null}
getOPConfig(): SpaceOptions;
```

### setOPConfig

```typescript theme={null}
setOPConfig(config: Partial<SpaceOptions>): void;
```

### beginEdit

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

Start one live edit; a second `beginEdit` before `endEdit` keeps the first start.

### endEdit

```typescript theme={null}
endEdit(): {
    undo: () => void;
    redo: () => void;
} | undefined;
```

End the live edit; its exact undo and redo, or undefined when no option changed.

### getEditAnchors

```typescript theme={null}
getEditAnchors(): EditAnchor[];
```

Draggable handles: one grip per boundary vertex (move on the XZ plane) and a height grip at the centroid (raise/lower the 3D volume along +Y).

### applyEditAnchor

```typescript theme={null}
applyEditAnchor(id: string, position: [
    number,
    number,
    number
]): void;
```

### dispose

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

## Types

### SpaceOptions

```typescript theme={null}
interface SpaceOptions extends HasPropertySets {
  ogid?: string;
  labelName: string;
  type: ElementType.SPACECONTAINER;
  name: string;
  number: string;
  profile: SpaceProfile;
  elevation: number;
  height: number;
  show3D: boolean;
  showLabel: boolean;
  fontSize: number;
  color: number;
}
```

### SpaceProfile

Polygon profile for a Space — alias of PolygonProfile.

```typescript theme={null}
type SpaceProfile = PolygonProfile;
```

## Related

* [`OPElement`](/floorkit/api/architecture/op-element)
* [`DrawingPrimitive`](/floorkit/api/drawings/draw-project-view#drawingprimitive)
* [`EditAnchor`](/floorkit/api/architecture/op-element#editanchor)
* [`ElementType`](/floorkit/api/architecture/op-element#elementtype)
* [`Event`](/floorkit/api/architecture/wall-network#event)
* [`HasPropertySets`](/floorkit/api/architecture/op-element#haspropertysets)
* [`IPlaceable`](/floorkit/api/architecture/op-element#iplaceable)
* [`IShape`](/floorkit/api/shapes/cuboid-shape#ishape)
* [`OPEditableSchema`](/floorkit/api/architecture/op-element#opeditableschema)
* [`OPGeometry`](/floorkit/api/architecture/opening#opgeometry)
* [`PlanExportView`](/floorkit/api/shapes/cylinder-shape#planexportview)
* [`PlanVectorExportable`](/floorkit/api/shapes/cylinder-shape#planvectorexportable)
* [`PolygonProfile`](/floorkit/api/primitives/polygon-maths#polygonprofile)
* [`Vec3`](/floorkit/api/architecture/wall#vec3)


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