When you rotate an object, its position does not change. You can notice this in your model - drop a new object in your model and left-click it. You will see the position, rotation, and size in the status bar at the bottom or FlexSim. Now if you right-click the blue arrow and rotate the object, you can watch the rotation status change, but not the position or size. This is the effect that is working against you. You dropped a rack in your model at a certain position, then rotated it. The rack's position in the model did not change, though its own internal coordinates were rotated.
I can think of two solutions to get you going again. The first is to use the object's center location, rather than its 0,0, as your starting point. Get an object's center position via the following commands:
xcenter(object);// and ycenter() and zcenter()
This may work for you as long as all your objects are in the model itself, and not nested in visual tools or other container objects.
The 2nd method would be to convert from one coordinate system to another. This method will be more flexible in that it works for nested objects as well. Every object in FlexSim has its own coordinate system that its child objects inherit. For instance, if you have a processor in the model, you can click it and see its position in model coordinates in the status bar. If you have a box on that processor and you click the box to view its status bar info, you'll see that its position is in relation to the processor's universe, starting at the processor's 0,0. If that box was instead a pallet, with a box on the pallet, then the box's location is in relation to the pallet's coordinate system, and the pallet's coordinate system is in relation to the processor's, who's coordinate system is the model's - make sense?
Anyway, there is a set of commands to convert from one object's coordinate system to another:
double model_x_loc = vectorprojectx(objectProjectingFrom, 0, 0, 0, model()); //repeat for y and z -
See the command documentation for vectorprojectx for more details.