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.

1 Answer

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered

Read End Z value

  1. Object conveyor = model().find("Conveyor1");
  2.  
  3. double z = conveyor.location.z;
  4. double sz = conveyor.size.z;
  5. double rise = getvarnum(conveyor, "rise");
  6.  
  7. double end;
  8. if (rise > 0)
  9. end = z + sz;
  10. else
  11. end = z;
  12. return end;

Read Start Z Value

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

Read End X Value

  1. Object conveyor = model().find("Conveyor1");
  2.  
  3. double x = conveyor.location.x;
  4. double sx = conveyor.size.x;
  5. double rz = conveyor.rotation.z;
  6. double rise = getvarnum(conveyor, "rise");
  7. double endX = sx * cos(degreestoradians(rz)) + x;
  8.  
  9. return endX;

Read End Y Value

  1. Object conveyor = model().find("Conveyor1");
  2.  
  3. double y = conveyor.location.y;
  4. double sx = conveyor.size.x;
  5. double rz = conveyor.rotation.z;
  6. double rise = getvarnum(conveyor, "rise");
  7. double endY = sx * sin(degreestoradians(rz)) + y;
  8.  
  9. return endY;

Set End X,Y Value

  1. Object conveyor = model().find("Conveyor1");
  2.  
  3. double x = 1;
  4. double y = 1;
  5. function_s(conveyor, "dragEnd", x, y, conveyor.location.z, activedocumentview());
  6.  
  7. function_s(conveyor, "clearNonLockedPoints");
  8. function_s(conveyor, "notifyEdgePointsOnEdgeMoved");
  9. 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.