Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: swe on August 31, 2012, 10:18:17 pm

Title: rotating shapes in port (shape script question)
Post by: swe on August 31, 2012, 10:18:17 pm
Does anyone know how to make EA Architect rotate an arrow for example to point in the right direction? Here is my scenario: I am creating an AUTOSAR port which has an arrow decorating the port (points outward for output, inwards for input). However, When I move my port around the class, the orientation of the arrow remains fixed at 0 degrees. Is there a way to have the arrow rotate as needed depending on where the user places the port?
Title: Re: rotating shapes in port (shape script question
Post by: qwerty on September 03, 2012, 03:39:59 am
See the shape script used for ports in SysML. It's a bit complex but feasible.

q.
Title: Re: rotating shapes in port (shape script question
Post by: swe on September 03, 2012, 04:59:39 pm
I don't have access to the SysML ports it seems. However, I figured out a simple solution in case anyone is intersted. I have 4 cases based on where the port is located (the edge). Here is the code, and accompanying picture.

Code: [Select]
shape main{      
      setpencolor(0,0,0);
      rectangle(0,100,100,0);      
      setfillcolor(0,0,0);

      if(hasProperty("parentedge", "right"))
      {
            polygon(50,50,3,35,0);
            return;
      }
      else if(hasProperty("parentedge", "left"))
      {
            polygon(50,50,3,35,180);
            return;
            }
      else if(hasProperty("parentedge", "bottom"))
      {
            polygon(50,50,3,35,270);
            return;
      }

      else if(hasProperty("parentedge", "top"))
      {
            polygon(50,50,3,35,90);
            return;
      }
}
Title: Re: rotating shapes in port (shape script question
Post by: qwerty on September 03, 2012, 08:35:18 pm
That's what is used in the SysML solution in principle. Congrats and thanks for posting. I did not do the latter as I thought Sparx' coding might be somehow copyrighted (although the script did not contain a copyright itself).

N.B. You can either remove the "else" or the "return" statements.

q.
Title: Re: rotating shapes in port (shape script question
Post by: Eve on September 04, 2012, 01:42:33 pm
Quote
I did not do the latter as I thought Sparx' coding might be somehow copyrighted (although the script did not contain a copyright itself).
Wise... I'm no lawyer, but it seems that even extracting it is on shaky ground according to the license agreement.
Quote
YOU hereby undertake not to sell, rent, lease, translate, adapt, vary, modify, decompile, disassemble, reverse engineer, create derivative works of, modify, sub-license, loan or distribute the SOFTWARE PRODUCT other than as expressly authorized by this EULA.
(Emphasis mine)
Title: Re: rotating shapes in port (shape script question
Post by: qwerty on September 05, 2012, 12:36:39 am
Thanks for the pointer. To me the process did not seem to be a "real" reverse engineering as it's so easy to do (at least for me). But I'll keep that emphasis in mind.

q.
Title: Re: rotating shapes in port (shape script question
Post by: skiwi on September 12, 2012, 11:32:58 am
Try submitting a feature request (please) for this basic piece of funtionality.

See also rotate feature request (http://www.sparxsystems.com/cgi-bin/yabb/YaBB.cgi?num=1307921175/0#0)
Title: Re: rotating shapes in port (shape script question
Post by: Eve on September 13, 2012, 08:38:11 am
Uh, what feature request? They can do what they were asking.
Title: Re: rotating shapes in port (shape script question
Post by: skiwi on September 13, 2012, 08:49:51 am
Yes, sorry, they did say shape script, I was thinking about being able to rotate an arrow (or similar shape) in a diagram from the UI.