
# IPCB_RegionShape interface

The outline of a shaped object as an editable list of segments.

```csharp
public interface IPCB_RegionShape
```

**Namespace:** PCB · **Assembly:** Altium.SDK.Interfaces

## Remarks

Regions (including component bodies), polygons, split planes and confinement constraint rules provide this interface. Each segment is a [`PolySegment`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/PolySegment.md).

For a region, the segments and the region's shape are kept separately: after changing the segments, call [`UpdateContourFromShape`](#updatecontourfromshape) so that the region's shape follows them.

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [ShapeSegment](#shapesegment) | [PolySegment](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/PolySegment.md) | get; set | A segment of the outline. |
| [ShapeSegmentCount](#shapesegmentcount) | `int` | get; set | The number of segments of the outline. |

### ShapeSegment

A segment of the outline.

```csharp
PolySegment GetState_ShapeSegment(int argI);
void SetState_ShapeSegment(int argI, PolySegment argValue);
```

**Type:** [PolySegment](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/PolySegment.md) · **Access:** read/write · **Index:** `argI` (`int`): The zero-based index of the segment. For a region it runs from 0 to [`ShapeSegmentCount`](#shapesegmentcount), where the last index is the closing segment, which repeats the first one as a line segment; for a polygon or a split plane it runs from 0 to [`ShapeSegmentCount`](#shapesegmentcount) - 1.

The accessors are extension methods of `IPCB_RegionShapeHelper` (`using PCB;`).

For a region, a polygon or a split plane, reading a segment outside the valid range returns a segment with all values zero, assigning one outside the range does nothing, and assigning the first segment also updates the closing segment after the last one.

### ShapeSegmentCount

The number of segments of the outline.

```csharp
int GetState_ShapeSegmentCount();
void SetState_ShapeSegmentCount(int argValue);
```

**Type:** `int` · **Access:** read/write

Assigning a value keeps the existing segments up to the new number, and sets the closing segment after the last one to repeat the first segment as a line segment.

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [UpdateContourFromShape](#updatecontourfromshape) | `void` | Rebuilds a region's shape from its segments. |
| [UpdateShapeFromContour](#updateshapefromcontour) | `void` | Rebuilds a region's segments from its current shape. |

### UpdateContourFromShape

Rebuilds a region's shape from its segments.

```csharp
void UpdateContourFromShape(bool argConserveExistingHoles);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argConserveExistingHoles` | `bool` | value | True to keep the holes of the region, false to remove them and keep only the outline. |

**Returns:** nothing (`void`)

The outline of the region is recreated from the segments, with arcs approximated by straight segments, and its area is recalculated. For a polygon or a split plane the call does nothing; for a confinement constraint it raises an error.

### UpdateShapeFromContour

Rebuilds a region's segments from its current shape.

```csharp
void UpdateShapeFromContour();
```

**Returns:** nothing (`void`)

For a polygon or a split plane the call does nothing; for a confinement constraint it raises an error.

## Returned by

[IPCB_Shapes.Items](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Shapes.md#items)
