Book a Demo

Author Topic: Scripting Layout Diagram  (Read 5426 times)

brback

  • EA User
  • **
  • Posts: 21
  • Karma: +1/-0
    • View Profile
Scripting Layout Diagram
« on: June 08, 2017, 11:38:13 pm »
With the help of you guys I've been able to import elements with their relations from our cmdb to Sparx represented as different ArchiMate elements. I am now in the process (by scripting) of creating a configuration diagram for each application that has been imported. I've been able to add the elements to a new diagram, and all the elements stack upon each other in the upper-left corner of the diagram.

I want the elements to layout as the "diagraph" option (or at least something else) as available in Tools -> Diagram Layout. As far as i can se the project interface package with its diagramLayoutEx method is supposed to do something like this. I have not succeeded in producing any code which executes this method successfully. Can anyone provide me with a good example which I can base my code on?  (for EA 13)  :)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Scripting Layout Diagram
« Reply #1 on: June 09, 2017, 05:27:10 am »
It looks like this is not exposed:

Code: [Select]
// =================================================================================================
// ConstLayoutStyles
// See http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/constlayoutstylesenum.htm
// =================================================================================================
var lsDiagramDefault = 0x00000000;
var lsProgramDefault = 0xFFFFFFFF;
var lsCycleRemoveGreedy = 0x80000000;
var lsCycleRemoveDFS = 0x40000000;
var lsLayeringLongestPathSink = 0x30000000;
var lsLayeringLongestPathSource = 0x20000000;
var lsLayeringOptimalLinkLength = 0x10000000;
var lsInitializeNaive = 0x08000000;
var lsInitializeDFSOut = 0x04000000;
var lsInitializeDFSIn = 0x0C000000;
var lsCrossReduceAggressive = 0x02000000;
var lsLayoutDirectionUp = 0x00010000;
var lsLayoutDirectionDown = 0x00020000;
var lsLayoutDirectionLeft = 0x00040000;
var lsLayoutDirectionRight = 0x00080000;

You need Sparx' assistance I guess.

q.

George

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Scripting Layout Diagram
« Reply #2 on: June 22, 2017, 02:09:49 am »
The layout option in GUI is is named "Digraph", it allows to choose also the direction. Corresponding constants are:
lsLayoutDirectionDown
lsLayoutDirectionLeft
lsLayoutDirectionRight
lsLayoutDirectionUp