Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoLayout diagrams from API

Occasional Contributor

AutoLayout diagrams from API

Hi all,


I'm using the JAVA API to add all elements and links, that's OK !


Is it possible to do an Auto Layout to arrange diagrams ?


Thanks by advance !

Tags (4)
3 Replies

Re: AutoLayout diagrams from API



For a diagram that does not have yet a text _drawing (that stores the graphical arrangement of diagram), an automatic arrangement will be triggered at first opening if the DiagramTypeParam is configured accordingly. No code is required, only configuration

See KB


There is also a function ArrangeLayout is available for the MegaDrawing object.  
See javadoc documentation


arrangeLayout(int layoutType, int lineStyle)


Occasional Contributor

Re: AutoLayout diagrams from API

Thanks for the answer.


But i'm using ONLY the JAVA API.


I tried to use the "arrangeLayout" but some mistakes appears :

- The egdes between elements are "direct" and i don't know how to set them "ortogonal"

- The elements affected to participants (in lanes) doen't be into the lanes

- Impossible to configure the laes to be horizontal (using the default "participant_horizontal.mgs" shape)


Maybe the full auto positionning will help me, so maybe it as a possibility to remove the existing "Drawing" ???


Thanks by advance !

Occasional Contributor

Re: AutoLayout diagrams from API

Hard to find help and always with issue ...


Followinf the procided links, i found some informations but no way to make them working.


MegaObject mgObject = _mgObject;
MegaObject mgDiagram = mgObject.getCollection(diagramCollectionName);
MegaDrawing mgDrawing = mgDiagram.callFunction("drawing", "RW");

MegaAttribute o1 = mgDrawing .getAttribute(DiagramTypeObject.MA_DiagramTypeObjectArrangement);
System.err.println("o1 -> " + o1);
System.err.println("   -> value = " + o1.getValue());

Results with :

MEGA Error 0x80020009(GetProp) : PropGet(MetaAttribute DiagramTypeObject Arrangement <gxMbtR9L61C0>) is not valid for the Business Process MetaClass

Any help please ?