Author Topic: rotating shapes in port (shape script question)  (Read 4577 times)

swe

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
rotating shapes in port (shape script question)
« 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?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #1 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.

swe

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #2 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;
      }
}

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #3 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.
« Last Edit: September 03, 2012, 08:39:15 pm by qwerty »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #4 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)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #5 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.

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #6 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
Orthogonality rules
Using EA16.1 (1627) on Windows 11 Enterprise/64 bit. Repositories in SQLServer2019 DB Schema 1558.
WebEA on Pro Cloud Server 4.2.64

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #7 on: September 13, 2012, 08:38:11 am »
Uh, what feature request? They can do what they were asking.

skiwi

  • EA Expert
  • ****
  • Posts: 2081
  • Karma: +46/-82
    • View Profile
Re: rotating shapes in port (shape script question
« Reply #8 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.
Orthogonality rules
Using EA16.1 (1627) on Windows 11 Enterprise/64 bit. Repositories in SQLServer2019 DB Schema 1558.
WebEA on Pro Cloud Server 4.2.64