question

Marian Cretu avatar image
0 Likes"
Marian Cretu asked Marian Cretu commented

Location when rotated

Hello everybody,

Maybe this is a bug but when objects are rotated the coordinates in the bottom bar are wrong.

To be easy I have inserted a plan 1m x 2m.

1. No rotation - everything is OK.

rotation-0.jpg

2. If the object is rotated 90 degrees the bottom bar shows coordinates for a point that is not in any corner of the object.

rotation-90.jpg

Please advise.

Thank you.

FlexSim 21.2.1
coordinates
rotation-0.jpg (817.9 KiB)
rotation-90.jpg (827.2 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Marian Cretu commented

Locations in FlexSim are stored in a rather unintuitive way. An object's location is stored in the tree as the position of the top left corner before any rotations are applied. This is what the bottom bar is displaying and what you get if you say

return obj.location;

In your code snippet you are using the getLocation() method which lets you specify a point on the object to use as the reference point for the location as described in Changing the Location Point of Reference. The properties window does this and sets the point to (0.5, 0.5, 0) so that it always shows the location of the center-bottom of the object. In your code you're getting the location from (0,0,0) or the top left corner after rotation. So you're seeing three different numbers:

return obj.location; //Position of top left corner before rotation (status bar)
return obj.getLocation(0,0,0); //Position of top left corner after rotation (your code)
return obj.getLocation(0.5,0.5,0); //Position of center (Properties panel)
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Marian Cretu avatar image Marian Cretu commented ·
Maybe it is a good ideea that coordinates in the bottom bar would be updated also when the object is rotated. In my opinion the world should be an "intuitive" place :). Thanks for your help.
0 Likes 0 ·