Book a Demo

Author Topic: Shapescript : cannot truncate text  (Read 4549 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Shapescript : cannot truncate text
« on: April 27, 2021, 01:34:52 am »
Hello,

I need to display a stereotyped element as a rectangle with the Element Type followed by the name in bold.

Here is the shapescript:

Code: [Select]
shape main{
  DefSize(100,100);
  Rectangle(0,0,100,100);
  AddSubShape("typecompartment",90,15,3,0);
  AddSubShape("namecompartment",90,20,3,0);
  return;

shape typecompartment
{
h_align = "center";
v_align = "top";
Print("This is a sample text");
}
shape namecompartment
{
h_align = "center";
v_align = "top";
bold = true;
PrintLn("#NAME#");
}
}

If the width is reduced, the "This is a sample text" text is printed on 2 lines, overlapping with the element's name.
Is there a way to truncate the 1st line if the element's width is small e.g. "This is a ..." similarly to the way EA handles stereotype names?

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shapescript : cannot truncate text
« Reply #1 on: April 27, 2021, 02:19:03 am »
Only if you use an add-in I guess. I wouldn't use it though.

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Shapescript : cannot truncate text
« Reply #2 on: April 28, 2021, 04:55:55 pm »
It's not a major issue so will leave it as it is..

I also noticed for this stereotyped actor that connector ends are displayed inside the element as illustrated below. This rendering for a stereotyped class with the same Shapescript is fine. Is there a tweak I should apply?





Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shapescript : cannot truncate text
« Reply #3 on: April 28, 2021, 05:04:00 pm »
It's not a major issue so will leave it as it is..

I also noticed for this stereotyped actor that connector ends are displayed inside the element as illustrated below. This rendering for a stereotyped class with the same Shapescript is fine. Is there a tweak I should apply?
Hi Guillaume,
I've come across similar issues before.  There are a couple of points to check.
1) Is the rectangle coincident with the (0,0,100,100) selection rectangle?  In other words, is the rectangle you are seeing the same size as the selection "points" when the shape is selected.  If the shapescript draws (for example) a rectangle(-5,-5,105,105), there'll be a 5-pixel border around the section rectangle - which would manifest as what you see.
2) Check the line drawing shapescript in case it extends beyond (0,100), either in main or in source or target (as appropriate).  This would also create the rendering shown.

If neither of the above, and you figure out what caused it, let us know.  With shapescripts, we need all the help we can get!  ;)

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Shapescript : cannot truncate text
« Reply #4 on: April 28, 2021, 08:13:55 pm »
Hi Paolo,

Thank you for your reply.
The selection rectangle doesn't match the element rectangle, yet changing the values doesn't fix the connector end position unfortunately.

I noticed that resizing the element moves the connector end position. I'm going to leave it like this...
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com