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 - jörg

Pages: [1] 2
1
Is there no idea how to solve this?

In my Project I use .NET Framework 4.7.2 but I also tried it with .NET 5.0 and .NET Core 3.1 -> no success. According to the EA documentation it should be possible.

I need this for module testing of modules that need data from EA Repository (modules of an EA-AddIn). If someone has ideas how to test EA-AddIn modules in another way, I'm open to hear them.

2
Thanks for the replies.

@Eve: I also tried this approach just for test, but the call to Marshal.GetActiveObject("EA.App") returned null. And yes, EA was running befor calling  ;).

@ Geert: I've found this article while searching a solution, too. Unfortunately it doesn't work  :( as described in my question.

There seems to be something wrong with the types. I have no clue why this happens and how to fix that. I tried the code in several VS-Projects, with different .NET Framework versions and .NET Core 3. Always the same result.

3
I tried it in the way posted by bergst, unfortunately I get System.InvalidCastExceptions. When I call
Code: [Select]
App EAClient = new App(); an object of type EA.AppClass is created instead an object of type EA.App.  ???
It has 4 members: Project, Repository, Visible and WebServerPort. In the debugger each of them shows a message like
Quote
Project = '((EA.AppClass)EAClient).Project' threw an exception of type 'System.InvalidCastException'.
The same happens when creating the Repository object. The object is created, but all members show this message in the debugger. Of course, when I then call EARepo.OpenFile(EAProjectFile); an exception is thrown:
Quote
Unable to cast COM object of type 'EA.RepositoryClass' to interface type 'EA.IDualRepository'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{4CD2CE1E-C301-4C16-9CA2-5A7EC4478C55}' failed due to the following error: Schnittstelle nicht unterstützt (0x80004002 (E_NOINTERFACE)).

So something really goes wrong with the object creation. Please can someone give me a hint whats going on there? Why are there types mangeled?

@ Geert: In your project I coudn't find the appropriate code.

Jörg

4
Suggestions and Requests / Re: Feature request: Note lists indentation
« on: March 26, 2021, 04:25:03 am »
not even 15!

5
Thanks for the answers, this was my guess, too.
In my special case I want to detect changes in a diagram or the elements it contains. For this purpose I iterate over the elements creating a hash value for comparision. So I decided to just ignore the missing element. I an element was removed from the diagram I see this in the diagrams "modified" date.

6
Automation Interface, Add-Ins and Tools / Unknown element in DiagramObjects
« on: December 17, 2020, 03:54:55 am »
Hi Specialists!

In my addin I'm facing a behaviour which I can't explain.

I'm iterating the DiagramObjects of a diagram and then for each DiagramObject I try to retrieve the related Element from the repository using the GetElementByID(ElementID)-Function of the Repository class to get further information about the element. The diagram is of course in the same repository.

This works very well for many diagrams but in one diagram the GetElementByID-Function throws an exception saying that it could not find the element ("Can't find matching ID"). The ObjectType is - of course - otDiagramObject and the GetType-Function of the DiagramObject class tells me it is a System_ComObject. The user (I don't have access to the EA project myself) searched the diagram and it's Elements and could not find any COM object. Re-saving the diagram (after a slight change) did not change anything. When he exports the package and imports it into a new project, the error is gone.

So I have the following questions (and hope for answers 8)):
1. Can anyone explain this behaviour?
2. How can I find out which element is causing the error?
3. Why is the error persistant over re-saving but disappears after exporting and re-importing into another project?

Question 2 is the most important one which I need an answer for. The others are for my curiosity

Thanks in advance,

Jörg

7
Hi all, thanks for your attention. For noe I decided to calculate and store hashes over the GUIDs of the diagram objects of a diagram. So if someone is deleted, the hash is different. This is pretty fast and secure. The methosd with generating a checksum over the generated picture is very time consuming, that*s why I changed it.

@Geert: Thanks for the hint with the database, I'm sure it will be useful in future.

CU,

Jörg

8
Hi all,

some days ago I discovered a very strange (IMHO) behaviour in EA:
When I delete elements from the project browser, which are placed in a diagram, the element disappears from the diagram (so far so good) but the modified date of the diagram has not changed although the diagram is changed.
This brings huge problems for me. I must detect, whether a diagram has changed since a special date and so I can't achieve this only by comparing the dates.

Can someone explain this behaviour to me?

Maybe there is also one who knows how to update the modified date in this case. Currently I check for changes by calculation MD5 checksums for the generated diagram pictures, which is very time consuming.

Thanks and Greetings,

Jörg

P.S.: I'm writing an AddIn but I decided to write here because this behaviour for me is a bug.

9
Hello Geert,

thanks a lot again for your help!! This solved my problem and I can enjoy my vacation week (as far as possible in these times). I was aware that I have to call 'Update' in several cases but I didn't know that I have to do this for all database objects. You'll never stop learning :), also the fact that the 'readonly' only means the variable where the object is stored in is const and not the object itself is a const object. And I wasn't surprised that again you has been the one who helped me out.
After solving this I struggled a bit with setting a long text as value but then I read again the documentation of the TaggedValue class and found the note about long text in tagged values.  ::) So sometimes RTFM is really helping  :)

