Object referring to a link. Use this object to create a connection of two blocks or to connect a block with an external port, or to query properties of a connection. The queries always work on exactly one link, but it is possible to create multiple connected links at once by specifying more than two link ends.
General Methods
Reset
Resets all internal settings to their default values.
SetPortFromExternalPort ( int endnumber, int portnumber, bool referencepin )
Sets an external port or its reference pin as port endnumber of the link. The smallest possible endnumber is 1. All ends of a link need to be connected with an external port or a block port. The chosen pin of the external port must not be connected already if endnumber is higher than 2.
SetSourcePortFromExternalPort ( int portnumber, bool referencepin )
Sets an external port or its reference pin as source port of the link. This is equivalent to SetPortFromExternalPort(1, portnumber, referencepin).
SetTargetPortFromExternalPort ( int portnumber, bool referencepin )
Sets an external port or its reference pin as target port of the link. This is equivalent to SetPortFromExternalPort(2, portnumber, referencepin)
SetPortFromBlockPort ( int endnumber, name blockname, name portname, bool referencepin )
Sets a block's port or its reference pin as port port endnumber of the link. The smallest possible endnumber is 1. All ends of a link need to be connected with an external port or a block port. The chosen pin of the block must not be connected already if endnumber is higher than 2.
SetSourcePortFromBlockPort ( name blockname, name portname, bool referencepin )
Sets a block's port or its reference pin as source port of the link. This is equivalent to SetPortFromBlockPort(1, blockname, portname, referencepin).
SetTargetPortFromBlockPort ( name blockname, name portname, bool referencepin )
Sets a block's port or its reference pin as target port of the link. This is equivalent to SetPortFromBlockPort(2, blockname, portname, referencepin).
SetSourceNodePosition ( int x, int y )
Sets the position of the node created at the source end of the link. This has only an effect if the chosen source port is already connected with a link. Possible values are 0 < x, y <100000, i.e. (50000, 50000) is the center of the schematic. It is always ensured that the created node is aligned with the grid, therefore the specified position might get adjusted slightly.
SetTargetNodePosition ( int x, int y )
Sets the position of the node created at the target end of the link. This has only an effect if the chosen target port is already connected with a link. Possible values are 0 < x, y <100000, i.e. (50000, 50000) is the center of the schematic. It is always ensured that the created node is aligned with the grid, therefore the specified position might get adjusted slightly.
Create
Creates a new link. All necessary settings for this connection have to be made previously, i.e. source port and target port must be set by some of the methods above. A new node is created for each link end that connects to an already connected pin. If the link has more than two ends, as many new nodes as needed to connect each end are created. They are positioned automatically.
Delete
Deletes a link. All necessary settings for this connection have to be made previously, i.e. source port and target port must be set by some of the methods above.
Reroute
Recalculates the route of the link. If the link was manually routed before, it will now be automatically routed.
SetManualRoute ( string array points )
Set a specific route for the link. points is an array containing the x and y coordinates of each route point, so the dimension of the array is twice the number of points. The start and end point cannot be set and are always added to the specified points. Additional intermediate points are added if the specified points do not result in an orthogonal route. This method may only be called for a link with exactly two ends.
SetOrthogonalPath ( bool orthogonal )
Specify whether the link should be routed with an orthogonal or polygonal path. If this method is not called before creating a link, the default as returned by IsOrthogonalMode is used.
SetOrthogonalMode ( bool orthogonal )
Specify whether new links should be routed with an orthogonal or polygonal path. This does not change existing links.
Queries
DoesExist bool
Checks if a link with the currently selected settings already exists.
IsManuallyRouted bool
Checks if the link was manually routed.
HasOrthogonalPath bool
Checks whether the link has an orthogonal or polygonal path.
IsOrthogonalMode bool
Checks whether new links will be created with an orthogonal or polygonal path.
GetLength int
Returns the length of the link.
GetNumberOfBends int
Returns the number of bends of the link.
'Connects two blocks with an external port
With Link
.Reset
.SetPortFromBlockPort (1, "R1", "2", False)
.SetPortFromBlockPort (2, "L1", "1", False)
.SetPortFromExternalPort (3, "1", False)
.Create
End With
'Sets a manual route with five points in total
Dim points(0 To 5) As String
points(0) = "50670" ' x(1)
points(1) = "50200" ' y(1)
points(2) = "50700" ' x(2)
points(3) = "50200" ' y(2)
points(4) = "50700" ' x(3)
points(5) = "50250" ' y(3)
With Link
.Reset
.SetPortFromBlockPort (1, "R1", "1", False)
.SetPortFromBlockPort (2, "R2", "1", False)
.SetManualRoute (points)
.Create
End With