question

Hoang Nk avatar image
0 Likes"
Hoang Nk asked Hoang Nk commented

Problem with moveobject() command

Hi folks,

I'm having a bit of a problem when using the moveobject() command to move a flow item onto a queue. I have a list of flow items and would like to place them into their respective locations (queues). However, when I use the moveobject() command, the item is not placed onto the surface of its corresponding queue but it looks like the following photo

1696234428108.png

And it even looks weirder when I tried to move the item to the queues on the upper level, the item will have a large offset with the queue surface, like in this photo

1696234604743.png

Is there any way I can fix this? Thanks a lot for your help.

Here's the code I used to make this:

  1. Table Init = Table("coil_file"); //list of items need to be generated
  2. int nrow = Init.numRows;
  3. treenode coil = Model.find("/Tools/FlowItemBin/Cylinder/1");
  4. for (int index = 1; index <= nrow; index++)
  5. {
  6.     string location = Init[index]["location"]; //location where the item is placed
  7.     string coil_num = Init[index]["coil_number"];
  8.     int width = Init[index]["width"]; //dimension of the item from the list
  9.     int diameter = Init[index]["diameter"];
  10.     Object newitem = coil.copy(model(), 0);
  11.     newitem.labels.assert("Coil_number").value = coil_num;
  12.     newitem.setSize(diameter/1000,diameter/1000,width/1000); //set item's dimensions
  13.     Object dest = Model.find(location);
  14.     moveobject(newitem, dest);
  15. }
FlexSim 23.1.3
moveobjectvisualization
1696234428108.png (55.5 KiB)
1696234604743.png (102.4 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

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Hoang Nk commented

The default placement logic of a queue will

- not take into account the rotation of the item
- place the item outside its area, if it doesn't fit into the queue (with some padding space and again without taking rotation into account)

For both cases, the solution is to deactivate the queue's stacking behaviour and instead adjust the location to what it should be in the On Entry trigger with object.setLocation().

capture1.png


capture1.png (4.8 KiB)
· 4
5 |100000

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