Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Kimi on July 05, 2012, 01:18:32 am

Title: Copying "alternate image" using a script?
Post by: Kimi on July 05, 2012, 01:18:32 am
Hi

I am using screen templates (in user interface diagrams) from which selected parameters are copied to other screens depending on element names and tagged values.
Regarding element size and position this already works well, but I would also like to copy appearances that are alternate images.
Is that possible at all? And if yes, how?
Thanks
Title: Re: Copying "alternate image" using a script?
Post by: qwerty on July 05, 2012, 04:05:46 am
You need to set the Object Style of the according Diagram Object to something like ImageID=<num>; where <num> is the ImageID of the according picture from t_image.

q.
Title: Re: Copying "alternate image" using a script?
Post by: Kimi on July 05, 2012, 08:09:00 pm
Thanks. Based on your answer I could solve this and even more.

For anyone seeing this later: There is a bit more to it than revealed here.
1) It is important not to omit the ";" at the end of "ImageID=<num>;"
2) It is necessary to call the diagram object method "update" after setting the style.

Now, taking a look at the XMI I found the style content that changes the font properties that are not documented in the style setting help page. Apparently, providing a full set of values in the style definition like
diagramObject.Style = "BCol=0;BFol=16777215;font=Arial;fontsz=100;bold=1;pitch=34;charset=0;ul=0;italic=0;";
lets you change whatever you can change within the diagram by the font definition. However, this does not work if e.g. the font=Arial; definition is missing.