question

Majid A avatar image
0 Likes"
Majid A asked Matthew Gillespie answered

How to read the end height of a conveyor using Flexsim

Able to set the end height of a conveyor using this method: https://answers.flexsim.com/questions/22316/how-can-i-set-the-start-and-end-height-of-a-convey.html

I want to first read the current end height and increment/decrement it by some value.

Also, how to read/write the ending x and y co-ordinates?

FlexSim 17.1.2
conveyor coordinates height
· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

You can't find those values directly in the object. The position end values are the results of the combination of the start position with size and rotation of the conveyor. If you look into the tree of a conveyor of your model and you change the end position in the Quick Properties you will notice that the height of the conveyors end is the sum of z position and z size. If the y-end-position differs to the start-position you get an angle at the spatialrz attribute and different value for the spatialsx attribute of your conveyor.

The attribute values are in the tree "Conveyor>spatial". The name of "Conveyor" is different in your model.

1 Like 1 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·
0 Likes 0 ·

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered

Read End Z value

Object conveyor = model().find("Conveyor1");

double z = conveyor.location.z;
double sz = conveyor.size.z;
double rise = getvarnum(conveyor, "rise");

double end;
if (rise > 0)
	end = z + sz;
else
	end = z;
	
return end;

Read Start Z Value

Same as above, but change rise > 0 to rise < 0.

Read End X Value

Object conveyor = model().find("Conveyor1");

double x = conveyor.location.x;
double sx = conveyor.size.x;
double rz = conveyor.rotation.z;
double rise = getvarnum(conveyor, "rise");
double endX = sx * cos(degreestoradians(rz)) + x;

return endX;

Read End Y Value

Object conveyor = model().find("Conveyor1");

double y = conveyor.location.y;
double sx = conveyor.size.x;
double rz = conveyor.rotation.z;
double rise = getvarnum(conveyor, "rise");
double endY = sx * sin(degreestoradians(rz)) + y;

return endY;

Set End X,Y Value

Object conveyor = model().find("Conveyor1");

double x = 1;
double y = 1;
function_s(conveyor, "dragEnd", x, y, conveyor.location.z, activedocumentview());

function_s(conveyor, "clearNonLockedPoints");
function_s(conveyor, "notifyEdgePointsOnEdgeMoved");
function_s(conveyor, "finalizeSpatialChanges");

Set Start X,Y Value

Same as above, but use "dragStart" instead of "dragEnd"

5 |100000

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