Equipment States and State Classes | Script to mass change Equipment Class assignment for (many) Cell Group(s) or Cell(s) under a Line
Global Equipment Class Change to Cell Groups and Cells
You have a Line with a large number of Cell Group(s) or Cell(s) and you want to mass change the Equipment Class assignment.
The Equipment Manager will work just great for a small number of objects but click / change / save will definitely gets .. complicated
when dealing with a large number of Equipment.
Step-by-step guide
Use the Following Script to set the state class of an equipment object and any direct children (not nested children)
|
eqPath = '[global]\\<Enterprise>\\<Site>\\<Area>\\<Line>'
myEqStateClass = '<new Equipment Class to use>'
def set_state_uuid(saveList, equipmentObject, stateUUID): equipmentObject.setPropertyValue('EquipmentStateClassUUID', stateUUID) saveList.add(equipmentObject) print 'Setting UUID (' + stateUUID + ') on equipment (' + equipmentObject.getName() +')' childLinks = equipmentObject.getChildCollection().values() for childLink in childLinks: childObj = childLink.getMESObject() if childObj.getMESObjectType().getStorageType().getName() == 'Equipment': set_state_uuid(saveList, childObj, stateUUID) return saveList = system.mes.object.list.createList() stateClassLink = system.mes.getMESObjectLinkByName('EquipmentStateClass', myEqStateClass) equipment = system.mes.loadMESObjectByEquipmentPath(eqPath)
set_state_uuid(saveList, equipment, stateClassLink.getMESObjectUUID()) system.mes.saveMESObjects(saveList)
|
Related articles
Equipment States
Keywords
State Class, Equipment State