Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: D. Schmid on July 21, 2015, 07:42:48 pm
-
Hi @all,
I'm currently trying to add a realization from a class to an interface with a script.
Unfortunatelly this:
var eRealization;
eRealization = eClass.Realizes.AddNew (eInterface.ElementID, "Interface");
eRealization.Update ();
eClass.Realizes.Refresh();
eClass.Update();
eClass.Refresh ();
won't work
also this:
var eAssociation as EA.Connector;
eAssociation = eClass.Connectors.AddNew ("", "Realization");
eAssociation.SupplierID = eInterface.ElementID;
eAssociation.Direction = "Source -> Destination";
eAssociation.Update();
will throw an error at the update saying the Realization is not allowed "class --> interface"
How can I add a realization to a class using a script? In both cases the interface will also be created by the script.
Regards
Dominik
-
I tried this with V9.3 and it worked. V12 failed. Looks like a bug. Will do a bit more testing.
q.
-
I remember a recent similar thread. Turn off Tools/Options/Links(/Strict Connector Syntax and it works again. Still smells like a bug as the connector looks more than legal (it's even offered in the quick linker). Go ahead and send a bug report.
q.
-
The second code snippet is the correct approach but it stopped working with EA 12, I think. It should have been fixed at 12.0.1213. From the readme:
Creation of new Realization connectors from automation restored
If it is still failing in a later edition, please send a bug report including the failing code snippet. And, as qwerty states, switching off Strict Connector Syntax is a work-around.
-
I don't have the very latest V12. I tested with 1208.
q.
-
Hi @all,
thank you for the quick Responses. The Workaround is working fine. I will test the script using 1215 today and will send a quick Feedback here and if necessary a little Bug Report. We currently use 1210 and there it didn't work.
Regards
Dominik
-
Hi again,
short Update. Just tested with 1215 and all works fine. Thank you all.
Regards
Dominik