Set oDrawing = oRepositoryDiagram.Drawing("RW") colApps = oRoot.getselection("Select [Application] Where [Diagram].[_HexaIdAbs] = '" & oRepositoryDiagram.GetProp("_HexaIdAbs") & _ "' And [Flow To Application Function].[Diagram].[_HexaIdAbs] = '" & oRepositoryDiagram.GetProp("_HexaIdAbs") & "'") For each oApp in colApps Set ExistingLinks = oApp.GetCollection(oOldLeg.GetId()) For each oLegApp in ExistingLinks DrawNewFlow(oDrawing, oApp, oLegApp, oOldLeg, oNewLeg) Next Next oDrawing.Flush Function DrawNewLink(oDrawing, oApp1 , oApp2 , oOldLeg, oNewLeg) dim arDrawingLink, NewFlowRelation, flowdrawingitem, parentdrawingitem, flowpoints 'Get old link '----------------------------- arDrawingLink = FindDrawingLink( oDrawing, oApp1.GetId(), oApp2.GetId(), oOldLeg.GetId()) if UBound(arDrawingLink) = 0 then Call PrintStatement("Link not found on this diagram") else Set oDrawingLink = arDrawingLink(0) Set oDrawingItem = oDrawingLink.DrawingItem 'Create new link '---------------- Set NewFlowRelation = oRoot.getCollection("Message Flow").Add("Message Flow App1 to App2") NewFlowRelation.getCollection("Source Flow Element").Add(oApp1) NewFlowRelation.getCollection("Target Flow Element").Add(oApp2) Set AlreadyConnectedDiagrams = NewFlowRelation.getCollection("Containing Diagram") Set flowdrawingitem = oDrawing.MegaObjectInsert(NewFlowRelation) Set parentdrawingitem = flowdrawingitem.ItemProperty("ParentDrawingItem") Set oLineStyle = oDrawingItem.LineStyle If oLineStyle.Style = 7 Or oLineStyle.Style = 1 Then 'orthogonal or simple Set colPoints = oDrawingItem.ItemProperty("DrwLine_Points") parentdrawingitem.ItemProperty("DrwLine_Points") = colPoints End If End If End Function Function FindDrawingLink(oDrawing, idRpMaster, idRpSlave, idLeg) ReDim arDrawingLink(0) For Each oDrawingLink In oDrawing.DrawingLinks If ( ( idLeg = oDrawingLink.OppositeLegId And idRpSlave = oDrawingLink.OppositeDrawingObject.Id And idRpMaster = oDrawingLink.DirectDrawingObject.Id ) Or ( idLeg = oDrawingLink.DirectLegId And idRpSlave = oDrawingLink.DirectDrawingObject.Id And idRpMaster = oDrawingLink.OppositeDrawingObject.Id ) ) Then ReDim Preserve arDrawingLink(UBound(arDrawingLink)+1) Set arDrawingLink(UBound(arDrawingLink)-1) = oDrawingLink End If Next FindDrawingLink = arDrawingLink End Function