I have an Anylogic model where there are different storage areas (using Pallet racks) and waiting areas defined using rectangles. I want define distance between all these areas. Is there any way to do so in Analogic? Perhaps, by defining 1 small square in the model equals x meters or so.
Asked
Active
Viewed 203 times
1 Answers
0
if you want the distance in pixels between 2 areas you can do this:
double distInPixels=node1.getCenter().distance(node2.getCenter());
if you want the distance in meters, you can use the scale object as follows
double distInMeters=scale.toLengthUnits(distInPixels,METER);
Check the help documentation for distance units if you don't like meters.

Felipe
- 8,311
- 2
- 15
- 31
-
Hello Felipe, your answer helps but I wish to set the distance between two areas. For ex, pixel distance between two areas is 10 pixels. I want to set 1 pixel=2 meters such that dist. between those areas be 10*2 = 20 meters. Can you tell me how to do that? – Chhandosee Bhattacharya Sep 12 '21 at 21:17
-
look for the scale object... there are 2 objects that exist when you create a new model, one of them is the scale... do you know the scale at all? – Felipe Sep 13 '21 at 05:07
-
No, I do not. Can I find it in Main properties? – Chhandosee Bhattacharya Sep 13 '21 at 06:50
-
i updated the answer so you can see what the scale is... it's visible in the projects/main/presentation – Felipe Sep 13 '21 at 09:44