Book a Demo

Author Topic: Shape script - Println types  (Read 3521 times)

ferran

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Shape script - Println types
« on: January 20, 2020, 09:22:19 pm »
I have the following shape script linked to a class element:

shape main
{
      startpath();
     moveto(20,10);
      lineto(20,90);
     arcto(0,0,100,100,20,100,85,100);
     lineto(78.5,10);
     arcto(0,0,100,100,80,0,20,0);
     lineto(20,10);
      endpath();
      fillandstrokepath();
     arcto(0,-80,100,20,20,20,85,20);
     moveto(20,20);
     arcto(0,-70,100,30,20,30,85,30);
     addsubshape("namecompartment", 100, 50, 0, 17);
      shape namecompartment
      {
       h_align = "center";
       editablefield = "name";
       println("#name#");
      }
     addsubshape("namecompartment2", 100, 50, 0, 5);
      shape namecompartment2
      {
       h_align = "center";
       editablefield = "attribute";
       println("#att#");
      }
}

My problem is that the   #name#   works but the #att# or #attribute#  I tried, does not work.
Does anybody know, which label I need between the hashtags to make it show the attributes defined in the class?

Thank you very much.

Ferran.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape script - Println types
« Reply #1 on: January 20, 2020, 10:24:28 pm »
You can't. See https://sparxsystems.com/enterprise_architect_user_guide/13.5/modeling_tools/displaying_element_properties.html

You could do it with an add-in. I would not recommend it. Why not use the generic shape?

q.

ferran

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: Shape script - Println types
« Reply #2 on: January 21, 2020, 03:15:13 am »
Ok thanks!

Because I want to represent dataflow structures like queues, stacks, circular buffers, etc.

And I personally think that stereotyping each of them is better and clearer.

Ferran.

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Shape script - Println types
« Reply #3 on: January 21, 2020, 06:25:47 pm »
Hi Ferran,


If you have a strict, repeated set of properties you could represent them as tagged values instead of attributes. Tagged values can be accessed in a shape script.

But it sounds like you're doing more source-code-like concepts, and in that case tagged values probably aren't useful; you need the freedom that attributes provide and as Q mentioned, attributes simply aren't accessible in shape scripts. Operations aren't either.


/Uffe
My theories are always correct, just apply them to the right reality.

ferran

  • EA User
  • **
  • Posts: 26
  • Karma: +0/-0
    • View Profile
Re: Shape script - Println types
« Reply #4 on: January 21, 2020, 08:03:47 pm »
Hi Uffe,


Thanks! I will take that into account!

Ferran.