Hi,
below a code snippet.
Sorry, it is in Python and from what I have seen in the forum, this is not really mainstream, but the COM32 wrapper is thin, so you should be able to port easily.
For the example, you need to have a StateMachine Diagram "smDiag" in your Model:
- open EA, your model and the Diagram "smDiag"
- start the script
--> script will find "smDiag" and start cycling through the states with an interval of 2 sec
It's quite rudimentary, but shows the way to go. The tough part was to find the right refresh commands, but this forum really helped...
Have fun!
fginfrance
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# $Id: smAnim $
import sys
import os
import win32com.client
import time
def playSM( eaTheRep, eaPack ):
print eaPack.Name
for eaDiag in eaPack.Diagrams:
if eaDiag.Name == "smDiag":
for elem in range( 0 , 25 ):
idx = 0
for obj in eaDiag.DiagramObjects:
if (idx == elem % 5):
obj.Style = "BCol=22220000;BFol=0;LCol=0;LWth=2;"
else:
obj.Style = "BCol=88880000;BFol=0;LCol=0;LWth=1;"
idx += 1
obj.Update()
eaTheRep.FlagUpdate = True
eaTheRep.ReloadDiagram( eaDiag.DiagramID )
time.sleep( 2 )
def connect( ):
""" Connect to Word COM server """
eaApp = win32com.client.Dispatch("EA.App")
eaRep = eaApp.Repository
print "connecting...", eaRep.ConnectionString
print "DONE"
return eaRep
if __name__ == '__main__':
eaRepo = connect()
for eaModel in eaRepo.Models:
for eaPkg in eaModel.Packages:
playSM( eaRepo, eaPkg )