All I want to do is script the addition of a connector to an element, then the addition of that element to a diagram. When I load the diagram after running my script, I see the element all right but there's no connector. What am I missing? I've tried editing other Connector attributes but no luck.
The c variable is the old Connector I want to base my new one on.
The Elements variable is the collection of ElementObjects in the Diagram.
Dim NewElement, AddingElement, NewConnectors, NewConn
Set NewElement = GetElementByGuid("{6DFB6497-AAE6-4a9f-90CE-2F86F8E9D542}")
c.SupplierID = NewElement.ElementID
NewConnectors = NewElement.Connectors
NewConn = NewConnectors.AddNew(c.Name, "Dependency")
NewConn.SupplierID = NewElement.ElementID
NewConn.ClientID = c.ClientID
NewConn.Stereotype = "deriveReqt"
NewConn.Update
Set AddingElement = Elements.AddNew(NewElement.Name, "")
AddingElement.ElementID = NewElement.ElementID
AddingElement.Update()
GetProjectInterface().LayoutDiagramEx Diagram.DiagramGUID, EA.ConstLayoutStyles.lsDiagramDefault, 8, 50, 50, true
ReloadDiagram(Diagram.DiagramID)
From what I've seen all I need to do is set the stereotype and sources, which I've done. What am I doing wrong?
EDIT: Appears I was overloading AddingElement = Elements.AddNew(NewElement.Name, "") , it didn't actually need a name. Also EA.ConstLayoutStyles.lsDiagramDefault, 8, 50, 50, true takes GetProjectInterface().LayoutDiagramEx Diagram.DiagramGUID, 0, 8, 50, 50, true instead; I guess the script doesn't like the layoutstyle stuff as much as addins do. Thanks Geert!