Book a Demo

Author Topic: Shapescript decorations  (Read 7477 times)

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Shapescript decorations
« on: September 19, 2019, 08:20:29 am »
Hi there,

Does anyone have shapescript decorations for the following:

Tick
Cross
Question Mark

Many thanks,
Rupert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +118/-20
    • View Profile
Re: Shapescript decorations
« Reply #1 on: September 19, 2019, 10:03:19 am »
My rough attempts.

Code: [Select]
decoration tick
{
orientation="NW";
SetPenWidth(2);
moveto(10,60);
lineto(40,90);
lineto(90,10);
}

decoration cross
{
orientation="NE";
SetPenWidth(2);
moveto(10,10);
lineto(90,90);
moveto(90,10);
lineto(10,90);
}

decoration question
{
orientation="SW";
SetPenWidth(2);
moveto(10,40);
BezierTo(10,20,30,10,50,10);
BezierTo(70,10,90,30,90,40);
BezierTo(90,60,50,70,50,90);

Ellipse(49,95,51,97);
}

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8609
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shapescript decorations
« Reply #2 on: September 19, 2019, 10:05:52 am »
Hi there,

Does anyone have shapescript decorations for the following:

Tick
Cross
Question Mark

Many thanks,
Rupert
Hi Rupert,

a couple of questions and observations.

I presume that's an "x" cross and not a "t" cross.
I don't have such scripts (thanks, Eve), but I do have a pile of "shapescript assets" which are kept in a special folder for re-use in shapescripts.  Perhaps we should start a repository for them?

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13457
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shapescript decorations
« Reply #3 on: September 19, 2019, 01:05:21 pm »
Hi there,

Does anyone have shapescript decorations for the following:

Tick
Cross
Question Mark

Many thanks,
Rupert
Hi Rupert,

a couple of questions and observations.

I presume that's an "x" cross and not a "t" cross.
I don't have such scripts (thanks, Eve), but I do have a pile of "shapescript assets" which are kept in a special folder for re-use in shapescripts.  Perhaps we should start a repository for them?

Paolo
I started such a repository a while ago: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8609
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shapescript decorations
« Reply #4 on: September 19, 2019, 01:31:12 pm »
[SNIP]

I started such a repository a while ago: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library

Geert
Yes, Geert,

I knew about that.  But that holds full shapescripts.  Would it be appropriate to add a folder for "Assets" which are "fragments" of shapescripts -Like the decorations Rupert mentioned?

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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13457
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Shapescript decorations
« Reply #5 on: September 19, 2019, 01:36:21 pm »
[SNIP]

I started such a repository a while ago: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library

Geert
Yes, Geert,

I knew about that.  But that holds full shapescripts.  Would it be appropriate to add a folder for "Assets" which are "fragments" of shapescripts -Like the decorations Rupert mentioned?

Paolo
Sure we can do that.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8609
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shapescript decorations
« Reply #6 on: September 19, 2019, 01:42:40 pm »
[SNIP]

Sure we can do that.

Geert
OK, so we might have subfolders for decorations, main shapes, target shapes, source shapes, other shapes, code snippets etc?  You get the idea.

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

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Shapescript decorations
« Reply #7 on: September 19, 2019, 03:04:46 pm »
Thanks for everyone's help.

Does anyone know how to draw a vertical compartment on an element?

Rupert

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +118/-20
    • View Profile
Re: Shapescript decorations
« Reply #8 on: September 19, 2019, 05:20:06 pm »
Quick improvement on the question mark. Looks nicer to my eyes at least.
Code: [Select]
decoration question
{
orientation="SW";
SetPenWidth(2);
moveto(50,80);
bezierto(50,60,70,50,70,40);
arcto(30,10,70,70,90,40,10,40);
SetPenWidth(1);
Ellipse(46,91,54,99);
}

What do you mean by a vertical compartment?

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Shapescript decorations
« Reply #9 on: September 20, 2019, 07:54:53 am »
Hi Eve,

Yes, that question mark looks better now.

What I would like is a vertical compartment on the left hand side of an element that I can colour in depending on its tagged value.

And then I would like horizontal compartments in the remaining space of the element to display the text from other tagged values.

Is that possible?

I only seem to be able to 'stack' horizontal compartments one on top of the other currently.

Thanks,
Rupert

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Shapescript decorations
« Reply #10 on: September 20, 2019, 08:42:04 am »
If you use the "border" layout type, you can add a sub shape on the "west" edge like so:

Code: [Select]
shape main
{
layouttype="border";
rectangle(0,0,100,100);

addsubshape("vert","W");

shape vert
{
preferredwidth=15;
setfillcolor(255,0,0);
rectangle(0,0,100,100);
}
}

Or East edge. If you want North or South edge, set a preferredheight value. And you can nest the layouttypes, so you can add a sub shape to the "center" (i.e. the rest of the shape) and that sub shape can have layouttype set to "topdown" or "leftright".
« Last Edit: September 20, 2019, 08:45:54 am by KP »
The Sparx Team
[email protected]

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Shapescript decorations
« Reply #11 on: September 20, 2019, 09:37:33 am »
Thanks KP, that works. well.

However I am trying to 'colour' the vertical compartment based on a tagged value :

shape main
{
   layouttype="border";
 noshadow = "true";
 h_align = "left";
   setfillcolor(255,255,255);
 DefSize(340,140);
 roundRect(0,0,100,100,10,10);
 AddSubShape("nameCompartment","N");
 AddSubShape("translations","S");
 AddSubShape("vert","W");
   
   shape vert
   {
      preferredwidth=15;
      rectangle(0,0,100,100);
                  if(hastag("Capability","Manage Customers, Sales, Billing, Products & Services"))
   {
setfillcolor(0, 177, 195);
   }
   }

 shape nameCompartment
 {
    layouttype="topdown";
   h_align = "center";
   editablefield = "name";
   SetFontColor(128,0,0);
   println("#name#");
  }
 
 shape translations
  {
      h_align="CENTER";
      v_align="BOTTOM";
   println("GM: #TAG:GM#");
  }

}
      
   
But I can't seem to get the vertical compartment to colour in.

Do you have any ideas?

Thanks,
Rupert


Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8609
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Shapescript decorations
« Reply #12 on: September 20, 2019, 09:47:34 am »
Rupert,

AFAIK, the HasTag function only compares to a single value.  If you are comparing using an Inclusive OR, you'll need to have four HasTag expressions.

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

rupertkiwi

  • EA User
  • **
  • Posts: 133
  • Karma: +5/-0
    • View Profile
Re: Shapescript decorations
« Reply #13 on: September 20, 2019, 10:01:30 am »
Hi Paolo,

Yes, that's fine having several HasTag statements. I just can't seem to get the compartment to colour in.

Thanks,
Rupert

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Shapescript decorations
« Reply #14 on: September 20, 2019, 10:02:06 am »
   shape vert
   {
      preferredwidth=15;
      rectangle(0,0,100,100);
                  if(hastag("Capability","Manage Customers, Sales, Billing, Products & Services"))
   {
setfillcolor(0, 177, 195);
   }
   }

The setfillcolor() has to be before the rectangle()
The Sparx Team
[email protected]