Book a Demo

Author Topic: Shape script on profile  (Read 6526 times)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Shape script on profile
« on: September 28, 2017, 09:19:41 pm »
I have created a profile with a number of extensions to base classes. I have attached the shape script below to one of the stereotypes extending the base class. The script draws the right geometry but the connectors look odd. There are 2 problems:

1) one end of the connector, the bottom end, is a few pixels inside the rectangle
2) if I change the stereotype of an element in the diagram to the stereotype with the same scripts, a significant amount of white space appears between the bottom of the shape and the end of the connectors

Have I missed anything? (Sparx EA version is 13.0.1310 Build 1310).



Code: [Select]
shape main{

rectangle(0,0,100,100);

addSubshape("stereotypecompartment", 100, 20);

addSubshape("namecompartment", 100, 20);

shape stereotypecompartment
{
h_align = "right";

editablefield = "stereotype";

rectangle(60,0,100,60);

println("#stereotype#");

}

shape namecompartment
{
h_align = "center";

editablefield = "name";

println("#name#");

}
}

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape script on profile
« Reply #1 on: September 28, 2017, 09:34:16 pm »
I could not reproduce either of the effects you see.

q.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Shape script on profile
« Reply #2 on: September 28, 2017, 10:33:45 pm »
I could not reproduce either of the effects you see.

q.
Which version of EA are you running?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Shape script on profile
« Reply #3 on: September 28, 2017, 10:45:41 pm »
I tried with 1351.

q.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Shape script on profile
« Reply #4 on: September 28, 2017, 10:48:25 pm »
I tried with 1351.

q.
Thanks, I will check if an upgrade fixes the problem.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Shape script on profile
« Reply #5 on: September 28, 2017, 11:42:45 pm »
Interesting this appears to fix the problem without upgrading - same idea different coding.

Just 3 additional questions:

1) is there anyway I can make the fonts of "stereotypecompartment" and "namecompartment" different and independent/
2) can I set the fill color of "stereotypecompartment" to mid-gray?
3) how I increase the line width of the enclosing rectangle?


Code: [Select]
shape main{

rectangle(0,0,100,100);

addSubshape("stereotypecompartment", 50, 50);

addSubshape("namecompartment", 100, 100);

shape stereotypecompartment
{
h_align = "left";
v_align = "top";

editablefield = "stereotype";

rectangle(0,0,80,50);

println("#stereotype#");

}

shape namecompartment
{
h_align = "center";

editablefield = "name";

printwrapped("#name#");

}
}

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Shape script on profile
« Reply #6 on: September 28, 2017, 11:50:25 pm »
Hi,

There's not a lot you can do with fonts in shape scripts. You can set the colour, but not the size or typeface.

For the others, take a look at SetFillColor() and SetPenWidth().


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