Jörg

10
Hi all,

after many hours of trying and searching I don't see another way than to ask the specialists here. It is not my first EA-Addin I develop but I fail in creating a Tagged Value for a Package. This is my code:

Code: [Select]
            string error;
            bool updated;

            EA.Package internalPackage = repo.GetPackageByGuid(packageGUID);

            EA.TaggedValue taggedValueConfig = internalPackage.Element.TaggedValues.AddNew("tvname", "Memo");

            taggedValueConfig.Notes = "some notes text";
            taggedValueConfig.Value = "some value text";

            updated = internalPackage.Element.Update();
            if (!updated) error = internalPackage.Element.GetLastError();

            internalPackage.Element.TaggedValues.Refresh();

            updated = internalPackage.Update();
            if (!updated) error = internalPackage.Element.GetLastError();

AddNew gives me a valid tagged value object. Nowhere an error is shown. 'updated' is always true. But at the end the tagged value is not added to the collection.

On one hand the API documentation writes, that the 'TaggedValue' collection of the 'Element' class is readonly, which would explain the failed adding. Also the documentation for the 'Element' attribute of the package class says:
Quote
Element

Notes: Read only

The associated element object; use to get/set common information such as Stereotype, Complexity, Alias, Author, Constraints, Tagged Values and Scenarios.
So it states it is readonly but then it says it is used to get/set - amonst others - tagged values.

