Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: Problems with unsymmetrical icons in the diagram layer #12165

Closed
abuntrock opened this issue Mar 28, 2024 · 1 comment · Fixed by #12180
Closed

Regression: Problems with unsymmetrical icons in the diagram layer #12165

abuntrock opened this issue Mar 28, 2024 · 1 comment · Fixed by #12180
Assignees
Labels
COMP/GUI/OMEdit Issue and pull request related to OMEdit regression
Milestone

Comments

@abuntrock
Copy link

abuntrock commented Mar 28, 2024

Description

The problem is present with 1.22.3 and v1.23.0-dev-391-g7423fcddfa (64-bit) but not with 1.22.0. The root cause is probably some changes in the flipping/alignment behavior because unsymmetrical icons behave differently when flipped in 1.22.0 and 1.22.3.

For unsymmetrical icons the position in the diagram view does not equal the placement annotation in the text view leading to "jumps" when another action is performed and getModelInstance is called. After those jumps previously drawn connection lines are "hanging in the air".

Steps to Reproduce

  1. Load the following model using the MSL.
model UnsymetricalIcon
  Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation(
    Placement(transformation(origin = {-160, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {-160, 0}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b annotation(
    Placement(transformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}}), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}})));
  Modelica.Mechanics.Rotational.Components.Inertia inertia annotation(
    Placement(transformation(extent = {{-10, -10}, {10, 10}})));
equation
  connect(inertia.flange_a, flange_a) annotation(Line(points = {{-10, 0}, {-160, 0}}));
  connect(inertia.flange_b, flange_b) annotation(Line(points = {{10, 0}, {100, 0}}));

annotation(
    Icon(coordinateSystem(extent = {{-160, -100}, {100, 100}}), graphics = {Rectangle(origin = {-30, 0}, extent = {{-130, 100}, {130, -100}}), Text(origin = {-29, -1}, extent = {{-95, 33}, {95, -33}}, textString = "Icon text")}),
    version = "",
    uses(Modelica(version = "4.0.0")),
  Diagram(coordinateSystem(extent = {{-160, -100}, {100, 100}})));
end UnsymetricalIcon;
  1. Instantiate this class in another empty diagram layer. You can directly see that the red points marking the extent of instances do not match the actual extent. The read points are not located at the corners of the class instance.
  2. Move the class instance to the upper left corner of the diagram. Now the red points match the instance's corner points but the text view looks like:
model tets
  UnsymetricalIcon unsymetricalIcon annotation(
    Placement(transformation(origin = {-84, 90}, extent = {{-13, -10}, {13, 10}})));
  annotation(
    uses(Rexroth_BRSL(version = "3.0.0"), Modelica(version = "4.0.0")));
end tets;

Even tough looking at the diagram layer, the instance is in the upper left corner (thus the left edge must be at x=-100), the left x axis position according to text view is -84-13=-97 and not -100.
4. When adding another class (e.g. Modelica.Mechanics.Rotational.Components.Fixed ) to the diagram layer the unsymetricalIcon jumps to the correct postion according to the text view.
5. However, when moving the unsymetricalIcon instance again the text view is not updated correctly again and steps 3 and 4 can be repated again with step 4 being any action that triggers getModelInstance like adding new instance, setting a parameter value, or adding a connection line.

Expected Behavior

The Diagram view and the text view's placement annotations always match also for unsymmetrical icons.

Version and OS

  • OpenModelica Version: 1.22.3 and v1.23.0-dev-391-g7423fcddfa (64-bit)
  • OS: Windows 10, 64 bit
  • MSL 4.0.0

Thanks for looking into this
Aaron Buntrock - Bosch Rexroth

@adeas31 adeas31 self-assigned this Mar 28, 2024
@adeas31 adeas31 added regression COMP/GUI/OMEdit Issue and pull request related to OMEdit labels Mar 28, 2024
@adeas31 adeas31 added this to the 1.23.0 milestone Mar 28, 2024
adeas31 added a commit to adeas31/OpenModelica that referenced this issue Apr 2, 2024
Fixes OpenModelica#12165
Copy extent center in the copy constructor.
Set extent center when creating the component.
adeas31 added a commit that referenced this issue Apr 2, 2024
Fixes #12165
Copy extent center in the copy constructor.
Set extent center when creating the component.
@abuntrock
Copy link
Author

Works perfect with today's nightly. Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/GUI/OMEdit Issue and pull request related to OMEdit regression
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants