IConnection interface

Overview 
The IConnection interface represents whether the wire or bus connection has a manual junction on it or not, with location, wire or bus objects count and the thickness of wire or bus objects.
The object count denotes the number of connections from this connection location for example one end of a capacitor can have two or more wire connections because it is tied to the Ground as well as to other points on the schematic. A connection that has 3 or more wire / bus objects denotes that a junction (system generated or manually placed) is required to tied the connections together. Thus you can use the IConnection interface to determine the number of wire or bus connections at the specified location.
The project that has schematics need to be compiled first before IConnection interfaces can be extracted with valid data.

Notes 
The ISch_Sheet interface has the IConnectionsArray interface which in turn has the IConnection interface.
The ISch_Document can be either ISch_Sheet or ISch_Lib interfaces depending on which document (Schematic Sheet or Schematic Library) you are working with.
A manual junction (placed by an user) may signify a forced connection of at least 3 or more connections on a schematic document.
IConnection Methods and Properties Table

IConnection methods

Function GetState_Location : TPoint;
Function GetState_ObjectsCount : Integer;
Function GetState_IsManualJunction : Boolean;
Procedure SetState_Location(AValue : TPoint);
Procedure SetState_ObjectsCount(AValue : Integer);
Procedure SetState_IsManualJunction(AValue : Boolean);
Function GetState_Size : EDPTypes_SCH.TSize;
Procedure SetState_Size(AValue : EDPTypes_SCH.TSize);

IConnection properties

Property Location : TPoint Read GetState_Location Write SetState_Location;
Property ObjectsCount : Integer Read GetState_ObjectsCount Write SetState_ObjectsCount;
Property IsManualJunction : Boolean Read GetState_IsManualJunction Write SetState_IsManualJunction;
Property Size : EDPTypes_SCH.TSize Read GetState_Size Write SetState_Size;

See also 
IConnectionsArray interface
ISch_Sheet interface

IConnection Methods

GetState_Location method

(ISch_Connection interface)
Syntax 
Function GetState_Location : TLocation;
Description 
The GetState_Location method retrieves the X,Y location of the wire or bus connection on the schematic document. This method is used by the Location property.
See also 
ISch_Connection interface
Location Property and Example
TLocation type

GetState_ ObjectsCount method

(ISch_Connection interface)
Syntax 
Function GetState_ObjectsCount
Description 
The GetState_ObjectsCount method reports the number of wire or bus connections at a location on the schematic sheet.
See also 
ISch_Connection interface
ObjectsCount Property and Example

GetState_Location method

(ISch_Connection interface)
Syntax 
Function GetState_IsManualJunction : Boolean;
Description 
The GetState_IsManualJunction function determines whether the connection has a manual junction or not.
See also 
ISch_Connection interface
Location property and example

SetState_Location method

(ISch_Connection interface)
Syntax 
Procedure SetState_Location (AValue : TLocation);
Description 
The procedure adds a location to the IConnection object.
See also 
ISch_Connection interface

SetState_ObjectsCount method

(ISch_Connection interface)
Syntax 
Procedure SetState_ObjectsCount (AValue : Integer);
Description 
This procedure sets the objects count for the IConnection object.
See also 
ISch_Connection interface

SetState_IsManualJunction method

(ISch_Connection interface)
Syntax 
Procedure SetState_IsManualJunction(AValue : Boolean);
Description 
This procedure sets the IsManualJunction Boolean setting for the IConnection object.
See also 
ISch_Connection interface

IConnection Properties

ObjectsCount property

