Book a Demo

Author Topic: EA Automation using Python  (Read 6319 times)

dmf

  • EA User
  • **
  • Posts: 42
  • Karma: +0/-0
    • View Profile
EA Automation using Python
« on: August 14, 2009, 02:45:55 pm »
Anyone performing EA automation using Python and wish to share experiences, hints, etc?  After a couple of years of using VB for EA automation I have permanently switched over to Python over the last few weeks.  Sooo much better.  8-)
« Last Edit: August 14, 2009, 02:48:09 pm by dmf »

fginfrance

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: EA Automation using Python
« Reply #1 on: October 03, 2009, 07:47:53 am »
Hi dmf,
I indeed just started diving in with Python 2.6.
I have introduced EA+RaQuest in my team and now am working on some ideas around a "code/HTML/DOC" generators, architectural rule checking, req-tracing, simulation etc.
Started w/ reverse-engineering the XMI format, but switched to COM automation after I stumbled over the Crocodile book.
EA API seems quite some "trial-and-error', so would be nice to exchange hints and experience, as "my project" is after-work only, so progress is slow.  So if you haven't abandoned yet...


fginfrance

dmf

  • EA User
  • **
  • Posts: 42
  • Karma: +0/-0
    • View Profile
Re: EA Automation using Python
« Reply #2 on: October 05, 2009, 01:38:37 pm »
Hi fginfrance,

I'm still moving ahead well with this.  After using COM Makepy to generate a .py file from the EA Object library, I'm able to develop my own python classes that override the standard EA objects (package, element, etc) to add to and simplify the interface.

PythonWin is also a really useful tool for interacting in real time with an active instance of EA.

I haven't yet been able to generate a .dll however to incorporate python add-ins - if you have any ideas, let me know!

fginfrance

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: EA Automation using Python
« Reply #3 on: October 06, 2009, 08:17:35 am »
Hi dmf,

nice to have some news from you and interesting to share with someone who started from a different approach.
I will have a look at the COM Makepy tools you mentioned.
Up to now, I simply used Mark Hammond's pywin32 libraries and they work "by magic", but it could be cool  8-) to have some more insight.
If you want to have a look, I posted a short example in the thread of zpeter concerning automating state machines.

Btw did you ever try to decode the Element.MiscData field?
I got a hint in the thread How to read the Details/Templates/ infos, but up to know did not yet find the right syntax (it is not a collection, it is not a string, it is always responding with exceptions... :(
Will have a try on the in-process dll stuff...

fginfrance

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: EA Automation using Python
« Reply #4 on: October 06, 2009, 09:03:21 am »
Me again.
Just to tell you that finally I understood the way to access MiscData (thanks to KP)

It's a function call, stupid!  ;)

Some hidden treasures out there!!!

Code: [Select]
     for idx in range( 0, 5 ):
        print idx, eaElem.MiscData( idx )