Author Topic: hide connector roles with script?  (Read 6789 times)

semo

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
hide connector roles with script?
« on: October 21, 2015, 08:27:20 pm »
Hi,

Is it possible to hide source and target roles of a connector using scripting? (roles for a certain connector would be hidden on all diagrams)
I.e. what you can do manually through: on connector, right-click / visibility / set label visibility

We would like to have the roles visible in the relations pane, but don’t want to make the diagrams too overloaded…

Any ideas?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13410
  • Karma: +568/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: hide connector roles with script?
« Reply #1 on: October 21, 2015, 08:38:53 pm »
Yes it is possible.
But it will require some nasty string manipulation and usage of the infamous Repository.Execute

I don't remember exactly where this info is stored, but I think it has been mentioned here on the forum in the past.

Make sure to use the top left search button and check all search parameters.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: hide connector roles with script?
« Reply #2 on: October 21, 2015, 09:44:36 pm »
The answers were always using shape script to suppress the label. I'll see if I can find anything else.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: hide connector roles with script?
« Reply #3 on: October 21, 2015, 10:07:01 pm »
You need (as Geert pointed out) use Repository.Execute o manipulate t_diagramlinks.geometry (maybe you can do that through API too, but I'm not sure about that). Anyhow, you have to foster that string for
Code: [Select]
<lbl>=<value>; where <lbl> is any of LLT (top), LMT (mid) or LMB (bottom label) and <value> is a string not containing a semicolon (as regex
Code: [Select]
"\$LLB=([^;]+);"). Now inside that string scan for
Code: [Select]
HDN=<val>;where <val> is 1 (hidden) or 0 (not hidden) and change that to your needs. Eventually you have to add an according LLT/LMT/LMB value with "HDN=1;".

q.
« Last Edit: October 21, 2015, 10:07:31 pm by qwerty »

semo

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: hide connector roles with script?
« Reply #4 on: October 21, 2015, 10:21:57 pm »
Thanks for the answers! I'll have to play around a bit to see if I can it to work - but at least I know where I need to look :-)

I'll let you know the outcome (might be a few days).

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13410
  • Karma: +568/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: hide connector roles with script?
« Reply #5 on: October 21, 2015, 10:23:44 pm »
Quote
You need (as Geert pointed out) use Repository.Execute o manipulate t_diagramlinks.geometry (maybe you can do that through API too, but I'm not sure about that). Anyhow, you have to foster that string for
Code: [Select]
<lbl>=<value>; where <lbl> is any of LLT (top), LMT (mid) or LMB (bottom label) and <value> is a string not containing a semicolon (as regex
Code: [Select]
"\$LLB=([^;]+);"). Now inside that string scan for
Code: [Select]
HDN=<val>;where <val> is 1 (hidden) or 0 (not hidden) and change that to your needs. Eventually you have to add an according LLT/LMT/LMB value with "HDN=1;".

q.

It doesn't get any nastier then this  ;D

Geert

smendonc

  • EA User
  • **
  • Posts: 148
  • Karma: +5/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: hide connector roles with script?
« Reply #6 on: October 22, 2015, 06:49:55 am »
The whole link geometry is nasty.  A long while ago I posted a script on how the label information can be changed -> http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1398959952/9#9.

I also wrote an antlr grammar to parse the whole thing so I could pretty print the entire field after pulling it from t_diagramlinks.geometry.  This helped me understand the changes I needed to make to the script for specific purposes.  The grammar took a while to develop because the usage of the field appears to have changed over the years.  I used repositories created from version 7 onwards to identify possible tokens and variations.

If the grammar might help let me know and I'll post the source.  Using antlr it can be used to generate source code for all the languages antlr supports.

Stan.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: hide connector roles with script?
« Reply #7 on: October 22, 2015, 07:38:13 am »
Sounds a bit like overkill to throw it into a compiler where a simple regex will suffice.

q.

smendonc

  • EA User
  • **
  • Posts: 148
  • Karma: +5/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: hide connector roles with script?
« Reply #8 on: October 22, 2015, 09:57:30 am »
Quote
Sounds a bit like overkill to throw it into a compiler where a simple regex will suffice.
Depends on need.  

I'd like to see a Regex that can interpret every variation of this field and separate it into intelligible groups for further work.  For simply finding specific text that needs to be updated and replaced a regex works.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: hide connector roles with script?
« Reply #9 on: October 22, 2015, 10:06:28 am »
A shot from the hip: "(LLT|LMT|LMB)=([^;]);" to find the 3 label descriptions and then a simple split by ":" for the 2nd group which will deliver "(.+)=(.+)" groups where you can make a case for the first group and evaluate the 2nd as parameter value.

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: hide connector roles with script?
« Reply #10 on: October 22, 2015, 10:14:17 am »
LLT|LLB|LMT|LMB|LRT|LRB|IRHS|ILHS

;)
The Sparx Team
[email protected]

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: hide connector roles with script?
« Reply #11 on: October 22, 2015, 07:43:54 pm »
Ah yes. There are more label positions.

q.