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

# Beam

> Beam is a structural member between two points.

Use it for a lintel, a ridge beam or a sloped member. The section can be a rectangle, a circle or your own profile.

## Import

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

## Example

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

async function example(wasmURL: string): Promise<void> {
  await new Floorkit().setupOpenGeometry(wasmURL);
  const beam = new Beam({
    shape: BeamShape.RECTANGULAR,
    start: [0, 3, 0],
    end: [5, 3.5, 0],
    width: 0.2,
    depth: 0.35,
  });
  try {
    beam.setOPConfig({ end: [5, 3.8, 0] });
    console.log(beam.toDrawing('top'), beam.getOPConfig());
  } finally {
    beam.dispose();
  }
}
```

## Notes

* All values are in metres. The axis goes through the centre of the section.
* The start point and the end point must be different.
* A `CUSTOM` shape needs a `customProfile`. Floorkit uses only the outer ring of that profile.
* The class makes geometry. It does not calculate structural strength.
* 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<BeamOptions>);
```

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

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

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

<ParamField path="config.shape" type="BeamShape" />

<ParamField path="config.start" type="Vec3">
  Axis start point (world). The axis runs through the section centroid.
</ParamField>

<ParamField path="config.end" type="Vec3">
  Axis end point (world). May differ in Y from `start` — sloped beams are supported (ridge beams,
  raking members).
</ParamField>

<ParamField path="config.width" type="number">
  Horizontal section dimension for RECTANGULAR shape.
</ParamField>

<ParamField path="config.depth" type="number">
  Vertical section dimension for RECTANGULAR shape.
</ParamField>

<ParamField path="config.radius" type="number">
  Radius for CIRCULAR shape.
</ParamField>

<ParamField path="config.customProfile" type="PolygonProfile">
  Custom section profile (local \[u, v] coordinates centered on \[0, 0]: u = horizontal across the
  beam, v = vertical). Only the outer ring is used (swept sections cannot carry holes). Only when
  shape === CUSTOM.
</ParamField>

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

<ParamField path="config.material" type="ColumnMaterial" />

<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="propertySet" type="BeamOptions" />

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

<ResponseField name="beamShape" type="BeamShape" />

<ResponseField name="start" type="Vec3" />

<ResponseField name="end" type="Vec3" />

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

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

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

<ResponseField name="customProfile" type="PolygonProfile | undefined" />

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

<ResponseField name="beamMaterial" type="ColumnMaterial" />

<ResponseField name="length" type="number">
  Read-only. Axis length (world). 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[];
```

Produce the beam's plan footprint as a standardized region primitive from its authored 2D polygon.

### setOPMaterial

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

### getEditAnchors

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

Draggable handles: the two axis endpoints, each free on its own horizontal plane (its Y is preserved, so sloped beams stay sloped).

### applyEditAnchor

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

### getOPConfig

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

### setOPConfig

```typescript theme={null}
setOPConfig(config: Partial<BeamOptions>): 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.

### dispose

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

## Types

### BeamOptions

```typescript theme={null}
interface BeamOptions extends HasPropertySets {
  ogid?: string;
  labelName: string;
  type: ElementType.BEAM;
  shape: BeamShape;
  start: Vec3;
  end: Vec3;
  width: number;
  depth: number;
  radius: number;
  customProfile?: PolygonProfile;
  color: number;
  material: ColumnMaterial;
}
```

### BeamShape

```typescript theme={null}
enum BeamShape {
  RECTANGULAR = 'RECTANGULAR',
  CIRCULAR = 'CIRCULAR',
  CUSTOM = 'CUSTOM',
}
```

## Related

* [`OPElement`](/floorkit/api/architecture/op-element)
* [`ColumnMaterial`](/floorkit/api/architecture/column#columnmaterial)
* [`DrawingPrimitive`](/floorkit/api/drawings/draw-project-view#drawingprimitive)
* [`EditAnchor`](/floorkit/api/architecture/op-element#editanchor)
* [`ElementType`](/floorkit/api/architecture/op-element#elementtype)
* [`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.