
# IConnectionsArray interface

The `IConnectionsArray` represents the bus and wire connections in a schematic document. Bus and wire connections that have more than 3 connections could be connected by an automatic junction or a manual junction (placed by an user).

```csharp
public interface IConnectionsArray
```

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

## Remarks

A schematic with valid buses and wires will have connections. An `IConnectionsArray` interface has all the connections for this schematic sheet and each element in the `IConnectionsArray` interface is a [`IConnection`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) interface type.

## Example

Iterate over the bus connections of the current schematic sheet.

```csharp
using SCH;

var currentSheet = SCH.GlobalVars.SchServer?.GetCurrentSchDocument() as ISch_Sheet;
if (currentSheet == null)
    return;
IConnectionsArray theBusConnections = currentSheet.GetState_BusConnections();

for (int j = 0; j < theBusConnections.GetState_ConnectionsCount(); j++)
{
    IConnection busConnection = theBusConnections.GetState_Connection(j);
    if (busConnection != null)
    {
        // Process the bus connection here.
    }
}
```

## Properties

| Property | Type | Access | Description |
| --- | --- | --- | --- |
| [Connection](#connection) | [IConnection](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) | get | This method retrieves the indexed connection of [`IConnection`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) type from the `IConnectionsArray` interface. |
| [ConnectionsCount](#connectionscount) | `int` | get | This method returns the number of connections for wires or buses on the schematic sheet. |

### Connection

This method retrieves the indexed connection of [`IConnection`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) type from the `IConnectionsArray` interface.

```csharp
IConnection GetState_Connection(int argIndex);
```

**Type:** [IConnection](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) · **Access:** read-only · **Index:** `argIndex` (`int`)

The accessors are extension methods of `IConnectionsArrayHelper` (`using SCH;`).

### ConnectionsCount

This method returns the number of connections for wires or buses on the schematic sheet. For each

```csharp
int GetState_ConnectionsCount();
```

**Type:** `int` · **Access:** read-only

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [AddConnection](#addconnection) | `void` | This method adds a connection with a location parameter into the `IConnectionsArray` object. |
| [AddConnectionXY](#addconnectionxy) | `void` | This method adds a connection with X,Y parameters into the `IConnectionsArray` object. |
| [AddConnectionXY_WithSize](#addconnectionxy_withsize) | `void` |  |
| [GetConnectionAt](#getconnectionat) | [IConnection](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) | This method retrieves the connection of [`IConnection`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) type based on a location. |
| [GraphicallyInvalidate](#graphicallyinvalidate) | `void` | This method puts the group of design objects (bus or wire objects in an connection array) in an invalid state. |
| [RemoveAllConnectionsAt](#removeallconnectionsat) | `bool` | This method removes all connections at this specified location on the schematic document. |
| [RemoveAllConnectionsForLine](#removeallconnectionsforline) | `bool` | This method removes all connections for the specified line with L1 and L2 parameters. |
| [ResetAllConnections](#resetallconnections) | `void` | This method resets all connections (frees all items) in the `IConnectionsArray` interface for either wire or bus connections. |

### AddConnection

This method adds a connection with a location parameter into the `IConnectionsArray` object.

```csharp
void AddConnection(Point argLocation);
void AddConnection(IPoint argLocation);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argLocation` | [Point](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Point.md) | value |

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

The first overload is an extension method of `IConnectionsArrayHelper` (`using SCH;`) with typed parameters; the second is declared by the interface.

**See also:** [IConnectionsArray.AddConnectionXY](#addconnectionxy)

### AddConnectionXY

This method adds a connection with X,Y parameters into the `IConnectionsArray` object.

```csharp
void AddConnectionXY(int argx, int argy);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argx` | `int` | value |
| `argy` | `int` | value |

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

**See also:** [IConnectionsArray.AddConnection](#addconnection)

### AddConnectionXY_WithSize

*No description yet.*

```csharp
void AddConnectionXY_WithSize(int argx, int argy, TSize argSize);
void AddConnectionXY_WithSize(int argx, int argy, int argSize);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argx` | `int` | value |
| `argy` | `int` | value |
| `argSize` | [TSize](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/TSize.md) | value |

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

The first overload is an extension method of `IConnectionsArrayHelper` (`using SCH;`) with typed parameters; the second is declared by the interface.

### GetConnectionAt

This method retrieves the connection of [`IConnection`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md) type based on a location.

```csharp
IConnection GetConnectionAt(Point argLocation);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argLocation` | [Point](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Point.md) | value | The location the connection is retrieved for. |

**Returns:** [IConnection](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/IConnection.md)

Extension method of `IConnectionsArrayHelper` (`using SCH;`).

**Example:** Show how many objects meet at a wire connection of the current schematic sheet.

```csharp
using SCH;

var currentSheet = SCH.GlobalVars.SchServer?.GetCurrentSchDocument() as ISch_Sheet;
if (currentSheet == null)
    return;
IConnectionsArray connections = currentSheet.GetState_WireConnections();
// Sample values: the location to look at.
var location = new DXP.Point(new DXP.SPoint { X = EDP.Utils.MilsToCoord(1000), Y = EDP.Utils.MilsToCoord(1000) });

IConnection connection = connections.GetConnectionAt(location);
if (connection != null)
    DXP.Utils.ShowMessage(connection.GetState_ObjectsCount().ToString());
```

### GraphicallyInvalidate

This method puts the group of design objects (bus or wire objects in an connection array) in an invalid state. A redraw is required to update the schematic sheet.

```csharp
void GraphicallyInvalidate();
```

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

### RemoveAllConnectionsAt

This method removes all connections at this specified location on the schematic document.

```csharp
bool RemoveAllConnectionsAt(Point argLocation);
bool RemoveAllConnectionsAt(IPoint argLocation);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argLocation` | [Point](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Point.md) | value |

**Returns:** `bool`

The first overload is an extension method of `IConnectionsArrayHelper` (`using SCH;`) with typed parameters; the second is declared by the interface.

### RemoveAllConnectionsForLine

This method removes all connections for the specified line with L1 and L2 parameters. If the call was successful, a true value is returned. The Connections can either represent bus or wire connections.

```csharp
bool RemoveAllConnectionsForLine(Point argL1, Point argL2);
bool RemoveAllConnectionsForLine(IPoint argL1, IPoint argL2);
```

| Parameter | Type | Passing |
| --- | --- | --- |
| `argL1` | [Point](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Point.md) | value |
| `argL2` | [Point](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/Point.md) | value |

**Returns:** `bool`

The first overload is an extension method of `IConnectionsArrayHelper` (`using SCH;`) with typed parameters; the second is declared by the interface.

### ResetAllConnections

This method resets all connections (frees all items) in the `IConnectionsArray` interface for either wire or bus connections.

```csharp
void ResetAllConnections();
```

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

## Returned by

[ISch_Sheet.BusConnections](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_Sheet.md#busconnections), [ISch_Sheet.WireConnections](https://altiumdeveloper.github.io/ad-sdk-docs/reference/sch/ISch_Sheet.md#wireconnections)