On the other hand I find many examples in the web for adding tagged values to elements (even in Ea-Documents, e.g. see https://sparxsystems.com/resources/user-guides/14.0/automation/automation.pdf, page 298), 'AddNew' returns a valid tagged value object and throws no exception and I can't imagine any reason why the 'TaggedValue' collection of the 'Element' class should be readonly.

I think there must be a way to add new tagged values to a package element. So please help me and tell me, what I'm doing wrong. I'm helpless and maximum confused. I know, it's a lot of text, but I wanted to give as much information as possible.

I use EA14 on a Windows 10 machine and I'm programming with Microsoft Visual Studio Professional 2019.

Thanks in advance,
Jörg

11
Automation Interface, Add-Ins and Tools / Re: MDG Diagram derivation
« on: February 04, 2020, 09:40:16 pm »
Dear Eve, I appreciate your help and I didn't want to upset you.
For now I will derive from builtin diagrams and provide a frame element to the user in the toolbox. It's not as comfortable as in the SysML diagram but it will do for now.

Would an add-in that contains menu items for creating your new diagram work for you?
Basically I know how to prorgram add-ins for EA, but I don't know what you mean here exactly. When I create an add-in, its menu only appears in the 'Specialize' section of the popup menu. Is there a way to create own menu entries e.g under the 'Add Diagram ...' entry in the Project Browser popup menu?

Another question which rose up while working on that MDG is how I could program such a behaviour like in the SysML diagrams by myself, meaning to paint a frame which is not a diagram element and which will resize automatically. I didn't find any drawing commands in the add-in API. Of course I could automatically add an frame element to each newly created diagram but this would be even this - a diagram element which can be edited or deleted by the user.
Maybe you can give me a hint whether and how this can be achieved.

12
Automation Interface, Add-Ins and Tools / Re: MDG Diagram derivation
« on: February 03, 2020, 09:50:23 pm »
Yeah, and that's what I suspected. And it is the customer, who wants that UI functionality. It is not our way of working to tell the customer he has to take what we give him or leave it.

What I don't understand is why I can derive from element stereotypes but not from diagram stereotypes. I would appreciate if that will be implemented in future versions of EA.

13
Automation Interface, Add-Ins and Tools / Re: MDG Diagram derivation
« on: January 31, 2020, 10:19:17 pm »
I tried it, but as described above, it is not what I need.

14
Automation Interface, Add-Ins and Tools / Re: MDG Diagram derivation
« on: January 30, 2020, 09:03:17 pm »
@qwerty: Sorry, but I don't understand your answer. I don't have any problems with the toolbox but with deriving diagrams in MDGs. Maybe you can explain.

@KP: I stumbled over these Cunstom Metamodel Diagram View before but it seemed not to be that what I wanted. Following your hint I created the view and unfortunaltely it was as expected: I have a new diagram derived from the SysML diagram, but it is located in the SysML technology branch of the diagram selection dialog.

What I want to achieve for the first is to create a technology which is a subset of SysML, containing several SysML diagrams and toolboxes with reduced content. I want the diagrams to appear in the branch of my technology in the diagram selection dialog, having the names I gave them ant attached to the toolboxes I created.
I have no problem creating the toolboxes containing SysML elements, but currently I see no way to derive a diagram not from a UML metaclass but from a SysML stereotype.

I am willing to create an own diagram, looking like a SysML diagram, but I cannot achieve that a SysML-like frame is drawed in the diagram, behaving like the frames in the SysML diagrams, which means showing the type and name of the diagram on the top border of the frame and resizing automatically to incluse all elements in the diagram. I not even can achieve to get any frame drawn in the diagram, although in the https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/modeling/create_diagram_profiles_using_.html article there are mentioned properties like 'Frame ID' and 'Frame Format', which makes me believe tha there should be a frame visible in the diagram.

I still hope that there is some specialist who is able to help me to reach my goal.

15
Automation Interface, Add-Ins and Tools / MDG Diagram derivation
« on: January 30, 2020, 04:37:13 am »
After a long time I'm back to EA and want to create an own MDG. There I have huge problems with creating own diagrams:

1. I tried to derive a diagram from a SysML1.4 diagram (SysML1.4::Sequence). In my diagram profile diagram I added a stereotype with name "SysML1.4::Sequence", another stereotype with my diagram name and an extension connector. In the base stereotype (SysML1.4::Sequence) i set the properties alias and toolbox (with an own toolbox in my MDG). When I (after creating and importing the MDG) want to add the diagram to a package, I can see the diagram in the selection dialog, but it doesn't have the icon of the SysML diagram but a class diagram icon. When I create the diagram, an empty diagram canvas is shown without any SysML frame and no metaclass.
I also tried  to change the base stereotype into a metaclass, with the same result except that the metaclass of the crated (derived) diagram is my derived diagram class itself.

2. So I changed the way to do it and derived my diagram from Diagram_Sequence metaclass. Now the icon was right, but the diagram itself still has no frame (diagramID set to 'sd', frameString set to '#DGMNAME#').

So my question(s): How can I derive a diagram from SysML1.4::Sequence or, if that isn't possible, how can I show the SysML frame around my diagram derived from 'Diagram_Sequence'?

Any help will be welcome!

Pages: [1] 2