Book a Demo

Author Topic: shape scripts of type "decoration"  (Read 4272 times)

Tonu

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
shape scripts of type "decoration"
« on: December 07, 2005, 03:08:42 pm »
I can not figure out how to use the shape script type "decoration".
I have upgraded to ver 6.0 hoping to customise some of the stereotypes I use. For instance, one of my needs is to make distinction between issues and requirements on a diagram.

I created a stereotype expanding Issue and tried to decorate the standard shape with this script:
---
decoration dot
{
 orientation = "NE";
 
 StartPath();
 Ellipse(10,10,20,20);
 Ellipse(12,12, 14, 14);
 Ellipse(16,12, 18, 14);
 moveto(14,18);
 lineto(16,18);
 EndPath();

 FillAndStrokePath();
}
---

Even if the shape appears in the script editor preview, it does not have any effect on the shape displayed in diagram.

The problem can not be in using a wrong stereotype, as if I change the script to type "shape main" the appearance of items in diagram will change.

Has anyone managed to change decoration of existing shapes (I am using ver 6.0 build 779)

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: shape scripts of type "decoration"
« Reply #1 on: December 07, 2005, 03:20:50 pm »
Tonu,

The number values you need to enter are % of the total size of the decoration, not pixel values. Try this version:

Code: [Select]

decoration dot  
{  
 orientation = "NE";  
 
 StartPath();  
 Ellipse(0,0,100,100);  
 Ellipse(20,20,40,40);
 Ellipse(60,20,80,40);
 moveto(40,80);
 lineto(60,80);
 EndPath();  

 FillAndStrokePath();  
}  


Hope that helps,

Neil
The Sparx Team
[email protected]

Tonu

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: shape scripts of type "decoration"
« Reply #2 on: December 07, 2005, 03:27:39 pm »
Hi Neill,

The only effect it had was that the shape got bigger in script editor. No changes in diagram, though ...

First I suspected, that decoration depends on the base class, but now I have tried it with Issue stereotype and Class stereotype. Neither one works

Any other suggestions?

Tonu

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: shape scripts of type "decoration"
« Reply #3 on: December 07, 2005, 03:32:51 pm »
Further to my previous reply, at build 779 decorations only work with classes and packages. We will add the functionality for other element types right away - should make it into 781. Sorry about that.

Neil
The Sparx Team
[email protected]

Tonu

  • EA User
  • **
  • Posts: 30
  • Karma: +0/-0
    • View Profile
Re: shape scripts of type "decoration"
« Reply #4 on: December 08, 2005, 05:03:55 am »
A hint, that is not related to the thread subject but rater to the problem that brough me to shape scripts. May be it will save those two hours I spent on palyng with scripts for someone else ...

I wanted to distinquish Requirements and Issues in a diagram. I discovered only now that there is an option "Show stereotype icon for requirements" that does the trick! (Tools->Options->Objects)

May be not as good-looking option as the small issue icon in the project tree, but solves the problem. The rest is a matter of taste anyway ;-)

Tonu

Graham_Moir

  • EA User
  • **
  • Posts: 749
  • Karma: +10/-15
    • View Profile
Re: shape scripts of type "decoration"
« Reply #5 on: December 29, 2005, 06:19:01 am »
Did this make it into build 781 ?

thanks

Graham_Moir

  • EA User
  • **
  • Posts: 749
  • Karma: +10/-15
    • View Profile
Re: shape scripts of type "decoration"
« Reply #6 on: February 02, 2006, 08:37:36 am »
Did extending this beyond class/package make it into 781, 785, 786 ?

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: shape scripts of type "decoration"
« Reply #7 on: February 02, 2006, 03:55:15 pm »
Quote
Did extending this beyond class/package make it into 781, 785, 786 ?


785, yes. It now works for all most element types. [I've just found a couple that don't work (e.g. component and artifact, although maybe that was intentional since they have their own built in decorations). We will get those, and any others, fixed for 787.]

Neil

PS Try this one with an actor element:

Code: [Select]
decoration dot
{
 orientation = "N";
 setorigin("N",-9,11);
 
 StartPath();
 Ellipse(0,0,100,100);
 Ellipse(20,20,40,40);
 Ellipse(60,20,80,40);
 moveto(40,80);
 lineto(60,80);
 EndPath();  

 FillAndStrokePath();  
}  
;D
The Sparx Team
[email protected]