Instead of creating text boxes everytime for the displaying the name of the blocks, I thought of creating a reusable template for the same. Following is what I created
partial block BlockTemplate
annotation(Icon(coordinateSystem(extent = {{-100,-100},{100,100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2,2}), graphics = {Text(origin = {-0.366361,-0.51471}, lineColor = {0,0,255}, extent = {{-150,150},{150,110}}, textString = "%name"),Text(origin = {0,-260}, lineColor = {0,0,255}, extent = {{-150,150},{150,110}}, textString = "%name")}));
end BlockTemplate;
Then I imported this in another block by using
extends BlockTemplate
Turns out that I get the %name displayed on top of the block but I cannot edit it.
What should be done so that I am able to edit it?
Thanks in advance, MSK
OK then you can do it like this,
Block A
block A
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100}, {100,100}}), graphics={Text(extent={{-52,50},{62,-20}}, lineColor={0,0,255}, textString="%name")}));
end A;
Block B
block B
extends A;
end B;
Block C
block C
B abc annotation (Placement(transformation(extent={{-60,20},{-40,40}})));
end C;