Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: André Ribeiro on November 07, 2013, 08:03:55 am

Title: Create custom Boundary Stereotype
Post by: André Ribeiro on November 07, 2013, 08:03:55 am
Hi everyone!

In my UML Profile I've created a stereotype which extends the metaclass Boundary and consequently is represented as a rectangle.
Now, I would like to know how can I represent it instead as a rectangle with rounded corners.

Thanks in advance!
Title: Re: Create custom Boundary Stereotype
Post by: Eve on November 07, 2013, 08:28:10 am
You can right click on any Boundary in EA and select Appearance | Shape | Rounded Rectangle.

What I'm not sure of is if you can specify that as the default from a profile.
Title: Re: Create custom Boundary Stereotype
Post by: qwerty on November 07, 2013, 09:50:57 pm
Could you write a shape script for a boundary???

q.
Title: Re: Create custom Boundary Stereotype
Post by: André Ribeiro on November 09, 2013, 12:55:19 am
Thank you for the answers, but I never used Shape scripts.
Is it possible to achieve what I want?
Some hints would be appreciated.

Many thanks!
Title: Re: Create custom Boundary Stereotype
Post by: qwerty on November 09, 2013, 01:10:03 am
Well, I just assigned a simple shape to a boundary and that worked. There are quite some examples in the help. Should not be too difficult when using RoundedRect.

q.
Title: Re: Create custom Boundary Stereotype
Post by: André Ribeiro on November 12, 2013, 04:43:24 am
Hi everyone,

I was able to create a boundary with the rounded corners, but now I would like to know how can I specify a transparent background color to this boundary?

My script:
Code: [Select]
shape main
{
      SetPenWidth(2);
      RoundRect(0, 0, 100, 100, 20, 20);
      
      addsubshape("stereotypecompartment", 100, 10);
      addsubshape("namecompartment", 100, 10);
      
      shape stereotypecompartment
      {
            h_align = "center";
            editablefield = "stereotype";
            println("«#stereotype#»");
      }

      shape namecompartment
      {
            h_align = "center";
            editablefield = "name";
            println("#name#");
      }
}

Thanks in advance!
Title: Re: Create custom Boundary Stereotype
Post by: KP on November 12, 2013, 09:44:54 am
Quote
None of the elements has transparency. Neither shape script offers that.

q.
To create a transparent shape in a shape script, use StrokePath() instead of FillAndStrokePath(), e.g.

Code: [Select]
shape main
{
    startpath();
    roundrect(0,0,100,100,30,30);
    endpath();
    strokepath();
}
Commands like rectangle(), roundrect() and ellipse() have an implicit FillAndStrokePath() but this technique bypasses that.
Title: Re: Create custom Boundary Stereotype
Post by: André Ribeiro on November 12, 2013, 09:55:10 pm
It worked!  ;D
Many thanks KP!