Book a Demo

Author Topic: Positioning of sequence flows on a sequence diagram using VBScript  (Read 7359 times)

andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
I have written a VBScript which takes in a PlantUML script and creates a Sequence diagram but I am having difficultly in the positioning of the sequence flows..

I have been trying the manipulate the startx/y and endx/y values on the connector to position the flow accordingly as there does not appear to be a way to assign/associate a sequence flow to an IntegrationFragment (ie Alt, Loop) and or a partition..

Before:


I run a script to do the following:
  • update the SequenceNo on  connector(891) from 1to 2 and set the startpointy/endpointy values to -250 with the aim of moving it inside the loop fragment (ie between -175 and -291)
  • add a connector with SequenceNo set to 1 and the y=-130
  • add a connector with SequenceNo set to 3 and the y=-400, with the aim to position the flow below the loop fragment

the script appear to work..
Code: [Select]
2019-3-6 18:33:47 [INFO]: ------VBScript Test Import------
2019-3-6 18:33:47 [DEBUG]: updates connector (891) trigger sequenceNo: 2 startpoint x: 100 startpoint y: -250 endpoint x: 205 endpoint y: -250
2019-3-6 18:33:48 [DEBUG]: created connector (902) before trigger sequenceNo: 1 startpoint x: 100 startpoint y: -130 endpoint x: 205 endpoint y: -130
2019-3-6 18:33:48 [DEBUG]: created connector (903) after trigger sequenceNo: 3 startpoint x: 100 startpoint y: -400 endpoint x: 205 endpoint y: -400
2019-3-6 18:33:48 [INFO]: Script Complete
2019-3-6 18:33:48 [INFO]: ===============

However it appears that EA renders the flows using SeqeunceNo and default spacings.. rather than the provided x/y coordinates..

After


I am looking for some clues on how the sequence diagram is rendered.. like is there something in pdata5 I need to parse out for..


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #1 on: March 06, 2019, 08:18:52 pm »
Have a look at this script:

https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Projects/Project%20A/Element%20Group/MessageOverview.vbs

It creates a sequence diagram with a bunch of messages in fragments.

I don't remember the exact details, but I know I had to figure these things out to get it working.

Geert

andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #2 on: March 06, 2019, 09:02:50 pm »
thanks Geert

anton.chertok

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #3 on: March 07, 2019, 02:51:53 pm »
Hey anders, how are you viewing the connector and element lists (the ones in your images), looks like a good debug tool.

andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #4 on: March 07, 2019, 08:33:03 pm »
Hey anders, how are you viewing the connector and element lists (the ones in your images), looks like a good debug tool.

simply dropped a ModelView element from the Dashboard toolbox onto the diagram and supplied a custom sql as the chart source..

andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #5 on: March 07, 2019, 10:06:25 pm »
Have a look at this script:

https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Projects/Project%20A/Element%20Group/MessageOverview.vbs

It creates a sequence diagram with a bunch of messages in fragments.

I don't remember the exact details, but I know I had to figure these things out to get it working.

Geert

I had a look and the example provided and tried a few different things.. however I still have not been able to manipulate the coordinates of the sequence flows..

I therefore reverted to trying to manipulate the  Fragments and partitions..



I could add some code similiar to Geert to manipulate the sizes of the nested fragments.. but there is not much real estate to play with.

below is the expected result which I had fixed up manually and low behold the x/y coordinates are updated..



I will upload the scripts to Git and provide a write up on my blog..

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #6 on: March 08, 2019, 12:17:47 am »
Nice :)

Geert

andersd7

  • EA User
  • **
  • Posts: 26
  • Karma: +1/-0
    • View Profile
Re: Positioning of sequence flows on a sequence diagram using VBScript
« Reply #7 on: March 10, 2019, 10:58:41 pm »
I will upload the scripts to Git and provide a write up on my blog..

I have created a blog post which describes the functionality of the VBScript I have written to  Create a Sequence Diagram using PlantUML

The post incldues my GitHub details, instructions to install and the feature backlog I hope to get though during my downtime.