Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - McMannus

Pages: [1] 2 3 ... 8
@Uffe: Please don't forget to notify us somehow after release :-)

Hi all,

as some of you guys maybe remember, I published an article on the EA community site in 2016 about easily finding out about differences in the EA API after version changes of EA (Link to article).

As in the near future, EA 14.0 is going to be released, I generated the API Diff to see the new and changed API methods. To help you guys out, I decided to upload all diffs I made so far, post them in this thread and keep it up-to-date: Using them is easy.
So, here are the links along with some highlights.

API Differences

EA9.3 -> EA10.0
EA10.0 -> EA11.0
EA11.0 -> EA12.0
EA12.0 -> EA12.1
EA12.1 -> EA13.0
EA13.0 -> EA13.5 (Generated 23 March 2018)
EA13.5 -> EA14.0 (Generated 23 March 2018)

Highlights in 14.0
  • New methods in Repository to save profiles and generate MDGs programmatically
  • Repository.GetAllDiagramImagesAndMap(): Saves the image and image-map for every diagram in the model, in the specified directory location.
  • Repository.ShowAddinWindow(): Shows the docked Add-In window on the specified page. Returns True if a tab of the specified name is now displayed.
  • New methods in Project Interface to build and run executable state machines

Highlights in 13.5
  • Repository.RefreshPackage() renamed into Repository.ReloadPackage(): reload a single package in project browser and its opened diagrams
  • Element.FQName: dot-separated list of the element parent hierarchy
  • EA_OnPreNewElement order changed in the event properties

Highlights in 13.0
  • Repository.RefreshPackage(): Reloads a Package and its open child diagrams.
  • Element.GetDecisionTable(): Provides read-only access to a decision table XML string.
  • Element.Clone(): Inserts a copy of the selected element under the same parent as the selected element.
  • Connector.AssociationClass: Returns the Association Class element if the connector has one; otherwise NULL/.
  • Diagram.FilterElements: Applies a comma-separated list of object ids (from SelectedObjects) to the currently-applied diagram filter, overriding the filter. The effect persists until another filter is applied, or the diagram is closed.
  • Diagram.FindElementInDiagram(): This function activates the Diagram View and displays the diagram with the diagram object selected.
  • EA_OnPreNewElement has a new parameter FQStereotype
  • New broadcast event EA_GetRibbonCategory: Add-Ins can use EA_GetRibbonCategory events to identify the Ribbon in which the Add-In should place its menu icon.

Regards from Germany

Hi all,

due to having had now incompatibility issues on three version changes of EA (11->12, 12->13, 13->13.5), I wanted to make the knowledge explicit, how to circumvent these issues.

The affected method was the EA_OnPreNewElement broadcast event with its signature
Code: [Select]
bool EA_OnPreNewElement(IDualRepository repository, EventProperties info)The EventProperties parameter is a class that contains a list of arbitrary data that can be accessed by
Code: [Select]
EventProperties.Get(object Index)This class is used as parameter in several of EA's broadcast events.

The problem with the usage of this class is that there are two ways of accessing the data in the event properties: either by passing a zero-based index to access a certain value in the list Props.Get(3) or by using a string identifier for the content which should be retrieved Props.Get("ObjectID").

If you use the index-based access (like I did since the beginning of my add-in writing. Don't even know, if the associative access was possible back then), you have to rely on the fact that the order of contents in the event properties is not changed.
Following is a small history of the event properties content and order in EA_OnPreNewElement:
EA 11:
0 Type 1 Stereotype 2 ParentID 3 DiagramID
EA 12:
0 Type 1 Stereotype 2 ParentID 3 DiagramID --> the parent ID delivered in EA12 is not anymore the direct element the element was dragged to, but the outmost parent element in the diagram
EA 13:
0 Type 1 FQStereotype 2 Stereotype 3 ParentID 4 DiagramID --> FQStereotype inserted in the middle of the list
EA 13.5:
0 Type 1 ParentID 2 DiagramID 3 Stereotype 4 FQStereotype --> Stereotype and FQStereotype moved to the end of the list

Without commenting this observation further, only two recommendations :):
  • To add-in developers: Only use the associative access to the event properties list (Props.Get("ParentID")), as hopefully the identifiers will stay the same for coming EA versions.
  • To the Sparxians designing the add-in interface: In the future, please make sure to add new parameters to the end of the list so that you will not cause incompatibilities in newer EA versions and don't change the order if there is no good reason for it. Alternatively, deprecate the index-based getter method in the EventProperties class.

