Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Yassine on September 09, 2016, 08:42:04 pm

Title: read Combined fragment's conditions
Post by: Yassine on September 09, 2016, 08:42:04 pm
Hi all,

I'm using a c# add-in and I would like to know, how I can read the Combined fragment's conditions. I went through all the properties available and I still cannot find where they are stored.

Thank you,
Yassine Hamza
Title: Re: read Combined fragment's conditions
Post by: Geert Bellekens on September 09, 2016, 08:46:33 pm
You might want to give us a bit more information then "combined fragment condition". That doesn't really ring a bell for me.

Geert
Title: Re: read Combined fragment's conditions
Post by: Yassine on September 09, 2016, 09:04:05 pm
Hi,

Sorry for the lack of information form my side.

So I have a Sequence diagram, and I want to parse the elements of all the diagram including Combined fragment( or InteractionFragment)

This is my Code:

foreach ( Diagram d in packages.Diagrams){

if(d.Name == "Sequence diagram"){

foreach(DiagramObject o in d.DiagramObjects){
if( repository.GetElementById(o.ElementID).Type == "InteractionFragment"){
Element CombinedFragement=repository.GetElementById(o.ElementID);
string condition = //Here is where I want to extract the conditions (if [condition 1] else [condition 2] ) in the Combined Fragment
}
}

}

I hope that's clear.

Thank you,
Yassine

Title: Re: read Combined fragment's conditions
Post by: qwerty on September 09, 2016, 09:25:03 pm
They are stored in t_xref. Look for the entries with ClientID being the guid of the fragment. You will find entries like

Name:Partitions
Type:element property
Description:@PAR;Name=condition;Size=40;GUID={BB1E1E12-7F24-4ee7-9A67-6121C07B5AB0};@ENDPAR;

q.
Title: Re: read Combined fragment's conditions
Post by: Geert Bellekens on September 09, 2016, 09:47:40 pm
They are stored in t_xref. Look for the entries with ClientID being the guid of the fragment. You will find entries like

Name:Partitions
Type:element property
Description:@PAR;Name=condition;Size=40;GUID={BB1E1E12-7F24-4ee7-9A67-6121C07B5AB0};@ENDPAR;

q.

Always fun having to parse out the details from a t_xref field.  :-X

If you are lucky you might find through the API too. Look closely at all the field EA.Element. Might be hidden in the StyleEx or CustomProperties or something like that, your never know.

Geert
Title: Re: read Combined fragment's conditions
Post by: qwerty on September 09, 2016, 09:56:46 pm
Ah yes, Geert. Element.Partitions also has the needed information.

q.
Title: Re: read Combined fragment's conditions
Post by: Yassine on September 09, 2016, 10:11:40 pm
Hi,

It's solved.
Thank you all for your help :D.

Best Regards,
Yassine