Book a Demo

Author Topic: Layout diagram automatically upside down  (Read 4712 times)

Markus Rohner

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Layout diagram automatically upside down
« on: February 08, 2018, 02:07:48 am »
I'm creating a new diagram
EA.Diagram collaborationDiagram = collabModel.Diagrams.AddNew(JobChainName, "BPMN2.0::BusinessProcess");

and then add activities to it
EA.Collection diagramObjects = collaborationDiagram.DiagramObjects;
EA.DiagramObject collabDiagramObject = diagramObjects.AddNew("l=200;r=600;t=200;b=200;", "");
collabDiagramObject.ElementID = activity1.ElementID;

EA.DiagramObject collabDiagramObject = diagramObjects.AddNew("l=200;r=600;t=200;b=200;", "");
collabDiagramObject.ElementID = activity2.ElementID;
and connect them as type "ControlFlow"

After adding start end end event (connected too) I layout the diagram:
Model.GetProjectInterface().LayoutDiagramEx(collaborationDiagram.DiagramGUID,0,4,20,20,true);

So far so good. The code works. Everything is on the diagram BUT it get's layouted updside down.
The start event is at the bottom and the Flow goes upward (the arrows are pointing upwards) and on top of the page there is the end event.

This happens aswell when I draw a collaboration diagram in EA an press <Diagram Layout: Apply Default Layout>.
So I don't think that the code is wrong.

I thought to lay it out manually. That's much more complicated and I couldn't find out what ("l=200;r=600;t=200;b=200;", "") means.

Does someone know how to do it correctly?

Thanks.
Markus

Arshad

  • EA User
  • **
  • Posts: 292
  • Karma: +21/-1
    • View Profile
Re: Layout diagram automatically upside down
« Reply #1 on: February 08, 2018, 02:58:23 am »
I thought to lay it out manually. That's much more complicated and I couldn't find out what ("l=200;r=600;t=200;b=200;", "") means.

Does someone know how to do it correctly?

Thanks.
Markus


Hi Markus

Its the position of the object in the diagram.
You can even set it directly in the DiagramObject property.

Code: [Select]
collabDiagramObject .left
collabDiagramObject .right
collabDiagramObject .bottom
collabDiagramObject .top


Arshad

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Layout diagram automatically upside down
« Reply #2 on: February 08, 2018, 02:59:32 am »
Check out the documentation in the manual:
http://www.sparxsystems.com/enterprise_architect_user_guide/13.5/automation/project_2.html

With the LayoutStyle parameter you can control the layout.

Also worth looking is the settings for the layout style.
Go to diagram properties | Diagram | Set Layout Style.
That dialog also includes a checkbox to use that style as the default style for the whole repository.

Geert

Markus Rohner

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Layout diagram automatically upside down
« Reply #3 on: February 08, 2018, 05:47:52 pm »
 8) Thanks a lot to both of you.
It works now, I knew I missed something...

Markus