question

Stan Davis avatar image
0 Likes"
Stan Davis asked Jason Lightfoot edited

How to Add Storage System Slot Labels Via Code

Having a large number of slot labels, I needed a way to quickly clear and re-add them to the Storage System. Here is what I developed. It works, but I am not sure it is the 'correct' way to do this. Any comments would be appreciated.


// CLEAR EXISTING SLOT LABELS
treenode myslotlabels = Model.find("Tools/StorageSystem>variables/slotLabels"); 
myslotlabels.subnodes.clear(); 
 
 
// REBUILD SLOT LABELS
treenode myStorageSystem = Storage.system;
int labelsneeded = 100;
treenode myslotlabel;
 
for(int k=1;k<=labelsneededk++){
    
 myslotlabel = function_s(myStorageSystem"addSlotLabel"); 
 myslotlabel.name = concat("PartNo", string.fromNum(k)); 
 myslotlabel.subnodes["colorPalette"].value = Model.find("Tools/ColorPalettes/PartNoColors");
 myslotlabel.subnodes["indexType"].value = 1
}


Thanks

FlexSim 23.0.2
slot labelsbest practices
· 3
5 |100000

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

Stan Davis avatar image Stan Davis commented ·

Note to FlexSim Support. I tried to submit this question twice after inserting the code from the editor. Both times it was blocked. The blocked message stated to contact site owner with Cloudflare Ray ID. I did that via email ([email protected]) but received non-monitored failed email response. Tried to call FlexSim in Utah a few times but only received 'leave a message' message. How do we notify FlexSim of issues like this???


0 Likes 0 ·
Kavika F avatar image Kavika F ♦ Stan Davis commented ·
Hey @Stan Davis, we received your call, but when we tried to call you back from our office line and cell phones, we got an automated voice saying we couldn't get through.

As for your code being blocked before, submitted code should be in a code block. This will avoid being blocked by the internal security system. If that still doesn't work, you can always post a screenshot.

0 Likes 0 ·
Stan Davis avatar image Stan Davis Kavika F ♦ commented ·
Kavika, Thanks - Stan
0 Likes 0 ·
Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jason Lightfoot edited

There are no exposed methods for adding Storage System labels, so what you have is the only way currently. Just keep in mind that function_s calls are subject to change in future versions and then you'd have to manage any updates yourself. For that reason try to put function_s calls in one place so you don't need to go through and edit your model extensively - so consider creating your own user command to add a Storage System label where you pass in the name, default value and color palette for example. I expect you should also consider adding the "defaultValue" and "trackedVariableType" subnodes too to be consistent.

· 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.

Stan Davis avatar image Stan Davis commented ·
Appreciate the feedback! Understood - Stan
0 Likes 0 ·
Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Stan Davis commented
· 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.

Stan Davis avatar image Stan Davis commented ·
Yes, I've reviewed that post many times and use similar elsewhere. This is a little different. Here, I'm setting the subnodes as well.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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