Book a Demo

Author Topic: Assigning images to custom stereotypes  (Read 12003 times)

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #15 on: July 16, 2014, 09:33:15 am »
I just put this part of the shape script at the end, and prefix it with a bunch of:

println(" ");
println(" ");

Until it appears below the shape.

There are probably more elegant solutions...

Andy
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #16 on: July 16, 2014, 09:46:50 am »
This one puts the name on the bottom edge of the shape:

Code: [Select]
shape main
{
      layouttype="border";
      image("ImageName",0,0,100,100);
      addsubshape("name","S");
      
      shape name
      {
            h_align="center";
            print("#NAME#");
      }
}
The Sparx Team
[email protected]

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #17 on: July 16, 2014, 10:05:24 am »
Awesome! Thanks a bunch  :)
So I should be able to make it possible for the user to edit the name directly on the drawing using the editablefield property right?

I added:

editablefield = "name";

 just before

print("#name#");

but nothing seemed to happen.
Is this because the text is outside the 100 x 100 box?

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #18 on: July 16, 2014, 10:49:34 am »
Quote
but nothing seemed to happen.
Press F2
The Sparx Team
[email protected]

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #19 on: July 17, 2014, 07:19:39 am »
You mean select the object with the mouse and hit F2?
Tried that and nothing.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #20 on: July 17, 2014, 02:24:06 pm »
Quote
That worked perfectly, thanks for that.

Is there any way to print this on the outside of the image box so that it doesn't sit on top of my nice pretty image?

In addition to the previous suggestion you could try putting the print statement in a shape label to get floating text label.
Code: [Select]
...
shape label
{
    print("#name#")// draw a floating text label
}

RTM: http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/writing_scripts.html
« Last Edit: July 17, 2014, 02:30:37 pm by phenzell »
Happy to help
:)