Problem with slot labels in warehousing module

Problem with slot labels in warehousing module

krzysztof_jurczykF5GXD
Enthusiast Enthusiast
25 Views
3 Replies
Message 1 of 4

Problem with slot labels in warehousing module

krzysztof_jurczykF5GXD
Enthusiast
Enthusiast

[ FlexSim 19.2.3 ]

Hello everyone,

The problem is how to update slot assignment labels which where assigned firstly by "Paint Slot Labels" option. I have prepared a code which is sth like:

Storage.Slot NAME = Storage.system.getSlot("PRODUCT_ID");
NAME.slot_name = "SLOT_NAME";

and it is work and assign data as I want but after reseting the model all data go back to the deafault values. I do not want to repeat this operation any time I reset the model (there is sth like 100 000 references to calculate).

Any sugestions?

And on the other hand - how to unmark "Paint Slot Labels" results?

Accepted solutions (1)
26 Views
3 Replies
Replies (3)
Message 2 of 4

JordanLJohnson
Autodesk
Autodesk
Accepted solution

If the model is running when you set the labels, the will go back to their "time 0" values when the model is reset. If setting the labels before running the model doesn't work, please post a model that we can look at to help you out.

As an alternative to using the getSlot method, you could iterate through all the slots of your model:

var objs = Storage.system.storageObjects;
for (int i = 1; i <= objs.length; i++) {
	Storage.Object obj = objs;
	var bays = obj.bays;
	for (int j = 1; j <= bays.length; j++) {
		var levels = bays.levels;
		for (int k = 1; k <= levels.length; k++) {
			var slots = levels.slots;
			for (int s = 1; s <= slots.length; s++) {
				slots.slot_name = "SLOT_NAME";
			}
		}
	}
}
.


Jordan Johnson
Principal Software Engineer
>

Message 3 of 4

krzysztof_jurczykF5GXD
Enthusiast
Enthusiast

Thank you for your answer. It is very useful but I still can not understand why label values go back to the default values. Ok - if the code you provided is somehow part of a model logic it is clear - each time I reset the model iI need to do this calculation.

But...

If I write this code in script window, and then run this code all labels should be assigned to slots and they should be as you had written "their time 0 values". Why it is not working this way and after reset all values dissapear?

Message 4 of 4

valentin_r
Not applicable

I had the same issue... And there is the solution !!!

You can use the following function:
function_s(myStorageSlot.as(Object), "paintLabel", string LabelName, num LabelValue , num PaintMode);

It does the same as the "Paint Slot Labels" library tool. The paintMode is the same as the "Mode" of the tool which is in the same order as in the Mode display (paintMode = 1 means "Paint Individual Slots", ... , paintMode = 5 means "Paint all slots in same objet").

Thank you @Begoña Espiñeira 😉