Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3333 closed defect (worksforme)

in OMEdit, Rotating a component drags it in a far position

Reported by: anonymous Owned by: Adeel Asghar
Priority: high Milestone: 1.9.3
Component: OMEdit Version: trunk
Keywords: Cc:

Description

Consider the following model:

model RotateDrags
  Modelica.Blocks.Continuous.Integrator toPcEnergy annotation(Placement(visible = true, transformation(origin = {44, -46}, extent = {{-104, 26}, {-84, 46}}, rotation = 0)));
equation

  annotation(Icon(coordinateSystem(extent = {{-120, -60}, {80, 60}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 60, Tolerance = 0.0001, Interval = 0.5), Diagram(coordinateSystem(extent = {{-120, -60}, {80, 60}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})));
end RotateDrags;

If, in OMEdit, one rotates the integrator, either clockwise or counterclockwise, the integrator is dragged to a different position. In my PC the new position is so far that the integrator falls outside the viewable space.

Tested on r25857

Change History (3)

comment:1 by Adeel Asghar, 10 years ago

Resolution: worksforme
Status: newclosed

I just tested with the latest version and it seems to work as expected. Note that you have origin and extent both values set which changes the position value and component transformation origin point. You need to read Modelica specifications section 17.5.2 Component Instance.

In your code rotation will be around your origin which is origin = {44, -46}. If you want to rotate around the center of component you should update your code like this,

model RotateDrags

  Modelica.Blocks.Continuous.Integrator toPcEnergy annotation(Placement(visible = true, transformation(origin={44, -46},   extent = {{-10, -10}, {10, 10}}, rotation=0)));
equation 

  annotation(Icon(coordinateSystem(extent = {{-120, -60}, {80, 60}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 60, Tolerance = 0.0001, Interval = 0.5), Diagram(coordinateSystem(extent = {{-120, -60}, {80, 60}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2})));
end RotateDrags;

comment:2 by anonymous, 10 years ago

Thank you.
Indeed reading 17.5.2 is instructive.
I don't know where that origin=... came from. I do not code annotations manually: it must have been created somehow during graphical operations.

I will stay tuned on this and in case it occurs again I will try to understand how that the origin keyword is created.

Thanks again.

comment:3 by Adeel Asghar, 10 years ago

Yes, every time you apply rotation on the component the origin is created in case your component doesn't have any and will be set to the center of your component. If your component has origin then it will be preserved.

In your case if you haven't coded the origin manually then it must be wrongly created and could be a bug in some graphical operation.

Note: See TracTickets for help on using tickets.