enterprise-architect

Keyboard shortcut to change Z-order in Enterprise Architect


I have to model diagrams with a lot of components. What is really annoying is to change the Z-Ordner by using the context menu, so that all the components are visible and are not hidden by other ones.

I tried in vain to find a Keyboard-Shortcut to change the elements Z-Order. Is there any?

Or are there other more automatic means to find the correct Z-Order with the Enterprise Architect by just knowing which component is contained in another one?


Solution

  • There's no keyboard shortcut for changing the z-order, but there are buttons that make it faster than using the context menu: enter image description here

    You could also fairly easily make a script to change the Z-Order of all elements in a diagram.

    Elements shown on a diagram are know in the API as DiagramObject https://sparxsystems.com/enterprise_architect_user_guide/16.1/add-ins___scripting/diagramobjects.html
    The property Sequence controls the Z-order.

    A script like this loops all diagramObjects in the current diagram, and sets the z-order.
    The only thing you need is an algorithm to decide the optimal z-order.

    sub main
        dim diagram as EA.Diagram
        set diagram = Repository.GetCurrentDiagram
        dim diagramObject as EA.DiagramObject
        for each diagramObject in diagram.DiagramObjects
            diagramObject.Sequence = <someValue>
            diagramObject.Update
        next
    end sub
    
    main