def recipeFunction(eqPath):
print 'Process Recipe Stuff for %s' % eqPath
linePath = eqPath
# Get a list of all the recipe entries under this path
recipeVals = system.recipe.getDefaultValues(linePath, "1", "")
# Cycle through the list
for ndx in range(recipeVals.size()):
# Get the recipe item at this point
recipeItem = recipeVals.get(ndx)
# Get the name of the item
recipeItemName = recipeItem.getName()
print recipeItemName
# Get the security object for this item
secInfo = system.recipe.getRecipeValueSecurity(linePath, recipeItemName, False)
#Cycle through and print the setting for each role
#for ndx in range(secInfo.getSecurityRoleCount()):
# recSec = secInfo.getSecurityRole(ndx)
# print recSec.getSecurityRole()
# print recSec.isAllowEdit()
# Get the security info for a specific role
secRole = secInfo.getSecurityRole('Supervisor')
# Allow the role to edit
secRole.setAllowEdit(True)
#This must be set otherwise it will inherit from the parent
secInfo.setInherit(False)
print secRole.getMinValue()
print secRole.getMaxValue()
# if you know the datatype or you know the item by name you can set the min and max for the role
#if recipeItemName == 'FanSpeed':
# secRole.setMinValue(32.5)
# secRole.setMaxValue(212.0)
#Update the security settings
system.recipe.updateRecipeValueSecurity(secInfo)
def eqTree(UUID):
obj = system.mes.loadMESObject(UUID)
recipeFunction(obj.getEquipmentPath())
if obj.getChildCollection().getList().size() > 0:
list = obj.getChildCollection().getList()
for item in list:
eqTree(item.getMESObjectUUID())
basePath = '[global]\New Enterprise'
obj = system.mes.loadMESObjectByEquipmentPath(basePath)
eqTree(obj.getUUID())