Book a Demo

Author Topic: decoration feature doesn't work in Shape Script  (Read 6922 times)

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
decoration feature doesn't work in Shape Script
« on: July 13, 2015, 10:39:59 pm »
Trying to draw the decoration element for my custom stereotype. Doesn't appear neither at the diagram, nor in the Shape Editor's preview.
Ok, putting the sample triangle decoration right from the documentation. No deal.
Was the decoration feature revoked from the 1214? The same for 'label' feature.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #1 on: July 13, 2015, 11:19:12 pm »
Maybe you should post your script.

q.

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #2 on: July 13, 2015, 11:49:12 pm »
Well, there is no processing for now. Just main shape and decoration.

Code: [Select]
shape main
{
  decoration folder
  {
     image("folder.emf", 10,10, 26,26);
  }
}
There is no much might have been changed. I was trying to move decoration's definition outside the main shape's block. The same result :(

By the way, trying to bypass that problem, I've discovered one more strange issue. I'm defining 2 subshapes (1 for image and second as the substitute for inoperable decoration), then calling them using

Code: [Select]
AddSubShape("image", "S");
AddSubShape("deco", "S");
First shape is ok and sits at the very bottom side of the element. But the second flies into the upper part of the main shape. Looks like it's impossible to use the same orientation for several subshapes. Only first is been drawn correctly.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #3 on: July 14, 2015, 01:53:27 am »
Take decoration out of shape main and put it on top level.

Also use 0,0,100,100 for the deco size.

q.
« Last Edit: July 14, 2015, 01:59:44 am by qwerty »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #4 on: July 14, 2015, 08:35:03 am »
Quote
Looks like it's impossible to use the same orientation for several subshapes.

As described at http://www.sparxsystems.com/enterprise_architect_user_guide/12.0/extending_uml_models/sub_shapes.html
Quote
Border - This requires an additional argument to the addsubshape method to specify which region of the containing shape the sub-shape is to occupy: N, E, S, W or CENTER; each region can only be occupied by one sub-shape

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #5 on: July 14, 2015, 06:05:11 pm »
My decorations seem to work okay. Here is some example code
Code: [Select]
// Archimate Data Object - Extension for message and database
shape main
{
      layouttype="border";
      rectangle(0,0,100,100);
      addsubshape("padding","n");
      addsubshape("name","center");
      
      shape padding
      {
            preferredheight=20;
      }
      
      shape name
      {
            preferredheight=20;
            h_align="center";
            rectangle(0,0,100,100);
            print("#name#");
      }
}

decoration icon
{
      orientation="ne";
    defsize(90,70);
        
      if(hasproperty("rectanglenotation","0"))
      {
      }
         else
         {
                  if (hastag("Type","Database"))
                  {
              startpath();
              moveto(0,20);
              bezierto(0,0,100,0,100,20);
              lineto(100,80);
              bezierto(100,100,0,100,0,80);
              lineto(0,20);
              endpath();
              fillandstrokepath();
              bezierto(0,40,100,40,100,20);      
                   }
                  else if (hastag("Type","Message"))
                  {
              rectangle(0,0,100,100);
              moveto(0,0);
              lineto(50,50);
              lineto(100,0);      
                  }
            }
}

decoration composite
{
       orientation="SE";
       if(hasproperty("iscomposite","true"))
       {
              ellipse(0,40,40,60);
              ellipse(60,40,100,60);
              moveto(30,50);
              lineto(70,50);
       }
}
Happy to help
:)

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #6 on: July 15, 2015, 05:03:49 am »
Hi guys,
And thanks for good advices! Moved my decoration in front of main shape and finally have it seen :) BUT! We're using a lot of rounded shapes and decorations are sliding right onto the rounded border. So, the final solution was to make a separate sub-shape consolidating other sub-shapes instead of decoration. Just like in Java!
Looks like Shape Script is sensitive to order. BTW, the BNF for Shape Script is a pure disaster and doesn't reflect any recent changes made in v.12 As well as the whole documentation which is outdated totally  :'( Guys from the Sparx, make you documentation aligned to your product!! That action is really vital for your customers!
One more thing. Is there any way to draw at lower level say, from an add-in? I didn't find anything except the Shape Script which is fine but sometimes really inconvenient as it hasn't complex features and variables.
Well, anyway! Thank you guys for your support and great clues!!! ;)

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #7 on: July 15, 2015, 06:09:08 am »
Nope. Shape script is the only thing we got to mess around on diagrams.

q.

Volkov

  • EA User
  • **
  • Posts: 21
  • Karma: +0/-0
    • View Profile
Re: decoration feature doesn't work in Shape Scrip
« Reply #8 on: July 15, 2015, 06:32:24 am »
Then, guys, you need to make it full-featured. Currently, it pushes you back drastically. Java inventors were caught into the same trap. But they found it instantly, and had made tons of good and right steps to get initiative back.
We're making system generating hundreds and hundreds shapes. It takes time and makes shape scripts cumbersome.