Book a Demo

Author Topic: Automated script for draw EA.Element (Activity) into EA.Diagram  (Read 4123 times)

cathello

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Hi all,
I builded an automated script that able to read from database, create objects into Diagram and create relationship between them.

I have a little problem. When create a new relationship througth a Connector i need to create with style "Orthogonal - Rounded" (default is Custom)

Is it possible?

I read that can i able to change the default routing style through the preferences but the type Routed is different to Orthogonal - Rounded.

This is my script to create a Connector:

"
var connectorDependency as EA.Connector;
connectorDependency = elementSource.Connectors.AddNew("", "Realization");
connectorDependency.Stereotype = "DataAssociation";
connectorDependency.Type = "Dependency";
connectorDependency.SupplierID = elementDestination.ElementID;   
connectorDependency.Update();
currentDiagram.Update();"


Thanks for help.
Catello.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller

cathello

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Automated script for draw EA.Element (Activity) into EA.Diagram
« Reply #2 on: August 28, 2019, 08:01:36 pm »
Thanks a lot.

Just a last question. What is the method in JScript that overwrite the style? I tried this:

                        for (var j=0; j < currentDiagram.DiagramLinks.Count; j++)
         {
            var link as EA.Diagram.DiagramLinks;
            link = currentDiagram.DiagramLinks.GetAt(j);
            link.WriteStyle = "Mode=3;TREE=OR;";
         }

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Automated script for draw EA.Element (Activity) into EA.Diagram
« Reply #3 on: August 28, 2019, 08:48:04 pm »
I'm not sure (I don't use Jscript), but I suppose it's just

Code: [Select]
link.Style = "Mode=3;TREE=OR;";
Don't forget to save your changes by calling update()

Geert

cathello

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: Automated script for draw EA.Element (Activity) into EA.Diagram
« Reply #4 on: August 28, 2019, 08:57:55 pm »
:) I found.

I used the class EA.Diagram.Diagram Links that has not the Style parameter but StyleEx. I tried to use an object EA.Diagram Links and now work it!!!


Thank you so much :)