question

Omar Aguilera Rico avatar image
1 Like"
Omar Aguilera Rico asked Phil BoBo edited

Update cell size by code, does not visually adjust 3D to new measurements.

I have the following model that adjusts the cell size of the floor storage but visually it does not do it at the time of applying the code. Only if I manually select Floor Storage> Proporties> Storage Object> Edit Dimensions by clicking on an option of this property the measurements are visually updated to the object.

I have a model where I have more than a thousand floor storage and doing this manually one by one at a time will take a lot of time.

How can I cover this part by means of the code?

Update Size Floor Storage.fsm

FlexSim 21.1.4
flexsim 21.1.4floor storagesizecell
· 1
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

Phil BoBo avatar image
1 Like"
Phil BoBo answered Phil BoBo edited

Call function_s(rack, "refreshBayLevelSlotLocations");

  1. int CantidadObjetosEnGrupo = content(Model.find("Tools/Groups/Floor Storage"));
  2.  
  3. for (int r = 1; r <= CantidadObjetosEnGrupo; r++) {
  4.     Object IdentificaFloorStorage = groupmember("Floor Storage",r);
  5.  
  6.     Storage.Object current = IdentificaFloorStorage;
  7.  
  8.     for (int i = 1; i <= current.bays.length; i++) {
  9.         Storage.Bay bay = current.bays[i];
  10.         getvarnode(current, "bays").subnodes[i].subnodes[2].value = 4;
  11.         rackgetbaycontent(current,i);
  12.         for (int j = 1; j <= bay.levels.length; j++) {
  13.             Storage.Level level = bay.levels[j];
  14.             getvarnode(current, "bays").subnodes[i].subnodes[4].subnodes[j].subnodes[2].value = 3.13;
  15.         }
  16.     }
  17.     function_s(current, "refreshBayLevelSlotLocations");
  18. }

A better solution would be to use the setProperty() method to set the dimensions rather than adjusting the tree values directly:

  1. int CantidadObjetosEnGrupo = content(Model.find("Tools/Groups/Floor Storage"));
  2.  
  3. for (int r = 1; r <= CantidadObjetosEnGrupo; r++) {
  4. Object IdentificaFloorStorage = groupmember("Floor Storage",r);
  5.  
  6. Map dimensions = IdentificaFloorStorage.getProperty("Dimensions");
  7. dimensions["BaySize"] = 2.24;
  8. dimensions["LevelSize"] = 3.43;
  9. IdentificaFloorStorage.setProperty("Dimensions", dimensions);
  10. }
5 |100000

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