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 - ufechner

Pages: 1 ... 4 5 [6]

how can I access user defined Attributes of Requirements, that are defined in RA-Quest using the COM-Interface?

I can access normal classes, didn't try to access the attributes of requirements yet.

Any help appreciated.

Uwe Fechner

Well, if you want to choose the best language, you have to know for which purpose.
I develop python scripts for the automation of EA for inhouse use only, so the deployment is no problem.

And support is no problem for me either:

You wont't get support for C# or .net from sparx, and you won't get support for python.
I did need support from sparx twice, one time there was a bug in EA with huge UseCase diagrams, and once a missing COM interface method.

If you have a problem with python, ask in the appropriate python forum and you will get a quick answer.

In our company we use delphi (for GUI applications), python (for inhouse non-GUI applications) and C (for embedded development), and we want to avoid to use more languages.

Developing software in python is very efficient and easy to validate, so you get high quality results quickly.

I hope to publish some more add-ons for EA, written in python in the future (in the moment I write a converter, that generates LaTex code from classes and requirements).


Uwe Fechner
embedded development

What's wrong with Python?
I use it successfully, it is easy to use.
I posted some examples in the EA wiki.


Uwe Fechner

Well, I finally found a solution:

cd \Programme\Sparx Systems\EA
copy EA.tlb C:\Python25\Lib\site-packages\win32com\client
cd \Python25\Lib\site-packages\win32com\client
python EA.tlb

For delphi, just open the file EA.tlb. The type library editor opens it and generates the according .pas file.


Uwe Fechner


I tried to import the EA type library in Borland Delphi 6.0 and in python.

The EA type library is not shown.

I did:

ea.exe /register (just to be sure)

Delphi -> Projekt -> import type library

Nothing there (well, many other type libraries, but not EA).

I tried with python:

python C:\Python25\Lib\site-packages\win32com\client\

Many typelibraries are displayed, not EA.

Any idea?


Uwe Fechner (Using EA 6.5.800 on Windows XP)

Thanks for your help.

The following code works fine:

> from win32com.client import *
> app = GetObject(None,"EA.App")
> repo = app.Repository
> print app.ConnectionString
> elem = repo.getElementByID(int(argv[2]))
> print

One more question:

In the User Guide it is written, that the
repository object is readonly.

Does this mean, that this fast method to access
an already open EA model does not work, if you want to
update the model (e.g. adding comments to already
existing elements)?


Uwe Fechner


if I try:

> repo=GetObject("K:\\Bounce\\Doc\\PumpenTester.eap")

I get the exception: "invalid file extension".

Any idea?


Uwe Fechner


I want to write a code generator in python.

> import win32com.client
> repo = win32com.client.Dispatch("EA.Repository")
> repo.OpenFile(sys.argv[1])
> elem = repo.getElementByID(int(argv[2]))
> print

I call the script using a custom tools menu entry,
so that the first parameter is the name of the model
file, and the second parameter the name of the selected

It works, but it is very slow (10 seconds on an 1,7 Ghz PC).

How can I get an instance of the repository, that is
already open, without beeing forced to write an addin?


Uwe Fechner


your hint did help, but your suggestion was still wrong.

Wrong:  '{6AB8AFBB_2217_4f0f_979D_59200D08976D}'
Right:    '{6AB8AFBB-2217-4f0f-979D-59200D08976D}'

Why do you use different ways to represent GUID's in the project and in the repository interface?

PLEASE add a hint regarding this issue to the online help (documentation of methods of the automation interface).


Uwe Fechner


I imported the type library with delphi and I am working fine with the EAProject component.

Now I try to use the repository component and have the following problem:

procedure TfrmMain.Button1Click(Sender: TObject);
 oElement: IDualElement;
 sTmp,sGUID: string;
 boResult: boolean;
 iCount: integer;
 if boResult then begin
   self.foMyUserIO.outLog('ModelCount: '+inttostr(iCount), ltMsg);
   if oElement<>nil then begin

If I execute this code, oElement is always NIL.
(The GUID exists, and it is a class element.)

Any idea?


Uwe Fechner

Pages: 1 ... 4 5 [6]