Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#5671 closed defect (fixed)

Bad scaling of icons in graphical view

Reported by: Oliver Lenord Owned by: Adeel Asghar
Priority: high Milestone: 1.16.0
Component: OMEdit Version: v1.14.0-dev-nightly
Keywords: schema view, icon Cc:

Description

The icon of a model is badly scaled.
The corresponding annotation is:

Circuits.MTCircuit mTCircuit

annotation (Placement(transformation(extent={{32,-80},{80,80}})));

This is obviously wrong in OMEdit.
In Dymola it looks fine, see attached png.

Attachments (6)

Dymola.png (58.2 KB ) - added by Oliver Lenord 5 years ago.
Expected output (Dymola)
OMEdit.png (40.0 KB ) - added by Oliver Lenord 5 years ago.
Wrong display in OMEdit
MTCircuit.mo (7.6 KB ) - added by Oliver Lenord 5 years ago.
IconScaling.mo (663 bytes ) - added by Oliver Lenord 5 years ago.
IconInstance_dymola.png (8.1 KB ) - added by Oliver Lenord 5 years ago.
IconInstance_OMEdit.png (113.0 KB ) - added by Adeel Asghar 5 years ago.

Download all attachments as: .zip

Change History (19)

by Oliver Lenord, 5 years ago

Attachment: Dymola.png added

Expected output (Dymola)

by Oliver Lenord, 5 years ago

Attachment: OMEdit.png added

Wrong display in OMEdit

comment:1 by Francesco Casella, 5 years ago

Milestone: 1.14.01.15.0

comment:2 by Adeel Asghar, 5 years ago

Can you post the model? Or tell us which library is that?

by Oliver Lenord, 5 years ago

Attachment: MTCircuit.mo added

comment:3 by Adeel Asghar, 5 years ago

Does seems like correct model as referenced in the screenshots. Also it depends and is part of GFA_ThermoModel.IdealCoolantCircuitTRex.Circuits library. Maybe you can make a minimal working example.

Version 0, edited 5 years ago by Adeel Asghar (next)

comment:4 by Adeel Asghar, 5 years ago

Milestone: 1.15.02.0.0

Moving this ticket to 2.0. More information is required.

comment:5 by Francesco Casella, 5 years ago

Milestone: 2.0.01.16.0

Maybe 1.16.0?

comment:6 by Oliver Lenord, 5 years ago

1) Create package IconScaling
2) Create model IconClass within IconScaling
3) Create rectangle for IconClass

model IconClass
equation

annotation(
    Icon(graphics = {Rectangle(extent = {{-40, 100}, {40, -100}})}));
end IconClass;

4) Create model IconInstance within IconScaling
5) drag IconClass into graphics window

model IconInstance
IconClass iconClass annotation(
    Placement(visible = true, transformation(origin = {0, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation

end IconInstance;

6) Change extent of IconClass icon

model IconClass
equation

  annotation(
    Icon(graphics = {Rectangle(extent = {{-40, 100}, {40, -100}})}, coordinateSystem(extent = {{-40, -100}, {40, 100}})),
    Diagram(coordinateSystem(extent = {{-40, -100}, {40, 100}})));
end IconClass;

7) add another IconClass to IconInstance

package IconScaling
  model IconClass
  equation

    annotation(
      Icon(graphics = {Rectangle(extent = {{-40, 100}, {40, -100}})}, coordinateSystem(extent = {{-40, -100}, {40, 100}})),
      Diagram(coordinateSystem(extent = {{-40, -100}, {40, 100}})));
  end IconClass;

  model IconInstance
  IconClass iconClass annotation(
      Placement(visible = true, transformation(origin = {0, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  IconClass iconClass1 annotation(
      Placement(visible = true, transformation(origin = {0, -10}, extent = {{-4, -10}, {4, 10}}, rotation = 0)));
  equation

  end IconInstance;
end IconScaling;

Even though both icons are displayed identical in the graphics window, they show different values for the x-coordinate of the extent in the annotations.

Opening the same model in Dymola shows the two boxes at different widths.

This could also be a bug in Dymola or an impreciseness in the Modelica specification.
In fact I do like the behavior of OMEdit better, but it is annoying to get different results.

Last edited 5 years ago by Adeel Asghar (previous) (diff)

by Oliver Lenord, 5 years ago

Attachment: IconScaling.mo added

by Oliver Lenord, 5 years ago

Attachment: IconInstance_dymola.png added

by Adeel Asghar, 5 years ago

Attachment: IconInstance_OMEdit.png added

comment:7 by Adeel Asghar, 5 years ago

I get the same result as Dymola.

comment:8 by Oliver Lenord, 5 years ago

This is true.
But initially, following the described steps, it didn't.

comment:9 by Adeel Asghar, 5 years ago

Status: newaccepted

I think I know what the problem is.

While creating the model you changed the coordinate system of IconClass and that change is not sent out to the instances.

I will if I can fix this real quick.

comment:10 by Adeel Asghar, 5 years ago

OK. I have a fix but I need to clean up, make it proper and test a bit.

Basically when the coordinate system changes we should update the bounding rectangle of the component instance and apply all the transformations again using the new coordinates.

comment:11 by Francesco Casella, 5 years ago

Please backport this to maintenance/v1.15 as well. I think we should leave 1.14.0 alone, just in case. The official release should be made tomorrow, I'll take no chances of breaking it.

comment:12 by Adeel Asghar, 5 years ago

Milestone: 1.16.01.15.0
Resolution: fixed
Status: acceptedclosed

Fixed in c3a557c/OpenModelica and ported to 1.15 as well.

comment:13 by Francesco Casella, 4 years ago

Milestone: 1.15.01.16.0

Release 1.15.0 was scrapped, because replaceable support eventually turned out to be more easily implemented in 1.16.0. Hence, all 1.15.0 tickets are rescheduled to 1.16.0

Note: See TracTickets for help on using tickets.