Book a Demo

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

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Assigning images to custom stereotypes
« on: July 09, 2014, 06:16:59 am »
I am trying to assign an image to a custom stereotype by following the instructions in the help files.

Go into Settings->UML Types->Stereotypes

1 Specify the steretype (KPI)
2. Base Class (Class)
3. Select Metafile radio button and select an emf file.
4. Save.
5. Re-generate the MDG.

Some things that have me curious are:

1. The instructions don't tell me to specify a Group Name (whatever that is) despite there being a text field called Group Name.
2. After I have assigned the emf file, nothing shows up in the Preview pane.

I am using version 9.3.

Cheers

Jays  :)

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #1 on: July 09, 2014, 09:42:25 am »
Two of your steps don't belong together:

Quote
Go into Settings->UML Types->Stereotypes
and

Quote
5. Re-generate the MDG.
At no point in creating an MDG Technology will you need to go into the Stereotypes table. They are either/or.
The Sparx Team
[email protected]

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #2 on: July 09, 2014, 10:46:00 am »
I am looking at the document "enterprise_architect_sdk.pdf" section 1.1 Custom Stereotypes, which states that to associate a meta-file image with a stereotype:

1. Select Settings->UML Types.
2. Type or select Stereotype name.
3. Select Base Class.
4 Click metafile radio button and assign button to locate required file.
5. Enter optional notes.
6. Click save.

I have assumed that this is the way that I assign an image to my stereotypes. If not, can you point me to the place that explains how to do it?

Cheers  :)

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #3 on: July 09, 2014, 11:17:45 am »
Those steps are for stereotypes that are not part of any profile/technology. If you are defining a stereotype in a profile, you will need to apply the image to the «stereotype» class and save the profile with "Alternate Images" option ticked, and then you can re-generate your technology.
« Last Edit: July 09, 2014, 11:58:35 am by KP »
The Sparx Team
[email protected]

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #4 on: July 11, 2014, 10:37:30 am »
HI there

I've found where to apply the image to the stereotype easily enough, but can't find where to "tick" alternate images on the profile.

Can you please point me in the right direction?

Cheers :-)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #5 on: July 11, 2014, 10:50:26 am »
Scratch that, I have found the alternate images option for the profile but when I regenerate, the MDG it doesnt show the image but rather still shows the standard object.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #6 on: July 11, 2014, 11:03:49 am »
You are using EA 9, aren't you? It is possible that you may need to do something like this, creating a shape script for the stereotype:
Code: [Select]
shape main
{
    image("imagename",0,0,100,100);
}
You will also need to include the images in your MDG Technology - the wizard has a page to help you.
The Sparx Team
[email protected]

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #7 on: July 11, 2014, 08:35:22 pm »
A bit off topic but something ill be putting forward as a feature request - just want to check if it sounds like a good idea/feasible.

in my shapescript id like to include something like:

image ("#TAG:location# flag.jpg", 0, 0, 100, 100)

I'd like the tag value loction to be substituted as it is in print statements...but it looks like the substituation only occurs in print statements. Would it be possible to just substitute the #TAG:<tag property># construct any where it appears within the shapescript ?

Regards,

Jon.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #8 on: July 12, 2014, 02:31:54 am »
I guess that implementing a primitive string manipulation in shape script would be the best.

q.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #9 on: July 14, 2014, 04:27:23 am »
I added an _image attribute to the stereotype and included the following script:

shape main{
image("Data Source_64.bmp",0,0,64,64)
}

and during the MDG generation I included Data Source_64.bmp in my build.

But I still get nothing.

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #10 on: July 14, 2014, 06:02:37 am »
Ok, so an update to this.
I have now managed to get one stereotype to display am image but another two that I have applied the same method to just show a blank grey square.

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #11 on: July 14, 2014, 07:06:40 am »
Sounds like your going though the pain barrier. Keep up the good work you'll get through it Jayson.

To get the image which you should have included in the MDG generation process you'll need to add the MDG name space of the image. This is the name you call the MDG. i.e. what you fill in on the 'Technology' field of the MDG Technology Creation Wizard Dialog.
So if you have a MDG Technology called 'MyMDG' you need to modify your code to something like this

Code: [Select]
shape main
{
   image("MyMDG::imagename",0,0,100,100);
}

Good luck Mr Speer  ;)
Happy to help
:)

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #12 on: July 16, 2014, 03:41:58 am »
Thanks Sunshine, definite pain going on  :D
But finally got that working thanks to you.

But once I did, I noticed that the name of the element doesn't appear which really makes the whole process pointless because I am currently looking at a dozen elements on a page that are indistinguishable without actually clicking on them.

Any chance you know how to add the element name?

Cheers

Jays  :)

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #13 on: July 16, 2014, 08:55:09 am »
Within the shapescript:

println("#NAME#");
      
and if you want to see the stereotype:

println("<<#stereotype#>>");
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

Jayson

  • EA User
  • **
  • Posts: 363
  • Karma: +1/-0
    • View Profile
Re: Assigning images to custom stereotypes
« Reply #14 on: July 16, 2014, 09:30:48 am »
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?