Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Icon does not show in OMEdit

Icon does not show in OMEdit

I've created a model icon in another tool (dymola 2014). This does not show in OMEdit (r18954).
I wonder whether it is correct Modelica code or not. It it is, maybe some fix must be made in the OMEdit code.
Can someone tell?
Here is  the icon-only model:

Code:


model justIcon
equation
  annotation(Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100,-100},{100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100,-100},{100,100}}), graphics={  Text(extent = {{-154,-47},{146,-87}}, textString = "%name", lineColor = {0,0,255}),Polygon(points = {{26,0},{-34,40},{-34,-40},{26,0}}, lineColor = {0,0,0}, fillColor = {255,255,255},
            fillPattern =  FillPattern.Solid),Line(points = {{-94,0},{96,0}}, color = {0,0,255}),Line(points = {{26,40},{26,-40}}, color = {0,0,255}),Line(points = {{26,20},{54,50},{54,76}}, color = {0,0,255}),Line(points = {{36,50},{56,30}}, color = {0,0,255}),Line(visible = useHeatPort, points = {{-4,-100},{-4,-20}}, color = {127,0,0}, smooth = Smooth.None, pattern = LinePattern.Dot),Rectangle(extent = {{-66,84},{68,62}}, lineColor = {0,0,255}, fillColor = {255,255,255},
            fillPattern =  FillPattern.Solid),Line(points = {{0,84},{0,106}}, color = {0,0,255}, smooth = Smooth.None)}),
    uses(Modelica(version="3.2")));
end justIcon;

Re: Icon does not show in OMEdit

The code is correct. But OMC fails to parse it,

Code:

getIconAnnotation(justIcon)

{-100.0,-100.0,100.0,100.0,false,0.1,2.0,2.0}

The reason is

Code:

visible = useHeatPort

Although we do instantiation but in your case useHeatPort is not defined. So that particular case should handled. Add a bug report about it https://trac.openmodelica.org/OpenModelica/newticket

As a workaround for now either change useHeatPort with true/false or define useHeatPort. In the following code useHeatPort is defined and it works fine,

Code:

model justIcon

 
parameter Boolean useHeatPort = false;

  annotation(Diagram(coordinateSystem(preserveAspectRatio = false, extent = {{-100,-100},{100,100}}), graphics), Icon(coordinateSystem(preserveAspectRatio = false, extent = {{-100,-100},{100,100}}), graphics={  Text(extent = {{-154,-47},{146,-87}}, textString = "%name", lineColor = {0,0,255}),Polygon(points = {{26,0},{-34,40},{-34,-40},{26,0}}, lineColor = {0,0,0}, fillColor = {255,255,255},
            fillPattern =  FillPattern.Solid),Line(points = {{-94,0},{96,0}}, color = {0,0,255}),Line(points = {{26,40},{26,-40}}, color = {0,0,255}),Line(points = {{26,20},{54,50},{54,76}}, color = {0,0,255}),Line(points = {{36,50},{56,30}}, color = {0,0,255}),Line(visible = useHeatPort, points = {{-4,-100},{-4,-20}}, color = {127,0,0}, smooth = Smooth.None, pattern = LinePattern.Dot),Rectangle(extent = {{-66,84},{68,62}}, lineColor = {0,0,255}, fillColor = {255,255,255},
            fillPattern =  FillPattern.Solid),Line(points = {{0,84},{0,106}}, color = {0,0,255}, smooth = Smooth.None)}),
    uses(Modelica(version="3.2")));
end justIcon;

Adeel.

Re: Icon does not show in OMEdit

Adeel,
your workaround is perfect!
I will also add a ticket on this issue.

There are 0 guests and 0 other users also viewing this topic
You are here: