Rotating labels with Enterprise Architect Python API

Viewed 155

I'm currently working with the Python API for Enterprise Architect and I got a diagram like in the picture down below.

Is there a way to rotate the port labels on the bottom of the diagram so that they are orientated vertically? I already tried diagramObject.SetStyleEx("ROT", "1") on the respective port object but with no success.

Example Diagram

1

Edit: I'm using EA v14. When I click a port label it gives me the option to manually rotate it.

Rotation

Version

1 Answers

You need to modify diagramObject.style. I made a small test program:

dia = rep.getDiagramByGUID("{E81414BA-F3B4-4069-B421-0BFA9789BB71}")
for do in dia.diagramobjects:
    do.style = do.style.replace("ROT=-1", "ROT=1").replace("ROT=0", "ROT=1")
    print (do.style)
    do.update

style is a csv list which might look like

DUID=3BA63121;HideIcon=0;LBL=CX=115:CY=27:OX=90:OY=13:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=1:ALT=0:ROT=-1;

So I changed all rotations to be clockwise rotated. I think you can sort out the part you need. (Note that I use a wrapper for repository which made me omit the brackets after the update.

Related