Sepasoft MES Module Suite
MESObjectCollection Object
An MESObjectCollection object is used to return a list of parent and children objects. Normally, the parent and child script functions of the MES objects should be used, but this is provided as a reference to the MESObjectCollection object itself and provides some additional functionality.
Object Creation
The following object methods can be used to return this type of object. It is not possible to create this object from scripting, but it is what comes back when you get the parent or child collections and then you can interact with it.
Object Properties
This object inherits the AbstractMESObject core properties.
Object Functions
This object provides the following functions:
add(mesObj)
Adds an MES object to the object collection.
add(mesObj)
- Parameters
String mesObj - The MES object to add to the object collection.
- Returns
Nothing
Python |
mesObject = system.mes.loadMESObject('Cosmetics', 'MaterialClass') mesObj = system.mes.loadMESObject('Sunscreen', 'MaterialDef') if mesObject != None: childList = mesObject.getChildCollection() print childList.add(mesObj) print childList |
>>>
None
{b6493625-90fa-41cf-b7e4-cbf5c888389a=Sunscreen, 5bf02be0-b9ca-40e6-9229-7f21a3d4bf2b=Mascara, 5ebd3b0a-1048-4f06-bfcb-fd4fdba9d811=Moisturizer, d6949341-ee6e-4a9b-985d-739bebe3ee31=Eye Liner, 9026e1a5-c13c-4b34-9142-96b25a0308b3=Nail Polish, 7be75da4-5fa6-4b9b-abae-087e00cb1971=Water, ee2019fa-1440-4198-8018-100e3ec3b7fa=Lipstick, cf3cd739-225b-42d5-8144-bc44b15568fd=Face Cream}
>>>
|
get(uuid)
Returns the MES object link for the specified UUID. If the specified UUID does not exist, None will be returned.
get(uuid)
- Parameters
None
- Returns
String mesObjectLink - The MES object link corresponding to the uuid.
Python |
#Object link corresponding to the specified uuid is returned. mesObject = system.mes.loadMESObject('Vinegar', 'MaterialClass') if mesObject != None: childList = mesObject.getChildCollection() print childList.get('5acf3c9f-2789-44af-888f-fce08d9972a7') |
Red Wine Vinegar
|
getList()
Returns a list of MES object links. Depending if getParentCollection() or getChildCollection() is called to get the MESObjectCollection object, it will contain MES object links that are parents or children.
getList()
- Parameters
None
- Returns
MESList <MESObjectLink> - A list containing MES object links.
#This example reads the child MES object links that belong to the Vinegar Material Class.
mesObject = system.mes.loadMESObject('Vinegar', 'MaterialClass')
if mesObject != None:
childList = mesObject.getChildCollection().getList()
for child in childList:
print child.getName()
|
Balsamic Vinegar
Red Wine Vinegar
White Vinegar
|
isEmpty()
Returns True if no MES object links exist in the collection.
isEmpty()
- Parameters
None
- Returns
Boolean - True if there are no MES object links in the collection.
Python |
#Object link corresponding to the specified uuid is returned. mesObject = system.mes.loadMESObject('Vinegar', 'MaterialClass') if mesObject != None: childList = mesObject.getChildCollection() print childList.get('5acf3c9f-2789-44af-888f-fce08d9972a7') |
False
|
remove(mesObj)
Removes an MES object from the object collection.
remove(mesObj)
- Parameters
String mesObj - The MES object to remove from the object collection.
- Returns
Nothing
Python |
mesObject = system.mes.loadMESObject('Cosmetics', 'MaterialClass') mesObj = system.mes.loadMESObject('Water', 'MaterialDef') if mesObject != None: childList = mesObject.getChildCollection() print childList.remove(mesObj) print childList |
>>>
None
{b6493625-90fa-41cf-b7e4-cbf5c888389a=Sunscreen, 5bf02be0-b9ca-40e6-9229-7f21a3d4bf2b=Mascara, 5ebd3b0a-1048-4f06-bfcb-fd4fdba9d811=Moisturizer, d6949341-ee6e-4a9b-985d-739bebe3ee31=Eye Liner, 9026e1a5-c13c-4b34-9142-96b25a0308b3=Nail Polish, ee2019fa-1440-4198-8018-100e3ec3b7fa=Lipstick, cf3cd739-225b-42d5-8144-bc44b15568fd=Face Cream}
>>>
|
size()
Returns the number of MES object links in the collection. Depending if getParentCollection() or getChildCollection() is called to get the MESObjectCollection object, it will represent the number of parents or children.
size()
- Parameters
None
- Returns
Integer - The number of MES object links in the collection.
Python |
#In this example, Vinegar material class has got three children. Therefore it prints 3. mesObject = system.mes.loadMESObject('Vinegar', 'MaterialClass') if mesObject != None: childList = mesObject.getChildCollection() print childList.size() |
3
|
Sepasoft MES Module Suite