gobravedave / Enterprise-Architect

scripts and other code snippets to extend Sparxs Enterprise Architect
BSD 2-Clause "Simplified" License
51 stars 12 forks source link

EA 15.0 "Run PlantUML Script" incorrect sequence diagram render #9

Closed iokarkan closed 2 years ago

iokarkan commented 2 years ago

Hello, I've been trying to use these scripts in EA version 14 and 15, and although I can successfully run PlantUML scripts from notes as detailed in the docs, the resulting diagrams are incorrect.


Steps

I provide below an example with EA v15.0 (build 1514):

1) Download the MyModel.EAP file.

2) Add a "test" sequence diagram to use for a test ("Add Diagram..." under "Plant UML" package, and select "UML Behavioral" - "Sequence")

3) Copy a note from an existing diagram in the "Sequence Diagram" folder, namely:

Actor Schedular as S
Control Job #lightblue
S ->> Job: trigger1()
loop flush job queue
S ->> Job: trigger2()
S ->> Job: trigger3()
S ->> Job: trigger4()
S ->> Job: trigger5()
End 
S ->> Job: trigger6()

and paste it in the "test" diagram.

4) Right-click -> "Specialize" -> "Scripts" -> "Run PlantUML Script"

5) The resulting diagram is the following:

image


System Output

Find the system output by EA below:

System Output - Script 2022-4-11 11:40:28 [INFO]: ------VBScript Run PlantUML script------ 2022-4-11 11:40:28 [INFO]: Create Sequence Diagram script activated 2022-4-11 11:40:28 [TRACE]: create_timeline(Actor Schedular as S) 2022-4-11 11:40:28 [TRACE]: create_timeline 2022-4-11 11:40:28 [TRACE]: create_timeline(Control Job #lightblue) 2022-4-11 11:40:28 [TRACE]: getColor(Control Job #lightblue) 2022-4-11 11:40:28 [TRACE]: getColor=15128749 2022-4-11 11:40:28 [TRACE]: create_timeline 2022-4-11 11:40:28 [TRACE]: create sequence(S ->> Job: trigger1()) 2022-4-11 11:40:28 [TRACE]: parsedScript: S -> > Job : trigger1() 2022-4-11 11:40:28 [TRACE]: timelineElementID(S) 2022-4-11 11:40:28 [TRACE]: timelineElementID=1144 2022-4-11 11:40:28 [TRACE]: timelineElementID(>) 2022-4-11 11:40:28 [TRACE]: create_timeline(participant >) 2022-4-11 11:40:28 [TRACE]: getStereotype(participant >) 2022-4-11 11:40:28 [TRACE]: getStereotype= 2022-4-11 11:40:28 [INFO]: Added Element: > (ID=1156) in package Plant UML 2022-4-11 11:40:28 [TRACE]: create_timeline 2022-4-11 11:40:28 [TRACE]: timelineElementID=1156 2022-4-11 11:40:28 [TRACE]: synch(->) 2022-4-11 11:40:28 [TRACE]: synch=Synchronous 2022-4-11 11:40:28 [TRACE]: signature(S -> > Job : trigger1()) 2022-4-11 11:40:28 [TRACE]: signature(retval=void) 2022-4-11 11:40:28 [TRACE]: isReturn(->) 2022-4-11 11:40:28 [TRACE]: isReturn=0 2022-4-11 11:40:28 [INFO]: added fragment: flush job queue (1157) 2022-4-11 11:40:28 [TRACE]: create sequence(S ->> Job: trigger2()) 2022-4-11 11:40:28 [TRACE]: parsedScript: S -> > Job : trigger2() 2022-4-11 11:40:28 [TRACE]: timelineElementID(S) 2022-4-11 11:40:28 [TRACE]: timelineElementID=1144 2022-4-11 11:40:28 [TRACE]: timelineElementID(>) 2022-4-11 11:40:28 [TRACE]: timelineElementID=1156 2022-4-11 11:40:29 [TRACE]: synch(->) 2022-4-11 11:40:29 [TRACE]: synch=Synchronous 2022-4-11 11:40:29 [TRACE]: signature(S -> > Job : trigger2()) 2022-4-11 11:40:29 [TRACE]: signature(retval=void) 2022-4-11 11:40:29 [TRACE]: isReturn(->) 2022-4-11 11:40:29 [TRACE]: isReturn=0 2022-4-11 11:40:29 [TRACE]: create sequence(S ->> Job: trigger3()) 2022-4-11 11:40:29 [TRACE]: parsedScript: S -> > Job : trigger3() 2022-4-11 11:40:29 [TRACE]: timelineElementID(S) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1144 2022-4-11 11:40:29 [TRACE]: timelineElementID(>) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1156 2022-4-11 11:40:29 [TRACE]: synch(->) 2022-4-11 11:40:29 [TRACE]: synch=Synchronous 2022-4-11 11:40:29 [TRACE]: signature(S -> > Job : trigger3()) 2022-4-11 11:40:29 [TRACE]: signature(retval=void) 2022-4-11 11:40:29 [TRACE]: isReturn(->) 2022-4-11 11:40:29 [TRACE]: isReturn=0 2022-4-11 11:40:29 [TRACE]: create sequence(S ->> Job: trigger4()) 2022-4-11 11:40:29 [TRACE]: parsedScript: S -> > Job : trigger4() 2022-4-11 11:40:29 [TRACE]: timelineElementID(S) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1144 2022-4-11 11:40:29 [TRACE]: timelineElementID(>) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1156 2022-4-11 11:40:29 [TRACE]: synch(->) 2022-4-11 11:40:29 [TRACE]: synch=Synchronous 2022-4-11 11:40:29 [TRACE]: signature(S -> > Job : trigger4()) 2022-4-11 11:40:29 [TRACE]: signature(retval=void) 2022-4-11 11:40:29 [TRACE]: isReturn(->) 2022-4-11 11:40:29 [TRACE]: isReturn=0 2022-4-11 11:40:29 [TRACE]: create sequence(S ->> Job: trigger5()) 2022-4-11 11:40:29 [TRACE]: parsedScript: S -> > Job : trigger5() 2022-4-11 11:40:29 [TRACE]: timelineElementID(S) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1144 2022-4-11 11:40:29 [TRACE]: timelineElementID(>) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1156 2022-4-11 11:40:29 [TRACE]: synch(->) 2022-4-11 11:40:29 [TRACE]: synch=Synchronous 2022-4-11 11:40:29 [TRACE]: signature(S -> > Job : trigger5()) 2022-4-11 11:40:29 [TRACE]: signature(retval=void) 2022-4-11 11:40:29 [TRACE]: isReturn(->) 2022-4-11 11:40:29 [TRACE]: isReturn=0 2022-4-11 11:40:29 [TRACE]: resize_diagramObject(End ) 2022-4-11 11:40:29 [TRACE]: resize_diagramObject 2022-4-11 11:40:29 [TRACE]: create sequence(S ->> Job: trigger6()) 2022-4-11 11:40:29 [TRACE]: parsedScript: S -> > Job : trigger6() 2022-4-11 11:40:29 [TRACE]: timelineElementID(S) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1144 2022-4-11 11:40:29 [TRACE]: timelineElementID(>) 2022-4-11 11:40:29 [TRACE]: timelineElementID=1156 2022-4-11 11:40:29 [TRACE]: synch(->) 2022-4-11 11:40:29 [TRACE]: synch=Synchronous 2022-4-11 11:40:29 [TRACE]: signature(S -> > Job : trigger6()) 2022-4-11 11:40:29 [TRACE]: signature(retval=void) 2022-4-11 11:40:29 [TRACE]: isReturn(->) 2022-4-11 11:40:29 [TRACE]: isReturn=0 2022-4-11 11:40:29 [DEBUG]: **Timeline Array** 2022-4-11 11:40:29 [TRACE]: PrintArray: lo(0),hi(2) 2022-4-11 11:40:29 [DEBUG]: 1144:1935:Schedular:S:ACTOR:30:120: 2022-4-11 11:40:29 [DEBUG]: 584:1936:Job::CONTROL:165:215: 2022-4-11 11:40:29 [DEBUG]: 1156:1937:>::PARTICIPANT:260:350: 2022-4-11 11:40:29 [DEBUG]: end of array 2022-4-11 11:40:29 [TRACE]: layout_Objects() 2022-4-11 11:40:29 [TRACE]: fragmentHeight(1:1) 2022-4-11 11:40:29 [TRACE]: height(InteractionFragment) 2022-4-11 11:40:29 [TRACE]: height=0 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: fragmentHeight=140 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: setLeftRightCoordinates(1:1) 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1144) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=0 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1156) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=2 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1144) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=0 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1156) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=2 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1144) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=0 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1156) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=2 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1144) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=0 2022-4-11 11:40:29 [TRACE]: timelineIndexById(1156) 2022-4-11 11:40:29 [TRACE]: timelineIndexById=2 2022-4-11 11:40:29 [TRACE]: setLeftRightCoordinates: Left=5:Right=375 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [TRACE]: height(End) 2022-4-11 11:40:29 [TRACE]: height=0 2022-4-11 11:40:29 [TRACE]: height(Sequence) 2022-4-11 11:40:29 [TRACE]: height=35 2022-4-11 11:40:29 [INFO]: created diagramObject (1157) Top=-145 Bottom=-285 Left=5 Right=375 2022-4-11 11:40:29 [DEBUG]: *resize timeline boxes to -305 2022-4-11 11:40:29 [DEBUG]: *timeline (1144) to be resized 2022-4-11 11:40:29 [DEBUG]: *timeline (584) to be resized 2022-4-11 11:40:29 [DEBUG]: *timeline (1156) to be resized 2022-4-11 11:40:29 [TRACE]: **Layout Array - updated** 2022-4-11 11:40:29 [TRACE]: PrintArray: lo(0),hi(7) 2022-4-11 11:40:29 [DEBUG]: 0:Sequence:1731::-130:-130:: 2022-4-11 11:40:29 [DEBUG]: 1:InteractionFragment:1157:140:-145:-285:5:375 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1732::-165:-165:: 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1733::-200:-200:: 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1734::-235:-235:: 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1735::-270:-270:: 2022-4-11 11:40:29 [DEBUG]: 1:End:::-305:-305:: 2022-4-11 11:40:29 [DEBUG]: 0:Sequence:1736::-305:-305:: 2022-4-11 11:40:29 [DEBUG]: end of array 2022-4-11 11:40:29 [DEBUG]: **Layout Array** 2022-4-11 11:40:29 [TRACE]: PrintArray: lo(0),hi(7) 2022-4-11 11:40:29 [DEBUG]: 0:Sequence:1731::-130:-130:: 2022-4-11 11:40:29 [DEBUG]: 1:InteractionFragment:1157:140:-145:-285:5:375 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1732::-165:-165:: 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1733::-200:-200:: 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1734::-235:-235:: 2022-4-11 11:40:29 [DEBUG]: 1:Sequence:1735::-270:-270:: 2022-4-11 11:40:29 [DEBUG]: 1:End:::-305:-305:: 2022-4-11 11:40:29 [DEBUG]: 0:Sequence:1736::-305:-305:: 2022-4-11 11:40:29 [DEBUG]: end of array 2022-4-11 11:40:29 [INFO]: Create Sequence Diagram Script Complete 2022-4-11 11:40:29 [INFO]: Script Complete 2022-4-11 11:40:29 [INFO]: ===============

Any help is much appreciated!

gobravedave commented 2 years ago

as before.. this script works for me using EA13.. the problem however appears to be with a space being inserted into the ->> making it -> >.. which then creates the &gt timeline participant. Not exactly sure what is driving this behavior.. you could possibly defend against it by replacing the > > with >> in the create_sequence function before the split..

your log.. 2022-4-11 11:40:28 [TRACE]: create_timeline 2022-4-11 11:40:28 [TRACE]: create sequence(S ->> Job: trigger1()) 2022-4-11 11:40:28 [TRACE]: parsedScript: S -> > Job : trigger1()

my log: 2022-4-13 12:10:29 [TRACE]: create_timeline 2022-4-13 12:10:29 [DEBUG]: Processing: S ->> Job: trigger1() 2022-4-13 12:10:29 [TRACE]: create sequence(S ->> Job: trigger1())

gobravedave commented 2 years ago

fixed by https://github.com/gobravedave/Enterprise-Architect/pull/10