Author Topic: Diagram Automation  (Read 12695 times)

Sam_Mancarella

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Diagram Automation
« Reply #15 on: March 31, 2004, 06:39:28 pm »
Hi all,

Quote
Looks like you're right.
 
Just tried all values 0 - 128 and all powers of 2.
 
All diagrams laid out according to settings I set by hand in the GUI.
 
Me thinks the feature doesn't work...!  


This is because the LayoutStyle parameter in the Project.LayoutDiagram() method is not actually used anywhere in the automated layout process, so yes, it doesn't work.  :o

Thanks for pointing out the design omission we'll be implementing a set of LayoutStyle options for this parameter for use in diagram layout. We endeavour to provide this within the next build or two of EA (during the next fortnight).

I will post an announcement here in this thread once we have made this layout customisation available.

Watch this space,  ;)

Sam Mancarella
- Sparx Systems

Bruno.Cossi

  • EA User
  • **
  • Posts: 803
  • Karma: +0/-0
    • View Profile
Re: Diagram Automation
« Reply #16 on: March 31, 2004, 10:31:31 pm »
Thanks, Sam. Can't wait! :-)

Bruno

Sam_Mancarella

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: Diagram Automation
« Reply #17 on: April 14, 2004, 11:12:24 pm »
As promised, we have made the necessary changes fo the AI to make use of the LayoutStyle parameter in the Project.LayoutDiagram() method.
Using this parameter, one can pass in all relevant layout options as would be found in the Diagram Properties->Set Layout Style dialog box using the constants defined in ConstLayoutStyles.

An example use of these parameters is shown below as a VB Function:
Code: [Select]
Private Function LayoutDiagram _
 (ByRef oProj As EA.Project, _
  ByVal sDiagramGUID As String) As Boolean

 Dim lLayoutStyle As Long
 If sDiagramGUID = "" Then
   LayoutDiagram = False
   Exit Function
 End If

 ' Set some styles using ConstLayoutStyles values
 ' Depth First Search Cycle Removal, Optimal Link Length Layering
 ' Naive Initialize, Default Spacing, Up Layout Direction
 ' Aggressive crossing reduction (8 iterations)
 lLayoutStyle = ConstLayoutStyles.lsCycleRemoveDFS Or _
   ConstLayoutStyles.lsLayeringOptimalLinkLength Or _
   ConstLayoutStyles.lsInitializeNaive Or _
   ConstLayoutStyles.lsCrossReduceAggressive Or _
   ConstLayoutStyles.lsLayoutDirectionDown Or _
   ConstLayoutStyles.lsCrossReduceIteration Or _
   CByte(8)

 LayoutDiagram = oProj.LayoutDiagram(sDiagramGUID, lLayoutStyle)

End Function


A couple of points to be aware of:
  • Using ConstLayoutStyles.lsDiagramDefault will layout the given diagram using the layout styles defined for it
  • ConstLayoutStyles.lsProgramDefault will layout the given diagram using EA's layout defaults
  • The three layout options requiring numerical values to be set are not mutually exclusive - ie: you can only set one numerical value to the parameter to define Layer Spacing, Column Spacing or the Cross Reduce Iterations values - this will be rectified in a later release of EA.


Hope this change proves useful for you in the meantime!
Best Regards
Sam Mancarella - Sparx Systems

[/list]