Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - newtonianb

Pages: [1]
1
I'm using win32com to interact with enterprise architect from a python script using

win32.com.client.Dispatch("EA.App")

Is there a way to get that script show up in Enterprise Architect? Or a way to have it ran from EA?

2
I have created a script that **automatically creates connections between various packages and elements**.

My issue is I ran the script several times and because there was no check to prevent duplicate connections I now have 10 duplicate connections for each element!

I need to

 1. delete them all
 2. find a way to check if connections already exists prior to creating them in the future

Here is my code to add the connectors

    function AddC(myDiagramObject, myPackageObject, myElementObject) {
        source = Repository.GetElementByID(myPackageObject.ElementID)
        target = Repository.GetElementByID(myElementObject.ElementID)
        association = source.Connectors.AddNew("", "Dependency")
        association.SupplierID = target.ElementID
        association.Stereotype = "Requirement"
        association.Update()
        Repository.ReloadDiagram(myDiagramObject.DiagramID)
    }

Here is my code that does not work to remove the connectors

    function DeleteC(diagramObject) {
      for(var c = 0; c < diagramObject.DiagramObjects.Count; c++)
      {
        var currentObject = diagramObject.DiagramObjects.GetAt(c)
          for (var d = 0; d < currentObject.Connectors.Count; d++) {
            currentObject.Connectors.Delete(d)
            currentObject.Update()
          }
      }

The line var currentObject in DeleteC function is giving me some objects of type "IDualDiagramObject" the problem these objects don't seem to have the Connectors property
    

Pages: [1]