Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: YogaMatt on July 21, 2016, 07:47:08 pm

Title: Convert class to instance (and keep the class) [Have Cake and Eat It]
Post by: YogaMatt on July 21, 2016, 07:47:08 pm
Modelling has proceeded with relationships being drawn between classes.
We want instantiate the classes into objects such that:
The manual effort is onerous. Does this require scripting or is there a pre-canned solution in EA?
Thank you.
 
Title: Re: Convert class to instance (and keep the class) [Have Cake and Eat It]
Post by: Nizam on July 22, 2016, 05:01:09 pm
Scripting seems to be the option.
A script that scans through all elements in a diagram and converts its type to 'Object' (thereby retaining all its connectors),
Create a 'Class' object into a set package, using the name and other metadata from the original object
Set the new Class ID / GUID as Classifier to the original Object (previously class) to make sure it knows its Classifer.

Title: Re: Convert class to instance (and keep the class) [Have Cake and Eat It]
Post by: YogaMatt on July 22, 2016, 05:58:53 pm
Scripting seems to be the option.
A script that scans through all elements in a diagram and converts its type to 'Object' (thereby retaining all its connectors),
Create a 'Class' object into a set package, using the name and other metadata from the original object
Set the new Class ID / GUID as Classifier to the original Object (previously class) to make sure it knows its Classifer.
Good logic - which ought to retain the diagrammatic representations. Thanks.