Skip to content

Instantly share code, notes, and snippets.

@davengeo
Created September 19, 2019 09:20
Show Gist options
  • Save davengeo/33cb05ebaf36267cd7a8153119a24736 to your computer and use it in GitHub Desktop.
Save davengeo/33cb05ebaf36267cd7a8153119a24736 to your computer and use it in GitHub Desktop.
#jArchi very simple copy paste between models for lazy people
console.log("copy paste");
from = $(selection).first();
a = {};
a.name = from.name;
a.documentation = from.documentation;
a.type = from.type
b = from.prop();
pp = new Array(b.length);
for (i=0;i<b.length;i++) {
pp[i] = {};
pp[i].key = b[i];
pp[i].value = from.prop(b[i]);
}
//READ THIS:
//most likely you have to change this to your target model path
model = $.model.load("/.../Archi4/model-repository/.....archimate");
model.setAsCurrent();
console.log("copying ******************");
e = model.createElement(a.type, a.name);
e.documentation = a.documentation;
for (i=0;i<pp.length;i++) {
e.prop(pp[i].key, pp[i].value);
}
console.log("done ******************");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment