Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: avantol13 on June 20, 2014, 01:06:33 am
-
I'm trying to connect two states together with a transition in a C# addin. I can create the states and the "Transition" but don't know how to set the destination of the transition.
Alternatively, I've attempted using EA.Connector and setting the TransitionEvent/TransitionAction/TransitionGuard values. When using EA.Connector, it connects the 2 states but with a "dependancy" not a "transition".
Any help would be greatly appreciated. Just getting to know the software and it's capabilities so forgive me.
Regards,
Alex
-
When you create the Connector supply "Transition" as the 2nd parameter.
q.
-
I tried that and when I go into EA and look at the connection, it's a dashed line and when right clicked it says "Dependancy Properties" instead of the desired "Transition Properties".
Here's a snippet of my code. states is a List<EA.Element>
connector = (EA.Connector)states[0].Connectors.AddNew("TRANSITION_EVENT_ONE", "Transition"); //source state
connector.SupplierID = states[1].ElementID; //destination state
if (!connector.Update()) //check for error
{
Console.WriteLine(connector.GetLastError());
}
states[0].Connectors.Refresh();
connector.TransitionEvent = "TRANSITION_EVENT_ONE";
connector.Constraints.AddNew("TRANSITION_EVENT_ONE", "Signal");
connector.Update();
On another note, the constraints attempt above doesn't appear to work either. :(
-
It appears that you have to create a "StateFlow" connector. That will do the job. I just tried that.
Regarding the constraints: for me the Update also fails. You should send a bug report to Sparx.
q.
-
"StateFlow" worked! Thank you so much.. I would've spent a bunch more time sifting through the help topics to figure this one out. I must've missed "StateFlow" the first time checking the different types of connectors.
Thanks,
Alex
-
Actually I created the connector in an empty repository and ran a SQL
SELECT * FROM t_connector
That gave the immediate answer.
q.