Just my two cents on the topic

General Board / Re: EA Repository Table; How to get diagram types?
« on: January 26, 2018, 12:07:42 am »
Definitely gonna try that one as the feature table outperforms MDB Viewer plus the support for multiple DB types is great :-)
Thanks Geert!

General Board / Re: EA Repository Table; How to get diagram types?
« on: January 25, 2018, 11:35:02 pm »

The diagram metatype is stored in the StyleEx column of t_diagram. It is a MEMO field and contains a semi-colon separated list of key-value pairs, of which the key "MDGDgm" contains the type you are searching for as shown in the example below. As you can see getting this solely by query is not the easiest task, but with a script/add-in it is easily possible to parse the content of the attribute.
StyleEx content for a BDD:

SaveTag=721D3575;ExcludeRTF=0;DocAll=0;HideQuals=0;AttPkg=1;ShowTests=0;ShowMaint=0;SuppressFOC=1;MatrixActive=0;SwimlanesActive=1;KanbanActive=0;MatrixLineWidth=1;MatrixLineClr=0;MatrixLocked=0;TConnectorNotation=UML 2.1;TExplicitNavigability=0;AdvancedElementProps=1;AdvancedFeatureProps=1;AdvancedConnectorProps=1;m_bElementClassifier=1;ProfileData=;MDGDgm=SysML1.3::BlockDefinition;STBLDgm=;ShowNotes=0;VisibleAttributeDetail=0;ShowOpRetType=1;SuppressBrackets=0;SuppConnectorLabels=0;PrintPageHeadFoot=0;ShowAsList=0;SuppressedCompartments=;Theme=:119;

PS: For examining EA databases and finding information, I found a small tool, where you can browse through an actual EA project with data easily and perform SQL queries (also update and insert queries unlike through EA's SQL editor):

Hi guys,

in model-based engineering, a core means for complexity reduction is to use multiple views (EA diagrams) for the same component (EA element) for depicting certain development aspects. For instance in the embedded system domain, there are architectural perspectives containing data flow views or dependency views. For the same component, there also exist quality perspectives such as the failure propagation through the component, which is related to the quality safety.

A typical model structure for this setting is illustrated in the image at the following link: Example

The example contains the architectural component "MyComponent" having 3 views, where the first one contains full details and the other two contain only certain aspects (in this case a subset of the interface). The "FailureModel MyComponent" is a separate element having 3 views, too.

To indicate that the failure propagation model is targeting "MyComponent", EA connectors can be used to formally relate both elements with each other. However, the aspects, which are solely existent through the notion of diagrams, don't offer the possibility for formal relation, although this would be very beneficial for automated consistency validation, i.e. if I add a port to e.g. aspect 1, I only want it to be shown in aspect 1 of the failure view as well, but not in aspect 2.

Is there a way in EA to formally relate or link two diagrams with each other, so that uambiguous programmatical navigation from a diagram of one element to a diagram of another element gets possible? (blue double arrows in the image)

As I'm quite fit in writing add-ins for EA, I know there is always the possibility to keep a custom programmatical map between the diagrams somewhere in the add-in. However, this would not be my first choice, as it means manual maintenance of consistency, when the user deletes or changes diagrams. I'm rather thriving to a native EA solution to the problem and hope I just overlooked a feature in the past 10 years of using EA :-)

Many thanks for your help.


Are you able to open the same file from an non-Japanese version of Access?
Yeah, I used already MDB Viewer Plus to look into the database to find something suspicious, but with no success. My english EA, however, does not allow me to open the file. It's funny that an XMI Export of the same project (exported from Japanese version) followed by an XMI Import in my English version works.

