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).
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 interface type.
Example
Iterate over the bus connections of the current schematic sheet.
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 | IConnection | get | This method retrieves the indexed connection of IConnection type from the IConnectionsArray interface. |
| 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 type from the IConnectionsArray interface.
IConnection GetState_Connection(int argIndex);
Type: IConnection · 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
int GetState_ConnectionsCount();
Type: int · Access: read-only
Methods
| Method | Returns | Description |
|---|---|---|
| AddConnection | void | This method adds a connection with a location parameter into the IConnectionsArray object. |
| AddConnectionXY | void | This method adds a connection with X,Y parameters into the IConnectionsArray object. |
| AddConnectionXY_WithSize | void | |
| GetConnectionAt | IConnection | This method retrieves the connection of IConnection type based on a location. |
| GraphicallyInvalidate | void | This method puts the group of design objects (bus or wire objects in an connection array) in an invalid state. |
| RemoveAllConnectionsAt | bool | This method removes all connections at this specified location on the schematic document. |
| RemoveAllConnectionsForLine | bool | This method removes all connections for the specified line with L1 and L2 parameters. |
| 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.
void AddConnection(Point argLocation);
void AddConnection(IPoint argLocation);
| Parameter | Type | Passing |
|---|---|---|
argLocation | Point | 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
This method adds a connection with X,Y parameters into the IConnectionsArray object.
void AddConnectionXY(int argx, int argy);
| Parameter | Type | Passing |
|---|---|---|
argx | int | value |
argy | int | value |
Returns: nothing (void)
See also: IConnectionsArray.AddConnection
AddConnectionXY_WithSize
No description yet.
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 | 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 type based on a location.
IConnection GetConnectionAt(Point argLocation);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argLocation | Point | value | The location the connection is retrieved for. |
Returns: IConnection
Extension method of IConnectionsArrayHelper (using SCH;).
Example: Show how many objects meet at a wire connection of the current schematic sheet.
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.
void GraphicallyInvalidate();
Returns: nothing (void)
RemoveAllConnectionsAt
This method removes all connections at this specified location on the schematic document.
bool RemoveAllConnectionsAt(Point argLocation);
bool RemoveAllConnectionsAt(IPoint argLocation);
| Parameter | Type | Passing |
|---|---|---|
argLocation | Point | 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.
bool RemoveAllConnectionsForLine(Point argL1, Point argL2);
bool RemoveAllConnectionsForLine(IPoint argL1, IPoint argL2);
| Parameter | Type | Passing |
|---|---|---|
argL1 | Point | value |
argL2 | Point | 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.
void ResetAllConnections();
Returns: nothing (void)