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<=labelsneeded; k++){ 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