0

I want to use the Automation Interface of Enterprise Architect (EA) to generate code from my StateMachine diagram according to my company's StateMachine framework.

With each state I want to know exactly it's operation is Entry or Exit action. Please refer to the images for more detail.

enter image description here

enter image description here

I use below code snippet (C#) to get the action type of method, but it's seem to have no way to do that.

    private void getElement(EA.Repository repository)
    {
        //repository.OpenDiagram(6);
        EA.Diagram currentDiagram = repository.GetCurrentDiagram();

        var objs = currentDiagram.DiagramObjects;
        for (short obj_i = 0; obj_i < objs.Count; ++obj_i )
        {
            EA.Element elem = repository.GetElementByID(objs.GetAt(obj_i));
            if(elem.Name == "State") //get only the state elments
            {
                var stateMethodList = elem.Methods;
                for(short mt_i = 0; mt_i < stateMethodList.Count; ++mt_i)
                {
                    EA.Method mt = stateMethodList.GetAt(mt_i);
                    EA.Parameter parameter = mt.Parameters.GetAt(index);  //we can get the method's parameters using the EA.Method.Parameters attribute
                    string returnType = mt.ReturnType;                    //we can get the method's return type using EA.Method.ReturnType attribute

                    //I want to get method's action type but the mt seems to be the common method type, and have no attribute name EA.Method.Actions and something like that.
                }
            }
        }

    }

I spend a lot of time to find the action type of method, but haven't found it yet.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86
van con Nguyen
  • 101
  • 1
  • 5

1 Answers1

1

mt.returntype will be either do, entry or exit.

qwerty_so
  • 35,448
  • 8
  • 62
  • 86