AutoLinkShapes(Shape1: Prognoz.Platform.Interop.Andy.IWxShape, Shape2: Prognoz.Platform.Interop.Andy.IWxShape): Prognoz.Platform.Interop.Andy.IWxLink;
Shape1. Workspace shape.
Shape2. Workspace shape that must be connected with the first one.
The AutoLinkShapes method connects two shapes with lines.
Connecting points for both shapes are selected automatically.
Executing the example requires that repository contains a workspace with the WSP identifier containing at least two shapes.
Add links to the Andy, Drawing, Metabase system assemblies.
Sub UserProc;
Var
mb: IMetabase;
ws: IWxWorkspace;
Shapes: IWxShapes;
Link: IWxLink;
Style: IWxStyle;
Begin
// Get workspace for editing
mb := MetabaseClass.Active;
ws := mb.ItemById("WSP").Edit As IWxWorkspace;
Shapes := ws.Shapes;
// Connect the second shape with the first one
Link := ws.AutoLinkShapes(Shapes.Item(0), Shapes.Item(1));
(ws As IMetabaseObject).Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Andy;
Imports Prognoz.Platform.Interop.Drawing;
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
ws: IWxWorkspace;
Shapes: IWxShapes;
Link: IWxLink;
Style: IWxStyle;
Begin
// Get workspace for editing
mb := Params.Metabase;
ws := mb.ItemById["WSP"].Edit() As IWxWorkspace;
Shapes := ws.Shapes;
// Connect the second shape with the first one
Link := ws.AutoLinkShapes(Shapes.Item[0], Shapes.Item[1]);
(ws As IMetabaseObject).Save();
End Sub;
After executing the example the connection will be created between two selected shapes.
See also: