Book a Demo

Author Topic: Recreation of sysML requirement behaviour in custom shape script  (Read 4794 times)

Seth

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Recreation of sysML requirement behaviour in custom shape script
« on: February 03, 2022, 07:15:33 pm »
hi i've combed the forums and not seen something that matches what i need with a solution so apologies if this is a repeat (feel free to point me to the other post that covers the issue).

I'm making custom MDG elements / tools that are effectively clones of sysml stereotypes and they work well, but in some instances i want the custom stereotype to behave like it's extended / generalised counterpart (e.g. a custom element behaves and looks exactly like a requirement except has custom stereotype classification and preset tags), but e.g. i want it to be shaped more like an activity and to be a pale orange.

when doing the shape scripts if i use drawnativeshape() i can still change the colour (great!) but i can't alter the roundrectangle to have larger rounded corners (because it's not the native shape in the context of the element).


i tried remaking a requirement based on raw script, but in truth even with various guides i have no idea why it doesn't behave the same as a normal requirement element.

does anyone have any script examples that can be tweaked for customisation but otherwise behave the same way as a normal element e.g. text wrapping and compartment appearance when tags become populated etc.? (that is another thing i don't understand; how to make a new compartment appear that prints all populated tags when said tags become populated y'know, like what happens with a requirement when you have "show tags" ticked and as an fyi, my test zone have "show tags" ticked.).

i also saw a previous comment from Geert, saying to try reverse engineering the requirement script by decoding the MDG XML file, but i've found this impossible as if i get the sysML XML from c/programfiles(x86)/sparx/ea/internal technology(?). no decoder can make sense of the content (i also opened it in notepad ++ and it is definitely like encrypted or something).

in short; i want to customise my custom MDG requirement cloned stereotypes to have a custom main shape / colour but otherwise internally behave exactly the same as a requirement. is this possible?

« Last Edit: February 03, 2022, 07:19:52 pm by Seth »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #1 on: February 03, 2022, 09:55:53 pm »
More or less you can do that. Fiddling around with shape script is somewhat of a PITA. Reverse engineering the shapes has been explained here. Try to search for base64 and zip (and shape script). You should find it somehow...

q.

P.S. Geert has a github repo with all shapes somewhere around....


Seth

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #3 on: February 03, 2022, 11:50:33 pm »
hi guys, thanks for the info. ill have to keep looking i guess.

Geert, in your github, where are the scripts for sysML stereotypes? i see the ones from the MDG folder but not sysML which is inbuilt technology or something?

Seth

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #4 on: February 03, 2022, 11:55:04 pm »
oh, Geert, am i able to use that script to extract the sysML stuff from C:\Program Files (x86)\Sparx Systems\EA\InternalTechnologies ?

in which case (sorry kind of newby to running these kinds of things) how do i execute the script?

thanks again!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #5 on: February 04, 2022, 02:57:57 am »
No, those are some EA-internal formats and it's yet unknown how to decode them.

q.

Seth

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #6 on: February 04, 2022, 09:07:02 pm »
ah that's a bit of a downer then.


okay final question because i cant see the forum post about this; but as with a normal requirement element where if i have tags selected, any and all tags that are added will be shown on the element. how do i execute this in shape script?

e.g. the base tag commonly used is id, but the tag area / the tag itself is invisible until it has a value. and if i add any new tags using the button on top of the tag interface, it will do the same. is there a command that i am missing for shape script that is in effect "if(hasproperty("istagged")){ print("#allTAG#");



so far my script is this:
shape main{
   
   setfillcolor(255,180,70);
   setfontcolor(50,50,50);
   roundrect(0,0,100,100,20,20);
   
   
   addsubshape("stereotype",100,10,0,0);
   addsubshape("namezone",100,10,0,10);
   DefSize(100,80);
   
   
   addsubshape("tagzone",100,50,0,30);
   
   
   
   shape stereotype{
      h_align = "center";
      print("<<#stereotype#>>");
      
   }

   shape namezone{
      h_align = "center";
      editablefield = "name";
      bold = "true";
      print("#name#");
      
   }
   
   shape tagzone{
      h_align = "left";
      
      
      if (hastag("id"))
      {
         moveto(0,0);
         lineto(100,0);
         print("#TAG#");
      }
         
      
   }
   
}

but i don't know how to get the tagzone to behave the same as a requirement element would if that makes sense? surely there is a command as i've suggested above otherwise regular requirements elements wouldn't print new custom made tags that were added on. (i would show a picture but i have no idea how to add jpeg attachments to this forum interface because the attachments + doesn't give me the option.......

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #7 on: February 04, 2022, 10:32:14 pm »
print("#tag:name#") where name is the name of the tagged value (aka stereotype property).

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #8 on: February 04, 2022, 10:47:49 pm »
I'm not sure if you can replicate the standard tagged values compartment.

Some of the more advanced graphical stuff seems to be hardcoded and cannot be replicated with shapescripts.

Geert

Seth

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #9 on: February 05, 2022, 01:33:11 am »
Hi qwerty, i know that's the basic way of doing it but it's not quite enough as Geert said afterward; it's probably not likely due to the features being locked away.

oh well looks like it's a dead lobster of a path.

thanks for your help / info!!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Recreation of sysML requirement behaviour in custom shape script
« Reply #10 on: February 05, 2022, 01:47:41 am »
I was referring to your #TAG# print which does not seem to be just. I somehow once managed to create the shape "rather" ok but that's too long ago and it was a lot of fiddling. Also it was not SysML but EA's requirements element.

q.