Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: M1TO on November 24, 2023, 12:01:48 am
-
Hi,
I have a subshape located "outside" the main shape and I want to add text to it. How do I do that? The text always seems to be "attached" to the main shape, no matter what I try.
shape main
{
DrawNativeShape();
addsubshape("test", 100, 100);
setfillcolor(0,255,255);
shape test
{
h_align = "center";
v_align = "center";
RoundRect(-15,0,0,15,5,5);
if (HasTag("Test","Yes"))
{
SetFontColor(200,12,0);
print("TestText");
}
}
}
-
Can you explain (with pictures) what you want to achieve, and what is going wrong now?
Geert
-
The text is now shown in the centre of the main shape. But I want it to be in the centre of the subshape, the turquoise rectangle attached to the "north-west" corner of the main shape. Unfortunately I have no idea how to add a picture to this post.
-
The text is now shown in the centre of the main shape. But I want it to be in the centre of the subshape, the turquoise rectangle attached to the "north-west" corner of the main shape. Unfortunately I have no idea how to add a picture to this post.
You can't attach images here. You can post images on a public image hosting site (e.g. imgur.com), and then link them here.
The problem is that you only think you have a subshape outside the main shape.
Actually ou have a subshape the exact same size and location of the main shape addsubshape("test", 100, 100);
Then inside the definition of you subshape you draw a rounded rectangle outside of the borders RoundRect(-15,0,0,15,5,5);
And then you print text in the middle of the subshape (which has the same size and location as the main shape)
h_align = "center";
v_align = "center";
print("TestText");
A possible solution:
shape main
{
DrawNativeShape();
addsubshape("test", 50, 50, -50, -50);
setfillcolor(0,255,255);
shape test
{
h_align = "center";
v_align = "center";
RoundRect(0,0,100,100,5,5);
if (HasTag("Test","Yes"))
{
SetFontColor(200,12,0);
print("TestText");
}
}
}
Geert
-
Ahh, I see. Thanks for clarifying that for me!