Add a Connector




public Object

"Add a connector and set values.


Sub ConnectorTest


   Dim source as object

   Dim target as object

   Dim con as object

   Dim o as object


   Dim client as object

   Dim supplier as object


   ''use ElementID's to quickly load an element in this example

   ''... you must find suitable ID's in your model


   source = m_Repository.GetElementByID(129)

   target = m_Repository.GetElementByID(169)


   con = source.Connectors.AddNew ("test link 2", "Association")


   ''again- replace ID with a suitable one from your model

   con.SupplierID = 169


   If not con.Update Then


   End If



   Console.WriteLine("Connector Created")


   o = con.Constraints.AddNew ("constraint2","type")

   If not o.Update Then


   End If


   o = con.TaggedValues.AddNew ("Tag","Value")

   If not o.Update Then


   End If


 ''use the client and supplier ends to set

 ''additional information


   client = con.ClientEnd

   client.Visibility = "Private"

   client.Role = "m_client"


   supplier = con.SupplierEnd

   supplier.Visibility = "Protected"

   supplier.Role = "m_supplier"



   Console.WriteLine("Client and Supplier set")





End Sub