Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: emiliano.davila on August 06, 2022, 12:51:14 am

Title: Group elements
Post by: emiliano.davila on August 06, 2022, 12:51:14 am
Hello,
We are trying to group elements using the EA API, but we have not succeeded in any way.
Is it possible to do this by API or by Database?

Best Regards.
Title: Re: Group elements
Post by: qwerty on August 06, 2022, 12:52:51 am
Group where?

q.
Title: Re: Group elements
Post by: emiliano.davila on August 06, 2022, 01:10:12 am
We want to replicate the "Group Elements" functionality in a diagram.

(https://i.imgur.com/wiizGiQ.png)
Title: Re: Group elements
Post by: qwerty on August 06, 2022, 01:15:04 am
That's probably possible, but likely only when fiddling with the tables directly. I haven't documented that yet and will probably be able to look into it during the weekend.

q.
Title: Re: Group elements
Post by: emiliano.davila on August 06, 2022, 01:34:29 am
Thank you very much, we look forward to hearing from you.
Title: Re: Group elements
Post by: qwerty on August 08, 2022, 09:39:35 pm
Yap, I found it. But I don't have all the details.

What EA does it that it stores grouping information in t_diagram.styleEx. E.g. I have grouped two classes and it added

Code: [Select]
OPTIONS_CA81B41F=GID=0C08:;OPTIONS_D744D373=GID=0C08:;
The OPTIONS_xxx is made from the t_diagramobjects.objectStyle contets. The first of which is
Code: [Select]
DUID=CA81B41F
So that part is doable, though it needs quite some queries to build the group string.

What I have not found out yet is how the
Code: [Select]
GID=0C08:;code is built. It might be a random code. Will see if I can get light into that too.

q.
Title: Re: Group elements
Post by: qwerty on August 08, 2022, 09:58:42 pm
A few experiments indicate that the GID code is a random 4-byte GUID.

Of course, the implementation is rotten. After having grouped the two elements I grouped one of them with a third. The result was a new group of the latest two elements and an orphan. Well, it's EA...

q.
Title: Re: Group elements
Post by: emiliano.davila on August 08, 2022, 10:12:59 pm
Thank you very much. All this information is very useful for us.
We will test and comment on the results.