10
« on: April 08, 2015, 10:38:13 pm »
Hi,
here is the script. It does mainly evaluate the tagged values to draw two decorations (ASIL and element type). Now there is also the problem that the upper left decoration is drawn above the element name. It's a matter of the element size and name length, but looks ugly. Showing the stereotype by name helps but looks ugly, too.
shape main
{
drawnativeshape();
if (HasTag("ElementType","mechanical"))
{
setfillcolor(192,192,192);
drawnativeshape();
return;
}
if (HasTag("ElementType","electrical"))
{
setfillcolor(234,128,102);
drawnativeshape();
return;
}
if (HasTag("ElementType","logical"))
{
setfillcolor(204,255,204);
drawnativeshape();
return;
}
if (HasTag("ElementType","functional"))
{
drawnativeshape();
return;
}
}
decoration Type
{
orientation = "SW";
if (HasTag("ElementType","mechanical"))
{
println("mech");
return;
}
if (HasTag("ElementType","electrical"))
{
println("eHW");
return;
}
if (HasTag("ElementType","logical"))
{
println("SW");
return;
}
if (HasTag("ElementType","functional"))
{
println("Fct");
return;
}
}
decoration SIL
{
orientation = "NW";
if (HasTag("SafetyIntegrity"))
{
startpath();
moveto(0,0);
lineto(100,0);
lineto(100,100);
lineto(0,100);
endpath();
}
// ASIL QM
if (HasTag("SafetyIntegrity","ASIL QM"))
{
setfillcolor(0, 255, 0);
fillandstrokepath();
println("QM");
return;
}
if (HasTag("SafetyIntegrity","ASIL QM(A)"))
{
setfillcolor(0, 255, 0);
fillandstrokepath();
println("QM(A)");
return;
}
if (HasTag("SafetyIntegrity","ASIL QM(B)"))
{
setfillcolor(0, 255, 0);
fillandstrokepath();
println("QM(B)");
return;
}
if (HasTag("SafetyIntegrity","ASIL QM(C)"))
{
setfillcolor(0, 255, 0);
fillandstrokepath();
println("QM(C)");
return;
}
if (HasTag("SafetyIntegrity","ASIL QM(D)"))
{
setfillcolor(0, 255, 0);
fillandstrokepath();
println("QM(D)");
return;
}
// ASIL A
if (HasTag("SafetyIntegrity","ASIL A"))
{
setfillcolor(255, 255, 0);
fillandstrokepath();
print("A");
return;
}
if (HasTag("SafetyIntegrity","ASIL A(B)"))
{
setfillcolor(255, 255, 0);
fillandstrokepath();
print("A(B)");
return;
}
if (HasTag("SafetyIntegrity","ASIL A(C)"))
{
setfillcolor(255, 255, 0);
fillandstrokepath();
print("A(C)");
return;
}
if (HasTag("SafetyIntegrity","ASIL A(D)"))
{
setfillcolor(255, 255, 0);
fillandstrokepath();
print("A(D)");
return;
}
// ASIL B
if (HasTag("SafetyIntegrity","ASIL B"))
{
setfillcolor(255, 104, 32);
fillandstrokepath();
println("B");
return;
}
if (HasTag("SafetyIntegrity","ASIL B(C)"))
{
setfillcolor(255, 104, 32);
fillandstrokepath();
println("B(C)");
return;
}
if (HasTag("SafetyIntegrity","ASIL B(D)"))
{
setfillcolor(255, 104, 32);
fillandstrokepath();
println("B(D)");
return;
}
// ASIL C
if (HasTag("SafetyIntegrity","ASIL C"))
{
setfillcolor(255, 0, 0);
fillandstrokepath();
println("C");
return;
}
if (HasTag("SafetyIntegrity","ASIL C(D)"))
{
setfillcolor(255, 0, 0);
fillandstrokepath();
println("C(D)");
return;
}
// ASIL D
if (HasTag("SafetyIntegrity","ASIL D"))
{
setfillcolor(192, 0, 157);
fillandstrokepath();
println("D");
return;
}
}
Thanks,
Markus