Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: martin1 on January 28, 2020, 07:30:20 pm
-
Hi,
I display text using PrintWrapped in a custom shape script.
Is it somehow possible to truncate the text shown in the shape script, just for display purpose? The original text should be left untouched. To give an example, I only want to show the first 100 characters of a label.
Martin
-
No. Shape Script is very limited.
q.
-
No. Shape Script is very limited.
I found out that I can request text from an addin function. So I could use that to read text from e.g. the Notes field, truncate it, and display the results in the shape. Hope that works?
-
No. Shape Script is very limited.
I found out that I can request text from an addin function. So I could use that to read text from e.g. the Notes field, truncate it, and display the results in the shape. Hope that works?
That would work, but you would have to be very careful that it doesn't ruin the performance.
Schapescripts are executed very often and should be as quick as possible.
Geert
-
And: they are interpreted and not compiled. If you have diagrams with lots of shape scripts to be executed you will appreciate a calm mind - ommm
q.
-
I'll keep that in mind. Thanks!
-
Now I have implemented such a truncation via add in. Works fine performance wise on my machine for all "normal" diagrams. By normal I want to say that I didn't try out diagrams with several thousands of elements.
-
So it's 10ths of elements, I guess.
q.
P.S. I just counted the elements in diagrams of a customer's model. It ranged from one to over 2000 to 1 with an average of 27. Astonishigly the 2000+ diagram was rendered rather smoothly and also the scrolling was ok. I think that's for the reason it was an auto-layout with a looong element band and it showed only 20 or so on a single page.