Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: rupertkiwi on September 19, 2019, 08:20:29 am
-
Hi there,
Does anyone have shapescript decorations for the following:
Tick
Cross
Question Mark
Many thanks,
Rupert
-
My rough attempts.
decoration tick
{
orientation="NW";
SetPenWidth(2);
moveto(10,60);
lineto(40,90);
lineto(90,10);
}
decoration cross
{
orientation="NE";
SetPenWidth(2);
moveto(10,10);
lineto(90,90);
moveto(90,10);
lineto(10,90);
}
decoration question
{
orientation="SW";
SetPenWidth(2);
moveto(10,40);
BezierTo(10,20,30,10,50,10);
BezierTo(70,10,90,30,90,40);
BezierTo(90,60,50,70,50,90);
Ellipse(49,95,51,97);
}
-
Hi there,
Does anyone have shapescript decorations for the following:
Tick
Cross
Question Mark
Many thanks,
Rupert
Hi Rupert,
a couple of questions and observations.
I presume that's an "x" cross and not a "t" cross.
I don't have such scripts (thanks, Eve), but I do have a pile of "shapescript assets" which are kept in a special folder for re-use in shapescripts. Perhaps we should start a repository for them?
Paolo
-
Hi there,
Does anyone have shapescript decorations for the following:
Tick
Cross
Question Mark
Many thanks,
Rupert
Hi Rupert,
a couple of questions and observations.
I presume that's an "x" cross and not a "t" cross.
I don't have such scripts (thanks, Eve), but I do have a pile of "shapescript assets" which are kept in a special folder for re-use in shapescripts. Perhaps we should start a repository for them?
Paolo
I started such a repository a while ago: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library)
Geert
-
[SNIP]
I started such a repository a while ago: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library)
Geert
Yes, Geert,
I knew about that. But that holds full shapescripts. Would it be appropriate to add a folder for "Assets" which are "fragments" of shapescripts -Like the decorations Rupert mentioned?
Paolo
-
[SNIP]
I started such a repository a while ago: https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library)
Geert
Yes, Geert,
I knew about that. But that holds full shapescripts. Would it be appropriate to add a folder for "Assets" which are "fragments" of shapescripts -Like the decorations Rupert mentioned?
Paolo
Sure we can do that.
Geert
-
[SNIP]
Sure we can do that.
Geert
OK, so we might have subfolders for decorations, main shapes, target shapes, source shapes, other shapes, code snippets etc? You get the idea.
Paolo
-
Thanks for everyone's help.
Does anyone know how to draw a vertical compartment on an element?
Rupert
-
Quick improvement on the question mark. Looks nicer to my eyes at least.
decoration question
{
orientation="SW";
SetPenWidth(2);
moveto(50,80);
bezierto(50,60,70,50,70,40);
arcto(30,10,70,70,90,40,10,40);
SetPenWidth(1);
Ellipse(46,91,54,99);
}
What do you mean by a vertical compartment?
-
Hi Eve,
Yes, that question mark looks better now.
What I would like is a vertical compartment on the left hand side of an element that I can colour in depending on its tagged value.
And then I would like horizontal compartments in the remaining space of the element to display the text from other tagged values.
Is that possible?
I only seem to be able to 'stack' horizontal compartments one on top of the other currently.
Thanks,
Rupert
-
If you use the "border" layout type, you can add a sub shape on the "west" edge like so:
shape main
{
layouttype="border";
rectangle(0,0,100,100);
addsubshape("vert","W");
shape vert
{
preferredwidth=15;
setfillcolor(255,0,0);
rectangle(0,0,100,100);
}
}
Or East edge. If you want North or South edge, set a preferredheight value. And you can nest the layouttypes, so you can add a sub shape to the "center" (i.e. the rest of the shape) and that sub shape can have layouttype set to "topdown" or "leftright".
-
Thanks KP, that works. well.
However I am trying to 'colour' the vertical compartment based on a tagged value :
shape main
{
layouttype="border";
noshadow = "true";
h_align = "left";
setfillcolor(255,255,255);
DefSize(340,140);
roundRect(0,0,100,100,10,10);
AddSubShape("nameCompartment","N");
AddSubShape("translations","S");
AddSubShape("vert","W");
shape vert
{
preferredwidth=15;
rectangle(0,0,100,100);
if(hastag("Capability","Manage Customers, Sales, Billing, Products & Services"))
{
setfillcolor(0, 177, 195);
}
}
shape nameCompartment
{
layouttype="topdown";
h_align = "center";
editablefield = "name";
SetFontColor(128,0,0);
println("#name#");
}
shape translations
{
h_align="CENTER";
v_align="BOTTOM";
println("GM: #TAG:GM#");
}
}
But I can't seem to get the vertical compartment to colour in.
Do you have any ideas?
Thanks,
Rupert
-
Rupert,
AFAIK, the HasTag function only compares to a single value. If you are comparing using an Inclusive OR, you'll need to have four HasTag expressions.
HTH,
Paolo
-
Hi Paolo,
Yes, that's fine having several HasTag statements. I just can't seem to get the compartment to colour in.
Thanks,
Rupert
-
shape vert
{
preferredwidth=15;
rectangle(0,0,100,100);
if(hastag("Capability","Manage Customers, Sales, Billing, Products & Services"))
{
setfillcolor(0, 177, 195);
}
}
The setfillcolor() has to be before the rectangle()
-
Yes ! That works great, many thanks for your help
-
Also, what is the best practice for using shapescripts?
Should they be applied to a stereotype at a model or profile level?
What if you want the tagged values for the element represented differently in different diagrams?
Rupert
-
Also, what is the best practice for using shapescripts?
Should they be applied to a stereotype at a model or profile level?
What if you want the tagged values for the element represented differently in different diagrams?
Rupert
We do it at the profile level.
If you want the shapescript to react to different digrams, you need to have a method for identifying the trigger.
We use a mixture of diagram.stereotype, diagram.mdgtype and diagram.name (as required).
HTH,
Paolo
-
I've done something similar here:
https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/blob/master/RM%20Requirements/process_heatmap.shapescript (https://github.com/GeertBellekens/Enterprise-Architect-Shapescript-Library/blob/master/RM%20Requirements/process_heatmap.shapescript)
Geert