Author Topic: Control Println Location in a Shape Script?  (Read 3093 times)

AndyJ

  • EA User
  • **
  • Posts: 337
  • Karma: +5/-3
  • It's only a model
    • View Profile
Control Println Location in a Shape Script?
« on: February 16, 2010, 03:28:18 pm »
Hi people,

I've created a simple shape script to display a person shape for classes stereotyped as a stakeholder...

As part of the script I've included the following code to display information about the stakeholder:

println("<<#stereotype#>>");
println("#NAME#");
println("#TAG:Stakeholder Type#");

Is it possible to control where this information is displayed in relation to the shape?

Is there another more appropriate method to display this information alongside the shape?

Currently I've put the shape on to the far right of the canvas to leave room for this text, but it makes associations look quite odd (lines terminating in blank space adjacent to the apparent shape.)

If anyone can point to a good reference about shape scripts I'd also appreciate it.
Sun Tzu: "If you sit by the river long enough, eventually the body of MS Visio floats past."

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8599
  • Karma: +256/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Control Println Location in a Shape Script?
« Reply #1 on: February 16, 2010, 04:00:57 pm »
Hi Andy,

Unfortunately the printxx functionality doesn't respond to the setorigin command. I put in a bug report about it about two weeks ago.  No response from Sparx yet.

The best you can do is to use a decoration subshape that allows you to move the shape around with the orientation attribute.  You can move the text around a bit by using \n to add newlines to move it relative to the orientation point.

There's also the detached label mechanism but you can't set the location of the note relative to the shape automatically (as far as I know - maybe the Sparxians can correct me).

HTH,
Paolo
« Last Edit: February 16, 2010, 04:22:46 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!