Book a Demo

Author Topic: Constraint's attached links with shape scripts  (Read 3924 times)

rainerf

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Constraint's attached links with shape scripts
« on: June 21, 2011, 05:38:10 pm »
Hi again,

unfortunately I ran into another problem with shape scripts for Constraints: if I add a shape script to a stereotype of Constraint and apply the stereotype to a Constraint, its attached links are not drawn anymore. Checking via Right Click -> Advanced -> Set Attached Links they are still present, but the dashed line in the diagram is gone.

Which shape script is used does not seem to matter, I simplified it to
Code: [Select]
shape main {
    rectangle(0, 0, 100, 100);
}
but the problem still occurs.

Again, thanks for your help,
Rainer.
« Last Edit: June 21, 2011, 05:38:36 pm by rainerf »

rainerf

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Constraint's attached links with shape scripts
« Reply #1 on: August 04, 2011, 10:59:35 pm »
*bump* Anyone?

Is this a bug? Should I report it somewhere? Or is there some trick to get this done correctly?

rainerf

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Constraint's attached links with shape scripts
« Reply #2 on: August 23, 2011, 11:13:46 pm »
The problem persists with EA 9.0.907. Is there no workaround for this?

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Constraint's attached links with shape scripts
« Reply #3 on: September 01, 2011, 12:23:20 pm »
The dotted line is part of the "normal" way of drawing the constraint, but the shape script doesn't know how to override it. So EA thinks you've overridden it with... nothing.

The only work-around I can think of is to put a drawNativeShape() at the beginning of your shape script to force the normal drawing instructions, and then superimpose your own shapes on top of that. drawNativeShape() will draw the dotted line, but will also draw the default constraint shape, so it will only work well if the shape you are creating fills the whole drawing area else bits of constraint will be poking out from underneath your custom shape. So this will look OK:
Code: [Select]
shape main
{
      drawnativeshape();
      setfillcolor(128,255,128);
      rectangle(0,0,100,100);
}

but this will look messy:
Code: [Select]
shape main
{
      drawnativeshape();
      setfillcolor(128,255,128);
      ellipse(0,0,100,100);
}
« Last Edit: September 01, 2011, 03:23:49 pm by KP »
The Sparx Team
[email protected]

rainerf

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Constraint's attached links with shape scripts
« Reply #4 on: September 01, 2011, 06:26:56 pm »
Thank you very much for the workaround, it works nicely.