
# IPCB_Sheet interface

The sheet of a PCB document, the rectangular area behind the board in the PCB editor that can hold the board outline and fabrication and assembly details, returned by [`IPCB_Board.PCBSheet`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#pcbsheet).

```csharp
public interface IPCB_Sheet
```

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

## Remarks

The sheet extends from ([`SheetX`](#sheetx), [`SheetY`](#sheety)) by [`SheetWidth`](#sheetwidth) to the right and [`SheetHeight`](#sheetheight) upwards, in internal units (10,000 per mil). [`ShowSheet`](#showsheet) sets whether it is drawn; when [`LockSheet`](#locksheet) is true, [`UpdateSheetPosition`](#updatesheetposition) fits it to the objects on the mechanical layers linked to the sheet.

The sheet of a new board is at (1000 mil, 1000 mil), 10000 mil wide and 8000 mil high, not shown ([`ShowSheet`](#showsheet) is false) and locked ([`LockSheet`](#locksheet) is true).

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [LockSheet](#locksheet) | `bool` | get; set | Whether the sheet is fitted to the objects on the mechanical layers linked to it. |
| [SheetHeight](#sheetheight) | `int` | get; set | The height of the sheet, in internal units (10,000 per mil). |
| [SheetWidth](#sheetwidth) | `int` | get; set | The width of the sheet, in internal units (10,000 per mil). |
| [SheetX](#sheetx) | `int` | get; set | The X coordinate of the sheet's bottom-left corner, in internal units (10,000 per mil). |
| [SheetY](#sheety) | `int` | get; set | The Y coordinate of the sheet's bottom-left corner, in internal units (10,000 per mil). |
| [ShowSheet](#showsheet) | `bool` | get; set | Whether the sheet is drawn in the PCB editor. |

### LockSheet

Whether the sheet is fitted to the objects on the mechanical layers linked to it.

```csharp
bool GetState_LockSheet();
void SetState_LockSheet(bool argValue);
```

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

When true, [`UpdateSheetPosition`](#updatesheetposition) moves and resizes the sheet to enclose those objects; when false, [`UpdateSheetPosition`](#updatesheetposition) does not change the sheet.

**See also:** [IPCB_MechanicalLayer.LinkToSheet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_MechanicalLayer.md#linktosheet)

### SheetHeight

The height of the sheet, in internal units (10,000 per mil).

```csharp
int GetState_SheetHeight();
void SetState_SheetHeight(int argValue);
```

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

The top edge of the sheet is at [`SheetY`](#sheety) plus this value.

### SheetWidth

The width of the sheet, in internal units (10,000 per mil).

```csharp
int GetState_SheetWidth();
void SetState_SheetWidth(int argValue);
```

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

The right edge of the sheet is at [`SheetX`](#sheetx) plus this value.

### SheetX

The X coordinate of the sheet's bottom-left corner, in internal units (10,000 per mil).

```csharp
int GetState_SheetX();
void SetState_SheetX(int argValue);
```

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

### SheetY

The Y coordinate of the sheet's bottom-left corner, in internal units (10,000 per mil).

```csharp
int GetState_SheetY();
void SetState_SheetY(int argValue);
```

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

### ShowSheet

Whether the sheet is drawn in the PCB editor.

```csharp
bool GetState_ShowSheet();
void SetState_ShowSheet(bool argValue);
```

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

**Example:** Show the properties of the current board and its sheet.

```csharp
using PCB;

IPCB_Board board = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (board == null)
    return;
string aShowSheet = board.GetState_PCBSheet().GetState_ShowSheet().ToString();
string aLockSheet = board.GetState_PCBSheet().GetState_LockSheet().ToString();
string unit = board.GetState_DisplayUnit() == TUnit.eImperial ? "Imperial (mil)" : "Metric (mm)";
DXP.Utils.ShowMessage(
    "Window Handle = " + board.GetState_Window() + "\r" +
    "Board Filename =" + board.GetState_FileName() + "\r" +
    "Origin X = " + board.GetState_XOrigin() + "\r" +
    "Origin Y = " + board.GetState_YOrigin() + "\r" +
    "Board Units = " + unit + "\r" +
    "Current layer = " + EDP.Utils.LayerToString(new V7_Layer(board.GetState_CurrentLayer())) + "\r" +
    "Sheet.X = " + board.GetState_PCBSheet().GetState_SheetX() + "\r" +
    "Sheet.Y = " + board.GetState_PCBSheet().GetState_SheetY() + "\r" +
    "Sheet.Height = " + board.GetState_PCBSheet().GetState_SheetHeight() + "\r" +
    "Sheet.Width = " + board.GetState_PCBSheet().GetState_SheetWidth() + "\r" +
    "Sheet is shown = " + aShowSheet + "\r" +
    "Sheet is locked = " + aLockSheet);
```

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [UpdateSheetPosition](#updatesheetposition) | `void` | Fits the sheet to the objects on the mechanical layers linked to the sheet, when [`LockSheet`](#locksheet) is true. |

### UpdateSheetPosition

Fits the sheet to the objects on the mechanical layers linked to the sheet, when [`LockSheet`](#locksheet) is true.

```csharp
void UpdateSheetPosition();
```

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

Sets [`SheetX`](#sheetx) and [`SheetY`](#sheety) to the bottom-left corner of the bounding rectangle of the objects on the mechanical layers linked to the sheet ([`IPCB_MechanicalLayer.LinkToSheet`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_MechanicalLayer.md#linktosheet)), and [`SheetWidth`](#sheetwidth) and [`SheetHeight`](#sheetheight) to its size. The sheet is not changed when [`LockSheet`](#locksheet) is false or when no objects are found on those layers.

## Returned by

[IPCB_Board.PCBSheet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Board.md#pcbsheet)
