Author Topic: Custom MDG _UCRect appears not to work  (Read 7084 times)

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1110
  • Karma: +101/-9
  • Its the results that count
    • View Profile
Custom MDG _UCRect appears not to work
« on: July 09, 2021, 11:42:16 am »
I have an MDG with stereotype extending Activity and I want it to not display in rectangle notation so I came across _UCRect special attribute. Great just the thing I thought set it to 0 and should be good.

Quote
_UCRect
(Only applicable to element types that have a distinct rectangle notation, or to elements that have Shape Scripts that evaluate the 'rectanglenotation' property, which can include element types that do not normally have rectangle notation.)
If set to 1, initially displays the element in rectangle notation. If set to 0, initially displays the element in standard notation.
Reference: https://sparxsystems.com/enterprise_architect_user_guide/15.2/modeling/supportedattributes_2.html

Unfortunately I've found it doesn't appear to work in V15.2 Build 1559 for me.
Anyone else managed to get it to work?


Happy to help
:)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 7947
  • Karma: +206/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #1 on: July 09, 2021, 01:15:23 pm »
I have an MDG with stereotype extending Activity and I want it to not display in rectangle notation so I came across _UCRect special attribute. Great just the thing; I thought set it to 0 and should be good.

[SNIP]

Unfortunately, I've found it doesn't appear to work in V15.2 Build 1559 for me.
Anyone else managed to get it to work?
YMOVWFM...
Fine for me, just checked.  Both settings of _UCRect work as advertised.

A few things to check.  Does the _UCRect appear in the <Apply type="Activity"> element in the MDG?  Does the shapescript respond correctly to the <context menu> item?

Maybe post the relevant parts of your MDG <stereotype/> element?
Also, the <Tag/> toolbox entry element [1]

HTH,
Paolo

[1] In researching your issue, I found a problem with my <Tag/> entry which stopped the item from being created from the toolobox.
« Last Edit: July 09, 2021, 01:17:36 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2849
  • Karma: +48/-3
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #2 on: July 09, 2021, 01:50:26 pm »
I wouldn't expect _UCRect=0 to do anything for Activity. It sets the default appearance on creation, and for Activity elements that is already NOT rectangle notation.
The Sparx Team
support@sparxsystems.com

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 7947
  • Karma: +206/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #3 on: July 09, 2021, 04:20:27 pm »
I wouldn't expect _UCRect=0 to do anything for Activity. It sets the default appearance on creation, and for Activity elements that is already NOT rectangle notation.
If Sunshine has a shapescript on his derivative of Activity, then "all bets are off", surely?

In our MDG, we set a lot of this stuff up explicitly.  I used our version of an ArchiMate Business Process (NOT derived from the ArchiMate MDG element, but which «extends» UML::Activity) for which we supplied our own shapescript to check the behaviour.

HTH,
Paolo

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

philchudley

  • EA User
  • **
  • Posts: 668
  • Karma: +16/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #4 on: July 09, 2021, 06:52:49 pm »
I have used within a shapescript something like this to control Rectangular Notation

   // Define the intial size for element
   defsize(160,80);
   
   // Check whether rectangle notation is enabled
   if (hasproperty("rectanglenotation", "0"))
   {
      // Not enabled, so just display as a rectangle (name centred vertically and horizontally)
      // horizontally
      rectangle(0,0,100,100);
      addsubshape("namecentre", "CENTER");
   }
   else
   {
      // Enabled so display heading containing the stereotype
      // Name compartment underneath (name centred vertically and at the top)
      rectangle(0,0,100,100);   
      addsubshape("type", "N");
      addsubshape("nametop", "CENTER");
   }


I have also used the _UCRect attribute to set the default appearance

_UCRect Seems to work on all elements, except Actor (my own stereotype has no Shapescript), has NOeffect,.  Maybe a bug in EA?

Phil
follow me on Twitter

@SparxEAGuru

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1110
  • Karma: +101/-9
  • Its the results that count
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #5 on: July 10, 2021, 06:41:39 am »
Hi thanks for the responses.
A few things to check.  Does the _UCRect appear in the <Apply type="Activity"> element in the MDG?  Does the shapescript respond correctly to the <context menu> item?
Yes it changes from rectangle and non-rectangle when I set it via the context menu whilst in Sparx. Just doesn't show the non rectangle shape when first created.

I wouldn't expect _UCRect=0 to do anything for Activity. It sets the default appearance on creation, and for Activity elements that is already NOT rectangle notation.
If Sunshine has a shapescript on his derivative of Activity, then "all bets are off", surely?

In our MDG, we set a lot of this stuff up explicitly.  I used our version of an ArchiMate Business Process (NOT derived from the ArchiMate MDG element, but which «extends» UML::Activity) for which we supplied our own shapescript to check the behaviour.
mmh? need to clarify what's been said there.
@KP are you saying UML::Activity are created as Not rectangle upon creation by default?
The shape I'm referring to in our custom MDG also <<extends>> UML::Activity  and upon creation its in rectangle notation. All other shapes derived from UML:: Activity appear to do that too. I know this as after creating the shape and checking the state via context menu on shape the rectangle notation is ticked. Our user base wants one shape to appear in non-rectangle notation when created hence my attempt to change it but found it appeared not to work.
« Last Edit: July 10, 2021, 06:50:57 am by Sunshine »
Happy to help
:)

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1110
  • Karma: +101/-9
  • Its the results that count
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #6 on: July 10, 2021, 06:44:25 am »
I have used within a shapescript something like this to control Rectangular Notation

   // Define the intial size for element
   defsize(160,80);
   
   // Check whether rectangle notation is enabled
   if (hasproperty("rectanglenotation", "0"))
   {
      // Not enabled, so just display as a rectangle (name centred vertically and horizontally)
      // horizontally
      rectangle(0,0,100,100);
      addsubshape("namecentre", "CENTER");
   }
   else
   {
      // Enabled so display heading containing the stereotype
      // Name compartment underneath (name centred vertically and at the top)
      rectangle(0,0,100,100);   
      addsubshape("type", "N");
      addsubshape("nametop", "CENTER");
   }


I have also used the _UCRect attribute to set the default appearance

_UCRect Seems to work on all elements, except Actor (my own stereotype has no Shapescript), has NOeffect,.  Maybe a bug in EA?

Phil
Yes our shape script is similar
Code: [Select]
// Business Event
shape main
{
layouttype="border";
if(hasproperty("rectanglenotation","0"))
{
defsize(90,70);
startpath();
moveto(0,100);
lineto(75,100);
arcto(50,0,100,100,75,100,75,0);
lineto(75,0);
lineto(0,0);
bezierto(30,30,30,70,0,100);
endpath();
fillandstrokepath();
addsubshape("padding","w");
addsubshape("name","center");

shape padding
{
preferredwidth=20;
}

shape name
{
v_align="center";
h_align="center";
print("#name#");
}
}
else
{
defsize(105,70);
roundrect(0,0,100,100,20,20);
addsubshape("padding","n");
addsubshape("name","center");

shape padding
{
preferredheight=20;
}

shape name
{
h_align="center";
print("#name#");
}
}
}

decoration event
{
orientation="ne";

if(hasproperty("rectanglenotation","0"))
{
}
else
{
moveto(0,100);
lineto(65,100);
arcto(40,20,90,100,65,100,65,20);
lineto(65,20);
lineto(0,20);
bezierto(30,40,30,80,0,100);
}
}

I've put that attribute '_UCRect = 0' in the stereotype but just wondering if that attribute should be in the metaclass UML::Activity that its extending. Where did you put '_UCRect = 0' to make it work?
« Last Edit: July 10, 2021, 06:49:05 am by Sunshine »
Happy to help
:)

qwerty

  • EA Guru
  • *****
  • Posts: 12329
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 7947
  • Karma: +206/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #8 on: July 10, 2021, 03:13:32 pm »
I have used within a shapescript something like this to control Rectangular Notation

[SNIP]

_UCRect Seems to work on all elements, except Actor (my own stereotype has no Shapescript), has NOeffect,.  Maybe a bug in EA?

Phil
Hi Phil,
For reasons best known to Sparxians, Actors use the ActRect attribute to control rectangle notation.

I don't think UCRect can work without a Shapescript (similar to shapescripts can't work without attaching to a stereotype).  Maybe the Sparxians can enlighten us?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

philchudley

  • EA User
  • **
  • Posts: 668
  • Karma: +16/-0
  • UML/EA Principal Consultant / Trainer
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #9 on: July 10, 2021, 08:08:14 pm »
Thanks Paolo I will try the ActRect attribute

Phil
follow me on Twitter

@SparxEAGuru

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1110
  • Karma: +101/-9
  • Its the results that count
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #10 on: July 11, 2021, 07:29:48 am »
See https://sparxsystems.com/enterprise_architect_user_guide/15.2/modeling/supportedattributes_2.html
It's the Metaclass.

q.

Duh! I'd missed that when I was skim reading it and put it under the stereotype hence the source of my problem.
Happy to help
:)

qwerty

  • EA Guru
  • *****
  • Posts: 12329
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #11 on: July 11, 2021, 09:10:05 am »
You're in good company (or is it bad?). That kind of "was it the stereo or the metaclass?" happened to me more than once.

q.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 7947
  • Karma: +206/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #12 on: July 12, 2021, 03:31:26 pm »
You're in good company (or is it bad?). That kind of "was it the stereo or the metaclass?" happened to me more than once.

q.
As some may recall, I took issue with whether certain attributes should be in the metaclass or should be in the stereotype.  The most obvious was the _MeaningBackwards and _MeaningForwards.  I asked for the rationale, but (as usual) received no response.  It seems (somewhat, if not bleedingly) obvious that, like "Her Majesty" on Beatles' Abbey Road album, ("It -by definition- varies from stereotype to stereotype").  Placing it in the metaclass requires an (effectively) redundant metaclass to be created for EACH relationship arc, unlike for item vertices where one needs only to create new extender metaclasses when the basic properties vary. So far, I think, in our MDG of hundreds of vertex stereotypes, of almost all types, we haven't required any.

Could I suggest that one could add the _MeaningBackwards and _MeaningForwards as attributes of the stereotype and maintain the existing functionality that; if defined in the metaclass, they will apply to ALL stereotypes that are extended from the metaclass, whereas if defined only in the stereotype, they apply solely to THAT stereotype?

Thoughts?
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 12329
  • Karma: +347/-287
  • I'm no guru at all
    • View Profile
Re: Custom MDG _UCRect appears not to work
« Reply #13 on: July 12, 2021, 07:48:28 pm »
I gave up in searching for logic in EA. In case of the metaclass I formerly re-used metaclasses. That's no longer possible. Instead I get a flood of "personal" metaclasses. As already said: I gave up...

q.