Book a Demo

Author Topic: Change the layout of a diagram with an add-on  (Read 4321 times)

andrea.baruzzo

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Change the layout of a diagram with an add-on
« 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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Change the layout of a diagram with an add-on
« Reply #1 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
« Last Edit: October 09, 2010, 06:24:03 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change the layout of a diagram with an add-on
« Reply #2 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