Yes, actually I already found a problem, which is directly related to EA itself. When trying to open an EAP file that has been created with the Japanese version (I'm using the English version), EA signals "An Error has occurred: Unrecognized database format" and refuses opening the project.

Any ideas from Sparx side what the cause of this problem could be and how to solve this issue?


Hi all,

I'm currently having a customer from Japan using the Japanese edition of EA. I wonder, if the different language and in particular the different characters might brake something in our add-ins. I mainly think about plain SQL query interpretation going through Rep.SQLQuery() and Rep.Execute().

Did someone of you guys experience problems with that?

Many thanks!

General Board / Re: Recursive SQL statements using WITH (CTE)
« on: August 01, 2017, 09:09:15 pm »
What you can also try is directly working on the EAP project with C# DB access mechanisms. I did that once for updating absolute paths for toolbox profile icons to the current version control checkout path (helps enormously if different work on MDG development). I believe with this method, the syntax you are allowed to use is just the database technology itself, so you could try the with statement with this method:

Code: [Select]
                var profilesProject =  "profiles.eap";
                const string iconFolder = "\\icons";

                    OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;"
                                                               + "Data Source=" + profilesProject);

                    using (DataTable dt = new DataTable())
                        using (OleDbDataAdapter adapter = new OleDbDataAdapter(@"SELECT [Default],ID FROM t_attribute WHERE Name='Icon'", conn))
                        List<string> queries = new List<string>();
                        foreach (DataRow row in dt.Rows)
                            string toolboxIconPath = row["Default"].ToString();
                            if (!toolboxIconPath.StartsWith(executingFolder))
                                int index = toolboxIconPath.IndexOf(iconFolder);
                                if (index > 0)
                                    string newPath = executingFolder + toolboxIconPath.Substring(index);
                                    Console.WriteLine("\tReplacement: " + toolboxIconPath + " -> " + newPath);
                                    queries.Add("UPDATE [t_attribute] SET [Default]='"+newPath+"' WHERE [ID]="+row["ID"]);

                        if (queries.Any())
                            Console.WriteLine("\nAre the replaced paths correct? Go on with 'y'");
                            ConsoleKeyInfo pressedChar = Console.ReadKey();
                            if (pressedChar.KeyChar == 'y')
                                foreach (string query in queries)
                                    using (OleDbCommand cmd = new OleDbCommand(query, conn))
                                Console.WriteLine("\nToolbox Icon Paths updated successfully :-)");

                catch (Exception e)
                    Console.WriteLine("\nAn error occured during updating the toolbox icon image paths. Are you sure that you have the SVN lock on the profiles.eap file?");
                Console.WriteLine("\n\nPress any key to exit...");

Be aware that not every connector has a diagram link row by default. This is yet another inconsistency to diagram objects. Before changing the diagram link via SQL make sure that the diagram link for your connector and specific diagram really exists. If this is not the case, you can create the link via code.

We do this for similar use cases (in this case bend point application to connectors) like shown below. The importance piece is the logic plus the insert query, which took me quite some time to get it accepted by EA.

Code: [Select]
        public void changeConnectorLayout(IDualConnector conn, int diagramID, IEnumerable<Point> bendPoints = null)
            string diagramLinkAvailableQuery = "SELECT ConnectorID FROM t_diagramlinks WHERE ConnectorID=" + conn.ConnectorID + " AND DiagramID=" + diagramID;
            string linkAvailable = EAFacade.RetrievalCore.getFieldByQuery(diagramLinkAvailableQuery, "ConnectorID");
            if (linkAvailable == null)
                string insertDiagramLinkSQL = "INSERT INTO t_diagramlinks(DiagramID, ConnectorID, Geometry, Style, Hidden) " +
                    "VALUES(" + diagramID + "," + conn.ConnectorID + @",'EDGE=1;$LLB=;LLT=;LMT=;LMB=;LRT=;LRB=;IRHS=;ILHS=;','Mode=3;Color=-1;LWidth=0;Tree=OR;',False)";
                changeConnectorLayout(conn, diagramID, bendPoints);
                ConnectorLayout layout = new ConnectorLayout(conn.ConnectorID, diagramID);

                string newStyleSQL = layout.GetStyleDBString();
                string newGeometrySQL = layout.GetGeometryDBString();
                string newBendPoints = layout.SetBendPoints(bendPoints.ToList());

                string setBendPointsSQL = "UPDATE t_diagramlinks SET Style='" + newStyleSQL + "', Geometry='" + newGeometrySQL + "', Path='" + newBendPoints + "' WHERE DiagramID=" + diagramID + " AND ConnectorID=" + conn.ConnectorID;