(IConnection interface)
Syntax 
Property ObjectsCount : Integer Read GetState_ObjectsCount Write SetState_ObjectsCount;
Description 
This property retrieves or sets the Objects Count for Bus or Wire connection represented by the IConnection object.
Example 
Var
I,J : Integer;
WS : IWorkspace;
Prj : IProject;
Doc : IDocument;
CurrentSch : ISch_Sheet;
TheWireConnections : IConnectionsArray;
WireConnection : IConnection;
Connectionslist : TStringList;
FileName : String;
FilePath : String;
ReportDocument : IServerDocument;
Begin
WS := GetWorkspace;
If WS = Nil Then Exit;
Prj := WS.DM_FocusedProject;
If Prj = Nil Then Exit;
Prj.DM_Compile;
Doc := WS.DM_FocusedDocument;
ConnectionsList := TStringList.Create;
If Doc.DM_DocumentKind = 'SCH' Then
Begin
CurrentSch := SchServer.GetSchDocumentByPath(Doc.DM_FullPath);
If CurrentSch <> Nil Then
Begin
TheWireConnections := CurrentSch.WireConnections;
// Collect data for wire connections (IConnectionArray)
ConnectionsList.Add('Wire Connections');
For J := 0 To TheWireConnections.ConnectionsCount 
- 1 Do
Begin
WireConnection := TheWireConnections.Connection(J);
If WireConnection <> Nil Then
Begin
ConnectionsList.Add('Wire Connection Count: ' 
+ IntToStr (WireConnection.ObjectsCount));
ConnectionsList.Add('Wire Connection Location: ' 
+ LocationtoStr(WireConnection.Location)); // currently 0,0
ConnectionsList.Add('Wire Connection has a manual junction: ' 
+ BooleantoStr (WireConnection.IsManualJunction));
ConnectionsList.Add('Wire Connection size: ' 
+ SizeToStr (WireConnection.Size));
ConnectionsList.Add('');
End;
End;
End;
End;

FilePath := ExtractFilePath(Doc.DM_FullPath);
FileName := FilePath 
+ '\ConnectionsReport.Txt';;
ConnectionsList.SaveToFile(FileName);
ConnectionsList.Free;

ReportDocument := Client.OpenDocument('Text', FileName);
If ReportDocument <> Nil Then
Client.ShowDocument(ReportDocument);
End;
See also 
IConnection interface

Location property

(IConnection interface)
Syntax 
Property Location : TLocation Read GetState_Location Write SetState_Location;
Description 
This property retrieves or sets the Location of Bus or Wire connection represented by the IConnection object.
Example 
WS := GetWorkspace;
If WS = Nil Then Exit;
Prj := WS.DM_FocusedProject;
If Prj = Nil Then Exit;
Prj.DM_Compile;
Doc := WS.DM_FocusedDocument;
If Doc.DM_DocumentKind = 'SCH' Then
Begin
CurrentSch := SchServer.GetSchDocumentByPath(Doc.DM_FullPath);
If CurrentSch <> Nil Then
Begin
TheWireConnections := CurrentSch.WireConnections;
For J := 0 To TheWireConnections.ConnectionsCount 
- 1 Do
Begin
WireConnection := TheWireConnections.Connection(J);
If WireConnection <> Nil Then
Begin
X := WireConnection.Location.X;
Y := WireConnection.Location.Y;
End;
End;
End;
See also 
IConnection interface

IsManualJunction property

(IConnection interface)
Syntax 
Property IsManualJunction : Boolean Read GetState_IsManualJunction Write SetState_IsManualJunction;
Description 
This property retrieves or sets the IsManualJunction setting of Bus or Wire connection represented by the IConnection object.
Example 
WS := GetWorkspace;
If WS = Nil Then Exit;
Prj := WS.DM_FocusedProject;
If Prj = Nil Then Exit;
Prj.DM_Compile;
Doc := WS.DM_FocusedDocument;
If Doc.DM_DocumentKind = 'SCH' Then
Begin
CurrentSch := SchServer.GetSchDocumentByPath(Doc.DM_FullPath);
If CurrentSch <> Nil Then
Begin
TheWireConnections := CurrentSch.WireConnections;
For J := 0 To TheWireConnections.ConnectionsCount 
- 1 Do
Begin
WireConnection := TheWireConnections.Connection(J);
If WireConnection <> Nil Then
Begin
ManualJunctionAtConnection := WireConnection.Location.IsManualJunction;
//rest of code
End;
End;
End;
See also 
IConnection interface

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.