
# IPCB_RectangularPrimitive interface

The base interface of PCB primitives whose shape is a rectangle with a rotation, such as [`IPCB_Fill`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Fill.md), [`IPCB_Text`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Text.md) and [`IPCB_EmbeddedBoard`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_EmbeddedBoard.md).

```csharp
public interface IPCB_RectangularPrimitive : IPCB_Primitive
```

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

**Inherits:** [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md)

**Derived:** [IPCB_EmbeddedBoard](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_EmbeddedBoard.md), [IPCB_Fill](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Fill.md), [IPCB_MultilineText](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_MultilineText.md), [IPCB_Text](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Text.md), [IPCB_Viewport](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Viewport.md)

## Remarks

The corners ([`X1Location`](#x1location), [`Y1Location`](#y1location)) and ([`X2Location`](#x2location), [`Y2Location`](#y2location)) define the boundary of the rectangle, [`XLocation`](#xlocation) and [`YLocation`](#ylocation) its reference point, and `Rotation` its rotation. The coordinates are in internal units (10,000 per mil).

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [Rotation](#rotation) | `double` | get; set | The rotation of the primitive, in degrees. |
| [X1Location](#x1location) | `int` | get; set | The X coordinate of the first corner of the rectangle, in internal units (10,000 per mil). |
| [X2Location](#x2location) | `int` | get; set | The X coordinate of the second corner of the rectangle, in internal units (10,000 per mil). |
| [XLocation](#xlocation) | `int` | get; set | The X coordinate of the primitive's reference point, in internal units (10,000 per mil). |
| [Y1Location](#y1location) | `int` | get; set | The Y coordinate of the first corner of the rectangle, in internal units (10,000 per mil). |
| [Y2Location](#y2location) | `int` | get; set | The Y coordinate of the second corner of the rectangle, in internal units (10,000 per mil). |
| [YLocation](#ylocation) | `int` | get; set | The Y coordinate of the primitive's reference point, in internal units (10,000 per mil). |

### Rotation

The rotation of the primitive, in degrees.

```csharp
double GetState_Rotation();
void SetState_Rotation(double argRotation);
```

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

### X1Location

The X coordinate of the first corner of the rectangle, in internal units (10,000 per mil).

```csharp
int GetState_X1Location();
void SetState_X1Location(int argX1);
```

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

The corners (`X1Location`, [`Y1Location`](#y1location)) and ([`X2Location`](#x2location), [`Y2Location`](#y2location)) define the boundary of the primitive.

### X2Location

The X coordinate of the second corner of the rectangle, in internal units (10,000 per mil).

```csharp
int GetState_X2Location();
void SetState_X2Location(int argX2);
```

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

The corners ([`X1Location`](#x1location), [`Y1Location`](#y1location)) and (`X2Location`, [`Y2Location`](#y2location)) define the boundary of the primitive.

### XLocation

The X coordinate of the primitive's reference point, in internal units (10,000 per mil).

```csharp
int GetState_XLocation();
void SetState_XLocation(int argX);
```

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

### Y1Location

The Y coordinate of the first corner of the rectangle, in internal units (10,000 per mil).

```csharp
int GetState_Y1Location();
void SetState_Y1Location(int argY1);
```

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

The corners ([`X1Location`](#x1location), `Y1Location`) and ([`X2Location`](#x2location), [`Y2Location`](#y2location)) define the boundary of the primitive.

### Y2Location

The Y coordinate of the second corner of the rectangle, in internal units (10,000 per mil).

```csharp
int GetState_Y2Location();
void SetState_Y2Location(int argY2);
```

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

The corners ([`X1Location`](#x1location), [`Y1Location`](#y1location)) and ([`X2Location`](#x2location), `Y2Location`) define the boundary of the primitive.

### YLocation

The Y coordinate of the primitive's reference point, in internal units (10,000 per mil).

```csharp
int GetState_YLocation();
void SetState_YLocation(int argY);
```

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

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [IsRedundant](#isredundant) | `bool` | Returns whether the primitive is redundant. |
| [RotateAroundXY](#rotatearoundxy) | `void` | Rotates the primitive about a point by an angle. |
| [SetState_XSizeYSize](#setstate_xsizeysize) | `bool` | Recalculates the stored size of the primitive. |

### IsRedundant

Returns whether the primitive is redundant.

```csharp
bool IsRedundant();
```

**Returns:** `bool`

For a fill, returns true when the rectangle has no width or no height: [`X1Location`](#x1location) equals [`X2Location`](#x2location), or [`Y1Location`](#y1location) equals [`Y2Location`](#y2location). For text and embedded boards the method always returns false.

### RotateAroundXY

Rotates the primitive about a point by an angle.

```csharp
void RotateAroundXY(int argX, int argY, double argngle);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argX` | `int` | value | The X coordinate of the point to rotate about, in internal units (10,000 per mil). |
| `argY` | `int` | value | The Y coordinate of the point to rotate about, in internal units (10,000 per mil). |
| `argngle` | `double` | value | The rotation angle, in degrees. |

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

The primitive is moved around the point and the angle is added to `Rotation`; the size of the primitive is then recalculated. For a fill, the center of the rectangle is rotated about the point and the corners keep their offsets from it, so passing the center (midway between [`X1Location`](#x1location) and [`X2Location`](#x2location), and between [`Y1Location`](#y1location) and [`Y2Location`](#y2location)) rotates the fill without moving it; you can also use the `Rotation` property. For an embedded board the method always rotates by 90 degrees, whatever angle is passed.

### SetState_XSizeYSize

Recalculates the stored size of the primitive.

```csharp
bool SetState_XSizeYSize();
```

**Returns:** `bool`

For a fill it also recalculates the area of the rectangle. [`RotateAroundXY`](#rotatearoundxy) calls this method itself.

## Inherited members

- From [IPCB_Primitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md): [AllowGlobalEdit](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#allowglobaledit), [BeginModify](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#beginmodify), [Board](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#board), [BoundingRectangle](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectangle), [BoundingRectangleChildren](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectanglechildren), [BoundingRectangleForPainting](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectangleforpainting), [BoundingRectangleForSelection](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#boundingrectangleforselection), [CancelModify](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#cancelmodify), [Component](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#component), [Coordinate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#coordinate), [DescriptorString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#descriptorstring), [DetailString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#detailstring), [Dimension](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#dimension), [DrawAsPreview](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#drawaspreview), [DRCError](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#drcerror), [Enabled](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled), [Enabled_Direct](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_direct), [Enabled_vComponent](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vcomponent), [Enabled_vCoordinate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vcoordinate), [Enabled_vDimension](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vdimension), [Enabled_vNet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vnet), [Enabled_vPolygon](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabled_vpolygon), [EnableDraw](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#enabledraw), [EndModify](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#endmodify), [Export_ToParameters](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#export_toparameters), [FlipXY](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#flipxy), [GraphicallyInvalidate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#graphicallyinvalidate), [Handle](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#handle), [Identifier](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#identifier), [InBoard](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#inboard), [InComponent](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#incomponent), [InCoordinate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#incoordinate), [Index](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#index), [InDimension](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#indimension), [InNet](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#innet), [InPolygon](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#inpolygon), [InSelectionMemory](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#inselectionmemory), [IsAssyTestPoint_Bottom](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#isassytestpoint_bottom), [IsAssyTestPoint_Top](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#isassytestpoint_top), [IsElectricalPrim](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#iselectricalprim), [IsFreePrimitive](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#isfreeprimitive), [IsHidden](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#ishidden), [IsKeepout](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#iskeepout), [IsPreRoute](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#ispreroute), [IsSaveable](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#issaveable), [IsTenting](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istenting), [IsTenting_Bottom](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istenting_bottom), [IsTenting_Top](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istenting_top), [IsTestPoint_Bottom](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istestpoint_bottom), [IsTestPoint_Top](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#istestpoint_top), [Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#layer), [MiscFlag1](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#miscflag1), [MiscFlag2](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#miscflag2), [MiscFlag3](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#miscflag3), [Moveable](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#moveable), [MoveByXY](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#movebyxy), [MoveToXY](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#movetoxy), [Net](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#net), [ObjectID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#objectid), [ObjectIDString](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#objectidstring), [PadCacheRobotFlag](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#padcacherobotflag), [PasteMaskExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#pastemaskexpansion), [Polygon](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#polygon), [PolygonOutline](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#polygonoutline), [PowerPlaneClearance](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#powerplaneclearance), [PowerPlaneConnectStyle](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#powerplaneconnectstyle), [PowerPlaneReliefExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#powerplanereliefexpansion), [Preview](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#preview), [ReliefAirGap](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#reliefairgap), [ReliefConductorWidth](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#reliefconductorwidth), [ReliefEntries](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#reliefentries), [Replicate](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#replicate), [RequiredParamterSpace](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#requiredparamterspace), [RotateBy](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#rotateby), [Selected](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#selected), [SolderMaskExpansion](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#soldermaskexpansion), [SwapLayerPairs](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#swaplayerpairs), [TearDrop](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#teardrop), [UnionIndex](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#unionindex), [UniqueId](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#uniqueid), [UniqueID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#uniqueid-1), [Used](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#used), [UserRouted](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#userrouted), [V7Layer](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#v7layer), [ViewableObjectID](https://altiumdeveloper.github.io/ad-sdk-docs/reference/pcb/IPCB_Primitive.md#viewableobjectid)