Hi guys,

I'm modeling and analyzing component architectures with a custom profile + add-in. The syntax and semantics are pretty close to SysML and therefore I'd like to have an arbitrary number of diagrams (like Internal Block Diagrams) per component. As far as I understand, EA's SysML extension derives the association of a diagram to a block only through the implicit containment in the project browser, i.e. when I move the diagram somewhere different in the model, the "formal" relation gets lost.

This is exactly the problem I'm trying to solve. The possibilities I thought about are:
1. Introduce a reference list tagged value to the component that is manually maintained in the add-in.
2. If a list of associated diagrams should be retrieved, search through the diagram elements of existing diagrams and take the ones, where the component is used largest element containing its realization.

In the past, we used Option 1 in similar use cases, but it proved to be a pain in the ass to maintain tagged value lists of GUIDs manually during deletion and creation. In addition, reuse model parts in different projects is pretty hard, because the GUIDs get outdated quickly in that case.
Option 2 is again implicit and not very robust.

Does anyone of you have a better idea, how this could be solved? The ideal solution would be a connector between an element and a diagram, but that is not possible as far as i know.

Thanks for any insight!

Hi guys,

I have defined several relation stereotypes in our profiles that serve for traceability and containment. The containment relations aim at specifying a containment structure being independent from the implicit containment existent through the project browser. The driver for this decision was EA's automatic model movement of elements to other parents based on diagram movement.

When elements are created from the toolbox or programmatically, the relations are automatically created. As we know, a connector is shown by default, if both source and target element appear together in a diagram. This clutters diagrams a lot for my specific use case, therefore I'd like to hide these connectors by default. My approach for doing so was to hide the diagram links in code directly after I put the elements and the connector in the diagram programmatically.

The problem is that the hiding doesn't have any effect, because the diagram link is apparently not created immediately, when the elements (connected already in the model) are put in the diagram.

I wonder if it's possible to hide certain stereotyped connectors through the profile definition directly.

I didn't find anything in the docs w.r.t such a feature. If this is not possible, I have to solve that programmatically somehow.

In this case: Did someone face a similar issue in the past that diagram links only appear delayed in t_diagramlinks and probably has a solution for this issue?

Another option, we used for similar things in the past was to use refGUID tagged values referencing the related elements. However, I remember, they had to be maintained manually (i.e. potential inconsistencies because of deletions of referenced elements) and therefore we discarded this approach back then.

Thanks for your help, guys :-)


If you click on the Sparx menu on the left upper corner of the tool, you will see a search bar at the bottom of the menu. There you can enter old menu entries and invoke them! Alternatively, you can change the Visual Style under Start > Workspace > Visual Style to Microsoft Office 2016. After that a search bar is shown directly next to the main menus (on the right).

General Board / Re: Auto layout Diagram from Visual Basic
« on: August 26, 2016, 11:32:26 pm »
Long story short:

Paolo is right: You cannot programmatically access the layout types like Circle, Box, etc. you know from the UI.

The only means of performing some programmatic layout with EA is through
Code: [Select]
Project.layoutDiagramEx(string DiagramGUID, long LayoutStyle, long Iterations, long LayerSpacing, long ColumnSpacing, boolean SaveToDiagram)
where LayoutStyle is one of the Enum values qwerty posted.

Pages: [1] 2 3 ... 8