Book a Demo

Author Topic: Shape Script for dependency  (Read 3537 times)

Uwe

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Shape Script for dependency
« on: November 21, 2008, 09:08:46 pm »
Hi,

I'm trying to have a red line as a dependency and it worked all fine with the following script:
---
shape main
{
       // draw a dashed line
       noshadow=true;
       setlinestyle("SOLID");
       setpencolor(255,0,0);
       moveto(0,0);
       lineto(100,0);
}

shape target
{
       // draw an arrow at the target end
       rotatable = true;
       setpencolor(255,0,0);
       startpath();
       moveto(16,-6);
       lineto(0,0);
       lineto(16,6);
       endpath();
       strokepath();
}

---
Unfortinatly I realised, that I had to have different types of connections, some with one arrow, other with two arrows, so here comes my question:
Do you know how to change the script, that it shows an arrow at the end, depending on "direction" drop down in the "dependency properties" dialog ?

Thanks

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Shape Script for dependency
« Reply #1 on: November 24, 2008, 08:41:57 am »

Thomas H.

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
    • View Profile
Re: Shape Script for dependency
« Reply #2 on: November 25, 2008, 03:08:37 am »
Maybe the following helps (please adjust the color RGB values):

shape main
{
  // draw a dashed line
  noshadow=true;
  setpencolor(100,100,100);
  setlinestyle("DASH");
  moveto(0,0);
  lineto(100,0);
}
 
shape source
{
  rotatable = true;

  if(HasProperty("Direction","Bi-Directional")) {
    startpath();
    setfillcolor(100,100,100);
    setpencolor(100,100,100);
    moveto(0,0);
    lineto(16,6);
    lineto(16,-6);
    endpath();
    fillandstrokepath();
  }

  if(HasProperty("Direction","Destination -> Source")) {
    startpath();
    setfillcolor(100,100,100);
    setpencolor(100,100,100);
    moveto(0,0);
    lineto(16,6);
    lineto(16,-6);
    endpath();
    fillandstrokepath();
  }
}

shape target
{
  rotatable = true;

  if(HasProperty("Direction","Bi-Directional")) {
    startpath();
    setfillcolor(100,100,100);
    setpencolor(100,100,100);
    moveto(0,0);
    lineto(16,6);
    lineto(16,-6);
    endpath();
    fillandstrokepath();
  }

  if(HasProperty("Direction","Source -> Destination")) {
    startpath();
    setfillcolor(100,100,100);
    setpencolor(100,100,100);
    moveto(0,0);
    lineto(16,6);
    lineto(16,-6);
    endpath();
    fillandstrokepath();
  }
}

Uwe

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Shape Script for dependency
« Reply #3 on: January 10, 2009, 01:29:00 am »
Thanx this helped a lot.