//layout using the default diagram layouter
AbstractDiagramPresentationElement diagramView = ...;
diagramView.open();
Layouting.layout(diagramView);
JAVA
//layout the selected symbols in the diagram using the default diagram layouter
AbstractDiagramPresentationElement diagramView = ...;
diagramView.open();
List<PresentationElement> symbolsToLayout = ...;
diagramView.setSelected(symbolsToLayout);
Layouting.layout(diagramView);
JAVA
//layout using any of the available layouters
AbstractDiagramPresentationElement diagram = ...;
diagram.open()
Layouting.layout(diagram, Layouting.HIERARCHIC_DIAGRAM_LAYOUTER);
JAVA
Make sure the diagram is opened and the session is closed before doing a diagram layout. These are the current limitation of layout API
You can find more code examples in
<installation_directory>\openapi\examples\testframework, com.nomagic.magicdraw.examples.testframework.DiagramLayoutTest class