Grigorio
Grigorio

Reputation: 25

Sparx EA VBScript. How to autolayout diagram?

I creating some "technique" diagrams from VBScript. For now I do layout diagram manaully (open each diagram in interface and click "Layout Diagram" button). There're too many diagrams now to do this, and I want to do some automatisation of this "proccess".

Have I any chance to not calculate positions of each element on diagram in my script and invoke existing function of SPARX EA from "Diagram Toolbox"?

If it matters, SPARX EA version is 12.0.

Upvotes: 1

Views: 1000

Answers (1)

qwerty_so
qwerty_so

Reputation: 36333

You can use EA's project interface:

if = Repository.GetProjectInterface ();
if.LayoutDiagramEx (string DiagramGUID, long LayoutStyle, long Iterations, long LayerSpacing, long ColumnSpacing, boolean SaveToDiagram);

Details see Sparx's help page. You will also need to look into EAConstants-JScript in the scripting window to decipher the needed parameters.

Side note: you eventually need to run the layout 3 times (at least when I sometimes use it the manual way). Depending on the complexity the results are most times questionable, but also they can give a good start for further manual layout.

Upvotes: 2

Related Questions