Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: andrea.baruzzo on October 09, 2010, 01:47:28 am

Title: Change the layout of a diagram with an add-on
Post by: andrea.baruzzo on October 09, 2010, 01:47:28 am
Hi,
I would like to write an add-on capable of display an existing diagram (or even creating a new one) applying custom layout algorithms. At a first glance, I don't find in the user guide a proper section illustrating how *programmatically* alter the default layout provided by EA.
Can anyone point me in the right place?
Thanks in advance,
Andrea
Title: Re: Change the layout of a diagram with an add-on
Post by: Paolo F Cantoni on October 09, 2010, 06:23:02 pm
Hi Andrea,

Firstly, you need to understand that there are currently (863) TWO layout mechnaisms in EA.  Diagram|Layout Diagram is the classic mechanism and the newer View|Layout Tools which allows a different set of layouts mechanisms.

Only the classic form is available via automation and is managed by the Project Interface:
LayoutDiagramEx (string DiagramGUID, long LayoutStyle, long Iterations, long LayerSpacing, long ColumnSpacing, boolean SaveToDiagram)

See the Help for details.

HTH,
Paolo
Title: Re: Change the layout of a diagram with an add-on
Post by: Geert Bellekens on October 11, 2010, 04:23:29 pm
Andrea,

To manually tweak the layout of a diagram look at the Style and StyleEx properties of things such as EA.Diagram, EA.DiagramObject, EA.DiagramLink,...

It's going to take a lot of trial and error, figuring out how to fill in the insane key=value pairs, cursing, considering suicide,... but eventually you should be able to manage.

Extra tip: Use Repository.SQLQuery and Repository. Execute if the API fails to provide some feature.

Geert